CC-3037: Nowplaying bar not showing current show

-fixed
This commit is contained in:
Martin Konecny 2011-11-15 15:45:08 -05:00
parent fe5191eac1
commit a0217f715f
6 changed files with 72 additions and 40 deletions

View file

@ -188,6 +188,10 @@ class ApiController extends Zend_Controller_Action
"nextShow"=>Application_Model_Show::GetNextShows($timeNow, 5),
"timezone"=> date("T"),
"timezoneOffset"=> date("Z"));
//Convert from UTC to localtime for user.
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
//echo json_encode($result);
header("Content-type: text/javascript");
@ -213,6 +217,8 @@ class ApiController extends Zend_Controller_Action
$result = array("env"=>APPLICATION_ENV,
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
"nextShow"=>Application_Model_Show::GetNextShows($timeNow, 5, $timeEnd));
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
header("Content-type: text/javascript");
echo $_GET['callback'].'('.json_encode($result).')';
@ -234,7 +240,10 @@ class ApiController extends Zend_Controller_Action
$result = array();
for ($i=0; $i<7; $i++){
$result[$dow[$i]] = Application_Model_Show::GetShowsByDayOfWeek($i);
$shows = Application_Model_Show::GetShowsByDayOfWeek($i);
Application_Model_Show::ConvertToLocalTimeZone($shows, array("show_starts", "show_ends"));
$result[$dow[$i]] = $shows;
}
header("Content-type: text/javascript");
@ -361,6 +370,8 @@ class ApiController extends Zend_Controller_Action
$this->view->is_recording = false;
$rows = Application_Model_Show::GetCurrentShow($today_timestamp);
Application_Model_Show::ConvertToLocalTimeZone($rows, array("starts", "ends", "start_timestamp", "end_timestamp"));
if (count($rows) > 0){
$this->view->is_recording = ($rows[0]['record'] == 1);
}

View file

@ -293,7 +293,27 @@ class ScheduleController extends Zend_Controller_Action
public function getCurrentPlaylistAction()
{
$this->view->entries = Application_Model_Schedule::GetPlayOrderRange();
$range = Application_Model_Schedule::GetPlayOrderRange();
/* Convert all UTC times to localtime before sending back to user. */
if (isset($range["previous"])){
$range["previous"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["starts"]);
$range["previous"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["previous"]["ends"]);
}
if (isset($range["current"])){
$range["current"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["current"]["starts"]);
$range["current"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["current"]["ends"]);
}
if (isset($range["next"])){
$range["next"]["starts"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["starts"]);
$range["next"]["ends"] = Application_Model_DateHelper::ConvertToLocalDateTimeString($range["next"]["ends"]);
}
Application_Model_Show::ConvertToLocalTimeZone($range["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
Application_Model_Show::ConvertToLocalTimeZone($range["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
$this->view->entries = $range;
}
public function findPlaylistsAction()