/** * Creates the output for the Venue view */ function display($tpl = null) { $settings = JemHelper::config(); $settings2 = JemHelper::globalattribs(); $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; if ($settings2->get('global_show_ical_icon', '0') == 1) { // Get data from the model $model = $this->getModel(); $model->setLimit($settings->ical_max_items); $model->setLimitstart(0); $rows = $model->getItems(); $venueid = $jinput->getInt('id'); // initiate new CALENDAR $vcal = JemHelper::getCalendarTool(); // $vcal->setProperty('unique_id', 'category'.$catid.'@'.$mainframe->getCfg('sitename')); $vcal->setConfig("filename", "venue" . $venueid . ".ics"); foreach ($rows as $row) { JemHelper::icalAddEvent($vcal, $row, $rows); } // generate and redirect output to user browser $vcal->returnCalendar(); } else { return; } }
/** * Creates the output for the Eventslist view */ function display($tpl = null) { $settings = JemHelper::config(); $settings2 = JemHelper::globalattribs(); if ($settings2->get('global_show_ical_icon','0')==1) { // Get data from the model $model = $this->getModel(); $model->setLimit($settings->ical_max_items); $model->setLimitstart(0); $rows = $model->getItems(); // initiate new CALENDAR $vcal = JemHelper::getCalendarTool(); $vcal->setConfig("filename", "events.ics"); if (!empty($rows)) { foreach ($rows as $row) { JemHelper::icalAddEvent($vcal, $row); } } // generate and redirect output to user browser $vcal->returnCalendar(); } else { return; } }
/** * Method to auto-populate the model state. * * Note. Calling getState in this method will result in recursion. */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); # it's needed to set the parent option parent::populateState('a.dates', 'asc'); }
/** * Creates the Calendar View */ function display($tpl = null) { $app = JFactory::getApplication(); //initialize variables $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JemHelper::config(); $params = $app->getParams(); $settings = JemHelper::globalattribs(); // Load css JemHelper::loadCss('calendar'); JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); $evlinkcolor = $params->get('eventlinkcolor'); $evbackgroundcolor = $params->get('eventbackgroundcolor'); $currentdaycolor = $params->get('currentdaycolor'); $eventandmorecolor = $params->get('eventandmorecolor'); $style = ' div[id^=\'catz\'] a {color:' . $evlinkcolor . ';} div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';} .eventcontent {background-color:' . $evbackgroundcolor . ';} .eventandmore {background-color:' . $eventandmorecolor . ';} .today .daynum {background-color:' . $currentdaycolor . ';}'; $this->document->addStyleDeclaration($style); // add javascript (using full path - see issue #590) JHtml::_('script', 'media/com_jem/js/calendar.js'); $rows = $this->get('Items'); $currentweek = $this->get('Currentweek'); $currentyear = Date("Y"); $showweeknr = $params->get('showweeknr', true); //Set Page title $pagetitle = $params->def('page_title', $menuitem->title); $params->def('page_heading', $pagetitle); $pageclass_sfx = $params->get('pageclass_sfx'); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } $this->document->setTitle($pagetitle); $this->document->setMetaData('title', $pagetitle); $cal = new activeCalendarWeek($currentyear, 1, 1); $cal->enableWeekNum(JText::_('COM_JEM_WKCAL_WEEK'), null, '', $showweeknr); // enables week number column with linkable week numbers $cal->setFirstWeekDay($params->get('firstweekday', 0)); $this->rows = $rows; $this->params = $params; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->currentweek = $currentweek; $this->cal = $cal; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); parent::display($tpl); }
public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } JHtml::_('behavior.framework'); JHtml::_('behavior.modal', 'a.modal'); JHtml::_('behavior.tooltip'); JHtml::_('behavior.formvalidation'); //initialise variables $jemsettings = JemHelper::config(); $document = JFactory::getDocument(); $user = JemFactory::getUser(); $this->settings = JemAdmin::config(); $task = JFactory::getApplication()->input->get('task', ''); $this->task = $task; $url = JUri::root(); $categories = JemCategories::getCategoriesTree(1); $selectedcats = $this->get('Catsselected'); $Lists = array(); $Lists['category'] = JemCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8"'); // Load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); // Load scripts JHtml::_('script', 'com_jem/attachments.js', false, true); JHtml::_('script', 'com_jem/recurrence.js', false, true); JHtml::_('script', 'com_jem/unlimited.js', false, true); JHtml::_('script', 'com_jem/seo.js', false, true); // JQuery noConflict //$document->addCustomTag('<script type="text/javascript">jQuery.noConflict();</script>'); //$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); //$document->addScript('http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js'); $access2 = JemHelper::getAccesslevelOptions(); $this->access = $access2; $this->jemsettings = $jemsettings; $this->Lists = $Lists; $this->addToolbar(); parent::display($tpl); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { # parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->get('task','','cmd'); $top_category = $params->get('top_category', 0); $startdayonly = $params->get('show_only_start', false); # params $this->setState('params', $params); # publish state $this->_populatePublishState($task); ########### ## DATES ## ########### #only select events within specified dates. (chosen month) $monthstart = mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date)); $monthend = mktime(0, 0, -1, strftime('%m', $this->_date)+1, 1, strftime('%Y', $this->_date)); $filter_date_from = $this->_db->Quote(strftime('%Y-%m-%d', $monthstart)); $filter_date_to = $this->_db->Quote(strftime('%Y-%m-%d', $monthend)); $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), '. $filter_date_from .') >= 0'; $this->setState('filter.calendar_from',$where); $where = ' DATEDIFF(a.dates, '. $filter_date_to .') <= 0'; $this->setState('filter.calendar_to',$where); ################## ## TOP-CATEGORY ## ################## if ($top_category) { $children = JEMCategories::getChilds($top_category); if (count($children)) { $where = 'rel.catid IN ('. implode(',', $children) .')'; $this->setState('filter.category_top', $where); } } # set filter $this->setState('filter.calendar_multiday',true); $this->setState('filter.calendar_startdayonly',(bool)$startdayonly); $this->setState('filter.groupby',array('a.id')); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { // parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->get('task', '', 'cmd'); // List state information /* in J! 3.3.6 limitstart is removed from request - but we need it! */ if ($app->input->getInt('limitstart', null) === null) { $app->setUserState('com_jem.venue.' . $itemid . '.limitstart', 0); } $limit = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'int'); $this->setState('list.limit', $limit); $limitstart = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limitstart', 'limitstart', 0, 'int'); // correct start value if required $limitstart = $limit ? (int) (floor($limitstart / $limit) * $limit) : 0; $this->setState('list.start', $limitstart); # Search $search = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $this->setState('filter.filter_search', $search); # FilterType $filtertype = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $this->setState('filter.filter_type', $filtertype); # filter_order $orderCol = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd'); $this->setState('filter.filter_ordering', $orderCol); # filter_direction // Changed order from ASC to DESC for showing all events $listOrder = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'DESC', 'word'); $this->setState('filter.filter_direction', $listOrder); # show open date events # (there is no menu item option yet so show all events) $this->setState('filter.opendates', 1); if ($orderCol == 'a.dates') { $orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder); } else { $orderby = $orderCol . ' ' . $listOrder; } $this->setState('filter.orderby', $orderby); # params $this->setState('params', $params); // Commented out to show all events // if ($task == 'archive') { // $this->setState('filter.published',2); // } else { // $this->setState('filter.published',1); // } $this->setState('filter.groupby', array('a.id')); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { # parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->getCmd('task'); # params $this->setState('params', $params); # publish state $this->setState('filter.published', 1); # access $this->setState('filter.access', true); ########### ## DATES ## ########### #only select events within specified dates. (chosen month) $monthstart = mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date)); $monthend = mktime(0, 0, -1, strftime('%m', $this->_date) + 1, 1, strftime('%Y', $this->_date)); $filter_date_from = $this->_db->Quote(strftime('%Y-%m-%d', $monthstart)); $filter_date_to = $this->_db->Quote(strftime('%Y-%m-%d', $monthend)); $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), ' . $filter_date_from . ') >= 0'; $this->setState('filter.calendar_from', $where); $where = ' DATEDIFF(a.dates, ' . $filter_date_to . ') <= 0'; $this->setState('filter.calendar_to', $where); ##################### ## FILTER-CATEGORY ## ##################### $catids = $params->get('catids'); $venids = $params->get('venueids'); $eventids = $params->get('eventids'); $catidsfilter = $params->get('catidsfilter'); $venidsfilter = $params->get('venueidsfilter'); $eventidsfilter = $params->get('eventidsfilter'); if ($catids) { $this->setState('filter.category_id', $catids); $this->setState('filter.category_id.include', $catidsfilter); } if ($venids) { $this->setState('filter.venue_id', $venids); $this->setState('filter.venue_id.include', $venidsfilter); } if ($eventids) { $this->setState('filter.event_id', $eventids); $this->setState('filter.event_id.include', $eventidsfilter); } # set filter $this->setState('filter.calendar_multiday', true); $this->setState('filter.groupby', array('a.id')); }
/** * Constructor */ public function __construct() { parent::__construct(); $app = JFactory::getApplication(); $jinput = $app->input; $jemsettings = JemHelper::config(); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $limit = $app->getUserStateFromRequest('com_jem.categoryelement.limit', 'limit', $jemsettings->display_num, 'int'); $limitstart = $jinput->getInt('limitstart'); $limitstart = $limit ? (int) (floor($limitstart / $limit) * $limit) : 0; $this->setState('limit', $limit); $this->setState('limitstart', $limitstart); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $params = $app->getParams(); $jinput = $app->input; $itemid = $jinput->getInt('Itemid', 0); $task = $jinput->getCmd('task', ''); $startdayonly = $params->get('show_only_start', false); # params $this->setState('params', $params); # publish state //$this->setState('filter.published', 1); $this->_populatePublishState($task); ########### ## DATES ## ########### #only select events within specified dates. (chosen month) $monthstart = mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date)); $monthend = mktime(0, 0, -1, strftime('%m', $this->_date)+1, 1, strftime('%Y', $this->_date)); $filter_date_from = strftime('%Y-%m-%d', $monthstart); $filter_date_to = strftime('%Y-%m-%d', $monthend); $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), '. $this->_db->Quote($filter_date_from) .') >= 0'; $this->setState('filter.calendar_from', $where); $where = ' DATEDIFF(a.dates, '. $this->_db->Quote($filter_date_to) .') <= 0'; $this->setState('filter.calendar_to', $where); # set filter $this->setState('filter.calendar_multiday', true); $this->setState('filter.calendar_startdayonly', (bool)$startdayonly); $this->setState('filter.filter_catid', $this->_id); $app->setUserState('com_jem.categorycal.catid'.$itemid, $this->_id); # groupby $this->setState('filter.groupby', array('a.id')); }
/** * Method override to check if you can add a new record. * * @param array An array of input data. * * @return boolean */ protected function allowAdd($data = array()) { // Initialise variables. $user = JFactory::getUser(); $jinput = JFactory::getApplication()->input; //$categoryId = JArrayHelper::getValue($data, 'catid', $jinput->getInt('catid'), 'int'); $allow = null; //if ($categoryId) { // // If the category has been passed in the data or URL check it. // $allow = $user->authorise('core.create', 'com_jem.category.'.$categoryId); //} $jemsettings = JemHelper::config(); $maintainer = JEMUser::venuegroups('add'); $delloclink = JEMUser::validate_user($jemsettings->locdelrec, $jemsettings->deliverlocsyes); if ($maintainer || $delloclink) { return true; } if ($allow === null) { // In the absense of better information, revert to the component permissions. return parent::allowAdd(); } else { return $allow; } }
public function display($tpl = null) { // Initialise variables. $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode("\n", $errors)); return false; } //initialise variables $jemsettings = JemHelper::config(); $document = JFactory::getDocument(); $user = JFactory::getUser(); $this->settings = JemAdmin::config(); $task = JFactory::getApplication()->input->get('task'); $this->task = $task; $url = JUri::root(); $categories = JemCategories::getCategoriesTree(1); $selectedcats = $this->get('Catsselected'); $Lists = array(); $Lists['category'] = JemCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, 'multiple="multiple" size="8"'); // Load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); // Load scripts JHtml::_('script', 'com_jem/attachments.js', false, true); JHtml::_('script', 'com_jem/recurrence.js', false, true); JHtml::_('script', 'com_jem/seo.js', false, true); JHtml::_('script', 'com_jem/slider-state.js', false, true); $this->access = JemHelper::getAccesslevelOptions(); $this->jemsettings = $jemsettings; $this->Lists = $Lists; $this->addToolbar(); parent::display($tpl); }
protected function populateState($ordering = null, $direction = null) { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); # limit/start $limit = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint'); $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); # Search $search = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $this->setState('filter.filter_search', $search); # FilterType $filtertype = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $this->setState('filter.filter_type', $filtertype); ########### ## ORDER ## ########### $filter_order = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.myattendances.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'string'); $filter_order = JFilterInput::getInstance()->clean($filter_order, 'string'); $filter_order_Dir = JFilterInput::getInstance()->clean($filter_order_Dir, 'string'); if ($filter_order == 'a.dates') { $orderby = array('a.dates ' . $filter_order_Dir, 'a.times ' . $filter_order_Dir); } else { $orderby = $filter_order . ' ' . $filter_order_Dir; } $this->setState('filter.orderby', $orderby); # params $params = $app->getParams(); $this->setState('params', $params); # groupby $this->setState('filter.groupby', array('a.id')); }
/** * contacts-query */ function buildQueryContacts() { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $filter_order = $app->getUserStateFromRequest('com_jem.selectcontact.filter_order', 'filter_order', 'con.ordering', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.selectcontact.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_order = JFilterInput::getinstance()->clean($filter_order, 'cmd'); $filter_order_Dir = JFilterInput::getinstance()->clean($filter_order_Dir, 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.selectcontact.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.selectcontact.filter_search', 'filter_search', '', 'string'); $search = $this->_db->escape(trim(JString::strtolower($search))); // Query $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select(array('con.*')); $query->from('#__contact_details As con'); // where $where = array(); $where[] = 'con.published = 1'; /* something to search for? (we like to search for "0" too) */ if ($search || $search === "0") { switch ($filter_type) { case 1: /* Search name */ $where[] = ' LOWER(con.name) LIKE \'%' . $search . '%\' '; break; case 2: /* Search address (not supported yet, privacy) */ //$where[] = ' LOWER(con.address) LIKE \'%' . $search . '%\' '; break; case 3: // Search city $where[] = ' LOWER(con.suburb) LIKE \'%' . $search . '%\' '; break; case 4: // Search state $where[] = ' LOWER(con.state) LIKE \'%' . $search . '%\' '; break; } } $query->where($where); // ordering // ensure it's a valid order direction (asc, desc or empty) if (!empty($filter_order_Dir) && strtoupper($filter_order_Dir) !== 'DESC') { $filter_order_Dir = 'ASC'; } if ($filter_order != '') { $orderby = $filter_order . ' ' . $filter_order_Dir; if ($filter_order != 'con.name') { $orderby = array($orderby, 'con.name'); // in case of city or state we should have a useful second ordering } } else { $orderby = 'con.name'; } $query->order($orderby); return $query; }
</h1> <?php endif; ?> <div class="clr"></div> <?php foreach ($this->rows as $row) : ?> <h2 class="jem cat<?php echo $row->id; ?>"> <?php echo JHtml::_('link', JRoute::_($row->linktarget), $this->escape($row->catname)); ?> </h2> <div class="floattext"> <?php if ($this->jemsettings->discatheader) { ?> <div class="catimg"> <?php // flyer if (empty($row->image)) { $jemsettings = JemHelper::config(); $imgattribs['width'] = $jemsettings->imagewidth; $imgattribs['height'] = $jemsettings->imagehight; echo JHtml::_('image', 'com_jem/noimage.png', $row->catname, $imgattribs, true); } else { $cimage = JemImage::flyercreator($row->image, 'category'); echo JemOutput::flyer($row, $cimage, 'category'); } ?> </div> <?php } ?> <div class="description cat<?php echo $row->id; ?>"> <?php echo $row->description; ?> <p> <?php echo JHtml::_('link', JRoute::_($row->linktarget), $row->linktext); ?>
/** * Formats the input dates and times to be used as a short from-to string for * events. Takes care of unset dates and or times. * * @param string $dateStart Start date of event * @param string $timeStart Start time of event * @param string $dateEnd End date of event * @param string $timeEnd End time of event * @return string Formatted date and time string to print */ static function formatShortDateTime($dateStart, $timeStart, $dateEnd = "", $timeEnd = "") { $settings = JemHelper::config(); // Use format saved in settings if specified or format in language file otherwise if(isset($settings->formatShortDate) && $settings->formatShortDate) { $format = $settings->formatShortDate; } else { $format = JText::_('COM_JEM_FORMAT_SHORT_DATE'); } if (isset($settings->datemode) && ($settings->datemode == 2)) { return self::formatDateTime2Lines($dateStart, $timeStart, $dateEnd, $timeEnd, $format); } else { return self::formatDateTime($dateStart, $timeStart, $dateEnd, $timeEnd, $format); } }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { // Initiliase variables. $app = JFactory::getApplication('site'); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $jinput = JFactory::getApplication()->input; $task = $jinput->getCmd('task'); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $pk = $jinput->getInt('id'); $this->setState('category.id', $pk); $this->setState('filter.req_catid', $pk); $global = new JRegistry(); $global->loadString($settings); $params = clone $global; $params->merge($global); if ($menu = $app->getMenu()->getActive()) { $params->merge($menu->params); } $this->setState('params', $params); $user = JFactory::getUser(); // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); $groups = implode(',', $user->getAuthorisedViewLevels()); # limit/start $limit = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint'); $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); # Search - variables $search = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $this->setState('filter.filter_search', $search); $filtertype = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $this->setState('filter.filter_type', $filtertype); # publish state if ($task == 'archive') { $this->setState('filter.published', 2); } else { # we've to check if the setting for the filter has been applied if ($params->get('global_show_archive_icon')) { $this->setState('filter.published', 1); } else { # retrieve the status to be displayed switch ($params->get('global_show_eventstatus')) { case 0: $status = 1; break; case 1: $status = 2; break; case 2: $status = array(1, 2); break; default: $status = 1; } $this->setState('filter.published', $status); } } ############### ## opendates ## ############### $this->setState('filter.opendates', $params->get('showopendates', 0)); ########### ## ORDER ## ########### # retrieve default sortDirection + sortColumn $sortDir = strtoupper($params->get('sortDirection')); $sortDirArchive = strtoupper($params->get('sortDirectionArchive')); $sortCol = $params->get('sortColumn'); $direction = array('DESC', 'ASC'); if (!in_array($sortCol, $this->filter_fields)) { $sortCol = 'a.dates'; } if (!in_array($sortDir, $direction)) { $sortDir = 'ASC'; } if (!in_array($sortDirArchive, $direction)) { $sortDirArchive = 'DESC'; } $filter_order = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order', 'filter_order', $sortCol, 'cmd'); $filter_order_DirDefault = $sortDir; // Reverse default order for dates in archive mode if ($task == 'archive' && $filter_order == 'a.dates') { $filter_order_DirDefault = $sortDirArchive; } $filter_order_Dir = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word'); $filter_order = JFilterInput::getInstance()->clean($filter_order, 'string'); $filter_order_Dir = JFilterInput::getInstance()->clean($filter_order_Dir, 'string'); if ($filter_order == 'a.dates') { $orderby = array('a.dates ' . $filter_order_Dir, 'a.times ' . $filter_order_Dir); } else { $orderby = $filter_order . ' ' . $filter_order_Dir; } $this->setState('filter.orderby', $orderby); $this->setState('filter.access', true); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { # parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->getCmd('task'); $top_category = $params->get('top_category', 0); $startdayonly = $params->get('show_only_start', false); $numberOfWeeks = $params->get('nrweeks', '1'); $firstweekday = $params->get('firstweekday', 1); # params $this->setState('params', $params); # publish state $this->setState('filter.published', 1); # access $this->setState('filter.access', true); ########### ## DATES ## ########### #only select events within specified dates. (chosen weeknrs) $config = JFactory::getConfig(); $offset = $config->get('offset'); $year = date('Y'); date_default_timezone_set($offset); $datetime = new DateTime(); $datetime->setISODate($year, $datetime->format("W"), 7); if ($firstweekday == 1) { if (date('N', time()) == 1) { #it's monday and monday is startdate; $filter_date_from = $datetime->modify('-6 day'); $filter_date_from = $datetime->format('Y-m-d') . "\n"; $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day'); $filter_date_to = $datetime->format('Y-m-d') . "\n"; } else { # it's not monday but monday is startdate; $filter_date_from = $datetime->modify('-6 day'); $filter_date_from = $datetime->format('Y-m-d') . "\n"; $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day'); $filter_date_to = $datetime->format('Y-m-d') . "\n"; } } if ($firstweekday == 0) { if (date('N', time()) == 7) { #it's sunday and sunday is startdate; $filter_date_from = $datetime->format('Y-m-d') . "\n"; $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day'); $filter_date_to = $datetime->format('Y-m-d') . "\n"; } else { #it's not sunday and sunday is startdate; $filter_date_from = $datetime->modify('-7 day'); $filter_date_from = $datetime->format('Y-m-d') . "\n"; $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks'); $filter_date_to = $datetime->format('Y-m-d') . "\n"; } } $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), \'' . $filter_date_from . '\') >= 0'; $this->setState('filter.calendar_from', $where); $where = ' DATEDIFF(a.dates, \'' . $filter_date_to . '\') <= 0'; $this->setState('filter.calendar_to', $where); ################## ## TOP-CATEGORY ## ################## if ($top_category) { $children = JEMCategories::getChilds($top_category); if (count($children)) { $where = 'rel.catid IN (' . implode(',', $children) . ')'; $this->setState('filter.category_top', $where); } } $this->setState('filter.groupby', 'a.id'); $this->setState('filter.calendar_startdayonly', $startdayonly); }
/** * Creates the Venue View */ function display($tpl = null) { if ($this->getLayout() == 'calendar') { ### Venue Calendar view ### $app = JFactory::getApplication(); // Load tooltips behavior JHtml::_('behavior.tooltip'); // initialize variables $document = JFactory::getDocument(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JEMHelper::config(); $params = $app->getParams(); $uri = JFactory::getURI(); $pathway = $app->getPathWay(); $jinput = $app->input; $print = $jinput->getBool('print', false); $user = JemFactory::getUser(); // Load css JemHelper::loadCss('jem'); JemHelper::loadCss('calendar'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } $evlinkcolor = $params->get('eventlinkcolor'); $evbackgroundcolor = $params->get('eventbackgroundcolor'); $currentdaycolor = $params->get('currentdaycolor'); $eventandmorecolor = $params->get('eventandmorecolor'); $style = ' div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';} .eventcontentinner {background-color:'.$evbackgroundcolor .';} .eventandmore {background-color:' . $eventandmorecolor . ';} .today .daynum {background-color:' . $currentdaycolor . ';}'; $document->addStyleDeclaration ($style); // add javascript (using full path - see issue #590) JHtml::_('script', 'media/com_jem/js/calendar.js'); // Retrieve year/month variables $year = $jinput->get('yearID', strftime("%Y"),'int'); $month = $jinput->get('monthID', strftime("%m"),'int'); // get data from model and set the month $model = $this->getModel('VenueCal'); $model->setDate(mktime(0, 0, 1, $month, 1, $year)); $rows = $this->get('Items','VenueCal'); // Set Page title $pagetitle = $params->def('page_title', $menuitem->title); $params->def('page_heading', $params->get('page_title')); $pageclass_sfx = $params->get('pageclass_sfx'); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } $document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event'); $permissions->canAddVenue = $user->can('add', 'venue'); $itemid = $jinput->getInt('Itemid', 0); $venueID = $jinput->getInt('id', $params->get('id')); $partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : ''; $partVenid = ($venueID > 0) ? '&id=' . $venueID : ''; $partLocid = ($venueID > 0) ? '&locid=' . $venueID : ''; $partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : ''); $url_base = 'index.php?option=com_jem&view=venue&layout=calendar' . $partVenid . $partItemid; $print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component'); // init calendar $cal = new JEMCalendar($year, $month, 0); $cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : '')); $cal->setFirstWeekDay($params->get('firstweekday',1)); $cal->enableDayLinks('index.php?option=com_jem&view=day'.$partLocid); // map variables $this->rows = $rows; $this->locid = $venueID; $this->params = $params; $this->jemsettings = $jemsettings; $this->permissions = $permissions; $this->cal = $cal; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print_link = $print_link; } else { ### Venue List view ### // initialize variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $params = $app->getParams('com_jem'); $pathway = $app->getPathWay (); $uri = JFactory::getURI(); $jinput = $app->input; $task = $jinput->getCmd('task', ''); $print = $jinput->getBool('print', false); $user = JemFactory::getUser(); $itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // get data from model $rows = $this->get('Items'); $venue = $this->get('Venue'); // check for data error if (empty($venue)) { $app->enqueueMessage(JText::_('COM_JEM_VENUE_ERROR_VENUE_NOT_FOUND'), 'error'); return false; } // are events available? $noevents = (!$rows) ? 1 : 0; // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'venue' && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default') && $menuitem->query['id'] == $venue->id); // get search & user-state variables $filter_order = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_DirDefault = 'ASC'; // Reverse default order for dates in archive mode if($task == 'archive' && $filter_order == 'a.dates') { $filter_order_DirDefault = 'DESC'; } $filter_order_Dir = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.venue.'.$itemid.'.filter_search', 'filter_search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // Get image $limage = JemImage::flyercreator($venue->locimage,'venue'); // Add feed links $link = '&format=feed&id='.$venue->id.'&limitstart='; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs); // pathway, page title, page heading if ($useMenuItemParams) { $pagetitle = $params->get('page_title', $menuitem->title ? $menuitem->title : $venue->venue); $pageheading = $params->get('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { $pagetitle = $venue->venue; $pageheading = $pagetitle; $params->set('show_page_heading', 1); // ensure page heading is shown $pathway->addItem($pagetitle, JRoute::_(JemHelperRoute::getVenueRoute($venue->slug))); } $pageclass_sfx = $params->get('pageclass_sfx'); // create the pathway if ($task == 'archive') { $pathway->addItem (JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&task=archive')); $print_link = JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug).'&task=archive&print=1&tmpl=component'); $pagetitle .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE'); } else { //$pathway->addItem($venue->venue, JRoute::_(JEMHelperRoute::getVenueRoute($venue->slug))); $print_link = JRoute::_(JemHelperRoute::getVenueRoute($venue->slug).'&print=1&tmpl=component'); } $params->set('page_heading', $pageheading); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } // set Page title & Meta data $document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); $document->setMetadata('keywords', $venue->meta_keywords); $document->setDescription(strip_tags($venue->meta_description)); // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event'); $permissions->canAddVenue = $user->can('add', 'venue'); // Check if the user has permission to edit-this venue $permissions->canEditVenue = $user->can('edit', 'venue', $venue->id, $venue->created_by); $permissions->canEditPublishVenue = $user->can(array('edit', 'publish'), 'venue', $venue->id, $venue->created_by); // Generate Venuedescription if (!$venue->locdescription == '' || !$venue->locdescription == '<br />') { // execute plugins $venue->text = $venue->locdescription; $venue->title = $venue->venue; JPluginHelper::importPlugin ('content'); $app->triggerEvent ('onContentPrepare', array ( 'com_jem.venue', &$venue, &$params, 0 )); $venuedescription = $venue->text; } // build the url if (!empty($venue->url) && !preg_match('%^http(s)?://%', $venue->url)) { $venue->url = 'http://' . $venue->url; } // prepare the url for output if (strlen($venue->url) > 35) { $venue->urlclean = $this->escape(substr($venue->url, 0, 35 )) . '...'; } else { $venue->urlclean = $this->escape($venue->url); } // create flag if ($venue->country) { $venue->countryimg = JemHelperCountries::getCountryFlag($venue->country); } // Create the pagination object $pagination = $this->get('Pagination'); // filters $filters = array (); // ALL events have the same venue - so hide this from filter and list $jemsettings->showlocate = 0; if ($jemsettings->showtitle == 1) { $filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE')); } if ($jemsettings->showlocate == 1) { $filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE')); } if ($jemsettings->showcity == 1) { $filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY')); } if ($jemsettings->showcat == 1) { $filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY')); } if ($jemsettings->showstate == 1) { $filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type); $lists['search'] = $search; // mapping variables $this->lists = $lists; $this->action = $uri->toString(); $this->rows = $rows; $this->noevents = $noevents; $this->venue = $venue; $this->print_link = $print_link; $this->params = $params; $this->limage = $limage; $this->venuedescription = $venuedescription; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->permissions = $permissions; $this->show_status = $permissions->canEditPublishVenue; $this->item = $menuitem; $this->pagetitle = $pagetitle; $this->task = $task; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); } parent::display($tpl); }
/** * Method to get the events * * @access public * @return array */ public static function getList(&$params) { mb_internal_encoding('UTF-8'); // Retrieve Eventslist model for the data $model = JModelLegacy::getInstance('Eventslist', 'JemModel', array('ignore_request' => true)); // Set params for the model // has to go before the getItems function $model->setState('params', $params); $model->setState('filter.access', true); # filter published # 0: unpublished # 1: published # 2: archived # -2: trashed $type = $params->get('type'); # archived events if ($type == 2) { $model->setState('filter.published', 2); $model->setState('filter.orderby', array('a.dates DESC', 'a.times DESC')); $cal_from = ""; } else { $model->setState('filter.published', 1); $model->setState('filter.orderby', array('a.dates ASC', 'a.times ASC')); $offset_minutes = 60 * $params->get('offset_hours', 0); $cal_from = "((TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(a.dates,' ',IFNULL(a.times,'00:00:00'))) > {$offset_minutes}) "; $cal_from .= $type == 1 ? " OR (TIMESTAMPDIFF(MINUTE, NOW(), CONCAT(IFNULL(a.enddates,a.dates),' ',IFNULL(a.endtimes,'23:59:59'))) > {$offset_minutes})) " : ") "; } $model->setState('filter.calendar_from', $cal_from); $model->setState('filter.groupby', 'a.id'); # clean parameter data $catids = $params->get('catid'); $venids = $params->get('venid'); $eventids = $params->get('eventid'); # filter category's if ($catids) { $model->setState('filter.category_id', $catids); $model->setState('filter.category_id.include', true); } # filter venue's if ($venids) { $model->setState('filter.venue_id', $venids); $model->setState('filter.venue_id.include', true); } # filter event id's if ($eventids) { $model->setState('filter.event_id', $eventids); $model->setState('filter.event_id.include', true); } # count $count = $params->get('count', '2'); $model->setState('list.limit', $count); # Retrieve the available Events $events = $model->getItems(); # do we have $events? if (!$events) { return array(); } # Loop through the result rows and prepare data $i = 0; $lists = array(); $maxlength = $params->get('cuttitle', '18'); $settings = JemHelper::config(); $dateformat = $params->get('formatdate', $settings->formatShortDate); foreach ($events as $row) { //cut titel $length = mb_strlen($row->title); if ($length > $maxlength && $maxlength > 0) { $row->title = mb_substr($row->title, 0, $maxlength); $row->title = $row->title . '...'; } $lists[$i] = new stdClass(); $lists[$i]->link = JRoute::_(JEMHelperRoute::getEventRoute($row->slug)); $lists[$i]->dateinfo = JEMOutput::formatDateTime($row->dates, $row->times, $row->enddates, $row->endtimes, $dateformat); $lists[$i]->text = $params->get('showtitloc', 0) ? $row->title : htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->venue = htmlspecialchars($row->venue, ENT_COMPAT, 'UTF-8'); $lists[$i]->city = htmlspecialchars($row->city, ENT_COMPAT, 'UTF-8'); $lists[$i]->venueurl = !empty($row->venueslug) ? JRoute::_(JEMHelperRoute::getVenueRoute($row->venueslug)) : null; $i++; } return $lists; }
/** * Creates the Day View */ function display($tpl = null) { // Initialize variables $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $document = JFactory::getDocument(); $params = $app->getParams(); $uri = JFactory::getURI(); $jinput = $app->input; $task = $jinput->getCmd('task', ''); $print = $jinput->getBool('print', false); $pathway = $app->getPathWay(); $user = JemFactory::getUser(); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'day' && !isset($menuitem->query['id'])); // Retrieving data $requestVenueId = $jinput->getInt('locid', 0); $requestCategoryId = $jinput->getInt('catid', 0); $requestDate = $jinput->getInt('id', 0); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // get variables $filter_order = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_search', 'filter_search', '', 'string'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // Get data from model $rows = $this->get('Items'); $day = $this->get('Day'); $daydate = JemOutput::formatdate($day); $showdaydate = true; // show by default // Are events available? $noevents = (!$rows) ? 1 : 0; // Show page heading specified on menu item or TODAY as heading - idea taken from com_content. if ($useMenuItemParams) { $pagetitle = $params->get('page_title', $menuitem->title); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { // TODO: If we can integrate $daydate into page_heading we should set $showdaydate to false. $pagetitle = JText::_('COM_JEM_DEFAULT_PAGE_TITLE_DAY'); $params->set('page_heading', $pagetitle); $pathway->addItem($pagetitle); } $pageclass_sfx = $params->get('pageclass_sfx'); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } // Set Page title $document->setTitle($pagetitle); if ($requestVenueId){ $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&locid='.$requestVenueId.'&id='.$requestDate); } elseif ($requestCategoryId){ $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&catid='.$requestCategoryId.'&id='.$requestDate); } else /*(!$requestCategoryId && !$requestVenueId)*/ { $print_link = JRoute::_('index.php?option=com_jem&view=day&tmpl=component&print=1&id='.$requestDate); } // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event'); $permissions->canAddVenue = $user->can('add', 'venue'); // add alternate feed link (w/o specific date) $link = 'index.php?option=com_jem&view=day&format=feed'; $attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0'); $document->addHeadLink(JRoute::_($link.'&type=rss'), 'alternate', 'rel', $attribs); $attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0'); $document->addHeadLink(JRoute::_($link.'&type=atom'), 'alternate', 'rel', $attribs); // search filter $filters = array(); if ($jemsettings->showtitle == 1) { $filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE')); } if ($jemsettings->showlocate == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE')); } if ($jemsettings->showcity == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY')); } if ($jemsettings->showcat == 1 && !($requestCategoryId)) { $filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY')); } if ($jemsettings->showstate == 1 && !($requestVenueId)) { $filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type); $lists['search'] = $search; // Create the pagination object $pagination = $this->get('Pagination'); $this->lists = $lists; $this->rows = $rows; $this->noevents = $noevents; $this->print_link = $print_link; $this->params = $params; $this->dellink = $permissions->canAddEvent; // deprecated $this->pagination = $pagination; $this->action = $uri->toString(); $this->task = $task; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->permissions = $permissions; $this->daydate = $daydate; $this->showdaydate = $showdaydate; // if true daydate will be shown as h2 sub heading $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); // Doesn't really help - each view has less or more specific needs. //$this->prepareDocument(); parent::display($tpl); }
/** * Creates the Myvenues View */ function display($tpl = null) { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; //initialize variables $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $app->getParams(); $uri = JFactory::getURI(); $user = JFactory::getUser(); $pathway = $app->getPathWay(); $db = JFactory::getDBO(); //redirect if not logged in if (!$user->get('id')) { $app->enqueueMessage(JText::_('COM_JEM_NEED_LOGGED_IN'), 'error'); return false; } // Decide which parameters should take priority $useMenuItemParams = $menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'myvenues'; // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomTag(); $venues = $this->get('Venues'); $venues_pagination = $this->get('VenuesPagination'); //are venues available? if (!$venues) { $novenues = 1; } else { $novenues = 0; } // get variables $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $filter_order = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_order', 'filter_order', 'l.venue', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.myvenues.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $search = $db->escape(trim(JString::strtolower($search))); $task = $jinput->getCmd('task'); //search filter $filters = array(); // Workaround issue #557: Show venue name always. $jemsettings->showlocate = 1; if ($jemsettings->showlocate == 1) { $filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE')); } if ($jemsettings->showcity == 1) { $filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size' => '1', 'class' => 'inputbox'), 'value', 'text', $filter_type); // search filter $lists['search'] = $search; // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //pathway if ($menuitem) { $pathway->setItemName(1, $menuitem->title); } //Set Page title $pagetitle = JText::_('COM_JEM_MY_VENUES'); $pageheading = $pagetitle; // Check to see which parameters should take priority if ($useMenuItemParams) { // Menu item params take priority $params->def('page_title', $menuitem->title); $pagetitle = $params->get('page_title', JText::_('COM_JEM_MY_VENUES')); $pageheading = $params->get('page_heading', $pagetitle); } $pageclass_sfx = $params->get('pageclass_sfx'); $params->set('page_heading', $pageheading); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } $document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); $this->action = $uri->toString(); $this->venues = $venues; $this->task = $task; $this->params = $params; $this->venues_pagination = $venues_pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->pagetitle = $pagetitle; $this->lists = $lists; $this->novenues = $novenues; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); parent::display($tpl); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { # parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->getCmd('task', ''); $requestVenueId = $jinput->getInt('locid', 0); $requestCategoryId = $jinput->getInt('catid', 0); $item = $jinput->getInt('Itemid', 0); $locid = $app->getUserState('com_jem.venuecal.locid'.$item); if ($locid) { $this->setstate('filter.filter_locid',$locid); } // maybe list of venue ids from calendar module $locids = explode(',', $jinput->getString('locids', '')); foreach ($locids as $id) { if ((int)$id > 0) { $venues[] = (int)$id; } } if (!empty($venues)) { $this->setstate('filter.venue_id', $venues); $this->setstate('filter.venue_id.include', true); } $cal_category_catid = $app->getUserState('com_jem.categorycal.catid'.$item); if ($cal_category_catid) { $this->setState('filter.req_catid',$cal_category_catid); } // maybe list of venue ids from calendar module $catids = explode(',', $jinput->getString('catids', '')); foreach ($catids as $id) { if ((int)$id > 1) { // don't accept 'root' $cats[] = (int)$id; } } if (!empty($cats)) { $this->setstate('filter.category_id', $cats); $this->setstate('filter.category_id.include', true); } // maybe top category is given by calendar view $top_category = $jinput->getInt('topcat', 0); if ($top_category > 0) { // accept 'root' $children = JEMCategories::getChilds($top_category); if (count($children)) { $where = 'rel.catid IN ('. implode(',', $children) .')'; $this->setState('filter.category_top', $where); } } # limit/start /* in J! 3.3.6 limitstart is removed from request - but we need it! */ if ($app->input->getInt('limitstart', null) === null) { $app->setUserState('com_jem.day.'.$itemid.'.limitstart', 0); } $limit = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.limit', 'limit', $jemsettings->display_num, 'int'); $this->setState('list.limit', $limit); $limitstart = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.limitstart', 'limitstart', 0, 'int'); $limitstart = $limit ? (int)(floor($limitstart / $limit) * $limit) : 0; $this->setState('list.start', $limitstart); # Search $search = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_search', 'filter_search', '', 'string'); $this->setState('filter.filter_search', $search); # FilterType $filtertype = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_type', 'filter_type', '', 'int'); $this->setState('filter.filter_type', $filtertype); # filter_order $orderCol = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd'); $this->setState('filter.filter_ordering', $orderCol); # filter_direction $listOrder = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $this->setState('filter.filter_direction', $listOrder); if ($orderCol == 'a.dates') { $orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder); } else { $orderby = $orderCol . ' ' . $listOrder; } $this->setState('filter.orderby', $orderby); # params $this->setState('params', $params); # published /// @todo bring given pub together with eventslist's unpub calculation (_populatePublishState()) $pub = explode(',', $jinput->getString('pub', '')); $published = array(); // sanitize remote data foreach ($pub as $val) { if (((int)$val >= 1) && ((int)$val <= 2)) { $published[] = (int)$val; } } // default to 'published' if (empty($published)) { //$published[] = 1; $this->_populatePublishState($task); } else { $this->setState('filter.published', $published); } # request venue-id if ($requestVenueId) { $this->setState('filter.req_venid',$requestVenueId); } # request cat-id if ($requestCategoryId) { $this->setState('filter.req_catid',$requestCategoryId); } # groupby $this->setState('filter.groupby',array('a.id')); }
/** * Method to auto-populate the model state. */ protected function populateState($ordering = null, $direction = null) { // parent::populateState($ordering, $direction); $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $jinput = JFactory::getApplication()->input; $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $params = $app->getParams(); $task = $jinput->getCmd('task'); $global = new JRegistry(); $global->loadString($settings); $params = clone $global; $params->merge($global); if ($menu = $app->getMenu()->getActive()) { $params->merge($menu->params); } $this->setState('params', $params); # limit $limit = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint'); $this->setState('list.limit', $limit); $limitstart = $app->input->get('limitstart', 0, 'uint'); $this->setState('list.start', $limitstart); # Search $search = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $this->setState('filter.filter_search', $search); # FilterType $filtertype = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $this->setState('filter.filter_type', $filtertype); # filter_order $orderCol = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd'); $this->setState('filter.filter_ordering', $orderCol); # filter_direction $listOrder = $app->getUserStateFromRequest('com_jem.venue.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word'); $this->setState('filter.filter_direction', $listOrder); if ($orderCol == 'a.dates') { $orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder); } else { $orderby = $orderCol . ' ' . $listOrder; } $this->setState('filter.orderby', $orderby); # publish state if ($task == 'archive') { $this->setState('filter.published', 2); } else { # we've to check if the setting for the filter has been applied if ($params->get('global_show_archive_icon')) { $this->setState('filter.published', 1); } else { # retrieve the status to be displayed switch ($params->get('global_show_eventstatus')) { case 0: $status = 1; break; case 1: $status = 2; break; case 2: $status = array(1, 2); break; default: $status = 1; } $this->setState('filter.published', $status); } } $this->setState('filter.access', true); $this->setState('filter.groupby', array('a.id')); }
/** * Calendar-View */ function display($tpl = null) { $app = JFactory::getApplication(); // Load tooltips behavior JHtml::_('behavior.tooltip'); JHtml::_('behavior.framework'); // initialize variables $document = JFactory::getDocument(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JemHelper::config(); $user = JemFactory::getUser(); $params = $app->getParams(); $top_category = (int)$params->get('top_category', 0); $jinput = $app->input; $print = $jinput->getBool('print', false); $this->param_topcat = $top_category > 0 ? ('&topcat='.$top_category) : ''; // Load css JemHelper::loadCss('jem'); JemHelper::loadCss('calendar'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } $evlinkcolor = $params->get('eventlinkcolor'); $evbackgroundcolor = $params->get('eventbackgroundcolor'); $currentdaycolor = $params->get('currentdaycolor'); $eventandmorecolor = $params->get('eventandmorecolor'); $style = ' div#jem .eventcontentinner a, div#jem .eventandmore a { color:' . $evlinkcolor . '; } .eventcontentinner { background-color:'.$evbackgroundcolor .'; } .eventandmore { background-color:'.$eventandmorecolor .'; } .today .daynum { background-color:'.$currentdaycolor.'; }'; $document->addStyleDeclaration($style); // add javascript (using full path - see issue #590) JHtml::_('script', 'media/com_jem/js/calendar.js'); $year = (int)$jinput->getInt('yearID', strftime("%Y")); $month = (int)$jinput->getInt('monthID', strftime("%m")); // get data from model and set the month $model = $this->getModel(); $model->setDate(mktime(0, 0, 1, $month, 1, $year)); $rows = $this->get('Items'); // Set Page title $pagetitle = $params->def('page_title', $menuitem->title); $params->def('page_heading', $pagetitle); $pageclass_sfx = $params->get('pageclass_sfx'); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } $document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); // Check if the user has permission to add things $permissions = new stdClass(); $catIds = $model->getCategories('all'); $permissions->canAddEvent = $user->can('add', 'event', false, false, $catIds); $permissions->canAddVenue = $user->can('add', 'venue', false, false, $catIds); $itemid = $jinput->getInt('Itemid', 0); $partItemid = ($itemid > 0) ? '&Itemid=' . $itemid : ''; $partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : ''); $url_base = 'index.php?option=com_jem&view=calendar' . $partItemid; $print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component'); // init calendar $cal = new JEMCalendar($year, $month, 0); $cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : '')); $cal->setFirstWeekDay($params->get('firstweekday', 1)); $cal->enableDayLinks('index.php?option=com_jem&view=day' . $this->param_topcat); $this->rows = $rows; $this->catIds = $catIds; $this->params = $params; $this->jemsettings = $jemsettings; $this->permissions = $permissions; $this->cal = $cal; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print_link = $print_link; parent::display($tpl); }
/** * Creates the Categories-View */ function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $user = JemFactory::getUser(); $print = $app->input->getBool('print', false); $task = $app->input->getCmd('task', ''); $id = $app->input->getInt('id', 1); $model = $this->getModel(); $rows = $this->get('Data'); $pagination = $this->get('Pagination'); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // get menu information $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $app->getParams('com_jem'); $pagetitle = $params->def('page_title', $menuitem->title); $pageheading = $params->def('page_heading', $params->get('page_title')); $pageclass_sfx = $params->get('pageclass_sfx'); // pathway $pathway = $app->getPathWay(); if ($menuitem) { $pathway->setItemName(1, $menuitem->title); } if ($task == 'archive') { $pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_('index.php?option=com_jem&view=categories&id='.$id.'&task=archive')); $print_link = JRoute::_('index.php?option=com_jem&view=categories&id='.$id.'&task=archive&print=1&tmpl=component'); $pagetitle .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $params->set('page_heading', $pageheading); } else { $print_link = JRoute::_('index.php?option=com_jem&view=categories&id='.$id.'&print=1&tmpl=component'); } // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } // Set Page title $document->setTitle($pagetitle); $document->setMetaData('title' , $pagetitle); // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event'); $permissions->canAddVenue = $user->can('add', 'venue'); // Get events if requested if (!empty($rows) && $params->get('detcat_nr', 0) > 0) { foreach($rows as $row) { $row->events = $model->getEventdata($row->id); } } $this->rows = $rows; $this->task = $task; $this->params = $params; $this->dellink = $permissions->canAddEvent; // deprecated $this->pagination = $pagination; $this->item = $menuitem; $this->jemsettings = $jemsettings; $this->pagetitle = $pagetitle; $this->print_link = $print_link; $this->model = $model; $this->id = $id; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->permissions = $permissions; parent::display($tpl); }
/** * Editvenue-View */ public function display($tpl = null) { // Initialise variables. $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $app = JFactory::getApplication(); $user = JemFactory::getUser(); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $url = JUri::root(); $language = JFactory::getLanguage(); $language = $language->getTag(); $language = substr($language, 0,2); // Get model data. $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->params = $this->state->get('params'); // Create a shortcut for $item and params. $item = $this->item; $params = $this->params; $this->form = $this->get('Form'); $this->return_page = $this->get('ReturnPage'); // check for data error if (empty($item)) { $app->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return false; } // check for guest if (!$user || $user->id == 0) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } if (empty($item->id)) { // Check if the user has access to the form $authorised = $user->can('add', 'venue'); } else { // Check if user can edit $authorised = $user->can('edit', 'venue', $item->id, $item->created_by); } if ($authorised !== true) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'editvenue' && 0 == $item->id); // menu item is always for new venues $title = ($item->id == 0) ? JText::_('COM_JEM_EDITVENUE_VENUE_ADD') : JText::sprintf('COM_JEM_EDITVENUE_VENUE_EDIT', $item->venue); if ($useMenuItemParams) { $pagetitle = $menuitem->title ? $menuitem->title : $title; $params->def('page_title', $pagetitle); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $pagetitle); // Load layout from menu item if one is set else from venue if there is one set if (isset($menuitem->query['layout'])) { $this->setLayout($menuitem->query['layout']); } elseif ($layout = $item->params->get('venue_layout')) { $this->setLayout($layout); } $item->params->merge($params); } else { $pagetitle = $title; $params->set('page_title', $pagetitle); $params->set('page_heading', $pagetitle); $params->set('show_page_heading', 1); // ensure page heading is shown $params->set('introtext', ''); // there is no introtext in that case $params->set('showintrotext', 0); $pathway->addItem($pagetitle, ''); // link not required here so '' is ok // Check for alternative layouts (since we are not in an edit-venue menu item) // Load layout from venue if one is set if ($layout = $item->params->get('venue_layout')) { $this->setLayout($layout); } $temp = clone($params); $temp->merge($item->params); $item->params = $temp; } $publisher = $user->can('publish', 'venue', $item->id, $item->created_by); if (!empty($this->item) && isset($this->item->id)) { // $this->item->images = json_decode($this->item->images); // $this->item->urls = json_decode($this->item->urls); $tmp = new stdClass(); // $tmp->images = $this->item->images; // $tmp->urls = $this->item->urls; $this->form->bind($tmp); } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } JHtml::_('behavior.framework'); JHtml::_('behavior.formvalidation'); JHtml::_('behavior.tooltip'); $access2 = JemHelper::getAccesslevelOptions(true); $this->access = $access2; // Load css JemHelper::loadCss('geostyle'); JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); // Load script JHtml::_('script', 'com_jem/attachments.js', false, true); JHtml::_('script', 'com_jem/other.js', false, true); $document->addScript('http://maps.googleapis.com/maps/api/js?sensor=false&libraries=places&language='.$language); // Noconflict $document->addCustomTag( '<script type="text/javascript">jQuery.noConflict();</script>' ); // JQuery scripts $document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); JHtml::_('script', 'com_jem/jquery.geocomplete.js', false, true); // No permissions required/useful on this view $permissions = new stdClass(); $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->jemsettings = $jemsettings; $this->settings = $settings; $this->permissions = $permissions; $this->limage = JemImage::flyercreator($this->item->locimage, 'venue'); $this->infoimage = JHtml::_('image', 'com_jem/icon-16-hint.png', JText::_('COM_JEM_NOTES'), NULL, true); $this->user = $user; if (!$publisher) { $this->form->setFieldAttribute('published', 'default', 0); $this->form->setFieldAttribute('published', 'readonly', 'true'); } $this->_prepareDocument(); parent::display($tpl); }
/** * Method to get a pagination object * * @access public * @return integer */ function getPagination() { $jemsettings = JemHelper::config(); $app = JFactory::getApplication(); $limit = $this->getState('limit'); $limitstart = $this->getState('limitstart'); $query = $this->buildQuery(); $total = $this->_getListCount($query); // Create the pagination object jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); return $pagination; }
/** * Method to get a pagination object * * @access public * @return integer */ function getPagination() { $app = JFactory::getApplication(); $jemsettings = JemHelper::config(); $limit = $app->getUserStateFromRequest('com_jem.userelement.limit', 'limit', $jemsettings->display_num, 'int'); $limitstart = $app->input->getInt('limitstart', 0); $query = $this->buildQuery(); $total = $this->_getListCount($query); // Create the pagination object jimport('joomla.html.pagination'); $pagination = new JPagination($total, $limitstart, $limit); return $pagination; }
/** * Creates the Simple List View */ function display($tpl = null) { // initialize variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $app->getParams(); $uri = JFactory::getURI(); $pathway = $app->getPathWay(); $user = JemFactory::getUser(); // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'search'); // add javascript JHtml::_('behavior.framework'); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); // Load Script JHtml::_('script', 'com_jem/search.js', false, true); $filter_continent = $app->getUserStateFromRequest('com_jem.search.filter_continent', 'filter_continent', '', 'string'); $filter_country = $app->getUserStateFromRequest('com_jem.search.filter_country', 'filter_country', '', 'string'); $filter_city = $app->getUserStateFromRequest('com_jem.search.filter_city', 'filter_city', '', 'string'); $filter_date_from = $app->getUserStateFromRequest('com_jem.search.filter_date_from', 'filter_date_from', '', 'string'); $filter_date_to = $app->getUserStateFromRequest('com_jem.search.filter_date_to', 'filter_date_to', '', 'string'); $filter_category = $app->getUserStateFromRequest('com_jem.search.filter_category', 'filter_category', 0, 'int'); $task = $app->input->get('task', ''); // get data from model $rows = $this->get('Data'); // are events available? $noevents = (!$rows) ? 1 : 0; // Check to see which parameters should take priority if ($useMenuItemParams) { // Menu item params take priority $pagetitle = $params->def('page_title', $menuitem ? $menuitem->title : JText::_('COM_JEM_SEARCH')); $pageheading = $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { $pagetitle = JText::_('COM_JEM_SEARCH'); $pageheading = $pagetitle; $params->set('introtext', ''); // there is no introtext in that case $params->set('showintrotext', 0); $pathway->addItem(1, $pagetitle); } $pageclass_sfx = $params->get('pageclass_sfx'); if ($task == 'archive') { $pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_('index.php?option=com_jem&view=search&task=archive')); $pagetitle .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE'); } $pageclass_sfx = $params->get('pageclass_sfx'); $params->set('page_heading', $pageheading); // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } // Set Page title $document->setTitle($pagetitle); $document->setMetadata('title' , $pagetitle); // No permissions required/useful on this view $permissions = new stdClass(); // create select lists $lists = $this->_buildSortLists(); if ($lists['filter']) { //$uri->setVar('filter', $app->input->getString('filter', '')); //$filter = $app->getUserStateFromRequest('com_jem.jem.filter', 'filter', '', 'string'); $uri->setVar('filter', $lists['filter']); $uri->setVar('filter_type', $app->input->getString('filter_type', '')); } else { $uri->delVar('filter'); $uri->delVar('filter_type'); } // Cause of group limits we can't use class here to build the categories tree $categories = $this->get('CategoryTree'); $catoptions = array(); $catoptions[] = JHtml::_('select.option', '1', JText::_('COM_JEM_SELECT_CATEGORY')); $catoptions = array_merge($catoptions, JemCategories::getcatselectoptions($categories)); $selectedcats = ($filter_category) ? array($filter_category) : array(); // build selectlists $lists['categories'] = JHtml::_('select.genericlist', $catoptions, 'filter_category', array('size'=>'1', 'class'=>'inputbox'), 'value', 'text', $selectedcats); // Create the pagination object $pagination = $this->get('Pagination'); // date filter $lists['date_from'] = JHtml::_('calendar', $filter_date_from, 'filter_date_from', 'filter_date_from', '%Y-%m-%d', array('class'=>"inputbox")); $lists['date_to'] = JHtml::_('calendar', $filter_date_to, 'filter_date_to', 'filter_date_to', '%Y-%m-%d', array('class'=>"inputbox")); // country filter $continents = array(); $continents[] = JHtml::_('select.option', '', JText::_('COM_JEM_SELECT_CONTINENT')); $continents[] = JHtml::_('select.option', 'AF', JText::_('COM_JEM_AFRICA')); $continents[] = JHtml::_('select.option', 'AS', JText::_('COM_JEM_ASIA')); $continents[] = JHtml::_('select.option', 'EU', JText::_('COM_JEM_EUROPE')); $continents[] = JHtml::_('select.option', 'NA', JText::_('COM_JEM_NORTH_AMERICA')); $continents[] = JHtml::_('select.option', 'SA', JText::_('COM_JEM_SOUTH_AMERICA')); $continents[] = JHtml::_('select.option', 'OC', JText::_('COM_JEM_OCEANIA')); $continents[] = JHtml::_('select.option', 'AN', JText::_('COM_JEM_ANTARCTICA')); $lists['continents'] = JHtml::_('select.genericlist', $continents, 'filter_continent', array('class'=>'inputbox'), 'value', 'text', $filter_continent); unset($continents); // country filter $countries = array(); $countries[] = JHtml::_('select.option', '', JText::_('COM_JEM_SELECT_COUNTRY')); $countries = array_merge($countries, $this->get('CountryOptions')); $lists['countries'] = JHtml::_('select.genericlist', $countries, 'filter_country', array('class'=>'inputbox'), 'value', 'text', $filter_country); unset($countries); // city filter if ($filter_country) { $cities = array(); $cities[] = JHtml::_('select.option', '', JText::_('COM_JEM_SELECT_CITY')); $cities = array_merge($cities, $this->get('CityOptions')); $lists['cities'] = JHtml::_('select.genericlist', $cities, 'filter_city', array('class'=>'inputbox'), 'value', 'text', $filter_city); unset($cities); } $this->lists = $lists; $this->action = $uri->toString(); $this->rows = $rows; $this->task = $task; $this->noevents = $noevents; $this->params = $params; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->permissions = $permissions; $this->pagetitle = $pagetitle; $this->filter_continent = $filter_continent; $this->filter_country = $filter_country; $this->document = $document; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); parent::display($tpl); }