/** * A temporary method of generating test data. Will be * refactored out once all services have been implemented. * @param bean the EventSUmmaryPage bean * @return bean the EventSUmmaryPage bean w/ stubbed data */ private function loadDemoSummaryData($model) { global $logger; $logger->debug(get_class($this) . '::loadTestSummaryData()'); // Test Venues require_once WEB_INF . '/beans/Venue.php'; $v1 = new Venue(); $v1->setName('Hurd Gallery'); $v1->setOid(48); $v2 = new Venue(); $v2->setName('Taube Courtyard'); $v2->setOid(24); $v3 = new venue(); $v3->setName('Main Lobby'); $v3->setOid(17); $venues = array($v1, $v2, $v3); // Test Audience require_once WEB_INF . '/beans/Audience.php'; $a1 = new Audience(); $a1->setName('All Age Groups'); $a2 = new Audience(); $a2->setName('Adults'); $a3 = new Audience(); $a3->setName('Toddlers'); $audiences = array($a1, $a2, $a3); $list = $model->getList(); foreach ($list as $event) { $event->setFamily($this->randomizeTestBoolean()); $event->setAudience($this->randomizeTestArray($audiences, 1, 1)); } $model->setEvents($list); // Page Announcement $msg = "<strong>This is some introductory text about this section of " . "the web site if needed.</strong> Otherwise this would not be " . "here and everything below would move up so that there isn't a " . "big blank space."; $model->setAnnouncement($msg); return $model; }
/** * Populates the Venue object from the request * @return bean Venue */ private function getBeanFromRequest() { $venue = new Venue(); $addr = new Address(); $addr->setOid($_REQUEST['aoid']); $addr->setStreet($_REQUEST['street']); $addr->setUnit($_REQUEST['unit']); $addr->setCity($_REQUEST['city']); $addr->setState($_REQUEST['state']); $addr->setPostalCode($_REQUEST['postalCode']); $addr->setPhone($_REQUEST['phone']); $venue->setOid($_REQUEST['oid']); $venue->setName($_REQUEST['name']); $venue->setDescription($_REQUEST['description']); $venue->setPubState($_REQUEST['pubState']); $venue->setAddress($addr); if (isset($_REQUEST['gallery'])) { $venue->setGallery($_REQUEST['gallery']); } $links = array(); //$links['exhibition'] = $_REQUEST['exhibition']; //$links['program'] = isset($_REQUEST['program']) ? $_REQUEST['program'] : null; //$links['course'] = isset($_REQUEST['course']) ? $_REQUEST['course'] : null; $venue->setEvents($links); return $venue; }
/** * 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; }
/** * Instantiates an Exhibition bean object and copies all * valid incoming form elements to the bean object * @return The valid Exhibition bean */ protected function getBeanFromRequest() { global $logger; $logger->debug(get_class($this) . "::getBeanFromRequest()"); $service = $this->getEventService(); // TODO: Add validator here $exhibit = new Exhibition($_REQUEST); $logger->debug("exhibition object: {$exhibit}"); if (isset($_REQUEST['displayOrder']) && intval($_REQUEST['displayOrder']) > 0) { $exhibit->setDisplayOrder($_REQUEST['displayOrder']); } // Format the times $logger->debug("Start Time: " . $_REQUEST['startMonth'] . "," . $_REQUEST['startDay'] . "," . $_REQUEST['startYear']); $startTime = mktime(0, 0, 0, $_REQUEST['startMonth'], $_REQUEST['startDay'], $_REQUEST['startYear']); $logger->debug("Start Time (mktime)" . $startTime); // find out if this is a recurring event $endTime = mktime(0, 0, 0, $_REQUEST['endMonth'], $_REQUEST['endDay'], $_REQUEST['endYear']); if ($_REQUEST['close_type'] == 'ongoing') { $endTime = 0; } // load the schedule $schedule = new Schedule(); if (isset($_REQUEST['scheduleOid'])) { $schedule->setOid(intval($_REQUEST['scheduleOid'])); } $schedule->setStartTime($startTime); $schedule->setEndTime($endTime); $exhibit->setSchedule($schedule); // venues if (isset($_REQUEST['venue'])) { $venues = array(); foreach ($_REQUEST['venue'] as $oid) { $venue = new Venue(); $venue->setOid($oid); $venues[] = $venue; } $logger->debug("Number of venues in the form: " . count($venues)); $exhibit->setVenues($venues); } // 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($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['audience']) || isset($cats['genre'])) { $exhibit->setCategories($cats); } // related events $events = array(); if (isset($_REQUEST['program'])) { foreach ($_REQUEST['program'] as $oid) { $program = new Program(); $program->setOid($oid); $events[] = $program; } } if (isset($events)) { $logger->debug("Number of related programs in the form: " . count($events)); $exhibit->setPrograms($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)); $exhibit->setCourses($events); } // gallery if (isset($_REQUEST['gallery'])) { $exhibit->setGallery($_REQUEST['gallery']); } // artists if (isset($_REQUEST['person'])) { $persons = array(); foreach ($_REQUEST['person'] as $oid) { $person = new Artist(); $person->setOid($oid); $persons[] = $person; } $logger->debug("Number of persons in the form: " . count($persons)); $exhibit->setArtists($persons); } // artifacts if (isset($_REQUEST['artifact'])) { $artifacts = array(); foreach ($_REQUEST['artifact'] as $id) { $artifacts[] = $id; } $artlist = implode(",", $artifacts); $logger->debug("Number of persons in the form: " . count($artifacts)); $exhibit->setArtifacts($artlist); } return $exhibit; }