can schedule/remove playlists from a show instance.

This commit is contained in:
naomiaro 2011-02-05 19:42:03 -05:00
parent 51b6a79f6f
commit 12cd80fe13
4 changed files with 21 additions and 25 deletions

View File

@ -279,32 +279,23 @@ class ScheduleController extends Zend_Controller_Action
public function scheduleShowDialogAction()
{
$showInstanceId = $this->_getParam('id');
$this->sched_sess->showInstanceId = $showInstanceId;
$show = new ShowInstance($showInstanceId);
$start_timestamp = $this->_getParam('start');
$end_timestamp = $this->_getParam('end');
$this->sched_sess->showId = $showId;
$this->sched_sess->showStart = $start_timestamp;
$this->sched_sess->showEnd = $end_timestamp;
$start_timestamp = $show->getShowStart();
$end_timestamp = $show->getShowEnd();
$start = explode(" ", $start_timestamp);
$end = explode(" ", $end_timestamp);
$startTime = explode(":", $start[1]);
$endTime = explode(":", $end[1]);
$dateInfo = getDate(strtotime($start_timestamp));
$userInfo = Zend_Auth::getInstance()->getStorage()->read();
$user = new User($userInfo->id, $userInfo->type);
$show = new Show($user, $showId);
$this->view->showContent = $show->getShowContent($start_timestamp);
$this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp);
$this->view->showContent = $show->getShowContent();
$this->view->timeFilled = $show->getTimeScheduled();
$this->view->showName = $show->getName();
$this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp);
$this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);
$this->view->showLength = $show->getShowLength();
$this->view->percentFilled = $show->getPercentScheduledInRange();
$this->view->wday = $dateInfo['weekday'];
$this->view->month = $dateInfo['month'];
@ -314,7 +305,6 @@ class ScheduleController extends Zend_Controller_Action
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
$this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');
unset($this->view->showContent);
}

View File

@ -307,7 +307,7 @@ class Schedule {
AND (ends <= '{$e_datetime}')";
$res = $CC_DBC->GetOne($sql);
if(is_null($res))
return 0;
@ -315,9 +315,9 @@ class Schedule {
}
public static function getPercentScheduledInRange($s_datetime, $e_datetime) {
$time = Schedule::getTimeScheduledInRange($s_datetime, $e_datetime);
$con = Propel::getConnection(CcSchedulePeer::DATABASE_NAME);
$sql = "SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '{$s_datetime}')";
@ -333,7 +333,7 @@ class Schedule {
$i_epoch = $r->fetchColumn(0);
$percent = ceil(($i_epoch / ($e_epoch - $s_epoch)) * 100);
return $percent;
}

View File

@ -107,7 +107,7 @@ class Show {
$showHost->save();
}
$this->populateShowUntilLastGeneratedDate($showId);
Show::populateShowUntilLastGeneratedDate($showId);
}
public function deleteShow($timestamp, $dayId=NULL) {
@ -374,6 +374,11 @@ class ShowInstance {
return $showInstance->getDbShowId();
}
public function getName() {
$show = CcShowQuery::create()->findPK($this->getShowId());
return $show->getDbName();
}
public function getShowStart() {
$showInstance = CcShowInstancesQuery::create()->findPK($this->_instanceId);
return $showInstance->getDbStarts();
@ -478,6 +483,7 @@ class ShowInstance {
$sched = new ScheduleGroup();
$lastGroupId = $this->getLastGroupId();
$pos = $this->getNextPos();
if(is_null($lastGroupId)) {
@ -578,7 +584,7 @@ class ShowInstance {
$start_timestamp = $this->getShowStart();
$end_timestamp = $this->getShowEnd();
Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);
return Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp);
}
public function getShowLength(){

View File

@ -32,7 +32,7 @@ CREATE FUNCTION show_content() RETURNS trigger AS
BEGIN
IF(TG_OP=''DELETE'') THEN
UPDATE cc_show_schedule SET position = (position - 1)
WHERE (show_id = old.show_id AND show_day = old.show_day AND position > old.position);
WHERE (instance_id = old.instance_id AND position > old.position);
END IF;
RETURN NULL;
END;