diff --git a/application/controllers/ScheduleController.php b/application/controllers/ScheduleController.php index 0ea3fe80c..ab72626b0 100644 --- a/application/controllers/ScheduleController.php +++ b/application/controllers/ScheduleController.php @@ -144,10 +144,9 @@ class ScheduleController extends Zend_Controller_Action } public function scheduleShowAction() - { - $request = $this->getRequest(); - + { $start_timestamp = $this->sched_sess->showStart; + $end_timestamp = $this->sched_sess->showEnd; $showId = $this->sched_sess->showId; $search = $this->_getParam('search', null); $plId = $this->_getParam('plId'); @@ -166,10 +165,13 @@ class ScheduleController extends Zend_Controller_Action $this->view->playlists = $show->searchPlaylistsForShow($start_timestamp, $search); $this->view->showContent = $show->getShowContent($start_timestamp); + $this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp); + $this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp); + $this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp); + $this->view->choice = $this->view->render('schedule/find-playlists.phtml'); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); - $this->view->dialog = $this->view->render('schedule/schedule-show.phtml'); - + unset($this->view->showContent); unset($this->view->playlists); } @@ -214,6 +216,7 @@ class ScheduleController extends Zend_Controller_Action { $group_id = $this->_getParam('groupId'); $start_timestamp = $this->sched_sess->showStart; + $end_timestamp = $this->sched_sess->showEnd; $show_id = $this->sched_sess->showId; $search = $this->_getParam('search', null); @@ -225,6 +228,10 @@ class ScheduleController extends Zend_Controller_Action $this->view->playlists = $show->searchPlaylistsForShow($start_timestamp, $search); $this->view->showContent = $show->getShowContent($start_timestamp); + $this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp); + $this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp); + $this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp); + $this->view->choice = $this->view->render('schedule/find-playlists.phtml'); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); @@ -235,10 +242,12 @@ class ScheduleController extends Zend_Controller_Action public function scheduleShowDialogAction() { $start_timestamp = $this->_getParam('start'); + $end_timestamp = $this->_getParam('end'); $showId = $this->_getParam('showId'); $this->sched_sess->showId = $showId; $this->sched_sess->showStart = $start_timestamp; + $this->sched_sess->showEnd = $end_timestamp; $userInfo = Zend_Auth::getInstance()->getStorage()->read(); @@ -248,9 +257,13 @@ class ScheduleController extends Zend_Controller_Action $this->view->playlists = $show->searchPlaylistsForShow($start_timestamp); $this->view->showContent = $show->getShowContent($start_timestamp); + $this->view->timeFilled = $show->getTimeScheduled($start_timestamp, $end_timestamp); + $this->view->showLength = $show->getShowLength($start_timestamp, $end_timestamp); + $this->view->percentFilled = Schedule::getPercentScheduledInRange($start_timestamp, $end_timestamp); + $this->view->choice = $this->view->render('schedule/find-playlists.phtml'); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); - $this->view->dialog = $this->view->render('schedule/schedule-show.phtml'); + $this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml'); unset($this->view->showContent); unset($this->view->playlists); diff --git a/application/models/Shows.php b/application/models/Shows.php index b266330f9..823e83213 100644 --- a/application/models/Shows.php +++ b/application/models/Shows.php @@ -556,6 +556,15 @@ class Show { return $event; } + public function getShowLength($start_timestamp, $end_timestamp){ + global $CC_DBC; + + $sql = "SELECT TIMESTAMP '{$end_timestamp}' - TIMESTAMP '{$start_timestamp}' "; + $length = $CC_DBC->GetOne($sql); + + return $length; + } + public function searchPlaylistsForShow($start_timestamp, $search=null){ global $CC_DBC; diff --git a/application/views/scripts/schedule/schedule-show-dialog.phtml b/application/views/scripts/schedule/schedule-show-dialog.phtml index 4101f836f..f80f95c01 100644 --- a/application/views/scripts/schedule/schedule-show-dialog.phtml +++ b/application/views/scripts/schedule/schedule-show-dialog.phtml @@ -1 +1,12 @@ -

View script for controller Schedule and script/action name scheduleShowDialog
\ No newline at end of file +
+ +
+ + +
+
+ timeFilled; ?> +
+ showLength; ?> +
+
diff --git a/public/css/schedule.css b/public/css/schedule.css index 3b4784ea0..a7f160ef2 100644 --- a/public/css/schedule.css +++ b/public/css/schedule.css @@ -6,6 +6,15 @@ div.ui-datepicker { font-size: 75%; } +#show_time_info { + clear: left; +} + +#show_progressbar { + width: 150px; + height: 5px; +} + #schedule_playlist_dialog ul { list-style-type: none; float: left; diff --git a/public/js/airtime/schedule/schedule.js b/public/js/airtime/schedule/schedule.js index 92610d462..3a6be0197 100644 --- a/public/js/airtime/schedule/schedule.js +++ b/public/js/airtime/schedule/schedule.js @@ -174,6 +174,9 @@ function setScheduleDialogHtml(json) { $("#schedule_playlist_chosen") .empty() .append(json.chosen); + + $("#show_time_filled").empty().append(json.timeFilled); + $("#show_progressbar").progressbar( "value" , json.percentFilled ); } function setScheduleDialogEvents() { @@ -263,6 +266,11 @@ function makeScheduleDialog(dialog, json) { setScheduleDialogEvents(); }); }); + + dialog.find("#show_progressbar").progressbar({ + value: json.percentFilled + }); + } function openScheduleDialog(show) { @@ -271,9 +279,10 @@ function openScheduleDialog(show) { url = '/Schedule/schedule-show-dialog/format/json'; start_date = makeTimeStamp(show.start); + end_date = makeTimeStamp(show.end); $.post(url, - {start: start_date, showId: show.id}, + {start: start_date, end: end_date, showId: show.id}, function(json){ var dialog = $(json.dialog);