CC-3522 : Now Playing Screen-> Periodical message pops up
This commit is contained in:
parent
b5bf5e9598
commit
b5863d3d7a
6 changed files with 39 additions and 27 deletions
|
@ -238,6 +238,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$show_filter = intval($request->getParam("showFilter", 0));
|
||||
$my_shows = intval($request->getParam("myShows", 0));
|
||||
$timestamp = intval($request->getParam("timestamp", -1));
|
||||
$instances = $request->getParam("instances", array());
|
||||
|
||||
$startsDT = DateTime::createFromFormat("U", $starts_epoch, new DateTimeZone("UTC"));
|
||||
$endsDT = DateTime::createFromFormat("U", $ends_epoch, new DateTimeZone("UTC"));
|
||||
|
@ -247,7 +248,7 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
|
||||
//only send the schedule back if updates have been made.
|
||||
// -1 default will always call the schedule to be sent back if no timestamp is defined.
|
||||
if ($showBuilder->hasBeenUpdatedSince($timestamp)) {
|
||||
if ($showBuilder->hasBeenUpdatedSince($timestamp, $instances)) {
|
||||
$this->view->update = true;
|
||||
}
|
||||
else {
|
||||
|
@ -275,7 +276,9 @@ class ShowbuilderController extends Zend_Controller_Action
|
|||
$opts = array("myShows" => $my_shows, "showFilter" => $show_filter);
|
||||
$showBuilder = new Application_Model_ShowBuilder($startsDT, $endsDT, $opts);
|
||||
|
||||
$this->view->schedule = $showBuilder->GetItems();
|
||||
$data = $showBuilder->GetItems();
|
||||
$this->view->schedule = $data["schedule"];
|
||||
$this->view->instances = $data["showInstances"];
|
||||
$this->view->timestamp = $current_time;
|
||||
|
||||
$end = microtime(true);
|
||||
|
|
|
@ -11,12 +11,6 @@ class Application_Form_ShowBuilder extends Zend_Form_SubForm
|
|||
array('ViewScript', array('viewScript' => 'form/showbuilder.phtml'))
|
||||
));
|
||||
|
||||
//set value to -1 originally to ensure we grab the schedule on first call.
|
||||
$timestamp = new Zend_Form_Element_Hidden('sb_timestamp');
|
||||
$timestamp->setValue(-1)
|
||||
->setDecorators(array('ViewHelper'));
|
||||
$this->addElement($timestamp);
|
||||
|
||||
// Add start date element
|
||||
$startDate = new Zend_Form_Element_Text('sb_date_start');
|
||||
$startDate->class = 'input_text';
|
||||
|
|
|
@ -19,6 +19,8 @@ class Application_Model_ShowBuilder {
|
|||
private $contentDT;
|
||||
private $epoch_now;
|
||||
private $currentShow;
|
||||
|
||||
private $showInstances = array();
|
||||
|
||||
private $defaultRowArray = array(
|
||||
"header" => false,
|
||||
|
@ -311,11 +313,13 @@ class Application_Model_ShowBuilder {
|
|||
* @return boolean whether the schedule in the show builder's range has been updated.
|
||||
*
|
||||
*/
|
||||
public function hasBeenUpdatedSince($timestamp) {
|
||||
public function hasBeenUpdatedSince($timestamp, $instances) {
|
||||
$outdated = false;
|
||||
$shows = Application_Model_Show::getShows($this->startDT, $this->endDT);
|
||||
$currentInstances = array();
|
||||
|
||||
foreach ($shows as $show) {
|
||||
$currentInstances[] = $show["instance_id"];
|
||||
|
||||
if (isset($show["last_scheduled"])) {
|
||||
$dt = new DateTime($show["last_scheduled"], new DateTimeZone("UTC"));
|
||||
|
@ -331,7 +335,8 @@ class Application_Model_ShowBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
if (count($shows) == 0) {
|
||||
//see if the displayed show instances have changed. (deleted, empty schedule etc)
|
||||
if ($outdated === false && count($instances) !== count($currentInstances)) {
|
||||
$outdated = true;
|
||||
}
|
||||
|
||||
|
@ -392,6 +397,10 @@ class Application_Model_ShowBuilder {
|
|||
if (isset($row)) {
|
||||
$display_items[] = $row;
|
||||
}
|
||||
|
||||
if ($current_id !== -1 && !in_array($current_id, $this->showInstances)) {
|
||||
$this->showInstances[] = $current_id;
|
||||
}
|
||||
}
|
||||
|
||||
//make the last footer if there were any scheduled items.
|
||||
|
@ -399,6 +408,6 @@ class Application_Model_ShowBuilder {
|
|||
$display_items[] = $this->makeFooterRow($scheduled_items[count($scheduled_items)-1]);
|
||||
}
|
||||
|
||||
return $display_items;
|
||||
return array("schedule" => $display_items, "showInstances" => $this->showInstances);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
<div class="sb-timerange">
|
||||
<?php echo $this->element->getElement('sb_timestamp') ?>
|
||||
<?php echo $this->element->getElement('sb_date_start') ?>
|
||||
<?php echo $this->element->getElement('sb_time_start') ?>
|
||||
<?php echo $this->element->getElement('sb_date_end') ?>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue