/** * 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) { //Everything in this function must be done in UTC. You will get a swift kick in the pants if you mess that up. if (!is_int($p_prev) || !is_int($p_next)) { //must enter integers to specify ranges Logging::info("Invalid range parameters: {$p_prev} or {$p_next}"); return array(); } $utcNow = new DateTime("now", new DateTimeZone("UTC")); $shows = Application_Model_Show::getPrevCurrentNext($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" => $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), "currentShow" => $shows['currentShow'], "nextShow" => $shows['nextShow']); return $range; }
/** * 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) { if (!is_int($p_prev) || !is_int($p_next)) { //must enter integers to specify ranges Logging::info("Invalid range parameters: {$p_prev} or {$p_next}"); return array(); } $date = new Application_Common_DateHelper(); $timeNow = $date->getTimestamp(); $utcTimeNow = $date->getUtcTimestamp(); $shows = Application_Model_Show::getPrevCurrentNext($utcTimeNow); $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, $utcTimeNow); $range = array("env" => APPLICATION_ENV, "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), "next" => $results['next'] != null ? $results['next'] : (count($shows['nextShow']) > 0 ? $shows['nextShow'][0] : null), "currentShow" => $shows['currentShow'], "nextShow" => $shows['nextShow'], "timezone" => date("T"), "timezoneOffset" => date("Z")); return $range; }