CC-4100: Make number of shows displayed in widget customizable
-fixed
This commit is contained in:
parent
b782b9a9b6
commit
bd51b4db02
|
@ -2,7 +2,7 @@
|
|||
|
||||
define('AIRTIME_COPYRIGHT_DATE', '2010-2012');
|
||||
define('AIRTIME_REST_VERSION', '1.1');
|
||||
define('AIRTIME_API_VERSION', '1.0');
|
||||
define('AIRTIME_API_VERSION', '1.1');
|
||||
|
||||
// Metadata Keys for files
|
||||
define('MDATA_KEY_FILEPATH', 'filepath');
|
||||
|
|
|
@ -271,31 +271,31 @@ class ApiController extends Zend_Controller_Action
|
|||
|
||||
$request = $this->getRequest();
|
||||
$type = $request->getParam('type');
|
||||
if($type == "endofday") {
|
||||
if ($type == "endofday") {
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
Logging::log($limit);
|
||||
if($limit == "" || !is_numeric($limit)) {
|
||||
$limit = "5";
|
||||
}
|
||||
|
||||
// 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, 5, $utcTimeEnd));
|
||||
"nextShow"=>Application_Model_Show::GetNextShows($utcTimeNow, $limit, $utcTimeEnd));
|
||||
|
||||
Application_Model_Show::ConvertToLocalTimeZone($result["nextShow"], array("starts", "ends", "start_timestamp", "end_timestamp"));
|
||||
}else{
|
||||
|
||||
$limit = $request->getParam('limit');
|
||||
if($limit == "" || !is_numeric($limit)) {
|
||||
$limit = "5";
|
||||
}
|
||||
|
||||
} else {
|
||||
$result = Application_Model_Schedule::GetPlayOrderRange();
|
||||
|
||||
//Convert from UTC to localtime for user.
|
||||
|
||||
//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"));
|
||||
}
|
||||
|
||||
$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.
|
||||
|
||||
//echo json_encode($result);
|
||||
header("Content-type: text/javascript");
|
||||
echo $_GET['callback'].'('.json_encode($result).')';
|
||||
} else {
|
||||
|
|
|
@ -32,6 +32,7 @@ class Application_Model_Schedule {
|
|||
{
|
||||
if (!is_int($p_prev) || !is_int($p_next)){
|
||||
//must enter integers to specify ranges
|
||||
Logging::log("Invalid range parameters: $p_prev or $p_next");
|
||||
return array();
|
||||
}
|
||||
|
||||
|
@ -49,7 +50,6 @@ class Application_Model_Schedule {
|
|||
"schedulerTime"=>$timeNow,
|
||||
"previous"=>$results['previous'] !=null?$results['previous']:(count($shows['previousShow'])>0?$shows['previousShow'][0]:null),
|
||||
"current"=>$results['current'] !=null?$results['current']:((count($shows['currentShow'])>0 && $shows['currentShow'][0]['record'] == 1)?$shows['currentShow'][0]:null),
|
||||
//"current"=>$results['current'] !=null?$results['current']:(count($shows['currentShow'])>0?$shows['currentShow'][0]:null),
|
||||
"next"=> $results['next'] !=null?$results['next']:(count($shows['nextShow'])>0?$shows['nextShow'][0]:null),
|
||||
"currentShow"=>$shows['currentShow'],
|
||||
"nextShow"=>$shows['nextShow'],
|
||||
|
|
|
@ -1845,9 +1845,9 @@ class Application_Model_Show {
|
|||
|
||||
/**
|
||||
* Given a start time $timeStart and end time $timeEnd, returns the next $limit
|
||||
* number of shows within the time interval;
|
||||
* If $timeEnd not given, shows within next 48 hours from $timeStart are returned;
|
||||
* If $limit not given, all shows within the intervals are returns;
|
||||
* number of shows within the time interval
|
||||
* If $timeEnd not given, shows within next 48 hours from $timeStart are returned
|
||||
* If $limit not given, all shows within the intervals are returned
|
||||
* Times are all in UTC time.
|
||||
*
|
||||
* @param String $timeStart - interval start time (in UTC)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var AIRTIME_API_VERSION = "1.0";
|
||||
var AIRTIME_API_VERSION = "1.1";
|
||||
|
||||
(function($){
|
||||
$.fn.airtimeShowSchedule = function(options) {
|
||||
|
@ -6,7 +6,8 @@
|
|||
var defaults = {
|
||||
updatePeriod: 20, //seconds
|
||||
sourceDomain: "http://localhost/", //where to get show status from
|
||||
text: {onAirToday:"On air today"}
|
||||
text: {onAirToday:"On air today"},
|
||||
showLimit: 5
|
||||
};
|
||||
options = $.extend(true, defaults, options);
|
||||
options.sourceDomain = addEndingBackslash(options.sourceDomain);
|
||||
|
@ -56,7 +57,7 @@
|
|||
|
||||
function getServerData(){
|
||||
$.ajax({url: options.sourceDomain + "api/live-info/",
|
||||
data: {type:"endofday",limit:"5"},
|
||||
data: {type:"endofday",limit: options.showLimit},
|
||||
dataType: "jsonp",
|
||||
success:function(data) {
|
||||
processData(data);
|
||||
|
|
|
@ -17,7 +17,8 @@ $(document).ready(function() {
|
|||
$("#onAirToday").airtimeShowSchedule({
|
||||
sourceDomain: "http://localhost",
|
||||
text: {onAirToday:"On air today"},
|
||||
updatePeriod: 5 //seconds
|
||||
updatePeriod: 5, //seconds
|
||||
showLimit: 10
|
||||
});
|
||||
$("#scheduleTabs").airtimeWeekSchedule({
|
||||
sourceDomain:"http://localhost",
|
||||
|
|
Loading…
Reference in New Issue