Exemple #1
0
 /**
  * Displays the series summary
  * @param bean $model The series summary model
  */
 public function summary($model)
 {
     global $logger, $mainframe;
     $logger->debug(get_class($this) . "::summary({$model})");
     $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR);
     $tmpl->readTemplatesFromInput('series_summary.pat.tpl');
     // page title + description
     $pg_title = "Series";
     if ($model->getSeries()) {
         $pg_title = $model->getSeries()->getName();
         $tmpl->addVar('series', 'description', $model->getSeries()->getDescription());
     }
     $mainframe->setPageTitle("Program Series | " . $pg_title);
     $tmpl->addVar('intro', 'title', $pg_title);
     // announcment
     if ($model->getAnnouncement() != null) {
         $tmpl->addVar('intro', 'announcement', $model->getAnnouncement());
     }
     $eventList = $model->getList();
     usort($eventList, array('FrontSeriesPage', 'sort_by_date'));
     foreach ($eventList as $event) {
         // simple attributes
         $tmpl->addVars('program', BeanUtil::beanToArray($event, true));
         // scalars only
         // primary genre
         $pg = $event->getPrimaryGenre();
         if ($pg != null) {
             $tmpl->addVar('program', 'genre', $pg->getName());
         }
         // activity level items
         $acts = $event->getChildren();
         $next_act = $this->getNextActivity($acts);
         $time_display = "";
         if ($next_act != null) {
             $schedule = $next_act->getSchedule();
             if ($schedule != null) {
                 //					$time_display = strftime("%A, %B %d, %I:%M %p ",$schedule->getStartTime());
                 $time_display = date("l, F j, g:i a", $schedule->getStartTime());
             }
             if ($next_act->getActivityStatus() != null) {
                 // get the ticket code
                 $tc = null;
                 if ($next_act->getTicketCode() != null) {
                     $tc = $next_act->getTicketCode();
                 } else {
                     $tc = $event->getTicketUrl();
                 }
                 $ticket = $this->getStatusImage($next_act->getActivityStatus()->getValue(), $tc);
             }
         }
         $tmpl->addVar('program', 'time', $time_display);
         $tmpl->addVar('program', 'status_img', $ticket);
         // audience
         $tmpl->clearTemplate('show_audience');
         $tmpl->clearTemplate('audience');
         $family = false;
         $cats = $event->getCategories();
         if (isset($cats[Category::AUDIENCE])) {
             foreach ($cats[Category::AUDIENCE] as $aud) {
                 if ($aud->getFamily()) {
                     $family = true;
                 }
                 $tmpl->addVar('audience', 'name', $aud->getName());
                 $tmpl->parseTemplate('audience', 'a');
                 $tmpl->setAttribute("show_audience", "visibility", "visible");
             }
         }
         $tmpl->addVar('program', 'family', $family);
         // image
         if ($event->getGallery() != null) {
             $images = $event->getGallery()->getImages();
             $logger->debug('Number of images [1]: ' . count($images));
             $img = $images[0];
             $logger->debug('Class of img [Image]: ' . get_class($img));
             $tmpl->addVar('program', 'imageurl', $img->getUrl());
             $tmpl->addVar('program', 'imagecredit', $img->getAuthor());
         }
         $tmpl->parseTemplate('program', "a");
     }
     $tmpl->displayParsedTemplate('series');
     // set the request for css ids and classes
     $_REQUEST['cce_scope'] = "programs";
     // css file name / body id
     $_REQUEST['cce_page'] = "";
     // body class
     $_REQUEST['cce_cols'] = "3";
     // canvas div id
     $_REQUEST['cce_subtype'] = "general";
     // canvas div class
 }
 /**
  * Renders the summary of given exhibitions (current or upcoming)
  * @param bean $model The exhibition summary model
  */
 private function summary($model)
 {
     global $logger, $mainframe;
     $logger->debug(get_class($this) . '::summary()');
     $list = $model->getList();
     $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR);
     $tmpl->readTemplatesFromInput('exhibition_summary.pat.tpl');
     $mainframe->setPageTitle($model->getViewType() . " Exhibitions");
     $tmpl->addVar('intro', 'view_type', $model->getViewType());
     if ($model->getAnnouncement() != null) {
         $tmpl->addVar('intro', 'announcement', $model->getAnnouncement());
     }
     // Add the objects to the nested templates
     for ($i = 0; $i < count($list); $i++) {
         $event = $list[$i];
         // simple attributes
         $tmpl->addVars('exhibition', BeanUtil::beanToArray($event, true));
         // scalars only
         // Event Status & Tickets
         $tmpl->addVar('exhibition', 'status', $event->getEventStatus());
         if ($event->getTicketUrl() != null) {
             $tmpl->addVar('ticket_link', 'ticketurl', $this->getTicketUrl($event->getTicketUrl()));
         }
         // schedule
         $time_display = "";
         if ($event->getScheduleNote()) {
             $time_display = $event->getScheduleNote();
         } elseif ($event->getSchedule() != null) {
             $st = $event->getSchedule()->getStartTime();
             $et = $event->getSchedule()->getEndTime();
             $time_display = $this->formatDate($st, 'tiny');
             if ($et > $st) {
                 $time_display .= " - " . $this->formatDate($et, 'tiny');
                 $time_display .= date(", Y", $et);
             }
         }
         $tmpl->addVar('exhibition', 'time_display', $time_display);
         // image
         if ($event->getGallery() != null) {
             $images = $event->getGallery()->getImages();
             $logger->debug('Number of images [1]: ' . count($images));
             $img = $images[0];
             $logger->debug('Class of img [Image]: ' . get_class($img));
             $tmpl->addVar('exhibition', 'imageurl', $img->getUrl());
             $tmpl->addVar('exhibition', 'imagecredit', $img->getAuthor());
         }
         // venues
         $logger->debug("Number of venues for event ID " . $event->getOid() . ": " . count($event->getVenues()));
         if ($event->getVenues() != null) {
             $tmpl->clearTemplate('venues');
             $logger->debug("type of venue collection [array]: " . gettype($event->getVenues()));
             foreach ($event->getVenues() as $venue) {
                 $logger->debug("Venue is of class [Venue]: " . get_class($venue));
                 $vlink = $this->getVenueTitleLink($venue);
                 $tmpl->addVar('venues', 'venue_link', $vlink);
                 $tmpl->parseTemplate('venues', "a");
             }
         }
         // related
         $tmpl->clearTemplate('show_related');
         $tmpl->setAttribute("show_related", "visibility", "hidden");
         $tmpl->clearTemplate('related');
         if ($event->getPrograms() != null) {
             $res = $event->getPrograms();
             if (count($res) > 0) {
                 foreach ($res as $prg) {
                     // only show published programs
                     if ($prg->getPubState() == 'Published') {
                         if (count($prg->getChildren()) > 0) {
                             $next = $this->getNextActivity($prg->getChildren());
                             if ($next) {
                                 $tmpl->addVar('related', 'oid', $prg->getOid());
                                 $tmpl->addVar('related', 'title', $prg->getTitle());
                                 $schedule = $next->getSchedule();
                                 $startTime = "(" . $this->formatDate($schedule->getStartTime()) . ")";
                                 $tmpl->addVar('related', 'startTime', $startTime);
                                 $tmpl->parseTemplate('related', "a");
                                 $tmpl->setAttribute("show_related", "visibility", "visible");
                             }
                         }
                     }
                 }
             }
         }
         // audience
         $tmpl->clearTemplate('show_audience');
         $tmpl->setAttribute("show_audience", "visibility", "hidden");
         $tmpl->clearTemplate('audience');
         $family = false;
         $cats = $event->getCategories();
         if (isset($cats[Category::AUDIENCE])) {
             foreach ($cats[Category::AUDIENCE] as $aud) {
                 if ($aud->getFamily()) {
                     $family = true;
                 }
                 $tmpl->addVar('audience', 'name', $aud->getName());
                 $tmpl->parseTemplate('audience', 'a');
                 $tmpl->setAttribute("show_audience", "visibility", "visible");
             }
         }
         $tmpl->addVar('exhibition', 'family', $family);
         $tmpl->parseTemplate('exhibition', "a");
     }
     $tmpl->displayParsedTemplate('exbt_summary');
 }
Exemple #3
0
 /**
  * Displays the what's on overview (list of published genres)
  * @param bean $model The program summary model
  */
 public function overview($model)
 {
     global $logger, $mainframe;
     $logger->debug(get_class($this) . "::summary({$model})");
     $list = $model->getList();
     $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR);
     $tmpl->readTemplatesFromInput('program_overview.pat.tpl');
     // page title
     $pg_title = PRGM_OVERVIEW_TITLE;
     $mainframe->setPageTitle($pg_title);
     $tmpl->addVar('intro', 'title', $pg_title);
     // announcement
     if ($model->getAnnouncement() != null) {
         $tmpl->addVar('intro', 'announcement', $model->getAnnouncement());
     }
     // order the genres alphabetically
     $name = array();
     foreach ($list as $key => $row) {
         $name[$key] = $row->getName();
     }
     array_multisort($name, SORT_ASC, $list);
     // load the genre information
     foreach ($list as $genre) {
         if ($genre->getName() != '') {
             // protects against empty categories
             // simple attributes
             $tmpl->addVars('genre', BeanUtil::beanToArray($genre, true));
             // scalars only
             // image
             $photo_url = $genre->getImage() != '' ? $genre->getImage() : DEFAULT_GENRE_IMAGE_URL;
             $tmpl->addVar('genre', 'photo_url', $photo_url);
             // link
             $link_url = "index.php?option=com_ccevents&scope=prgm&task=summary&filter=Genre&fid=" . $genre->getOid() . "&ccmenu=" . $_REQUEST['ccmenu'];
             $tmpl->addVar('genre', 'link_url', $this->cceventSefUrl($link_url));
             $tmpl->parseTemplate('genre', "a");
         }
     }
     $tmpl->displayParsedTemplate('program_overview');
     // set the request for css ids and classes
     $_REQUEST['cce_scope'] = "whats_on";
     // css file name / body id
     $_REQUEST['cce_page'] = "whats_on_at_the_skirball";
     // body class
     $_REQUEST['cce_cols'] = "2";
     // canvas div id
     $_REQUEST['cce_subtype'] = "overview";
     // canvas div class
     $_REQUEST['ccmenu'] = isset($_REQUEST['ccmenu']) ? $_REQUEST['ccmenu'] : '';
     // menu
 }
Exemple #4
0
 /**
  * Displays the what's on overview (list of published genres)
  * @param bean $model The course summary model
  */
 public function overview($model)
 {
     global $logger, $mainframe;
     $logger->debug(get_class($this) . "::overview({$model})");
     $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR);
     $tmpl->readTemplatesFromInput('course_overview.pat.tpl');
     // page title
     $pg_title = "Learning For Life Overview";
     $mainframe->setPageTitle($pg_title);
     $tmpl->addVar('intro', 'title', $pg_title);
     if ($model->getAnnouncement() != null) {
         $tmpl->addVar('intro', 'announcement', $model->getAnnouncement());
     }
     $eventList = $model->getList();
     // TODO: sort by primary genre\
     $pgs = array();
     foreach ($eventList as $event) {
         $pgs[] = $event->getPrimaryGenre();
     }
     array_multisort($pgs, $eventList);
     // a temporary place to hold a comparison operator for group headings
     $prev_category_name = "";
     $first = true;
     foreach ($eventList as $event) {
         // check group order for series and audience groupings
         $tmpl->setAttribute('group', 'visibility', 'hidden');
         $sort_name = $event->getPrimaryGenre()->getName();
         if ($sort_name != $prev_category_name) {
             $tmpl->addVar('group', 'group_heading', $sort_name);
             $tmpl->setAttribute('group', 'visibility', 'visible');
             $prev_category_name = $sort_name;
             $first = true;
         }
         // simple attributes
         $tmpl->addVars('course', BeanUtil::beanToArray($event, true));
         // scalars only
         $first_class = $first ? ' first' : '';
         $tmpl->addVar('course', 'first_class', $first_class);
         $first = false;
         // detail link
         $dlink = $this->cceventSefUrl("index.php?option=com_ccevents&scope=crse&task=summary&filter=Genre&fid=" . $event->getPrimaryGenre()->getOid(), $event->getOid());
         $tmpl->addVar('course', 'detail_link', $dlink);
         // venue
         $venues = $event->getVenues();
         $dv = isset($venues[0]) ? $venues[0] : null;
         if ($dv != null) {
             $dv_link = $this->getVenueTitleLink($dv);
             // in the MasterPage
             $tmpl->addVar('course', 'venue', $dv_link);
         }
         // date description (Use scheduleNote or next activity time
         $date_desc = '';
         if ($event->getScheduleNote() != null) {
             $date_desc = $event->getScheduleNote();
         } else {
             $next = $this->getNextActivity($event->getChildren());
             if ($next != null && $next->getSchedule() != null) {
                 $date_desc = $this->formatDate($next->getSchedule()->getStartTime());
                 // in the master page class
             }
         }
         $tmpl->addVar('course', 'date_desc', $date_desc);
         // sessions
         if ($event->getChildren() != null) {
             $sessions = count($event->getChildren());
             $ss = ' session';
             if ($sessions > 1) {
                 $ss = ' sessions';
             }
             $tmpl->addVar('course', 'sessions', $sessions . $ss);
         }
         $tmpl->parseTemplate('course', "a");
     }
     $tmpl->displayParsedTemplate('course_overview');
     // set the request for css ids and classes
     $_REQUEST['cce_cols'] = "2";
     // canvas div id
     $_REQUEST['cce_subtype'] = "general";
     // canvas div class
     $_REQUEST['ccmenu'] = isset($_REQUEST['ccmenu']) ? $_REQUEST['ccmenu'] : '';
     // menu
 }
Exemple #5
0
 /**
  * The default render method.  Displays the summary list
  * @param bean $model The exhibition summary model
  */
 public function render($model)
 {
     global $logger, $mainframe;
     $logger->debug(get_class($this) . '::render()');
     $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR);
     $tmpl->readTemplatesFromInput('homepage_events.pat.tpl');
     $title = HOMEPAGE_TITLE;
     $mainframe->setPageTitle($title);
     $tmpl->addVar('intro', 'title', $title);
     if ($model->getAnnouncement() != null) {
         $tmpl->addVar('intro', 'announcement', $model->getAnnouncement());
     }
     $hp = $model->getDetail();
     // cycle through the 9 slots
     for ($i = 1; $i < 10; $i++) {
         $getter = "getEvent" . $i;
         $event = $hp->{$getter}();
         // if there is a published event in the slot, render it
         $time_display = null;
         $genre = null;
         $ticket = null;
         if ($event != null && $event->getPubState() == PublicationState::PUBLISHED) {
             // load the image
             $gallery = $event->getGallery();
             $images = $gallery->getImages();
             $image = $images[0];
             $img_src = "";
             $img_alt = $event->getTitle();
             if ($image != null) {
                 $img_src = $image->getUrl();
                 $img_alt = $image->getTitle() != null ? $images[0]->getTitle() : $event->getTitle();
             }
             // set the differences between event types
             if (get_class($event) == Event::EXHIBITION) {
                 // set the genre
                 $genre = Event::EXHIBITION;
                 // figure the proper link url
                 $elink = $this->cceventSefUrl("index.php?option=com_ccevents&scope=exbt&task=detail&ccmenu=v2hhdcdzie9u&oid=" . $event->getOid());
                 // get the time
                 if ($event->getScheduleNote()) {
                     $time_display = $event->getScheduleNote();
                 } else {
                     $schedule = $event->getSchedule();
                     if ($schedule != null) {
                         $time_display = $this->formatDate($schedule->getStartTime());
                         if ($schedule->getEndTime() > 0) {
                             $time_display .= $this->formatDate($schedule->getEndTime());
                         }
                     }
                 }
                 // get the status/tickets image
                 $ticket = $this->getStatusImage($event->getEventStatus(), $event->getTicketUrl());
             } else {
                 // genre
                 if ($event->getPrimaryGenre() != null) {
                     $genre = $event->getPrimaryGenre()->getName();
                 }
                 // figure the proper link url
                 if (get_class($event) == Event::PROGRAM) {
                     $elink = $this->cceventSefUrl("index.php?option=com_ccevents&scope=prgm&task=detail&ccmenu=v2hhdcdzie9u&oid=" . $event->getOid());
                 } else {
                     if (get_class($event) == Event::COURSE) {
                         $elink = $this->cceventSefUrl("index.php?option=com_ccevents&scope=crse&task=summary&filter=Genre&fid=" . $event->getPrimaryGenre()->getOid(), $event->getOid());
                     }
                 }
                 // actvity level items
                 if ($event->getScheduleNote()) {
                     $time_display = $event->getScheduleNote();
                 } else {
                     $acts = $event->getChildren();
                     $next_act = $this->getNextActivity($acts);
                     if ($next_act != null) {
                         $schedule = $next_act->getSchedule();
                         if ($schedule != null) {
                             $time_display = $this->formatDate($schedule->getStartTime());
                         }
                         if ($next_act->getActivityStatus() != null) {
                             // get the ticket code
                             $tc = null;
                             if ($next_act->getTicketCode() != null) {
                                 $tc = $next_act->getTicketCode();
                             } else {
                                 $tc = $event->getTicketUrl();
                             }
                             $ticket = $this->getStatusImage($next_act->getActivityStatus()->getValue(), $next_act->getTicketCode());
                         }
                     }
                 }
             }
             // load the template
             $tmpl->addVar('event', 'title', $event->getTitle());
             $tmpl->addVar('event', 'img_src', $img_src);
             $tmpl->addVar('event', 'img_alt', $img_alt);
             $tmpl->addVar('event', 'genre', $genre);
             $tmpl->addVar('event', 'event_link', $this->cceventSefUrl($elink));
             $tmpl->addVar('event', 'time', $time_display);
             $tmpl->addVar('event', 'status_img', $ticket);
             $tmpl->parseTemplate('event', "a");
         }
     }
     $tmpl->displayParsedTemplate('homepage');
     // set the request for css ids and classes
     $_REQUEST['cce_scope'] = "home";
     // css file name / body id
     $_REQUEST['cce_page'] = "welcome";
     // body class
     $_REQUEST['cce_cols'] = "3";
     // canvas div id
     $_REQUEST['cce_subtype'] = "home";
     // canvas div class
 }