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); }
/** * * @param string $start * In the format "YYYY-MM-DD HH:mm:ss" * @param string $end * In the format "YYYY-MM-DD HH:mm:ss" * @param boolean $editable */ public static function getFullCalendarEvents($start, $end, $editable = false) { $events = array(); $start_range = new DateTime($start); $end_range = new DateTime($end); $interval = $start_range->diff($end_range); $days = $interval->format('%a'); $shows = Show::getShows($start, $end); $today_timestamp = date("Y-m-d H:i:s"); foreach ($shows as $show) { $options = array(); //only bother calculating percent for week or day view. if (intval($days) <= 7) { $show_instance = new ShowInstance($show["instance_id"]); $options["percent"] = $show_instance->getPercentScheduled(); } if ($editable && strtotime($today_timestamp) < strtotime($show["starts"])) { $options["editable"] = true; $events[] = Show::makeFullCalendarEvent($show, $options); } else { $events[] = Show::makeFullCalendarEvent($show, $options); } } return $events; }