Ejemplo n.º 1
0
 public static function GetDataGridData($viewType, $dateString)
 {
     if ($viewType == "now") {
         $date = new DateHelper();
         $timeNow = $date->getTimestamp();
         $startCutoff = 60;
         $endCutoff = 86400;
         //60*60*24 - seconds in a day
     } else {
         $date = new DateHelper();
         $time = $date->getTime();
         $date->setDate($dateString . " " . $time);
         $timeNow = $date->getTimestamp();
         $startCutoff = $date->getNowDayStartDiff();
         $endCutoff = $date->getNowDayEndDiff();
     }
     $data = array();
     $showIds = ShowInstance::GetShowsInstancesIdsInRange($timeNow, $startCutoff, $endCutoff);
     foreach ($showIds as $showId) {
         $instanceId = $showId['id'];
         $si = new ShowInstance($instanceId);
         $showId = $si->getShowId();
         $show = new Show($showId);
         //append show header row
         $data[] = Application_Model_Nowplaying::CreateHeaderRow($show->getName(), $si->getShowStart(), $si->getShowEnd());
         $scheduledItems = $si->getScheduleItemsInRange($timeNow, $startCutoff, $endCutoff);
         $dataTablesRows = Application_Model_Nowplaying::CreateDatatableRows($scheduledItems);
         //append show audio item rows
         $data = array_merge($data, $dataTablesRows);
         //append show gap time row
         $gapTime = Application_Model_Nowplaying::FormatDuration($si->getShowEndGapTime(), true);
         if ($si->isRecorded()) {
             $data[] = Application_Model_Nowplaying::CreateRecordingRow($si);
         } else {
             if ($gapTime > 0) {
                 $data[] = Application_Model_Nowplaying::CreateGapRow($gapTime);
             }
         }
     }
     return array("currentShow" => Show_DAL::GetCurrentShow($timeNow), "rows" => $data);
 }
Ejemplo n.º 2
0
 /**
  * Returns data related to the scheduled items.
  *
  * @param int $prev
  * @param int $next
  * @return date
  */
 public static function GetPlayOrderRange($prev = 1, $next = 1)
 {
     if (!is_int($prev) || !is_int($next)) {
         //must enter integers to specify ranges
         return array();
     }
     global $CC_CONFIG;
     $date = new DateHelper();
     $timeNow = $date->getTimestamp();
     return array("env" => APPLICATION_ENV, "schedulerTime" => gmdate("Y-m-d H:i:s"), "previous" => Application_Model_Dashboard::GetPreviousItem($timeNow), "current" => Application_Model_Dashboard::GetCurrentItem($timeNow), "next" => Application_Model_Dashboard::GetNextItem($timeNow), "currentShow" => Show_DAL::GetCurrentShow($timeNow), "nextShow" => Show_DAL::GetNextShows($timeNow, 1), "timezone" => date("T"), "timezoneOffset" => date("Z"));
 }
Ejemplo n.º 3
0
 public function recordedShowsAction()
 {
     global $CC_CONFIG;
     $api_key = $this->_getParam('api_key');
     if (!in_array($api_key, $CC_CONFIG["apiKey"])) {
         header('HTTP/1.0 401 Unauthorized');
         print 'You are not allowed to access this resource.';
         exit;
     }
     $today_timestamp = date("Y-m-d H:i:s");
     $now = new DateTime($today_timestamp);
     $end_timestamp = $now->add(new DateInterval("PT2H"));
     $end_timestamp = $end_timestamp->format("Y-m-d H:i:s");
     $this->view->shows = Show::getShows($today_timestamp, $end_timestamp, $excludeInstance = NULL, $onlyRecord = TRUE);
     $this->view->is_recording = false;
     $rows = Show_DAL::GetCurrentShow($today_timestamp);
     if (count($rows) > 0) {
         $this->view->is_recording = $rows[0]['record'] == 1;
     }
 }