Resolved differences merging 2.5.x into saas
This commit is contained in:
commit
275ca5eed6
31 changed files with 832 additions and 326 deletions
|
@ -56,14 +56,11 @@ SQL;
|
|||
|
||||
return $real_streams;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns data related to the scheduled items.
|
||||
*
|
||||
* @param int $p_prev
|
||||
* @param int $p_next
|
||||
* @return date
|
||||
*/
|
||||
public static function GetPlayOrderRange($p_prev = 1, $p_next = 1)
|
||||
public static function GetPlayOrderRange($utcTimeEnd = null, $showsToRetrieve = 5)
|
||||
{
|
||||
//Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up.
|
||||
|
||||
|
@ -74,25 +71,72 @@ SQL;
|
|||
return array();
|
||||
}
|
||||
|
||||
// when timeEnd is unspecified, return to the default behaviour - set a range of 48 hours from current time
|
||||
if (!$utcTimeEnd) {
|
||||
$end = new DateTime();
|
||||
$end->add(new DateInterval("P2D")); // Add 2 days
|
||||
$end->setTimezone(new DateTimeZone("UTC"));
|
||||
$utcTimeEnd = $end->format("Y-m-d H:i:s");
|
||||
}
|
||||
|
||||
$utcNow = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
$shows = Application_Model_Show::getPrevCurrentNext($utcNow);
|
||||
$shows = Application_Model_Show::getPrevCurrentNext($utcNow, $utcTimeEnd, $showsToRetrieve);
|
||||
$previousShowID = count($shows['previousShow'])>0?$shows['previousShow'][0]['instance_id']:null;
|
||||
$currentShowID = count($shows['currentShow'])>0?$shows['currentShow']['instance_id']:null;
|
||||
$nextShowID = count($shows['nextShow'])>0?$shows['nextShow'][0]['instance_id']:null;
|
||||
$results = self::GetPrevCurrentNext($previousShowID, $currentShowID, $nextShowID, $utcNow);
|
||||
|
||||
$range = array(
|
||||
"station" => array (
|
||||
"env" => APPLICATION_ENV,
|
||||
"schedulerTime" => $utcNow->format("Y-m-d H:i:s")
|
||||
),
|
||||
//Previous, current, next songs!
|
||||
"tracks" => array(
|
||||
"previous" => $results['previous'],
|
||||
"current" => $results['current'],
|
||||
"next" => $results['next']
|
||||
),
|
||||
//Current and next shows
|
||||
"shows" => array (
|
||||
"previous" => $shows['previousShow'],
|
||||
"current" => $shows['currentShow'],
|
||||
"next" => $shows['nextShow']
|
||||
)
|
||||
);
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
||||
/**
|
||||
* Old version of the function for backwards compatibility
|
||||
* @deprecated
|
||||
*/
|
||||
public static function GetPlayOrderRangeOld()
|
||||
{
|
||||
// Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up.
|
||||
|
||||
$utcNow = new DateTime("now", new DateTimeZone("UTC"));
|
||||
|
||||
$shows = Application_Model_Show::getPrevCurrentNextOld($utcNow);
|
||||
$previousShowID = count($shows['previousShow'])>0?$shows['previousShow'][0]['instance_id']:null;
|
||||
$currentShowID = count($shows['currentShow'])>0?$shows['currentShow'][0]['instance_id']:null;
|
||||
$nextShowID = count($shows['nextShow'])>0?$shows['nextShow'][0]['instance_id']:null;
|
||||
$results = self::GetPrevCurrentNext($previousShowID, $currentShowID, $nextShowID, $utcNow);
|
||||
|
||||
$range = array("env"=>APPLICATION_ENV,
|
||||
"schedulerTime"=> $utcNow->format("Y-m-d H:i:s"),
|
||||
//Previous, current, next songs!
|
||||
"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),
|
||||
"next"=> $results['next'] !=null?$results['next']:(count($shows['nextShow'])>0?$shows['nextShow'][0]:null),
|
||||
//Current and next shows
|
||||
"currentShow"=>$shows['currentShow'],
|
||||
"nextShow"=>$shows['nextShow'],
|
||||
|
||||
$range = array(
|
||||
"env" => APPLICATION_ENV,
|
||||
"schedulerTime" => $utcNow->format("Y-m-d H:i:s"),
|
||||
//Previous, current, next songs!
|
||||
"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),
|
||||
"next"=> $results['next'] !=null?$results['next']:(count($shows['nextShow'])>0?$shows['nextShow'][0]:null),
|
||||
//Current and next shows
|
||||
"currentShow"=>$shows['currentShow'],
|
||||
"nextShow"=>$shows['nextShow']
|
||||
);
|
||||
|
||||
|
||||
return $range;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue