/** * Renders the program detail template * * @param bean $model a DetailPageModel bean * @return void */ private function renderDetailPageModel($model) { global $logger; $logger->debug(get_class($this) . "::renderDetailPageModel({$model})"); $cat = $model->getDetail(); $options = $model->getOptions(); $tmpl = $this->createPatTemplate(); $tmpl->readTemplatesFromInput('audience_detail.pat.tpl'); // Render the primary form fields $tmpl->addVars('audience_detail', BeanUtil::beanToArray($cat, true)); // scalars only // Render the editor field $dconf = $this->getEditorConfig(Editor::MEDIUM, 'description', $cat->getDescription()); $tmpl->addVar('audience_detail', 'desc_editor', $this->setEditor($dconf)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $cat->getPubState()); if ($ps->value == $cat->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } $tmpl->displayParsedTemplate('audience_detail'); // Render the tabs // TODO: Consider this later /* $tabs = new mosTabs(0); //1 = use cookies to remember selected tab $tabs->startPane("links"); if( $cat->getOid() == null ) { $tabs->startTab("Notice","new-links"); echo "<br/><br/>To assign a Programs, first save this new Series.<br/><br/>"; $tabs->endTab(); } else { $tmpl->addVar('program_select','scope','Series'); $tabs->startTab("Programs","prgm-links"); foreach ($options['program'] as $prgm) { $tmpl->addVar('program_select','oid',$prgm->getOid()); $tmpl->addVar('program_select','title',$prgm->getTitle()); if ( isset($venues) && $this->bean_in_array($ven,$venues) ) { $tmpl->addVar('venue_options','selected','selected'); } else { $tmpl->addVar('venue_options','selected',''); } $tmpl->parseTemplate('venue_options','a'); } $tmpl->displayParsedTemplate('vnueTab'); $tabs->endTab(); $tmpl->displayParsedTemplate( 'prgmTab' ); */ // Close the form $tmpl->displayParsedTemplate('close_form'); }
public function execute($actionParams) { $action = $this->expression; list($beanClass, $methodName) = BeanUtil::getBeanAndProperties($action); $beanInstance = BeanLocator::get($beanClass); return ReflectionUtil::callMethod($beanInstance, $methodName, $actionParams); }
/** * Updates the given Anncoument PDO from the bean * * @param */ public function update($bean) { global $logger; $logger->debug(get_class($this) . "::update({$bean})"); $logger->debug("Announcment scope, " . $bean->getScope() . " has oid: " . $bean->getOid()); $epm = epManager::instance(); $pdo = $epm->get('Announcement', $bean->getOid()); $pdo = BeanUtil::CopyBean($bean, $pdo); if (!$epm->commit($pdo)) { trigger_error("Unable to commit " . $bean->getScope() . " announcement.", E_USER_ERROR); } }
private function updateModel(MovicoRequest $req) { $vars = $req->getPostVars(); foreach ($vars as $var) { list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($var->getName(), true); ReflectionUtil::callNestedSetter(BeanLocator::get($beanClass), $nestedProperty, $var->getConvertedValue()); } $files = $req->getFiles(); foreach ($files as $key => $fileArray) { $file = new UploadedFile($fileArray); list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($key, true); ReflectionUtil::callNestedSetter(BeanLocator::get($beanClass), $nestedProperty, $file); } }
public function doRender($row = null) { $name = $this->value; if (!is_null($row)) { $dtComp = $this->getFirstAncestorOfType("DataSeries"); $dtVar = $dtComp->getVar(); $dtValue = BeanUtil::getBeanString($dtComp->getValue()) . "({$row})"; $name = str_replace($dtVar, $dtValue, $this->value); } $val = $this->getConvertedValue($this->value, $row); $type = $this->getType(); $focus = $this->autoFocus === "true" ? " autoFocus=\"true\"" : ""; return "<input class=\"" . $this->class . "\" id=\"" . $this->id . "\" maxlength=\"" . $this->maxLength . "\" type=\"{$type}\" name=\"{$name}\" value=\"{$val}\"{$focus}/>"; }
/** * Displays the venue detail * @param bean $model The program detail model */ public function detail($model) { global $logger, $mainframe; $logger->debug(get_class($this) . "::detail({$model})"); $venue = $model->getDetail(); $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR); $tmpl->readTemplatesFromInput('venue_detail.pat.tpl'); // simple attributes $tmpl->addVars('venue', BeanUtil::beanToArray($venue, true)); // scalars only // page title $mainframe->setPageTitle("Facilities Tour | " . $venue->getName()); // Gallery if ($venue->getGallery() != null) { $gal = $venue->getGallery(); $logger->debug("Type of gallery [Gallery]: " . get_class($gal)); $images = $gal->getImages(); $tmpl->addVar('photo', 'gallery', true); foreach ($images as $img) { $logger->debug('Class of img [Image]: ' . get_class($img) . $img); $tmpl->addVar('photo', 'url', $img->getUrl()); $tmpl->addVar('photo', 'author', $img->getAuthor()); $tmpl->addVar('photo', 'title', $img->getTitle()); $tmpl->parseTemplate('photo', "a"); } } // address if ($venue->getAddress() != null && $venue->getAddress()->getStreet() != "") { $logger->debug("Type of address [Address]: " . gettype($venue->getAddress())); $addr = $venue->getAddress(); $astr = ""; if ($addr->getPhone() != null) { $astr .= "<strong>" . $addr->getPhone() . "</strong><br/>"; } $astr .= $addr->getStreet() . "<br/>"; if ($addr->getUnit() != null) { $astr .= $addr->getUnit() . "<br/>"; } if ($addr->getCity() != null) { $astr .= $addr->getCity() . ", "; } $astr .= $addr->getState() . " " . $addr->getPostalCode(); $tmpl->addVar('venue', 'address', $astr); } $tmpl->displayParsedTemplate('venue'); }
/** * Renders the detail page for the given home_page * @param bean DetailPageModel */ private function renderDetail($model) { global $logger; $logger->debug(get_class($this) . '::detail()'); $home_page = $model->getDetail(); $options = $model->getOptions(); $tmpl = $this->createPatTemplate(); $tmpl->readTemplatesFromInput('home_page_detail.pat.tpl'); $tmpl->addGlobalVar('scope', 'HomePage'); // Render the primary form fields $tmpl->addVars('home_page_form', BeanUtil::beanToArray($home_page, true)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $home_page->getPubState()); if ($ps->value == $home_page->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } // Date Selects $logger->debug("Size of months in page: " . count($options['month'])); $startTime = $home_page->getStartTime() > 0 ? $home_page->getStartTime() : time(); foreach ($options['month'] as $key => $value) { $tmpl->addVar('start_month_options', 'value', $key); $tmpl->addVar('start_month_options', 'text', $value); if ($key == date("n", $startTime)) { $tmpl->addVar('start_month_options', 'selected', 'selected'); } else { $tmpl->addVar('start_month_options', 'selected', ''); } $tmpl->parseTemplate('start_month_options', 'a'); } foreach ($options['day'] as $value) { $tmpl->addVar('start_day_options', 'value', $value); if (intval($value) == date("j", $startTime)) { $tmpl->addVar('start_day_options', 'selected', 'selected'); } else { $tmpl->addVar('start_day_options', 'selected', ''); } $tmpl->parseTemplate('start_day_options', 'a'); } foreach ($options['year'] as $value) { $tmpl->addVar('start_year_options', 'value', $value); if (intval($value) == date("Y", $startTime)) { $tmpl->addVar('start_year_options', 'selected', 'selected'); } else { $tmpl->addVar('start_year_options', 'selected', ''); } $tmpl->parseTemplate('start_year_options', 'a'); } $tmpl->displayParsedTemplate('home_page_form'); // Render the Tabs $tabs = new mosTabs(1); //1 = use cookies to remember selected tab $tabs->startPane("links"); if ($home_page->getOid() == null) { $tabs->startTab("Notice", "new-links"); echo "<br/><br/>To assign events, first save this new home page.<br/><br/>"; $tabs->endTab(); } else { $tabs->startTab("Exhibitions", "home_page_exhibitions"); for ($index = 1; $index <= 3; $index++) { $getter = 'getEvent' . $index; $eventIndex = $this->getPromoObject($home_page->{$getter}()); foreach ($options['exhibition'] as $event) { $tmpl->addVar('published_exhibition_options', 'type', $event->getScope()); $tmpl->addVar('published_exhibition_options', 'oid', $event->getOid()); $tmpl->addVar('published_exhibition_options', 'title', $event->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Exhibition' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_exhibition_options', 'selected', 'selected'); } else { $tmpl->addVar('published_exhibition_options', 'selected', ''); } $tmpl->parseTemplate('published_exhibition_options', 'a'); } $tmpl->addVar('published_exhibitions', 'index', $index); $tmpl->parseTemplate('published_exhibitions', 'a'); $tmpl->clearTemplate('published_exhibition_options'); } $tmpl->displayParsedTemplate('exhibitions'); $tabs->endTab(); $tabs->startTab("Programs", "home_page_programs"); for ($index = 4; $index <= 9; $index++) { $getter = 'getEvent' . $index; $eventIndex = $this->getPromoObject($home_page->{$getter}()); foreach ($options['program'] as $event) { $tmpl->addVar('published_program_options', 'type', $event->getScope()); $tmpl->addVar('published_program_options', 'oid', $event->getOid()); $tmpl->addVar('published_program_options', 'title', $event->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Program' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_program_options', 'selected', 'selected'); } else { $tmpl->addVar('published_program_options', 'selected', ''); } $tmpl->parseTemplate('published_program_options', 'a'); } foreach ($options['genre'] as $cat) { $tmpl->addVar('published_genre_options', 'type', $cat->getScope()); $tmpl->addVar('published_genre_options', 'oid', $cat->getOid()); $tmpl->addVar('published_genre_options', 'title', $cat->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Genre' && $cat->getOid() == $eventIndex->id) { $tmpl->addVar('published_genre_options', 'selected', 'selected'); } else { $tmpl->addVar('published_genre_options', 'selected', ''); } $tmpl->parseTemplate('published_genre_options', 'a'); } foreach ($options['audience'] as $cat) { $tmpl->addVar('published_audience_options', 'type', $cat->getScope()); $tmpl->addVar('published_audience_options', 'oid', $cat->getOid()); $tmpl->addVar('published_audience_options', 'title', $cat->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Audience' && $cat->getOid() == $eventIndex->id) { $tmpl->addVar('published_audience_options', 'selected', 'selected'); } else { $tmpl->addVar('published_audience_options', 'selected', ''); } $tmpl->parseTemplate('published_audience_options', 'a'); } foreach ($options['series'] as $cat) { $tmpl->addVar('published_series_options', 'type', $cat->getScope()); $tmpl->addVar('published_series_options', 'oid', $cat->getOid()); $tmpl->addVar('published_series_options', 'title', $cat->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Genre' && $cat->getOid() == $eventIndex->id) { $tmpl->addVar('published_series_options', 'selected', 'selected'); } else { $tmpl->addVar('published_series_options', 'selected', ''); } $tmpl->parseTemplate('published_series_options', 'a'); } /* foreach ($options['course'] as $event) { $tmpl->addVar('published_course_options','type',$event->getScope()); $tmpl->addVar('published_course_options','oid',$event->getOid()); $tmpl->addVar('published_course_options','title',$event->getTitle()); if ( !empty($eventIndex) && $eventIndex->scope == 'Course' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_course_options','selected','selected'); } else { $tmpl->addVar('published_course_options','selected',''); } $tmpl->parseTemplate('published_course_options','a'); } */ $count = $index - 3; $tmpl->addVar('published_events', 'index', $index); $tmpl->addVar('published_events', 'count', $count); $tmpl->parseTemplate('published_events', 'a'); $tmpl->clearTemplate('published_program_options'); $tmpl->clearTemplate('published_genre_options'); $tmpl->clearTemplate('published_audience_options'); $tmpl->clearTemplate('published_series_options'); // $tmpl->clearTemplate('published_course_options'); } $tmpl->displayParsedTemplate('programs'); $tabs->endTab(); $tabs->startTab("Calendar", "calendar_promo"); for ($index = 10; $index <= 13; $index++) { $getter = 'getEvent' . $index; $eventIndex = $this->getPromoObject($home_page->{$getter}()); foreach ($options['exhibition'] as $event) { $tmpl->addVar('published_cal_exhibition_options', 'type', $event->getScope()); $tmpl->addVar('published_cal_exhibition_options', 'oid', $event->getOid()); $tmpl->addVar('published_cal_exhibition_options', 'title', $event->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Exhibition' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_cal_exhibition_options', 'selected', 'selected'); } else { $tmpl->addVar('published_cal_exhibition_options', 'selected', ''); } $tmpl->parseTemplate('published_cal_exhibition_options', 'a'); } foreach ($options['program'] as $event) { $tmpl->addVar('published_cal_program_options', 'type', $event->getScope()); $tmpl->addVar('published_cal_program_options', 'oid', $event->getOid()); $tmpl->addVar('published_cal_program_options', 'title', $event->getTitle()); if (!empty($eventIndex) && $eventIndex->scope == 'Program' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_cal_program_options', 'selected', 'selected'); } else { $tmpl->addVar('published_cal_program_options', 'selected', ''); } $tmpl->parseTemplate('published_cal_program_options', 'a'); } /* foreach ($options['course'] as $event) { $tmpl->addVar('published_course_options','type',$event->getScope()); $tmpl->addVar('published_course_options','oid',$event->getOid()); $tmpl->addVar('published_course_options','title',$event->getTitle()); if ( !empty($eventIndex) && $eventIndex->scope == 'Course' && $event->getOid() == $eventIndex->id) { $tmpl->addVar('published_course_options','selected','selected'); } else { $tmpl->addVar('published_course_options','selected',''); } $tmpl->parseTemplate('published_course_options','a'); } */ $count = $index - 9; $tmpl->addVar('published_calendar', 'index', $index); $tmpl->addVar('published_calendar', 'count', $count); $tmpl->parseTemplate('published_calendar', 'a'); $tmpl->clearTemplate('published_cal_program_options'); $tmpl->clearTemplate('published_cal_exhibition_options'); // $tmpl->clearTemplate('published_cal_course_options'); } $tmpl->displayParsedTemplate('calendar'); $tabs->endTab(); } $tmpl->displayParsedTemplate('close_form'); }
/** * Renders the detail page for the given venue * @param bean DetailPageModel */ private function renderDetail($model) { global $logger; $logger->debug(get_class($this) . '::detail()'); $venue = $model->getDetail(); $events = $venue->getEvents(); $options = $model->getOptions(); $tmpl = $this->createPatTemplate(); $tmpl->readTemplatesFromInput('venue_detail.pat.tpl'); $tmpl->addGlobalVar('scope', 'Venue'); // Render the primary form fields $tmpl->addVars('venue_form', BeanUtil::beanToArray($venue, true)); // scalars only // Renders the editor field $dconf = $this->getEditorConfig(Editor::MEDIUM, 'description', $venue->getDescription()); $tmpl->addVar('venue_form', 'description_editor', $this->setEditor($dconf)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $venue->getPubState()); if ($ps->value == $venue->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } /// Address Elements $addr = $venue->getAddress(); $tmpl->addVar('address', 'oid', $addr->getOid()); $tmpl->addVar('address', 'street', $addr->getStreet()); $tmpl->addVar('address', 'unit', $addr->getUnit()); $tmpl->addVar('address', 'city', $addr->getCity()); $tmpl->addVar('address', 'state', $addr->getState()); $tmpl->addVar('address', 'postalCode', $addr->getPostalCode()); $tmpl->addVar('address', 'phone', $addr->getPhone()); // State Select $selectedState = DEFAULT_POSTAL_STATE_KEY; if ($venue->getAddress() != null && $venue->getAddress()->getState() != null) { $selectedState = $venue->getAddress()->getState(); } $logger->debug("Selected state: " . $selectedState); foreach (AddressUtil::getUsStates() as $key => $value) { $tmpl->addVar('state_options', 'code', $key); $tmpl->addVar('state_options', 'name', $value); if ($key == $selectedState) { $tmpl->addVar('state_options', 'selected', 'selected'); $logger->debug("Found matching state to select: " . $key); } else { $tmpl->addVar('state_options', 'selected', ''); } $tmpl->parseTemplate('state_options', 'a'); } $tmpl->displayParsedTemplate('venue_form'); // Render the Tabs $tabs = new mosTabs(1); //1 = use cookies to remember selected tab $tabs->startPane("links"); if ($venue->getOid() == null) { $tabs->startTab("Notice", "new-links"); echo "<br/><br/>To assign events, first save this new venue.<br/><br/>"; $tabs->endTab(); } else { $tabs->startTab("Exhibitions", "exbt-links"); foreach ($options['exhibition'] as $exbt) { $tmpl->addVar('exhibition_options', 'oid', $exbt->getOid()); $tmpl->addVar('exhibition_options', 'title', $exbt->getTitle()); if (isset($events) && $this->bean_in_array($exbt, $events)) { $tmpl->addVar('exhibition_options', 'selected', 'selected'); } else { $tmpl->addVar('exhibition_options', 'selected', ''); } $tmpl->parseTemplate('exhibition_options', 'a'); } $tmpl->displayParsedTemplate('exbtTab'); $tabs->endTab(); $tabs->startTab("Programs", "prgm-links"); foreach ($options['program'] as $prgm) { $tmpl->addVar('program_options', 'oid', $prgm->getOid()); $tmpl->addVar('program_options', 'title', $prgm->getTitle()); if (isset($events) && $this->bean_in_array($prgm, $events)) { $tmpl->addVar('program_options', 'selected', 'selected'); } else { $tmpl->addVar('program_options', 'selected', ''); } $tmpl->parseTemplate('program_options', 'a'); } $tmpl->displayParsedTemplate('prgmTab'); $tabs->endTab(); $tabs->startTab("Courses", "crse-links"); foreach ($options['course'] as $crse) { $tmpl->addVar('course_options', 'oid', $crse->getOid()); $tmpl->addVar('course_options', 'title', $crse->getTitle()); if (isset($events) && $this->bean_in_array($crse, $events)) { $tmpl->addVar('course_options', 'selected', 'selected'); } else { $tmpl->addVar('course_options', 'selected', ''); } $tmpl->parseTemplate('course_options', 'a'); } $tmpl->displayParsedTemplate('crseTab'); $tabs->endTab(); /* $tabs->startTab("Gallery","glry-links"); foreach ($options['gallery'] as $glry) { $tmpl->addVar('gallery_options','gid',$glry['id']); $tmpl->addVar('gallery_options','name',$glry['name']); if ( $glry['id'] == $venue->getGallery() ) { $tmpl->addVar('gallery_options','selected','selected'); } else { $tmpl->addVar('gallery_options','selected',''); } $tmpl->parseTemplate('gallery_options','a'); } $tmpl->displayParsedTemplate('glryTab'); $tabs->endTab(); */ } $tmpl->displayParsedTemplate('close_form'); }
/** * Renders the detail of a given exhibition * @param bean $model The exhibition detail model */ function detail($model) { global $logger, $mainframe; $logger->debug(get_class($this) . "::detail({$model})"); $event = $model->getDetail(); $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR); $tmpl->readTemplatesFromInput('exhibition_detail.pat.tpl'); $mainframe->setPageTitle("Exhibition | " . $event->getTitle()); $tmpl->addVars('exbt_detail', BeanUtil::beanToArray($event, true)); // scalars only // 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('exbt_detail', 'time_display', $time_display); // Event Status & Tickets $tmpl->addVar('exbt_detail', 'status', $event->getEventStatus()); if ($event->getTicketUrl() != null) { $tmpl->addVar('ticket_link', 'ticketurl', $this->getTicketUrl($event->getTicketUrl())); } // venues 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"); } } // gallery images if ($event->getGallery() != null) { $tmpl->addVar('photoArea', 'displayPhotos', true); $images = $event->getGallery()->getImages(); $logger->debug('Number of images: ' . count($images)); foreach ($images as $img) { $tmpl->addVar('photo', 'imageurl', $img->getUrl()); $tmpl->addVar('photo', 'caption', $img->getAuthor()); $tmpl->parseTemplate('photo', '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"); } } } } } } $tmpl->displayParsedTemplate('exbt_detail'); }
/** * Renders the program detail template * * @param bean $model a DetailPageModel bean * @return void */ private function renderDetailPageModel($model) { global $logger; $logger->debug(get_class($this) . "::renderDetailPageModel({$model})"); $person = $model->getDetail(); $options = $model->getOptions(); $exhibitions = $person->getExhibitions(); $tmpl = $this->createPatTemplate(); $tmpl->readTemplatesFromInput('person_detail.pat.tpl'); // Render the primary form fields $tmpl->addVars('person_detail', BeanUtil::beanToArray($person, true)); // scalars only // Render the editor fields $sconf = $this->getEditorConfig(Editor::SMALL, 'summary', $person->getSummary()); $tmpl->addVar('person_detail', 'summary_editor', $this->setEditor($sconf)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $person->getPubState()); if ($ps->value == $person->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } $tmpl->displayParsedTemplate('person_detail'); // Render the Tabs $tabs = new mosTabs(1); //1 = use cookies to remember selected tab $tabs->startPane("links"); if ($person->getOid() == null) { $tabs->startTab("Notice", "new-links"); echo "<br/><br/>To assign a gallery, first save this new person.<br/><br/>"; $tabs->endTab(); } else { $tabs->startTab("Gallery", "glry-links"); foreach ($options['gallery'] as $glry) { $tmpl->addVar('gallery_options', 'gid', $glry->id); $tmpl->addVar('gallery_options', 'name', $glry->title); if ($glry->id == $person->getGallery()) { $tmpl->addVar('gallery_options', 'selected', 'selected'); } else { $tmpl->addVar('gallery_options', 'selected', ''); } $tmpl->parseTemplate('gallery_options', 'a'); } $tmpl->displayParsedTemplate('glryTab'); $tabs->endTab(); $tabs->startTab("Exhibitions", "exbt-links"); foreach ($options['exhibition'] as $exbt) { $tmpl->addVar('exhibition_options', 'oid', $exbt->getOid()); $tmpl->addVar('exhibition_options', 'title', $exbt->getTitle()); if (isset($exhibitions) && $this->bean_in_array($exbt, $exhibitions)) { $tmpl->addVar('exhibition_options', 'selected', 'selected'); } else { $tmpl->addVar('exhibition_options', 'selected', ''); } $tmpl->parseTemplate('exhibition_options', 'a'); } $tmpl->displayParsedTemplate('exbtTab'); $tabs->endTab(); } // Close the form $tmpl->displayParsedTemplate('close_form'); }
/** * 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 }
public function beanToHash($bean) { $hash = array(); foreach ($bean as $key => $value) { if (is_object($value)) { $hash[$key] = BeanUtil::beanToHash($value); } else { if (is_array($value)) { $hash[$key] = array('key' => $key, 'value' => BeanUtil::beanToHash($value)); } else { $hash[] = array('key' => $key, 'value' => $value); } } } return $hash; }
/** * 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; }
/** * Converts the incoming exhibition bean object to PDO instances. * This includes the conversion from nested list of * linked elements stored as arrays of oids to their * PDO instances. * * @access private * @param bean $bean an Exhibition bean * @param bean $copyOption an optional CopyOptionBean (for ignore null values) */ private function exhibitionBeanToPdo($bean, $copyOption = null) { global $logger; $logger->debug(get_class($this) . "::exhibitionBeanToPdo({$bean},{$copyOption})"); if (get_class($bean) != 'Exhibition') { trigger_error("Incoming object is not a valid Event", E_USER_ERROR); return; } if ($copyOption == null) { $copyOption = new CopyBeanOption(); $copyOption->setScalarsOnly(true); } // Check to see if there is a event OID if ($bean->getOid() > 0) { $pdo = $this->fetchEventById('Exhibition', $bean->getOid()); } else { // Get a new event PDO $epm = epManager::instance(); $pdo = $epm->create('Exhibition'); } // Copy the bean values over the top of the PDO values BeanUtil::copyBean($bean, $pdo, $copyOption); // schedule pdo $schedule = $this->fetchSchedule($bean->getSchedule(), 'Exhibition'); //print_r($schedule); //print_r($bean->getSchedule()); $bean->getSchedule()->setScope('Exhibition'); BeanUtil::copyBean($bean->getSchedule(), $schedule, $copyOption); //print_r($schedule); $pdo->setSchedule($schedule); //print_r($pdo->getSchedule()); // pubState from string to pdo $pubState = $this->fetchPubState($bean->getPubState()); $pdo->setPubState($pubState); // eventStatus from string to pdo $eventStatus = $this->fetchEventStatus($bean->getEventStatus()); $pdo->setEventStatus($eventStatus); // venues from array of oids to array of pdos $venues = $bean->getVenues(); if ($venues != null) { $vpdos = array(); foreach ($venues as $venue) { if ($venue->getOid() == 0) { continue; } $vpdos[] = $this->fetchVenueById($venue->getOid()); } $pdo->getVenues()->removeAll(); $pdo->setVenues($vpdos); } // categories from keyed array of oids to array of pdos $cats = $bean->getCategories(); if ($cats != null) { $cpdos = array(); foreach ($cats as $key => $value) { foreach ($value as $cat) { if ($cat->getOid() == 0) { continue; } $cpdos[] = $this->fetchCategoryById(ucfirst($key), $cat->getOid()); } } $pdo->getCategories()->removeAll(); $pdo->setCategories($cpdos); } // related programs from keyed array of oids to array of pdos $programs = $bean->getPrograms(); if ($programs != null) { $epdos = array(); foreach ($programs as $program) { if ($program->getOid() == 0) { continue; } $epdos[] = $this->fetchEventById('Program', $program->getOid()); } $pdo->getPrograms()->removeAll(); $pdo->setPrograms($epdos); } // related courses from keyed array of oids to array of pdos $courses = $bean->getCourses(); if ($courses != null) { $epdos = array(); foreach ($courses as $course) { if ($course->getOid() == 0) { continue; } $epdos[] = $this->fetchEventById('Course', $course->getOid()); } $pdo->getCourses()->removeAll(); $pdo->setCourses($epdos); } // related artists $artists = $bean->getArtists(); if ($artists != null) { $ps = $this->getPersonService(); $epdos = array(); foreach ($artists as $artist) { if ($artist->getOid() == 0) { continue; } $epdos[] = $ps->fetchPersonById('Artist', $artist->getOid()); } $pdo->getArtists()->removeAll(); $pdo->setArtists($epdos); } return $pdo; }
/** * A convenience method to convert the incoming bean * to the corresponding PDO. This includes all translations * such as the nested PublicationSate. * If the bean has an oid, then it will fetch the person, * if the person id is null, a new pdo object will be returned. * * @access private * @param bean Person bean * @return pdo Person PDO */ private function beanToPdo($bean) { global $logger; $logger->debug(get_class($this) . "::beanToPdo({$bean})"); // Check to see if there is a valid OID if ($bean->getOid() > 0) { $pdo = $this->fetchPersonById(get_class($bean), $bean->getOid()); } else { // Get a new event PDO $epm = epManager::instance(); $pdo = $epm->create(get_class($bean)); } // Copy the bean values over the top of the PDO values BeanUtil::copyBean($bean, $pdo); // Translate the pubState from string to object instance; $pubState = $this->fetchPubState($bean->getPubState()); $pdo->setPubState($pubState); // Get the Exhibitions if an Artist if (get_class($bean) == Person::ARTIST) { $es = $this->getEventService(); $exhibitions = $bean->getExhibitions(); if ($exhibitions != null) { $epdos = array(); foreach ($exhibitions as $event) { $epdos[] = $es->fetchEventById('Exhibition', $event->getOid()); } $pdo->getExhibitions()->removeAll(); $pdo->setExhibitions($epdos); } } return $pdo; }
public function getRows() { list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($this->value); $beanObj = BeanLocator::get($beanClass); return ReflectionUtil::callNestedGetter($beanObj, $nestedProperty); }
/** * A convenience method to convert the incoming bean * to the corresponding PDO. This includes all translations * such as the nested PublicationSate and Address objects. * If the bean has an oid, then it will fetch the home_page, * if the home_page id is null, a new pdo object will be returned. * * @access private * @param bean HomePage bean * @return pdo HomePage PDO */ private function beanToPdo($bean) { global $logger; $logger->debug(get_class($this) . "::beanToPdo({$bean})"); // Check to see if there is a valid HomePage OID if ($bean->getOid() > 0) { $pdo = $this->fetchHomePageById($bean->getOid()); } else { // Get a new event PDO $epm = epManager::instance(); $pdo = $epm->create('HomePage'); } // Copy the bean values over the top of the PDO values BeanUtil::copyBean($bean, $pdo); // Translate the pubState from string to object instance $pubState = $this->fetchPubState($bean->getPubState()); $pdo->setPubState($pubState); return $pdo; }
/** * Renders the flat text view. * @param bean $model The calendar summary model */ public function text($model) { global $logger; $logger->debug(get_class($this) . '::text()'); $this->setRequestFlags('text'); $list = $model->getList(); $selected = $model->getSelected(); $selectedTime = CalendarForm::getMonthStart($selected); $tmpl = $this->createPatTemplate(FRONT_TEMPLATE_DIR); $tmpl->readTemplatesFromInput('calendar_text.pat.tpl'); $tmpl->addVar('calendar', 'cal_type', 'text'); $this->renderControls($tmpl, $model); $logger->debug("Nuumber of events in the page:" . count($model->getList())); // render the list $days = $this->formatEntries($list); foreach ($days as $entry) { $start = $entry["start"]; $tmpl->addVar('day', 'day_num', date('j', $start)); $tmpl->addVar('day', 'day_name', date('l', $start)); $tmpl->clearTemplate('event'); foreach ($entry["schedules"] as $sched) { // load the event info $tmpl->addVars('event', BeanUtil::beanToArray($sched, true)); // scalars only // Format the start time $st = date("g:i a", $sched->getStartTime()); $tmpl->addVar('event', 'formatted_time', $st); // figure out the proper url if ($sched->getScope() == Event::EXHIBITION) { $tmpl->addVar('event', 'url', 'index.php?option=com_ccevents&scope=exbt&task=detail&oid=' . $sched->getOid()); } elseif ($sched->getScope() == Event::PROGRAM) { $tmpl->addVar('event', 'url', 'index.php?option=com_ccevents&scope=prgm&task=detail&oid=' . $sched->getOid()); } elseif ($sched->getScope() == Event::COURSE) { $tmpl->addVar('event', 'url', 'index.php?option=com_ccevents&scope=crse&task=summary&filter=Genre&fid=' . $sched->getFid()); } $tmpl->parseTemplate('event', 'a'); } $tmpl->parseTemplate('day', 'a'); } $cal_link = $this->cceventSefUrl('index.php?option=com_ccevents&scope=cldr&task=month&month=' . $selected->getMonth() . '&year=' . $selected->getYear()); $tmpl->addVar('calendar', 'cal_view_link', $cal_link); $tmpl->displayParsedTemplate('calendar'); }
/** * Convert this bean instance to an associative array. * * @return array An associative array */ public function toArray() { $result = array(); $vars = get_class_vars(get_class($this)); foreach ($vars as $key => $value) { // build the accessor names $getter = 'get' . ucfirst($key); if (!method_exists($this, $getter)) { $getter = 'get_' . $key; } // populate the array $val = $this->{$getter}(); if (is_object($val) || is_array($val)) { $result[$key] = BeanUtil::beanToArray($val); } else { $result[$key] = $val; } } return $result; }
private function getBeanValue($valueExpression, $rowIndex = null) { list($beanClass, $nestedProperty) = BeanUtil::getBeanAndProperties($valueExpression); try { $beanObj = BeanLocator::get($beanClass); } catch (NoSuchBeanException $e) { try { $dataSeries = $this->getFirstAncestorOfType("DataSeries"); if ($dataSeries->getVar() !== $beanClass || is_null($rowIndex)) { throw new NoSuchBeanException($beanClass); } $rows = $dataSeries->getRows(); $beanObj = $rows[$rowIndex]; } catch (NoSuchAnchestorComponentException $e) { throw new NoSuchBeanException($beanClass); } } return ReflectionUtil::callNestedGetter($beanObj, $nestedProperty); }
/** * 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 }
/** * 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 }
/** * Renders the exhibition detail template * * @param bean $model a DetailPageModel bean * @return void */ private function renderDetailPageModel($model) { global $logger; $logger->debug(get_class($this) . "::renderDetailPageModel({$model})"); $exbt = $model->getDetail(); $options = $model->getOptions(); $programs = $exbt->getPrograms(); $courses = $exbt->getCourses(); $artists = $exbt->getArtists(); $categories = $exbt->getCategories(); $venues = $exbt->getVenues(); $artifacts = explode(",", $exbt->getArtifacts()); $logger->debug("Number of artists for exhibition in page: " . count($artists)); $tmpl = $this->createPatTemplate(); //in the MasterPage class $tmpl->readTemplatesFromInput('exhibition_detail.pat.tpl'); $tmpl->addGlobalVar('scope', 'Exhibition'); // Render the primary form fields $tmpl->addVars('exhibition_form', BeanUtil::beanToArray($exbt, true)); // scalars only // Renders the editor fields $sconf = $this->getEditorConfig(Editor::SMALL, 'summary', $exbt->getSummary()); $tmpl->addVar('exhibition_form', 'summary_editor', $this->setEditor($sconf)); $dconf = $this->getEditorConfig(Editor::MEDIUM, 'description', $exbt->getDescription()); $tmpl->addVar('exhibition_form', 'description_editor', $this->setEditor($dconf)); $cconf = $this->getEditorConfig(Editor::SMALL, 'credit', $exbt->getCredit()); $tmpl->addVar('exhibition_form', 'credit_editor', $this->setEditor($cconf)); $aconf = $this->getEditorConfig(Editor::SMALL, 'addinfo', $exbt->getAddinfo()); $tmpl->addVar('exhibition_form', 'addinfo_editor', $this->setEditor($aconf)); $a2conf = $this->getEditorConfig(Editor::SMALL, 'addinfo2', $exbt->getAddinfo2()); $tmpl->addVar('exhibition_form', 'addinfo2_editor', $this->setEditor($a2conf)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $exbt->getPubState()); if ($ps->value == $exbt->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } // Event Status Select foreach ($options['eventStatus'] as $es) { $tmpl->addVar('eventStatus_options', 'value', $es->value); if ($es->value == $exbt->getEventStatus()) { $tmpl->addVar('eventStatus_options', 'selected', 'selected'); } else { $tmpl->addVar('eventStatus_options', 'selected', ''); } $tmpl->parseTemplate('eventStatus_options', 'a'); } // Date Selects $logger->debug("Size of months in page: " . count($options['month'])); $schedule = $exbt->getSchedule(); if (empty($schedule)) { $schedule = new Schedule(); } $tmpl->addVar('exhibition_form', 'scheduleOid', $schedule->getOid()); $startTime = $schedule->getStartTime() > 0 ? $schedule->getStartTime() : time(); // set the end time functionality if ($schedule->getEndTime() > 0) { $endTime = $schedule->getEndTime(); $tmpl->addVar('close_form', 'show_closing', '1'); } else { $endTime = time(); $tmpl->addVar('close_form', 'show_closing', '0'); } foreach ($options['month'] as $key => $value) { $tmpl->addVar('start_month_options', 'value', $key); $tmpl->addVar('start_month_options', 'text', $value); if ($key == date("n", $startTime)) { $tmpl->addVar('start_month_options', 'selected', 'selected'); } else { $tmpl->addVar('start_month_options', 'selected', ''); } $tmpl->parseTemplate('start_month_options', 'a'); $tmpl->addVar('end_month_options', 'value', $key); $tmpl->addVar('end_month_options', 'text', $value); if ($key == date("n", $endTime)) { $tmpl->addVar('end_month_options', 'selected', 'selected'); } else { $tmpl->addVar('end_month_options', 'selected', ''); } $tmpl->parseTemplate('end_month_options', 'a'); } foreach ($options['day'] as $value) { $tmpl->addVar('start_day_options', 'value', $value); if (intval($value) == date("j", $startTime)) { $tmpl->addVar('start_day_options', 'selected', 'selected'); } else { $tmpl->addVar('start_day_options', 'selected', ''); } $tmpl->parseTemplate('start_day_options', 'a'); $tmpl->addVar('end_day_options', 'value', $value); if (intval($value) == date("j", $endTime)) { $tmpl->addVar('end_day_options', 'selected', 'selected'); } else { $tmpl->addVar('end_day_options', 'selected', ''); } $tmpl->parseTemplate('end_day_options', 'a'); } foreach ($options['year'] as $value) { $tmpl->addVar('start_year_options', 'value', $value); if (intval($value) == date("Y", $startTime)) { $tmpl->addVar('start_year_options', 'selected', 'selected'); } else { $tmpl->addVar('start_year_options', 'selected', ''); } $tmpl->parseTemplate('start_year_options', 'a'); $tmpl->addVar('end_year_options', 'value', $value); if (intval($value) == date("Y", $endTime)) { $tmpl->addVar('end_year_options', 'selected', 'selected'); } else { $tmpl->addVar('end_year_options', 'selected', ''); } $tmpl->parseTemplate('end_year_options', 'a'); } // Press Release Article Select $proptions = $options['pressrelease']; foreach ($proptions as $pra) { $tmpl->addVar('pressrelease_options', 'value', $pra->getId()); $tmpl->addVar('pressrelease_options', 'title', substr($pra->getTitle(), 0, 60)); if ($pra->getId() == $exbt->getPressRelease()) { $tmpl->addVar('pressrelease_options', 'selected', 'selected'); } else { $tmpl->addVar('pressrelease_options', 'selected', ''); } $tmpl->parseTemplate('pressrelease_options', 'a'); } // Comment Article Select $caoptions = $options['commentarticle']; foreach ($caoptions as $ca) { $tmpl->addVar('commentarticle_options', 'value', $ca->getId()); $tmpl->addVar('commentarticle_options', 'title', $ca->getTitle()); if ($ca->getId() == $exbt->getCommentArticle()) { $tmpl->addVar('commentarticle_options', 'selected', 'selected'); } else { $tmpl->addVar('commentarticle_options', 'selected', ''); } $tmpl->parseTemplate('commentarticle_options', 'a'); } // Related Content Category $relatedoptions = $options['relatedcategory']; foreach ($relatedoptions as $rca) { $tmpl->addVar('relatedcategory_options', 'value', $rca->getId()); $tmpl->addVar('relatedcategory_options', 'title', $rca->getTitle()); if ($rca->getId() == $exbt->getRelatedArticles()) { $tmpl->addVar('relatedcategory_options', 'selected', 'selected'); } else { $tmpl->addVar('relatedcategory_options', 'selected', ''); } $tmpl->parseTemplate('relatedcategory_options', 'a'); } // Render the Main Template $tmpl->displayParsedTemplate('exhibition_form'); // Render the Tabs $tabs = new mosTabs(1); //1 = use cookies to remember selected tab $tabs->startPane("links"); if ($exbt->getOid() == null) { $tabs->startTab("Notice", "new-links"); echo "<br/><br/>To assign a Venue, first save this new Exhibition.<br/><br/>"; $tabs->endTab(); } else { $tabs->startTab("Venues", "vnue-links"); foreach ($options['venue'] as $ven) { $tmpl->addVar('venue_options', 'oid', $ven->getOid()); $tmpl->addVar('venue_options', 'name', $ven->getName()); if (isset($venues) && $this->bean_in_array($ven, $venues)) { $tmpl->addVar('venue_options', 'selected', 'selected'); } else { $tmpl->addVar('venue_options', 'selected', ''); } $tmpl->parseTemplate('venue_options', 'a'); } $tmpl->displayParsedTemplate('vnueTab'); $tabs->endTab(); $tabs->startTab("Genres", "cat-links"); foreach ($options['audience'] as $aud) { $tmpl->addVar('audience_options', 'oid', $aud->getOid()); $tmpl->addVar('audience_options', 'name', $aud->getName()); if (isset($categories['Audience']) && $this->bean_in_array($aud, $categories['Audience'])) { $tmpl->addVar('audience_options', 'selected', 'selected'); } else { $tmpl->addVar('audience_options', 'selected', ''); } $tmpl->parseTemplate('audience_options', 'a'); } foreach ($options['genre'] as $gen) { $tmpl->addVar('genre_options', 'oid', $gen->getOid()); $tmpl->addVar('genre_options', 'name', $gen->getName()); if (isset($categories['Genre']) && $this->bean_in_array($gen, $categories['Genre'])) { $tmpl->addVar('genre_options', 'selected', 'selected'); } else { $tmpl->addVar('genre_options', 'selected', ''); } $tmpl->parseTemplate('genre_options', 'a'); } $tmpl->displayParsedTemplate('catsTab'); $tabs->endTab(); $tabs->startTab("Programs", "prgm-links"); foreach ($options['program'] as $prgm) { $tmpl->addVar('program_options', 'oid', $prgm->getOid()); $tmpl->addVar('program_options', 'title', $prgm->getTitle()); if (isset($programs) && $this->bean_in_array($prgm, $programs)) { $tmpl->addVar('program_options', 'selected', 'selected'); } else { $tmpl->addVar('program_options', 'selected', ''); } $tmpl->parseTemplate('program_options', 'a'); } $tmpl->displayParsedTemplate('prgmTab'); $tabs->endTab(); $tabs->startTab("Courses", "crse-links"); foreach ($options['course'] as $prgm) { $tmpl->addVar('course_options', 'oid', $prgm->getOid()); $tmpl->addVar('course_options', 'title', $prgm->getTitle()); if (isset($courses) && $this->bean_in_array($prgm, $courses)) { $tmpl->addVar('course_options', 'selected', 'selected'); } else { $tmpl->addVar('course_options', 'selected', ''); } $tmpl->parseTemplate('course_options', 'a'); } $tmpl->displayParsedTemplate('crseTab'); $tabs->endTab(); $tabs->startTab("Gallery", "glry-links"); foreach ($options['gallery'] as $glry) { $tmpl->addVar('gallery_options', 'gid', $glry->id); $tmpl->addVar('gallery_options', 'name', $glry->title); if ($glry->id == $exbt->getGallery()) { $tmpl->addVar('gallery_options', 'selected', 'selected'); } else { $tmpl->addVar('gallery_options', 'selected', ''); } $tmpl->parseTemplate('gallery_options', 'a'); } $tmpl->displayParsedTemplate('glryTab'); $tabs->endTab(); $tabs->startTab("Artists", "pers-links"); foreach ($options['person'] as $pers) { $artistName = $pers->getLastName() ? $pers->getLastName() . ", " . $pers->getFirstName() : $pers->getFriendlyName(); $tmpl->addVar('person_options', 'oid', $pers->getOid()); $tmpl->addVar('person_options', 'title', $artistName); if (isset($artists) && $this->bean_in_array($pers, $artists)) { $tmpl->addVar('person_options', 'selected', 'selected'); } else { $tmpl->addVar('person_options', 'selected', ''); } $tmpl->parseTemplate('person_options', 'a'); } foreach ($options['artifact'] as $album) { foreach ($album->getImages() as $image) { $large = $image->getLarge(); if ($large) { $tmpl->addVar('object_options', 'oid', $large->getId()); $tmpl->addVar('object_options', 'name', $image->getTitle()); if (isset($artifacts) && in_array($large->getId(), $artifacts)) { $tmpl->addVar('object_options', 'selected', 'selected'); } else { $tmpl->addVar('object_options', 'selected', ''); } $tmpl->parseTemplate('object_options', 'a'); } } } $tmpl->displayParsedTemplate('persTab'); $tabs->endTab(); } $tmpl->displayParsedTemplate('close_form'); }
/** * Copies the updated values of the bean to the pdo * object, then commits the pdo object to update the * address. * * @access private * @param bean Address Bean * @return pdo updated Address PDO */ private function updateAddress($bean) { global $logger; $logger->debug(get_class($this) . "::updateAddress({$bean})"); $logger->debug("Address is of class: " . get_class($bean)); $logger->debug("Before update the address id: " . $bean->getOid()); $epm = epManager::instance(); $pdo = null; if ($bean->getOid() > 0) { $pdo = $this->fetchAddressById($bean->getOid()); $logger->debug("Oid > 0: " . $pdo->getOid()); } else { if (trim($bean->getStreet()) != NULL) { $pdo = $epm->create('Address'); $logger->debug("No oid, but valid street: " . $bean->getStreet()); } else { return null; // This is not a valid address } } $pdo = BeanUtil::copyBean($bean, $pdo); $pdo = $epm->commit($pdo); $logger->debug("After update the address id: " . $pdo->getOid()); return $pdo; }
/** * Renders the program detail template * * @param bean $model a DetailPageModel bean * @return void */ private function renderDetailPageModel($model) { global $logger; $logger->debug(get_class($this) . "::renderDetailPageModel({$model})"); $program = $model->getDetail(); $options = $model->getOptions(); $exhibitions = $program->getExhibitions(); $courses = $program->getCourses(); $categories = $program->getCategories(); $tmpl = $this->createPatTemplate(); //in the MasterPage class $tmpl->readTemplatesFromInput('program_detail.pat.tpl'); $tmpl->addGlobalVar('scope', 'Program'); // Render the primary form fields $tmpl->addVars('program_form', BeanUtil::beanToArray($program, true)); // scalars only // Renders the editor fields $sconf = $this->getEditorConfig(Editor::SMALL, 'summary', $program->getSummary()); $tmpl->addVar('program_form', 'summary_editor', $this->setEditor($sconf)); $dconf = $this->getEditorConfig(Editor::MEDIUM, 'description', $program->getDescription()); $tmpl->addVar('program_form', 'description_editor', $this->setEditor($dconf)); $cconf = $this->getEditorConfig(Editor::SMALL, 'credit', $program->getCredit()); $tmpl->addVar('program_form', 'credit_editor', $this->setEditor($cconf)); $aconf = $this->getEditorConfig(Editor::SMALL, 'addinfo', $program->getAddinfo()); $tmpl->addVar('program_form', 'addinfo_editor', $this->setEditor($aconf)); $a2conf = $this->getEditorConfig(Editor::SMALL, 'addinfo2', $program->getAddinfo2()); $tmpl->addVar('program_form', 'addinfo2_editor', $this->setEditor($a2conf)); // PubState Select foreach ($options['pubState'] as $ps) { $tmpl->addVar('pubState_options', 'value', $ps->value); $logger->debug("current: " . $ps->value . " | selected " . $program->getPubState()); if ($ps->value == $program->getPubState()) { $tmpl->addVar('pubState_options', 'selected', 'selected'); } else { $tmpl->addVar('pubState_options', 'selected', ''); } $tmpl->parseTemplate('pubState_options', 'a'); } // Primary Genre Select $genre = $program->getPrimaryGenre(); foreach ($options['genre'] as $gc) { $tmpl->addVar('primaryGenre_options', 'oid', $gc->getOid()); $tmpl->addVar('primaryGenre_options', 'name', $gc->getName()); if (!empty($genre) && $gc->getOid() == $genre->getOid()) { $tmpl->addVar('primaryGenre_options', 'selected', 'selected'); } else { $tmpl->addVar('primaryGenre_options', 'selected', ''); } $tmpl->parseTemplate('primaryGenre_options', 'a'); } // DefaultVenue Select $venues = $program->getVenues(); $venue = isset($venues[0]) ? $venues[0] : null; foreach ($options['venue'] as $dv) { $tmpl->addVar('defaultVenue_options', 'oid', $dv->getOid()); $tmpl->addVar('defaultVenue_options', 'name', $dv->getName()); if (!empty($venue) && $dv->getOid() == $venue->getOid()) { $tmpl->addVar('defaultVenue_options', 'selected', 'selected'); } else { $tmpl->addVar('defaultVenue_options', 'selected', ''); } $tmpl->parseTemplate('defaultVenue_options', 'a'); } // Press Release Article Select $proptions = $options['pressrelease']; foreach ($proptions as $pra) { $tmpl->addVar('pressrelease_options', 'value', $pra->getId()); $tmpl->addVar('pressrelease_options', 'title', $pra->getTitle()); if ($pra->getId() == $program->getPressRelease()) { $tmpl->addVar('pressrelease_options', 'selected', 'selected'); } else { $tmpl->addVar('pressrelease_options', 'selected', ''); } $tmpl->parseTemplate('pressrelease_options', 'a'); } // Comment Article Select $caoptions = $options['commentarticle']; foreach ($caoptions as $ca) { $tmpl->addVar('commentarticle_options', 'value', $ca->getId()); $tmpl->addVar('commentarticle_options', 'title', $ca->getTitle()); if ($ca->getId() == $program->getCommentArticle()) { $tmpl->addVar('commentarticle_options', 'selected', 'selected'); } else { $tmpl->addVar('commentarticle_options', 'selected', ''); } $tmpl->parseTemplate('commentarticle_options', 'a'); } // Related Content Category $relatedoptions = $options['relatedcategory']; foreach ($relatedoptions as $rca) { $tmpl->addVar('relatedcategory_options', 'value', $rca->getId()); $tmpl->addVar('relatedcategory_options', 'title', $rca->getTitle()); if ($rca->getId() == $program->getRelatedArticles()) { $tmpl->addVar('relatedcategory_options', 'selected', 'selected'); } else { $tmpl->addVar('relatedcategory_options', 'selected', ''); } $tmpl->parseTemplate('relatedcategory_options', 'a'); } // Render the Main Template $tmpl->displayParsedTemplate('program_form'); $logger->debug("program form template parsed"); // Render the Tabs $tabs = new mosTabs(1); //1 = use cookies to remember selected tab $tabs->startPane("links"); if ($program->getOid() == null) { $tabs->startTab("Notice", "new-links"); echo "<br/><br/>To assign a performance, first save this new program.<br/><br/>"; $tabs->endTab(); } else { $tabs->startTab("Performances", "perf-links"); $tmpl->addVar('activity_tab', 'scope', 'Performance'); // Date Selects $logger->debug("Size of months in page: " . count($options['month'])); foreach ($options['month'] as $key => $value) { $tmpl->addVar('start_month_options', 'value', $key); $tmpl->addVar('start_month_options', 'text', $value); $tmpl->parseTemplate('start_month_options', 'a'); $tmpl->addVar('end_month_options', 'value', $key); $tmpl->addVar('end_month_options', 'text', $value); $tmpl->parseTemplate('end_month_options', 'a'); } foreach ($options['day'] as $value) { $tmpl->addVar('start_day_options', 'value', $value); $tmpl->parseTemplate('start_day_options', 'a'); $tmpl->addVar('end_day_options', 'value', $value); $tmpl->parseTemplate('end_day_options', 'a'); } foreach ($options['year'] as $value) { $tmpl->addVar('start_year_options', 'value', $value); $tmpl->parseTemplate('start_year_options', 'a'); $tmpl->addVar('end_year_options', 'value', $value); $tmpl->parseTemplate('end_year_options', 'a'); } foreach ($options['hour'] as $value) { $tmpl->addVar('start_hour_options', 'value', $value); $tmpl->parseTemplate('start_hour_options', 'a'); $tmpl->addVar('end_hour_options', 'value', $value); $tmpl->parseTemplate('end_hour_options', 'a'); } foreach ($options['minute'] as $value) { $tmpl->addVar('start_minute_options', 'value', $value); $tmpl->parseTemplate('start_minute_options', 'a'); $tmpl->addVar('end_minute_options', 'value', $value); $tmpl->parseTemplate('end_minute_options', 'a'); } foreach ($options['ampm'] as $value) { $tmpl->addVar('start_ampm_options', 'value', $value); $tmpl->parseTemplate('start_ampm_options', 'a'); $tmpl->addVar('end_ampm_options', 'value', $value); $tmpl->parseTemplate('end_ampm_options', 'a'); } foreach ($options['venue'] as $av) { $tmpl->addVar('activityVenue_options', 'oid', $av->getOid()); $tmpl->addVar('activityVenue_options', 'name', $av->getName()); if (!empty($venue) && $av->getOid() == $venue->getOid()) { $tmpl->addVar('activityVenue_options', 'selected', 'selected'); } else { $tmpl->addVar('activityVenue_options', 'selected', ''); } $tmpl->parseTemplate('activityVenue_options', 'a'); } foreach ($options['eventStatus'] as $es) { $tmpl->addVar('activityStatus_options', 'value', $es->value); $tmpl->parseTemplate('activityStatus_options', 'a'); } $activities = $program->getChildren(); if (!empty($activities)) { $delim = $activityStartTime = $activityEndTime = $activityVenueId = $activityVenueName = $activityStatus = $activityTicketCode = ''; foreach ($activities as $activity) { $schedule = $activity->getSchedule(); $ststr = date("Y-n-j H:i:s", $schedule->getStartTime()); $etstr = date("Y-n-j H:i:s", $schedule->getEndTime()); $activityStartTime .= $delim . $ststr; $activityEndTime .= $delim . $etstr; $activityVenueId .= $delim . $activity->getVenue()->getOid(); $activityVenueName .= $delim . $activity->getVenue()->getName(); $activityStatus .= $delim . $activity->getActivityStatus()->getValue(); $activityTicketCode .= $delim . $activity->getTicketCode(); $delim = '|'; } $tmpl->addVar('activity_tab', 'start_time', $activityStartTime); $tmpl->addVar('activity_tab', 'end_time', $activityEndTime); $tmpl->addVar('activity_tab', 'venue_id', $activityVenueId); $tmpl->addVar('activity_tab', 'venue_name', $activityVenueName); $tmpl->addVar('activity_tab', 'activity_status', $activityStatus); $tmpl->addVar('activity_tab', 'activity_ticket', $activityTicketCode); } $tmpl->displayParsedTemplate('perfTab'); $tabs->endTab(); $tabs->startTab("Genres", "cat-links"); foreach ($options['audience'] as $aud) { $tmpl->addVar('audience_options', 'oid', $aud->getOid()); $tmpl->addVar('audience_options', 'name', $aud->getName()); if (isset($categories['Audience']) && $this->bean_in_array($aud, $categories['Audience'])) { $tmpl->addVar('audience_options', 'selected', 'selected'); } else { $tmpl->addVar('audience_options', 'selected', ''); } $tmpl->parseTemplate('audience_options', 'a'); } foreach ($options['genre'] as $gen) { $tmpl->addVar('genre_options', 'oid', $gen->getOid()); $tmpl->addVar('genre_options', 'name', $gen->getName()); if (isset($categories['Genre']) && $this->bean_in_array($gen, $categories['Genre'])) { $tmpl->addVar('genre_options', 'selected', 'selected'); } else { $tmpl->addVar('genre_options', 'selected', ''); } $tmpl->parseTemplate('genre_options', 'a'); } $tmpl->displayParsedTemplate('catsTab'); $tabs->endTab(); $tabs->startTab("Series", "series-links"); foreach ($options['series'] as $ser) { $tmpl->addVar('series_options', 'oid', $ser->getOid()); $tmpl->addVar('series_options', 'name', $ser->getName()); if (isset($categories['Series']) && $this->bean_in_array($ser, $categories['Series'])) { $tmpl->addVar('series_options', 'selected', 'selected'); } else { $tmpl->addVar('series_options', 'selected', ''); } $tmpl->parseTemplate('series_options', 'a'); } $tmpl->displayParsedTemplate('sersTab'); $tabs->endTab(); $tabs->startTab("Exhibits", "exbt-links"); foreach ($options['exhibition'] as $exbt) { $tmpl->addVar('exhibition_options', 'oid', $exbt->getOid()); $tmpl->addVar('exhibition_options', 'title', $exbt->getTitle()); if (isset($exhibitions) && $this->bean_in_array($exbt, $exhibitions)) { $tmpl->addVar('exhibition_options', 'selected', 'selected'); } else { $tmpl->addVar('exhibition_options', 'selected', ''); } $tmpl->parseTemplate('exhibition_options', 'a'); } $tmpl->displayParsedTemplate('exbtTab'); $tabs->endTab(); $tabs->startTab("Courses", "crse-links"); foreach ($options['course'] as $prgm) { $tmpl->addVar('course_options', 'oid', $prgm->getOid()); $tmpl->addVar('course_options', 'title', $prgm->getTitle()); if (isset($courses) && $this->bean_in_array($prgm, $courses)) { $tmpl->addVar('course_options', 'selected', 'selected'); } else { $tmpl->addVar('course_options', 'selected', ''); } $tmpl->parseTemplate('course_options', 'a'); } $tmpl->displayParsedTemplate('crseTab'); $tabs->endTab(); $tabs->startTab("Gallery", "glry-links"); foreach ($options['gallery'] as $glry) { $tmpl->addVar('gallery_options', 'gid', $glry->id); $tmpl->addVar('gallery_options', 'name', $glry->title); if ($glry->id == $program->getGallery()) { $tmpl->addVar('gallery_options', 'selected', 'selected'); } else { $tmpl->addVar('gallery_options', 'selected', ''); } $tmpl->parseTemplate('gallery_options', 'a'); } $tmpl->displayParsedTemplate('glryTab'); $tabs->endTab(); } $logger->debug("parsing template"); $tmpl->displayParsedTemplate('close_form'); }
/** * A convenience method to convert the incoming bean * to the corresponding PDO. This includes all translations * such as the nested PublicationSate. * If the bean has an oid, then it will fetch the category, * if the category id is null, a new pdo object will be returned. * * @access private * @param bean Category bean * @return pdo Category PDO */ private function beanToPdo($bean) { global $logger; $logger->debug(get_class($this) . "::beanToPdo({$bean})"); // Check to see if there is a valid OID if ($bean->getOid() > 0) { $pdo = $this->fetchCategoryById($bean->getOid()); } else { // Get a new event PDO $epm = epManager::instance(); $pdo = $epm->create('Category'); } // Copy the bean values over the top of the PDO values BeanUtil::copyBean($bean, $pdo); // Set the scope $pdo->setScope(get_class($bean)); // Translate the pubState from string to object instance $pubState = $this->fetchPubState($bean->getPubState()); $pdo->setPubState($pubState); // Translate the events from array of oids to array of PDOs $eventAssoc = $bean->getEvents(); if ($eventAssoc != null) { $es = new EventService(); $eventPdo = array(); foreach ($eventAssoc as $key => $value) { $type = ucfirst($key); $logger->debug("The event type is: " . $type); foreach ($value as $evoid) { $eventPdo[] = $es->fetchEventById($type, $evoid); } } $pdo->setEvents($eventPdo); } return $pdo; }