Merge branch '2.1.x' into devel

Conflicts:
	airtime_mvc/application/controllers/ApiController.php
	airtime_mvc/application/models/Schedule.php
	airtime_mvc/application/models/Show.php
This commit is contained in:
Martin Konecny 2012-08-06 17:10:46 -04:00
commit 48a1bf3f02
3 changed files with 21 additions and 14 deletions

View file

@ -258,29 +258,39 @@ class ApiController extends Zend_Controller_Action
$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.

View file

@ -107,8 +107,7 @@ class Application_Model_Schedule
$sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) AS unioned ORDER BY starts"; $sql = "SELECT * FROM (($filesSql) UNION ($streamSql)) AS unioned ORDER BY starts";
$rows = $con->query($sql)->fetchAll(PDO::FETCH_ASSOC);
$rows = $con->query($sql)->fetchAll();
$numberOfRows = count($rows); $numberOfRows = count($rows);
$results['previous'] = null; $results['previous'] = null;

View file

@ -1763,8 +1763,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;
} }
@ -1907,8 +1906,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;
} }