예제 #1
0
 /**
  *
  * @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;
 }