Exemple #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);
 }
 public function scheduleShowDialogAction()
 {
     $showInstanceId = $this->_getParam('id');
     $this->sched_sess->showInstanceId = $showInstanceId;
     $show = new ShowInstance($showInstanceId);
     $start_timestamp = $show->getShowStart();
     $end_timestamp = $show->getShowEnd();
     //check to make sure show doesn't overlap.
     if (Show::getShows($start_timestamp, $end_timestamp, array($showInstanceId))) {
         $this->view->error = "cannot schedule an overlapping show.";
         return;
     }
     $start = explode(" ", $start_timestamp);
     $end = explode(" ", $end_timestamp);
     $startTime = explode(":", $start[1]);
     $endTime = explode(":", $end[1]);
     $dateInfo_s = getDate(strtotime($start_timestamp));
     $dateInfo_e = getDate(strtotime($end_timestamp));
     $this->view->showContent = $show->getShowContent();
     $this->view->timeFilled = $show->getTimeScheduled();
     $this->view->showName = $show->getName();
     $this->view->showLength = $show->getShowLength();
     $this->view->percentFilled = $show->getPercentScheduled();
     $this->view->s_wday = $dateInfo_s['weekday'];
     $this->view->s_month = $dateInfo_s['month'];
     $this->view->s_day = $dateInfo_s['mday'];
     $this->view->e_wday = $dateInfo_e['weekday'];
     $this->view->e_month = $dateInfo_e['month'];
     $this->view->e_day = $dateInfo_e['mday'];
     $this->view->startTime = sprintf("%d:%02d", $startTime[0], $startTime[1]);
     $this->view->endTime = sprintf("%d:%02d", $endTime[0], $endTime[1]);
     $this->view->chosen = $this->view->render('schedule/scheduled-content.phtml');
     $this->view->dialog = $this->view->render('schedule/schedule-show-dialog.phtml');
     unset($this->view->showContent);
 }