shows time filled in show, with progress bar and time.

This commit is contained in:
naomiaro 2011-01-15 18:23:15 -05:00
parent 25c7d4cb90
commit 86a4998e0a
5 changed files with 59 additions and 8 deletions

View File

@ -145,9 +145,8 @@ class ScheduleController extends Zend_Controller_Action
public function scheduleShowAction() public function scheduleShowAction()
{ {
$request = $this->getRequest();
$start_timestamp = $this->sched_sess->showStart; $start_timestamp = $this->sched_sess->showStart;
$end_timestamp = $this->sched_sess->showEnd;
$showId = $this->sched_sess->showId; $showId = $this->sched_sess->showId;
$search = $this->_getParam('search', null); $search = $this->_getParam('search', null);
$plId = $this->_getParam('plId'); $plId = $this->_getParam('plId');
@ -166,9 +165,12 @@ class ScheduleController extends Zend_Controller_Action
$this->view->playlists = $show->searchPlaylistsForShow($start_timestamp, $search); $this->view->playlists = $show->searchPlaylistsForShow($start_timestamp, $search);
$this->view->showContent = $show->getShowContent($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->choice = $this->view->render('schedule/find-playlists.phtml');
$this->view->chosen = $this->view->render('schedule/scheduled-content.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->showContent);
unset($this->view->playlists); unset($this->view->playlists);
@ -214,6 +216,7 @@ class ScheduleController extends Zend_Controller_Action
{ {
$group_id = $this->_getParam('groupId'); $group_id = $this->_getParam('groupId');
$start_timestamp = $this->sched_sess->showStart; $start_timestamp = $this->sched_sess->showStart;
$end_timestamp = $this->sched_sess->showEnd;
$show_id = $this->sched_sess->showId; $show_id = $this->sched_sess->showId;
$search = $this->_getParam('search', null); $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->playlists = $show->searchPlaylistsForShow($start_timestamp, $search);
$this->view->showContent = $show->getShowContent($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->choice = $this->view->render('schedule/find-playlists.phtml');
$this->view->chosen = $this->view->render('schedule/scheduled-content.phtml'); $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
@ -235,10 +242,12 @@ class ScheduleController extends Zend_Controller_Action
public function scheduleShowDialogAction() public function scheduleShowDialogAction()
{ {
$start_timestamp = $this->_getParam('start'); $start_timestamp = $this->_getParam('start');
$end_timestamp = $this->_getParam('end');
$showId = $this->_getParam('showId'); $showId = $this->_getParam('showId');
$this->sched_sess->showId = $showId; $this->sched_sess->showId = $showId;
$this->sched_sess->showStart = $start_timestamp; $this->sched_sess->showStart = $start_timestamp;
$this->sched_sess->showEnd = $end_timestamp;
$userInfo = Zend_Auth::getInstance()->getStorage()->read(); $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->playlists = $show->searchPlaylistsForShow($start_timestamp);
$this->view->showContent = $show->getShowContent($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->choice = $this->view->render('schedule/find-playlists.phtml');
$this->view->chosen = $this->view->render('schedule/scheduled-content.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->showContent);
unset($this->view->playlists); unset($this->view->playlists);

View File

@ -556,6 +556,15 @@ class Show {
return $event; 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){ public function searchPlaylistsForShow($start_timestamp, $search=null){
global $CC_DBC; global $CC_DBC;

View File

@ -1 +1,12 @@
<br /><br /><center>View script for controller <b>Schedule</b> and script/action name <b>scheduleShowDialog</b></center> <div id="schedule_playlist_dialog">
<input id="schedule_playlist_search" type="text"></input>
<div>
<ul id="schedule_playlist_choice"></ul>
<ul id="schedule_playlist_chosen"></ul>
</div>
<div id="show_time_info">
<span id="show_time_filled"><?php echo $this->timeFilled; ?></span>
<div id="show_progressbar"></div>
<span id="show_length"><?php echo $this->showLength; ?></span>
</div>
</div>

View File

@ -6,6 +6,15 @@ div.ui-datepicker {
font-size: 75%; font-size: 75%;
} }
#show_time_info {
clear: left;
}
#show_progressbar {
width: 150px;
height: 5px;
}
#schedule_playlist_dialog ul { #schedule_playlist_dialog ul {
list-style-type: none; list-style-type: none;
float: left; float: left;

View File

@ -174,6 +174,9 @@ function setScheduleDialogHtml(json) {
$("#schedule_playlist_chosen") $("#schedule_playlist_chosen")
.empty() .empty()
.append(json.chosen); .append(json.chosen);
$("#show_time_filled").empty().append(json.timeFilled);
$("#show_progressbar").progressbar( "value" , json.percentFilled );
} }
function setScheduleDialogEvents() { function setScheduleDialogEvents() {
@ -263,6 +266,11 @@ function makeScheduleDialog(dialog, json) {
setScheduleDialogEvents(); setScheduleDialogEvents();
}); });
}); });
dialog.find("#show_progressbar").progressbar({
value: json.percentFilled
});
} }
function openScheduleDialog(show) { function openScheduleDialog(show) {
@ -271,9 +279,10 @@ function openScheduleDialog(show) {
url = '/Schedule/schedule-show-dialog/format/json'; url = '/Schedule/schedule-show-dialog/format/json';
start_date = makeTimeStamp(show.start); start_date = makeTimeStamp(show.start);
end_date = makeTimeStamp(show.end);
$.post(url, $.post(url,
{start: start_date, showId: show.id}, {start: start_date, end: end_date, showId: show.id},
function(json){ function(json){
var dialog = $(json.dialog); var dialog = $(json.dialog);