CC-4152: Widget does not display current show in some modes
-fixed
This commit is contained in:
parent
8d2348606c
commit
40023d9086
3 changed files with 27 additions and 17 deletions
|
@ -260,41 +260,51 @@ class ApiController extends Zend_Controller_Action
|
||||||
*/
|
*/
|
||||||
public function liveInfoAction()
|
public function liveInfoAction()
|
||||||
{
|
{
|
||||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
if (Application_Model_Preference::GetAllow3rdPartyApi()) {
|
||||||
// disable the view and the layout
|
// disable the view and the layout
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
|
||||||
$date = new Application_Common_DateHelper;
|
$date = new Application_Common_DateHelper;
|
||||||
$utcTimeNow = $date->getUtcTimestamp();
|
$utcTimeNow = $date->getUtcTimestamp();
|
||||||
$utcTimeEnd = ""; // if empty, GetNextShows will use interval instead of end of day
|
$utcTimeEnd = ""; // if empty, getNextShows will use interval instead of end of day
|
||||||
|
|
||||||
$request = $this->getRequest();
|
$request = $this->getRequest();
|
||||||
$type = $request->getParam('type');
|
$type = $request->getParam('type');
|
||||||
|
/* This is some *extremely* lazy programming that needs to bi fixed. For some reason
|
||||||
|
* we are using two entirely different codepaths for very similar functionality (type = endofday
|
||||||
|
* vs type = interval). Needs to be fixed for 2.2 - MK */
|
||||||
if ($type == "endofday") {
|
if ($type == "endofday") {
|
||||||
|
|
||||||
$limit = $request->getParam('limit');
|
$limit = $request->getParam('limit');
|
||||||
if($limit == "" || !is_numeric($limit)) {
|
if ($limit == "" || !is_numeric($limit)) {
|
||||||
$limit = "5";
|
$limit = "5";
|
||||||
}
|
}
|
||||||
|
|
||||||
// make GetNextShows use end of day
|
// make getNextShows use end of day
|
||||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||||
$result = array("env"=>APPLICATION_ENV,
|
$result = array("env"=>APPLICATION_ENV,
|
||||||
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
"schedulerTime"=>gmdate("Y-m-d H:i:s"),
|
||||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd));
|
"currentShow"=>Application_Model_Show::getCurrentShow($utcTimeNow),
|
||||||
|
"nextShow"=>Application_Model_Show::getNextShows($utcTimeNow, $limit, $utcTimeEnd)
|
||||||
|
);
|
||||||
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
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"));
|
||||||
} else {
|
} else {
|
||||||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||||
|
|
||||||
//Convert from UTC to localtime for Web Browser.
|
//Convert from UTC to localtime for Web Browser.
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::ConvertToLocalTimeZone($result["currentShow"],
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"],
|
||||||
|
array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
}
|
}
|
||||||
|
|
||||||
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION; //used by caller to determine if the airtime they are running or widgets in use is out of date.
|
|
||||||
|
|
||||||
|
//used by caller to determine if the airtime they are running or widgets in use is out of date.
|
||||||
|
$result['AIRTIME_API_VERSION'] = AIRTIME_API_VERSION;
|
||||||
header("Content-type: text/javascript");
|
header("Content-type: text/javascript");
|
||||||
|
|
||||||
// If a callback is not given, then just provide the raw JSON.
|
// If a callback is not given, then just provide the raw JSON.
|
||||||
|
@ -308,7 +318,7 @@ class ApiController extends Zend_Controller_Action
|
||||||
|
|
||||||
public function weekInfoAction()
|
public function weekInfoAction()
|
||||||
{
|
{
|
||||||
if (Application_Model_Preference::GetAllow3rdPartyApi()){
|
if (Application_Model_Preference::GetAllow3rdPartyApi()) {
|
||||||
// disable the view and the layout
|
// disable the view and the layout
|
||||||
$this->view->layout()->disableLayout();
|
$this->view->layout()->disableLayout();
|
||||||
$this->_helper->viewRenderer->setNoRender(true);
|
$this->_helper->viewRenderer->setNoRender(true);
|
||||||
|
@ -320,9 +330,9 @@ class ApiController extends Zend_Controller_Action
|
||||||
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
|
$dow = array("monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday");
|
||||||
|
|
||||||
$result = array();
|
$result = array();
|
||||||
for ($i=0; $i<7; $i++){
|
for ($i=0; $i<7; $i++) {
|
||||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||||
$utcDayStart = $utcDayEnd;
|
$utcDayStart = $utcDayEnd;
|
||||||
|
|
||||||
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
Application_Model_Show::ConvertToLocalTimeZone($shows, array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||||
|
|
|
@ -109,7 +109,7 @@ class Application_Model_Schedule {
|
||||||
$sql .= ' AND st.playout_status > 0 ORDER BY st.starts';
|
$sql .= ' AND st.playout_status > 0 ORDER BY st.starts';
|
||||||
|
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
$numberOfRows = count($rows);
|
$numberOfRows = count($rows);
|
||||||
|
|
||||||
$results['previous'] = null;
|
$results['previous'] = null;
|
||||||
|
|
|
@ -1736,7 +1736,7 @@ class Application_Model_Show {
|
||||||
." AND modified_instance != TRUE";
|
." AND modified_instance != TRUE";
|
||||||
|
|
||||||
// Convert back to local timezone
|
// Convert back to local timezone
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1850,7 +1850,7 @@ class Application_Model_Show {
|
||||||
* @param String $timeEnd - interval end time (in UTC)
|
* @param String $timeEnd - interval end time (in UTC)
|
||||||
* @return array - the next $limit number of shows within the time interval
|
* @return array - the next $limit number of shows within the time interval
|
||||||
*/
|
*/
|
||||||
public static function GetNextShows($timeStart, $limit = "0", $timeEnd = "")
|
public static function getNextShows($timeStart, $limit = "0", $timeEnd = "")
|
||||||
{
|
{
|
||||||
global $CC_CONFIG;
|
global $CC_CONFIG;
|
||||||
$con = Propel::getConnection();
|
$con = Propel::getConnection();
|
||||||
|
@ -1877,7 +1877,7 @@ class Application_Model_Show {
|
||||||
$sql = $sql . " LIMIT $limit";
|
$sql = $sql . " LIMIT $limit";
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = $con->query($sql)->fetchAll();
|
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||||
return $rows;
|
return $rows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue