コード例 #1
0
 public function makeContextMenuAction()
 {
     $instanceId = $this->_getParam('instanceId');
     $service_calendar = new Application_Service_CalendarService($instanceId);
     $this->view->items = $service_calendar->makeContextMenu();
 }
コード例 #2
0
 private function checkToDeleteCcShow($showId)
 {
     // check if there are any non deleted show instances remaining.
     $ccShowInstances = CcShowInstancesQuery::create()->filterByDbShowId($showId)->filterByDbModifiedInstance(false)->filterByDbRebroadcast(0)->orderByDbStarts()->find();
     if ($ccShowInstances->isEmpty()) {
         return true;
     } else {
         if (count($ccShowInstances) >= 1) {
             $lastShowDays = array();
             //get the show's timezone
             $ccShow = CcShowQuery::create()->findPk($showId);
             if ($ccShow->isRepeating()) {
                 $showTimezone = $ccShow->getFirstRepeatingCcShowDay()->getDbTimezone();
             } else {
                 $showTimezone = $ccShow->getFirstCcShowDay()->getDbTimezone();
             }
             /* Creates an array where the key is the day of the week (monday,
              * tuesday, etc.) and the value is the last show date for each
              * day of the week. We will use this array to update the last_show
              * for each cc_show_days entry of a cc_show
              */
             foreach ($ccShowInstances as $instance) {
                 $instanceStartDT = $instance->getDbStarts(null);
                 $instanceStartDT->setTimezone(new DateTimeZone($showTimezone));
                 $lastShowDays[$instanceStartDT->format("w")] = $instanceStartDT;
             }
             foreach ($lastShowDays as $dayOfWeek => $lastShowStartDT) {
                 $ccShowDay = CcShowDaysQuery::create()->filterByDbShowId($showId)->filterByDbDay($dayOfWeek)->filterByDbRepeatType(-1, Criteria::NOT_EQUAL)->findOne();
                 if (isset($ccShowDay)) {
                     $lastShowStartDT->setTimeZone(new DateTimeZone($ccShowDay->getDbTimezone()));
                     $lastShowEndDT = Application_Service_CalendarService::addDeltas($lastShowStartDT, 1, 0);
                     $ccShowDay->setDbLastShow($lastShowEndDT->format("Y-m-d"))->save();
                 }
             }
         }
     }
     return false;
 }