Beispiel #1
0
 /**
  * Process the incoming request for the summary
  * view of published programs in the series.  
  *
  * @param object Joomla mainframe object
  * @return bean SummaryPageModel
  */
 public function summary($mainframe)
 {
     global $logger;
     $logger->debug(get_class($this) . '::summary()');
     $model = new SummaryPageModel();
     $evs = $this->getEventService();
     // check for a sort preference
     if (isset($_REQUEST['sort'])) {
         $_SESSION['summary_sort'] = $_REQUEST['sort'];
     }
     // filter by series
     $model->setSeries("");
     $series_id = $_REQUEST['oid'];
     $logger->debug("Found a series filter with id: " . $series_id);
     $list = $evs->getEventsByPubState('Program', array('Published'), $series_id);
     // clean the list
     $mp = new MasterPage();
     $current = array();
     foreach ($list as $event) {
         $last = $mp->getLastActivity($event->getChildren());
         if ($last == NULL || $mp->isCurrent($last)) {
             // Gallery
             $event = $this->setGallery($event, true);
             // in the MasterAction class
             $current[] = $event;
         }
     }
     // set the series name for the page title
     $cat = $evs->getCategoryById('Series', $series_id);
     $model->setSeries($cat);
     // announcement
     $model->setAnnouncement($this->getPublishedAnnouncement('Program', true));
     $model->setList($current);
     return $model;
 }
 /**
  * Gets the summary data for the past exhibitions.
  * @param object A joomla mainframe object (or extended mainframe)
  * @return bean An SummaryPageModel bean.
  */
 function past($mainframe)
 {
     global $logger;
     $logger->debug(get_class($this) . '::past()');
     // Get the year range, or set it to the current year range
     $selectedRange = isset($_REQUEST['year']) ? $_REQUEST['year'] : date('Y') - 1 . "-" . date('Y');
     $startYear = substr($selectedRange, 0, strpos($selectedRange, '-'));
     $endYear = substr($selectedRange, strpos($selectedRange, '-') + 1);
     $startRange = mktime(0, 0, 0, 1, 1, $startYear);
     $endRange = mktime(23, 59, 59, 12, 31, $endYear);
     $service = $this->getEventService();
     $gs = $this->getGalleryService();
     $model = new SummaryPageModel();
     $pubStates = array(PublicationState::PUBLISHED);
     $logger->debug("Size of pubStates array: " . count($pubStates));
     $list = $service->getEventsByPubState('Exhibition', $pubStates);
     $logger->debug("Size of exhibitions array: " . count($list));
     // filter for the past exhibitions
     $past = array();
     $years = array();
     foreach ($list as $event) {
         $et = $event->getSchedule()->getEndTime();
         $now = time();
         if ($event->getPubState() == PublicationState::PUBLISHED && $et < $now && $et > 0 || $event->getPubState() == PublicationState::ARCHIVED) {
             if ($et != 0) {
                 $eYear = date('Y', $et);
                 $years[] = $eYear;
             }
             if ($et >= $startRange && $et <= $endRange) {
                 $event = $this->setGallery($event, true, true);
                 // in the MasterAction class
                 $past[] = $event;
             }
         }
     }
     // Sort past array into reverse chronological order by start time ...
     $revChron = array();
     foreach ($past as $exhibition) {
         $revChron[$exhibition->getSchedule()->getStartTime()] = $exhibition;
     }
     krsort($revChron, SORT_NUMERIC);
     $past = array();
     foreach ($revChron as $exhibition) {
         $past[] = $exhibition;
     }
     $logger->debug("Total past: " . count($past));
     $years = array_unique($years);
     sort($years);
     $years = array_reverse($years);
     $model->years = $years;
     $annc = $this->getPublishedAnnouncement('Exhibition', true);
     $model->setAnnouncement($annc);
     $model->setList($past);
     return $model;
 }
Beispiel #3
0
 /**
  * Compiles the list of events and activities for the calendar
  * @param object $mainframe The Joomla specific page object
  * @return bean summary page model bean
  */
 private function setSummaries($mainframe)
 {
     global $mosConfig_live_site, $logger;
     $logger->debug(get_class($this) . "::setSummaries()");
     $ss = $this->getScheduleService();
     $model = new SummaryPageModel();
     $cal = $this->getBeanFromRequest();
     $start = CalendarForm::getMonthStart($cal);
     $end = CalendarForm::getMonthEnd($cal);
     if (FrontCalendarAction::USE_PROMOS) {
         $promos = $this->getPromos();
         $list = array();
         for ($i = 0; $i < count($promos); $i++) {
             $promo = $promos[$i];
             $list[] = $promo;
         }
         $model->setAnnouncement($list);
     }
     // get the list of schedules for their oids
     $schedules = $ss->getSchedulesForRange($start, $end);
     // get the events for the scheudles in the range
     $es = $this->getEventService();
     $events = array();
     $cals = array();
     foreach ($schedules as $sched) {
         $logger->debug("Finding event by schedule id: " . $sched->getOid());
         $event = $es->getEventBySchedule($sched);
         $logger->debug("The event has a title of: " . $event->getTitle());
         // only add published events
         if ($event->getPubState() == 'Published') {
             // start time
             if ($sched->getStartTime() > $start) {
                 $events[] = $event;
                 if ($this->isFilter($event)) {
                     $cals[] = $this->setCalendarEntry($sched, $event);
                 }
             }
             // exhibition end time
             if ($event->getScope() == Event::EXHIBITION && $sched->getEndTime() < $end) {
                 $events[] = $event;
                 if ($this->isFilter($event)) {
                     $cals[] = $this->setCalendarEntry($sched, $event, true);
                 }
             }
         }
     }
     $logger->debug("Number of events: " . count($events));
     $model->setSelected($cal);
     $model->setList($cals);
     $model->setOptions($this->getOptions($events));
     return $model;
 }
Beispiel #4
0
 /**
  * Process the incoming request for the overview
  * view of published primary genres.  
  *
  * @param object Joomla mainframe object
  * @return bean SummaryPageModel
  */
 public function overview($mainframe)
 {
     global $logger;
     $logger->debug(get_class($this) . '::overview()');
     $model = new SummaryPageModel();
     $es = new EventService();
     $courses = array();
     $events = $es->getEventsByPubState('Course', array('Published'));
     foreach ($events as $crse) {
         $pg = $crse->getPrimaryGenre();
         // Check to see if we are looking for school-related courses (not expected)
         $school = isset($_REQUEST['school']) ? $school : null;
         // add only the proper type (public or school)
         if ($pg->getSchool() == $school) {
             $courses[] = $crse;
         }
     }
     $model->setList($courses);
     // announcement
     $model->setAnnouncement($this->getPublishedAnnouncement('Course', false));
     return $model;
 }
Beispiel #5
0
 /**
  * Returns the model for the featured programs  
  *
  * @param object Joomla mainframe object
  * @return bean SummaryPageModel
  */
 public function featured($mainframe = null)
 {
     global $logger;
     $logger->debug(get_class($this) . '::featured()');
     $model = new SummaryPageModel();
     $evs = $this->getEventService();
     $events = $evs->getFeatured(Event::PROGRAM, true);
     $ss = $this->getScheduleService();
     $results = array();
     foreach ($events as $event) {
         // get the gallery
         $event = $this->setGallery($event, true, true);
         // in the MasterAction class
         // get the performaces
         $performances = $ss->getActivities(Event::PROGRAM, $event->getOid());
         $event->setChildren($performances);
     }
     $model->setList($events);
     $model->setAnnouncement($this->getPublishedAnnouncement(Event::PROGRAM));
     return $model;
 }