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
|
@ -267,10 +267,13 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$date = new Application_Common_DateHelper;
|
||||
$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();
|
||||
$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") {
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
|
@ -278,23 +281,30 @@ class ApiController extends Zend_Controller_Action
|
|||
$limit = "5";
|
||||
}
|
||||
|
||||
// make GetNextShows use end of day
|
||||
// make getNextShows use end of day
|
||||
$utcTimeEnd = Application_Common_DateHelper::GetDayEndTimestampInUtc();
|
||||
$result = array("env"=>APPLICATION_ENV,
|
||||
"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 {
|
||||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
//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["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"));
|
||||
}
|
||||
|
||||
$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");
|
||||
|
||||
// If a callback is not given, then just provide the raw JSON.
|
||||
|
@ -322,7 +332,7 @@ class ApiController extends Zend_Controller_Action
|
|||
$result = array();
|
||||
for ($i=0; $i<7; $i++) {
|
||||
$utcDayEnd = Application_Common_DateHelper::GetDayEndTimestamp($utcDayStart);
|
||||
$shows = Application_Model_Show::GetNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$shows = Application_Model_Show::getNextShows($utcDayStart, "0", $utcDayEnd);
|
||||
$utcDayStart = $utcDayEnd;
|
||||
|
||||
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';
|
||||
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
$numberOfRows = count($rows);
|
||||
|
||||
$results['previous'] = null;
|
||||
|
|
|
@ -1736,7 +1736,7 @@ class Application_Model_Show {
|
|||
." AND modified_instance != TRUE";
|
||||
|
||||
// Convert back to local timezone
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
@ -1850,7 +1850,7 @@ class Application_Model_Show {
|
|||
* @param String $timeEnd - interval end time (in UTC)
|
||||
* @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;
|
||||
$con = Propel::getConnection();
|
||||
|
@ -1877,7 +1877,7 @@ class Application_Model_Show {
|
|||
$sql = $sql . " LIMIT $limit";
|
||||
}
|
||||
|
||||
$rows = $con->query($sql)->fetchAll();
|
||||
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
|
||||
return $rows;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue