示例#1
0
 /**
  * Populates the Venue object from the request
  * @return bean Venue
  */
 protected function getBeanFromRequest()
 {
     global $logger;
     $prgm = new Program($_REQUEST);
     $genre = new Genre();
     $genre->setOid($_REQUEST['primaryGenre']);
     $prgm->setPrimaryGenre($genre);
     if (isset($_REQUEST['defaultVenue'])) {
         $venue = new Venue();
         $venue->setOid($_REQUEST['defaultVenue']);
         $prgm->setDefaultVenue($venue);
         $prgm->setVenues(array($venue));
     }
     // categories
     $cats = array();
     if (isset($_REQUEST['audience'])) {
         foreach ($_REQUEST['audience'] as $oid) {
             $category = new Audience();
             $category->setOid($oid);
             $cats['audience'][] = $category;
         }
     }
     if (isset($_REQUEST['genre'])) {
         foreach ($_REQUEST['genre'] as $oid) {
             $category = new Genre();
             $category->setOid($oid);
             $cats['genre'][] = $category;
         }
     }
     if (isset($_REQUEST['series'])) {
         foreach ($_REQUEST['series'] as $oid) {
             $category = new Series();
             $category->setOid($oid);
             $cats['series'][] = $category;
         }
     }
     if (isset($cats['audience'])) {
         $logger->debug("Number of audience categories in the form: " . count($cats['audience']));
     }
     if (isset($cats['genre'])) {
         $logger->debug("Number of genre categories in the form: " . count($cats['genre']));
     }
     if (isset($cats['series'])) {
         $logger->debug("Number of series categories in the form: " . count($cats['series']));
     }
     if (isset($cats['audience']) || isset($cats['genre']) || isset($cats['series'])) {
         $prgm->setCategories($cats);
     }
     // related events
     $events = array();
     if (isset($_REQUEST['exhibition'])) {
         foreach ($_REQUEST['exhibition'] as $oid) {
             $exhibition = new Exhibition();
             $exhibition->setOid($oid);
             $events[] = $exhibition;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related exhibitions in the form: " . count($events));
         $prgm->setExhibitions($events);
     }
     $events = array();
     if (isset($_REQUEST['course'])) {
         foreach ($_REQUEST['course'] as $oid) {
             $course = new Course();
             $course->setOid($oid);
             $events[] = $course;
         }
     }
     if (isset($events)) {
         $logger->debug("Number of related courses in the form: " . count($events));
         $prgm->setCourses($events);
     }
     $activities = array();
     if (isset($_REQUEST['activityChanged']) && $_REQUEST['activityChanged']) {
         // parse delimited attributes as pipe-delimited '|' string
         $startTimes = explode('|', $_REQUEST['activityStartTime']);
         $endTimes = explode('|', $_REQUEST['activityEndTime']);
         $venues = explode('|', $_REQUEST['activityVenueList']);
         $status = explode('|', $_REQUEST['activityStatusList']);
         $tickets = explode('|', $_REQUEST['activityTicketList']);
         for ($index = 0; $index < count($venues); $index++) {
             $schedule = new Schedule();
             $stint = strtotime($startTimes[$index]);
             $etint = strtotime($endTimes[$index]);
             $schedule->setStartTime($stint);
             $schedule->setEndTime($etint);
             $venue = new Venue();
             $venue->setOid($venues[$index]);
             $activity = new Performance();
             $activity->setSchedule($schedule);
             $activity->setVenue($venue);
             $activity->setActivityStatus($status[$index]);
             $activity->setTicketCode($tickets[$index]);
             $activities[] = $activity;
         }
     }
     if (isset($activities)) {
         $logger->debug("Number of related performances in the form: " . count($activities));
         $prgm->setChildren($activities);
     }
     return $prgm;
 }
示例#2
0
 /** 
  * Returns a list of performances for the given Program
  * @param int id
  * @return array Performances
  */
 function getPerformances($eventId)
 {
     global $logger;
     $logger->debug(get_class($this) . "::getPerformances({$eventId})");
     $result = array();
     // this could be refactored as a subselect
     $db = $this->getDbo();
     $query = 'SELECT distinct a.eoid as oid, a.scope, a.ticketCode' . ' FROM Activity as a, _ez_relation_ as r, Program as e' . ' WHERE r.oid_b = a.eoid and r.class_a="Program" and r.class_b="Performance"' . '    AND r.oid_a=' . $eventId;
     $db->setQuery($query);
     $perfs = $db->loadAssocList();
     // now get the schedules
     foreach ($perfs as $perf) {
         $performance = new Performance($perf);
         $query = 'SELECT DISTINCT s.eoid as oid, s.startTime, s.endTime ' . ' FROM Schedule as s ' . ' WHERE s.eoid IN ' . '    (select r.oid_b ' . '     from _ez_relation_ as r' . '     where r.class_a="Performance" and r.class_b="Schedule"' . '         AND r.oid_a=' . $performance->getOid() . ')';
         $db->setQuery($query);
         $schedule = new Schedule($db->loadAssoc());
         $performance->setSchedule($schedule);
         $result[] = $performance;
     }
     return $result;
 }
示例#3
0
 /**
  * Converts the given exhibition PDO to a bean object.
  * This includes the conversion from nested lists
  * of PDO objects to usable lists of oids/names to be used
  * by the page renderer.
  *
  * @access private
  * @param pdo $pdo Program
  * @return bean Program
  */
 private function exhibitionPdoToBean($pdo)
 {
     global $logger;
     $logger->debug(get_class($this) . "::exhibitionPdoToBean({$pdo})");
     $bean = new Exhibition($pdo->epGetVars());
     // pubState to a string
     $ps = '';
     if ($pdo->getPubState() != null) {
         $ps = $pdo->getPubState()->getValue();
     }
     $bean->setPubState($ps);
     // eventStatus to a string
     $es = '';
     if ($pdo->getEventStatus() != null) {
         $es = $pdo->getEventStatus()->getValue();
     }
     $bean->setEventStatus($es);
     // schedule
     $schedule = $pdo->getSchedule();
     if ($schedule) {
         $bean->setSchedule(new Schedule($schedule->epGetVars()));
     } else {
         $bean->setSchedule(new Schedule());
     }
     // venues from array of pdos to array of venue bean
     $vens = array();
     if ($pdo->getVenues() != null) {
         foreach ($pdo->getVenues() as $ven) {
             $vens[] = new Venue($ven->epGetVars());
         }
     }
     $bean->setVenues($vens);
     // categories from array of pdos to keyed array of oids
     $cats = array();
     if ($pdo->getCategories() != null) {
         foreach ($pdo->getCategories() as $cat) {
             $scope = $cat->getScope();
             $cats[$scope][] = new $scope($cat->epGetVars());
         }
     }
     $bean->setCategories($cats);
     // related programs from array of pdos to keyed array of oids
     $programs = $pdo->getPrograms();
     if ($programs != null) {
         $related = array();
         foreach ($programs as $event) {
             $rp = new Program($event->epGetVars());
             $ps = $event->getPubState()->getValue();
             $rp->setPubState($ps);
             // primary genre
             if ($event->getPrimaryGenre()) {
                 $pg = $event->getPrimaryGenre();
                 $prpg = new Category(array("oid" => $pg->getOid(), "name" => $pg->getName()));
                 $rp->setPrimaryGenre($prpg);
             }
             $acts = array();
             foreach ($event->getChildren() as $perf) {
                 $sch = new Performance($perf->epGetVars());
                 $sch->setSchedule(new Schedule($perf->schedule->epGetVars()));
                 $acts[] = $sch;
             }
             usort($acts, array(&$this, "orderPerformances"));
             $rp->setChildren($acts);
             // Using "Nextevent" so we can use orderProgramsByNextevent; really is firstEvent
             $rp->setNextevent($acts[0]->schedule->getStartTime());
             $related[] = $rp;
         }
         usort($related, array(&$this, "orderProgramsByNextevent"));
         $bean->setPrograms($related);
     }
     // related courses from array of pdos to keyed array of oids
     $courses = $pdo->getCourses();
     if ($courses != null) {
         $related = array();
         foreach ($courses as $event) {
             $related[] = new Course($event->epGetVars());
         }
         $bean->setCourses($related);
     }
     // related artists
     $artists = $pdo->getArtists();
     if ($artists != null) {
         $related = array();
         foreach ($artists as $person) {
             $related[] = new Artist($person->epGetVars());
         }
         $bean->setArtists($related);
     }
     return $bean;
 }
示例#4
0
 /**
  * A sample detail bean for use in rendering the template.
  * If a course is supplied, it will copy thevalues of the
  * given bean over the top of the demo bean.
  * @return
  */
 private function getDemoCourseDetail($crse)
 {
     require_once WEB_INF . '/beans/Performance.php';
     require_once WEB_INF . '/beans/Schedule.php';
     require_once WEB_INF . '/beans/Venue.php';
     global $logger;
     $logger->debug(get_class($this) . "::getDemoCourseDetail({$crse})");
     $bean = new Course();
     $bean->setTitle("Demo Course Detail Bean");
     $desc = "<p>This is a description of the course. Malian Grammy Award nominee Mamadou Diabate is a virtuoso kora player descended from a long line of Manding musician-storytellers. Dolor dignissim exerci feugiat. Lobortis ut, luptatum facilisis. Augue volutpat facilisis at, eum consequat adipiscing accumsan blandit molestie. </p>\n\t\t\t\t <p>Lobortis eros at hendrerit luptatum consequat feugiat ut facilisi commodo esse autem consequat at ex ullamcorper hendrerit wisi, commodo nostrud nisl wisi eum autem eu esse eu iriure. Tation, magna ad nibh at eum, ea praesent eum lorem eu erat enim commodo dolore?</p>\n \t\t\t\t <p>Crisare enim sed ex eros hendrerit blandit illum qui sciurus autem nulla enim luptatum. Quis enim eum feugait elit blandit, hendrerit consequat, velit ut luptatum nostrud wisi ea. Dignissim consequat dolore aliquam eum volutpat, wisi dolore et exerci nisl veniam luptatum ut ullamcorper consequatvel nulla delenit.</p>\n\t\t\t\t";
     $bean->setDescription($desc);
     $bean->setPrimaryGenre("Music");
     // Performances
     $perf = new Performance();
     $schd = new Schedule();
     $schd->setStartTime(time());
     $perf->setSchedule($schd);
     $logger->debug("Performance time: " . $perf->getSchedule()->getStartTime());
     $perf->setTicketCode("21");
     $bean->setChildren(array($perf));
     $logger->debug("Number of set performaces: " . count($bean->getChildren()));
     // Venues
     $v1 = new Venue();
     $v1->setName('Hurd Gallery');
     $bean->setDefaultVenue($v1);
     if (get_class($crse) == 'Course') {
         $crse->setPerformances(null);
         $option = new CopyBeanOption();
         $option->setIgnoreNullValues(true);
         BeanUtil::copyBean($crse, $bean, $option);
     }
     return $bean;
 }