Exemple #1
0
 /**
  * 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');
 }
Exemple #2
0
 /**
  * The default render method.  Displays the editor tabs
  * @param bean $model The summary model
  */
 public function render($model)
 {
     global $logger;
     $logger->debug(get_class($this) . '::render()');
     $notice = $model->getList();
     $tmpl = $this->createPatTemplate();
     $tmpl->readTemplatesFromInput('announcement.pat.tpl');
     $tmpl->displayParsedTemplate('announcement_open');
     // Render the Tabs
     $tabs = new mosTabs(0);
     //1 = use cookies to remember selected tab
     $tabs->startPane("links");
     foreach ($notice as $note) {
         $logger->debug("Notice published: " . $note->getPublished());
         $tabs->startTab($note->getScope(), $note->getScope() . "_tab");
         echo "<div style='padding: 20px;'>";
         echo $this->getPublished($note->getScope(), $note->getPublished());
         $conf = $this->getEditorConfig(Editor::SMALL, $note->getScope(), $note->getContent());
         echo $this->setEditor($conf);
         echo "<input type='hidden' name='" . $note->getScope() . "_oid' value='" . $note->getOid() . "'/>";
         echo "</div>";
         $tabs->endTab();
     }
     $tabs->endPane();
     $tmpl->displayParsedTemplate('announcement_close');
 }
Exemple #3
0
 /**
  * Renders the summary of given venues
  * @param bean $model The venues summary model
  */
 private function renderSummary($model)
 {
     global $logger;
     $logger->debug(get_class($this) . '::summary()');
     $data = $model->getVenues();
     $tmpl = $this->createPatTemplate();
     $tmpl->readTemplatesFromInput('venue_summary.pat.tpl');
     $tmpl->addVar('venue_summary', 'total', count($data));
     // Add the objects to the nested templates
     for ($i = 0; $i < count($data); $i++) {
         $venue = $data[$i];
         $logger->debug("Class of venue: " . get_class($venue));
         $tmpl->addVar('venue', 'iter', $i);
         $tmpl->addVar('venue', 'index', $i + 1);
         // Render the primary form fields
         $tmpl->addVars('venue', BeanUtil::beanToArray($venue, true));
         // scalars only
         $ab = $venue->getAddress();
         if ($ab->getStreet() == null) {
             $addr = "n/a";
         } else {
             $addr = $ab->getStreet() . "," . $ab->getCity() . "," . $ab->getState();
         }
         $tmpl->addVar('venue', 'address', $addr);
         $pubwidget = $this->getPubControls($venue->getPubState());
         $tmpl->addVars('venue', $pubwidget);
         $ecount = 0;
         $pcount = 0;
         $ccount = 0;
         $events = $venue->getEvents();
         foreach ($events as $event) {
             switch ($event->getScope()) {
                 case 'Exhibition':
                     $ecount += 1;
                     break;
                 case 'Program':
                     $pcount += 1;
                     break;
                 case 'Course':
                     $ccount += 1;
                     break;
             }
         }
         $tmpl->addVar('venue', 'exhibition', $ecount);
         $tmpl->addVar('venue', 'program', $pcount);
         $tmpl->addVar('venue', 'course', $ccount);
         $tmpl->parseTemplate('venue', "a");
     }
     $tmpl->displayParsedTemplate('venue_summary');
 }
Exemple #4
0
 public static function getInstance()
 {
     if (!self::$conn instanceof self) {
         self::$conn = new self();
     }
     return self::$conn;
 }
Exemple #5
0
 /**
  * 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');
 }
Exemple #6
0
 /**
  * Renders the summary of given home_pages
  * @param bean $model The home_pages summary model
  */
 private function renderSummary($model)
 {
     global $logger;
     $logger->debug(get_class($this) . '::summary()');
     $data = $model->getHomePages();
     $tmpl = $this->createPatTemplate();
     $tmpl->readTemplatesFromInput('home_page_summary.pat.tpl');
     $tmpl->addVar('home_page_summary', 'total', count($data));
     // Add the objects to the nested templates
     for ($i = 0; $i < count($data); $i++) {
         $home_page = $data[$i];
         $logger->debug("Class of home_page: " . get_class($home_page));
         $tmpl->addVar('home_page', 'iter', $i);
         $tmpl->addVar('home_page', 'index', $i + 1);
         // Render the primary form fields
         $tmpl->addVars('home_page', BeanUtil::beanToArray($home_page, true));
         // scalars only
         $pubwidget = $this->getPubControls($home_page->getPubState());
         $tmpl->addVars('home_page', $pubwidget);
         $tmpl->parseTemplate('home_page', "a");
     }
     $tmpl->displayParsedTemplate('home_page_summary');
 }
Exemple #7
0
 /**
  * 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');
 }
Exemple #8
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 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');
 }
 function buildWhere()
 {
     global $current_user;
     $returnArray = array();
     if (!is_array($this->filters)) {
         // use defaults
         $this->filters = array();
         foreach ($this->searchFields as $name => $params) {
             if (!empty($params['default'])) {
                 $this->filters[$name] = $params['default'];
             }
         }
     }
     foreach ($this->filters as $name => $params) {
         if (!empty($params)) {
             if ($name == 'assigned_user_id' && $this->myItemsOnly) {
                 continue;
             }
             // don't handle assigned user filter if filtering my items only
             $widgetDef = $this->seedBean->field_defs[$name];
             $widgetClass = $this->layoutManager->getClassFromWidgetDef($widgetDef, true);
             $widgetDef['table'] = $this->seedBean->table_name;
             $widgetDef['table_alias'] = $this->seedBean->table_name;
             if (!empty($widgetDef['source']) && $widgetDef['source'] == 'custom_fields') {
                 $widgetDef['table'] = $this->seedBean->table_name . "_cstm";
                 $widgetDef['table_alias'] = $widgetDef['table'];
             }
             switch ($widgetDef['type']) {
                 // handle different types
                 case 'date':
                 case 'datetime':
                 case 'datetimecombo':
                     if (is_array($params) && !empty($params)) {
                         if (!empty($params['date'])) {
                             $widgetDef['input_name0'] = $params['date'];
                         }
                         $filter = 'queryFilter' . $params['type'];
                     } else {
                         $filter = 'queryFilter' . $params;
                     }
                     array_push($returnArray, $widgetClass->{$filter}($widgetDef, true));
                     break;
                 case 'assigned_user_name':
                     // This type runs through the SugarWidgetFieldname class, and needs a little extra help to make it through
                     if (!isset($widgetDef['column_key'])) {
                         $widgetDef['column_key'] = $name;
                     }
                     // No break here, we want to run through the default handler
                 // No break here, we want to run through the default handler
                 case 'relate':
                     if (isset($widgetDef['link']) && $this->seedBean->load_relationship($widgetDef['link'])) {
                         $widgetLink = $widgetDef['link'];
                         $widgetDef['module'] = $this->seedBean->{$widgetLink}->focus->module_name;
                         $widgetDef['link'] = $this->seedBean->{$widgetLink}->getRelationshipObject()->name;
                     }
                     // No break - run through the default handler
                 // No break - run through the default handler
                 default:
                     $widgetDef['input_name0'] = $params;
                     if (is_array($params) && !empty($params)) {
                         // handle array query
                         array_push($returnArray, $widgetClass->queryFilterone_of($widgetDef, false));
                     } else {
                         array_push($returnArray, $widgetClass->queryFilterStarts_With($widgetDef, true));
                     }
                     $widgetDef['input_name0'] = $params;
                     break;
             }
         }
     }
     if ($this->myItemsOnly) {
         array_push($returnArray, $this->seedBean->table_name . '.' . "assigned_user_id = '" . $current_user->id . "'");
     }
     return $returnArray;
 }
Exemple #11
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 #12
0
 /**
  * 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');
 }
Exemple #13
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
 }
Exemple #14
0
<?php

require 'bean.php';
include_once 'carrito.php';
header("Content-Type: text/html;charset=utf-8");
if (!isset($_SESSION)) {
    session_start();
}
$Beans = bean::getInstance();
if (isset($_GET['id_categoria'])) {
    //$Beans-> setCategoria($_POST['id_categoria']);
    header('Location: categoria.php?categoria=' . $_GET['id_categoria'] . '');
} else {
    if (isset($_POST['id_producto'])) {
    } else {
        if (isset($_POST['articulo'])) {
            $Beans->insertaProdCarrito($_POST['articulo']);
        } else {
            if (isset($_POST['gestionCarrito'])) {
                header('Location: carrito.php');
            } else {
                if (isset($_POST['registro'])) {
                    header('Location: registro.php');
                } else {
                    if (isset($_GET['accion']) and strcmp($_GET['accion'], "signup") == 0) {
                        $Beans->registarUsuario($_POST['nombre'], $_POST['apellido'], $_POST['usuario'], $_POST['password']);
                        header('Location: index.php');
                    } else {
                        if (isset($_GET['accion']) and strcmp($_GET['accion'], "login") == 0) {
                            $dadesUsuario = $Beans->validaUsuari($_POST['usuario'], $_POST['password']);
                            if ($dadesUsuario) {
Exemple #15
0
if (!isset($_SESSION['valid_user'])) {
    include '_nav.php';
} else {
    include '_navLogin.php';
}
?>

      </nav>

      <div id="wrapper">
         <section>
         <div class="producto">
            <?php 
if (isset($_GET['id'])) {
    $idProd = $_GET['id'];
    $bean = bean::getInstance();
    $productos = $bean->getProducto($idProd);
    foreach ($productos as $producto) {
        $id = $producto['IDPRODUCTO'];
        $imagen = $producto['IMAGEN'];
        $nombre = $producto['NOMBRE'];
        $desc = $producto['DESCRIPCION'];
        $precio = $producto['PRECIO'];
        $stock = $producto['STOCK'];
        ?>
         <div class="container">
            <div class="row">
               <div class="col-md-4"> <img class="imgproduc" src="<?php 
        echo $imagen;
        ?>
" width="100%" height="100%;"/></div>
Exemple #16
0
 /**
  * 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');
 }
Exemple #17
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
 }
 /**
  * Does all dashlet processing, here's your chance to modify the rows being displayed!
  */
 function process($lvsParams = array())
 {
     $currentSearchFields = array();
     $configureView = true;
     // configure view or regular view
     $query = false;
     $whereArray = array();
     $lvsParams['massupdate'] = false;
     $this->loadCustomMetadata();
     $this->addCustomFields();
     // apply filters
     if (isset($this->filters) || $this->myItemsOnly) {
         $whereArray = $this->buildWhere();
     }
     $this->lvs->export = false;
     $this->lvs->multiSelect = false;
     // columns
     $displayColumns = array();
     if (!empty($this->displayColumns)) {
         // use user specified columns
         foreach ($this->displayColumns as $name => $val) {
             $displayColumns[strtoupper($val)] = $this->columns[$val];
             $displayColumns[strtoupper($val)]['label'] = trim($displayColumns[strtoupper($val)]['label'], ':');
             // strip : at the end of headers
         }
     } else {
         if (isset($this->columns)) {
             // use the default
             foreach ($this->columns as $name => $val) {
                 if (!empty($val['default']) && $val['default']) {
                     $displayColumns[strtoupper($name)] = $val;
                     $displayColumns[strtoupper($name)]['label'] = trim($displayColumns[strtoupper($name)]['label'], ':');
                 }
             }
         }
     }
     $this->lvs->displayColumns = $displayColumns;
     $this->seedBean->ACLFilterFieldList($this->lvs->displayColumns, array("owner_override" => true));
     $this->lvs->lvd->setVariableName($this->seedBean->object_name, array());
     $lvdOrderBy = $this->lvs->lvd->getOrderBy();
     // has this list been ordered, if not use default
     $nameRelatedFields = array();
     //bug: 44592 - dashlet sort order was not being preserved between logins
     if (!empty($lvsParams['orderBy']) && !empty($lvsParams['sortOrder'])) {
         $lvsParams['overrideOrder'] = true;
     } else {
         if (empty($lvdOrderBy['orderBy'])) {
             foreach ($displayColumns as $colName => $colParams) {
                 if (!empty($colParams['defaultOrderColumn'])) {
                     $lvsParams['overrideOrder'] = true;
                     $lvsParams['orderBy'] = $colName;
                     $lvsParams['sortOrder'] = $colParams['defaultOrderColumn']['sortOrder'];
                 }
             }
         }
     }
     // Check for 'last_name' column sorting with related fields (last_name, first_name)
     // See ListViewData.php for actual sorting change.
     if ($lvdOrderBy['orderBy'] == 'last_name' && !empty($displayColumns['NAME']) && !empty($displayColumns['NAME']['related_fields']) && in_array('last_name', $displayColumns['NAME']['related_fields']) && in_array('first_name', $displayColumns['NAME']['related_fields'])) {
         $lvsParams['overrideLastNameOrder'] = true;
     }
     if (!empty($this->displayTpl)) {
         //MFH BUG #14296
         $where = '';
         if (!empty($whereArray)) {
             $where = '(' . implode(') AND (', $whereArray) . ')';
         }
         $this->lvs->setup($this->seedBean, $this->displayTpl, $where, $lvsParams, 0, $this->displayRows);
         if (in_array('CREATED_BY', array_keys($displayColumns))) {
             // handle the created by field
             foreach ($this->lvs->data['data'] as $row => $data) {
                 $this->lvs->data['data'][$row]['CREATED_BY'] = $data['CREATED_BY_NAME'];
             }
         }
         // assign a baseURL w/ the action set as DisplayDashlet
         foreach ($this->lvs->data['pageData']['urls'] as $type => $url) {
             // awu Replacing action=DisplayDashlet with action=DynamicAction&DynamicAction=DisplayDashlet
             if ($type == 'orderBy') {
                 $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url);
             } else {
                 $this->lvs->data['pageData']['urls'][$type] = preg_replace('/(action=.*&)/Ui', 'action=DynamicAction&DynamicAction=displayDashlet&', $url) . '&sugar_body_only=1&id=' . $this->id;
             }
         }
         $this->lvs->ss->assign('dashletId', $this->id);
     }
 }
Exemple #19
0
 /**
  * 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');
 }