/** * Creates the output for the event view */ function display($tpl = null) { $settings = JemHelper::globalattribs(); // check iCal global setting if ($settings->get('global_show_ical_icon','0')==1) { // Get data from the model $row = $this->get('Item'); if (empty($row)) { return; } $row->categories = $this->get('Categories'); $row->id = $row->did; $row->slug = $row->alias ? ($row->id.':'.$row->alias) : $row->id; $params = $row->params; // check individual iCal Event setting if ($params->get('event_show_ical_icon',1)) { // initiate new CALENDAR $vcal = JemHelper::getCalendarTool(); $vcal->setConfig( "filename", "event".$row->did.".ics" ); JemHelper::icalAddEvent($vcal, $row); // generate and redirect output to user browser $vcal->returnCalendar(); } else { return; } } else { return; } }
/** * 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 get the time zone field option groups. * * @return array The field option objects as a nested array in groups. */ protected function getGroups() { $settings = JemHelper::globalattribs(); $globalTz = $settings->get('global_timezone'); $groups = array(); $keyField = !empty($this->keyField) ? $this->keyField : 'id'; $keyValue = $this->form->getValue($keyField); $view = $this->element['view']; // If the timezone is not set use the server setting. if (strlen($this->value) == 0 && empty($keyValue)) { # we didn't select A timezone so we'll take a look at the server setting. # are we in settings-view? if ($view == 'venue') { # check if there is a setting filled if ($globalTz) { $this->value = $globalTz; } else { # there is no global value so check the the server setting $serverTz = JFactory::getConfig()->get('offset'); # UTC is seen as Abidjan and that's not something we want if ($serverTz == 'UTC') { $serverTz = 'Europe/Berlin'; // for the moment it's been set to this } $this->value = $serverTz; } } } // Get the list of time zones from the server. $zones = DateTimeZone::listIdentifiers(); // Build the group lists. foreach ($zones as $zone) { // Time zones not in a group we will ignore. if (strpos($zone, '/') === false) { continue; } // Get the group/locale from the timezone. list($group, $locale) = explode('/', $zone, 2); // Only use known groups. if (in_array($group, self::$zones)) { // Initialize the group if necessary. if (!isset($groups[$group])) { $groups[$group] = array(); } // Only add options where a locale exists. if (!empty($locale)) { $groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false); } } } // Sort the group lists. ksort($groups); foreach ($groups as &$location) { sort($location); } // Merge any additional groups in the XML definition. $groups = array_merge(parent::getGroups(), $groups); return $groups; }
/** * 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); }
/** * Constructor * * @param object &$subject The object to observe * @param array $config An array that holds the plugin configuration * */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage(); $app = JFactory::getApplication(); $jemsettings = JemHelper::globalattribs(); $this->_SiteName = $app->getCfg('sitename'); $this->_MailFrom = $app->getCfg('mailfrom'); $this->_FromName = $app->getCfg('fromname'); $this->_AdminDBList = self::Adminlist(); $this->_UseLoginName = !$jemsettings->get('global_regname', 1); // regname == 1: name, 0: username (login name) }
/** * Method to get venue data. * * @param integer The id of the venue. * @return mixed item data object on success, false on failure. */ public function getItem($itemId = null) { $jemsettings = JEMHelper::config(); // Initialise variables. $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id'); // Get a row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($itemId); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } $properties = $table->getProperties(1); $value = JArrayHelper::toObject($properties, 'JObject'); // Convert attrib field to Registry. //$registry = new JRegistry(); //$registry->loadString($value->attribs); $globalregistry = JemHelper::globalattribs(); $value->params = clone $globalregistry; //$value->params->merge($registry); // Compute selected asset permissions. $user = JemFactory::getUser(); // Check edit permission. $value->params->set('access-edit', $user->can('edit', 'venue', $value->id, $value->created_by)); // Check edit state permission. $value->params->set('access-change', $user->can('publish', 'venue', $value->id, $value->created_by)); $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false; $files = JemAttachment::getAttachments('venue' . $itemId); $value->attachments = $files; if (empty($itemId)) { $value->country = $jemsettings->defaultCountry; } return $value; }
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 $document = JFactory::getDocument(); $app = JFactory::getApplication(); $jinput = $app->input; $this->settings = JEMAdmin::config(); $this->settings2 = JemHelper::globalattribs(); $task = $jinput->getCmd('task'); $this->task = $task; # load css JHtml::_('stylesheet', 'com_jem/backend.css', array(), true); # load js //JHtml::_('behavior.framework'); //mootools JHtml::_('script', 'com_jem/attachments.js', false, true); //$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js'); $this->access = JEMHelper::getAccesslevelOptions(); # retrieve mapType setting $settings = JemHelper::globalattribs(); $mapType = $settings->get('mapType', '0'); switch ($mapType) { case '0': $type = '"roadmap"'; break; case '1': $type = '"satellite"'; break; case '2': $type = '"hybrid"'; break; case '3': $type = '"terrain"'; break; } $this->mapType = $type; //JHtml::_('jquery.framework'); JHtml::_('script', 'com_jem/slider-state.js', false, true); $this->addToolbar(); parent::display($tpl); }
/** * Creates the output for the event view */ function display($tpl = null) { $settings = JemHelper::globalattribs(); // check iCal global setting if ($settings->get('global_show_ical_icon', '0') == 1) { // Get data from the model $row = $this->get('Item'); $row->categories = $this->get('Categories'); $row->id = $row->did; $row->slug = $row->alias ? $row->id . ':' . $row->alias : $row->id; $params = $row->params; // check individual iCal Event setting if ($params->get('event_show_ical_icon', 1)) { $filename_type = $params->get('event_ical_filename_type', '2'); switch ($filename_type) { case 1: $filename = JText::_('COM_JEM_EVENT_ICAL_FILENAME'); break; case 2: $filename = "event" . $row->did; break; case 3: $filename = $params->get('event_ical_filename', 'event'); break; } // initiate new CALENDAR $vcal = JemHelper::getCalendarTool(); $vcal->setConfig("filename", $filename . '.ics'); JemHelper::icalAddEvent($vcal, $row, 'event'); // generate and redirect output to user browser $vcal->returnCalendar(); } else { return; } } else { return; } }
/** * Calendar-View */ function display($tpl = null) { $app = JFactory::getApplication(); $document = JFactory::getDocument(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JemHelper::config(); $vsettings = JemHelper::viewSettings('vcalendar'); $params = $app->getParams(); $settings = JemHelper::globalattribs(); // Load css JemHelper::loadCss('jem'); JemHelper::loadCss('calendar'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); $evlinkcolor = $params->get('eventlinkcolor'); $evbackgroundcolor = $params->get('eventbackgroundcolor'); $currentdaycolor = $params->get('currentdaycolor'); $eventandmorecolor = $params->get('eventandmorecolor'); $style = ' div#jem div[id^=\'catz\'] a {color:' . $evlinkcolor . ' !important;} div#jem div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';} div#jem .eventcontent {background-color:' . $evbackgroundcolor . '; !important} div#jem .eventandmore {background-color:' . $eventandmorecolor . ' !important;} div#jem .today .daynum {background-color:' . $currentdaycolor . ' !important;}'; $document->addStyleDeclaration($style); // add javascript (using full path - see issue #590) JHtml::_('script', 'media/com_jem/js/calendar.js'); $year = $app->input->request->getInt('yearID', strftime("%Y")); $month = $app->input->request->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); //init calendar $cal = new JEMCalendar($year, $month, 0); $cal->enableMonthNav('index.php?view=calendar'); $cal->setFirstWeekDay($params->get('firstweekday', 1)); $cal->enableDayLinks(false); //$cal->enableDatePicker(); $this->rows = $rows; $this->params = $params; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->vsettings = $vsettings; $this->cal = $cal; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); parent::display($tpl); }
/** * 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); }
/** * 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); }
/** * 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 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); }
/** * Retrieve Categories * * Due to multi-cat this function is needed * filter-index (4) is pointing to the cats */ function getCategories($id) { $user = JemFactory::getUser(); $userid = (int) $user->get('id'); $levels = $user->getAuthorisedViewLevels(); $app = JFactory::getApplication(); $params = $app->getParams(); $catswitch = $params->get('categoryswitch', '0'); $settings = JemHelper::globalattribs(); // Query $db = JFactory::getDBO(); $query = $db->getQuery(true); $case_when_c = ' CASE WHEN '; $case_when_c .= $query->charLength('c.alias'); $case_when_c .= ' THEN '; $id_c = $query->castAsChar('c.id'); $case_when_c .= $query->concatenate(array($id_c, 'c.alias'), ':'); $case_when_c .= ' ELSE '; $case_when_c .= $id_c.' END as catslug'; $query->select(array('DISTINCT c.id','c.catname','c.access','c.checked_out AS cchecked_out','c.color',$case_when_c)); $query->from('#__jem_categories as c'); $query->join('LEFT', '#__jem_cats_event_relations AS rel ON rel.catid = c.id'); $query->select(array('a.id AS multi')); $query->join('LEFT','#__jem_events AS a ON a.id = rel.itemid'); if ($id != 'all'){ $query->where('rel.itemid ='.(int)$id); } $query->where('c.published = 1'); ################### ## FILTER-ACCESS ## ################### # Filter by access level. ################################### ## FILTER - MAINTAINER/JEM GROUP ## ################################### # as maintainter someone who is registered can see a category that has special rights # let's see if the user has access to this category. // $query3 = $db->getQuery(true); // $query3 = 'SELECT gr.id' // . ' FROM #__jem_groups AS gr' // . ' LEFT JOIN #__jem_groupmembers AS g ON g.group_id = gr.id' // . ' WHERE g.member = ' . (int) $user->get('id') // // . ' AND ' .$db->quoteName('gr.addevent') . ' = 1 ' // . ' AND g.member NOT LIKE 0'; // $db->setQuery($query3); // $groupnumber = $db->loadColumn(); // $jemgroups = implode(',',$groupnumber); // JEM groups doesn't overrule view access levels! // if ($jemgroups) { // $query->where('(c.access IN ('.$groups.') OR c.groupid IN ('.$jemgroups.'))'); // } else { $query->where('(c.access IN ('.implode(',', $levels).'))'); // } ####################### ## FILTER - CATEGORY ## ####################### # set filter for top_category $top_cat = $this->getState('filter.category_top'); if ($top_cat) { $query->where($top_cat); } # Filter by a single or group of categories. $categoryId = $this->getState('filter.category_id'); if (is_numeric($categoryId)) { $type = $this->getState('filter.category_id.include', true) ? '= ' : '<> '; $query->where('c.id '.$type.(int) $categoryId); } elseif (is_array($categoryId) && count($categoryId)) { JArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); $type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN'; $query->where('c.id '.$type.' ('.$categoryId.')'); } # filter set by day-view $requestCategoryId = $this->getState('filter.req_catid'); if ($requestCategoryId) { $query->where('c.id = '.$db->quote($requestCategoryId)); } ################### ## FILTER-SEARCH ## ################### # define variables $filter = $this->getState('filter.filter_type'); $search = $this->getState('filter.filter_search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('c.id = '.(int) substr($search, 3)); } else { $search = $db->Quote('%'.$db->escape($search, true).'%', false); if ($search && $settings->get('global_show_filter')) { if ($filter == 4) { $query->where('c.catname LIKE '.$search); } } } } $db->setQuery($query); if ($id == 'all') { $cats = $db->loadColumn(0); $cats = array_unique($cats); } else { $cats = $db->loadObjectList(); } return $cats; }
/** * Remove images */ function rmObsImages() { $settings = JemHelper::globalattribs(); $trash_path = $settings->get('trashedimages_path', '/trashedimages'); $trash_folder = JPATH_SITE . $trash_path; $trash_foldersmall = JPATH_SITE . $trash_path . '/small'; if (JFolder::exists($trash_folder)) { $files = JFolder::files($trash_folder, $filter = '.', false, true, array('index.html')); if ($files) { JFile::delete($files); } } if (JFolder::exists($trash_foldersmall)) { $files = JFolder::files($trash_foldersmall, $filter = '.', false, true, array('index.html')); if ($files) { JFile::delete($files); } } return; }
/** * Creates the output for the Event view */ function display($tpl = null) { $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $app = JFactory::getApplication(); $user = JemFactory::getUser(); $userId = $user->get('id'); $dispatcher = JDispatcher::getInstance(); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $this->params = $app->getParams('com_jem'); $this->item = $this->get('Item'); $this->print = $app->input->getBool('print', false); $this->state = $this->get('State'); $this->user = $user; $this->jemsettings = $jemsettings; $this->settings = $settings; $categories = isset($this->item->categories) ? $this->item->categories : $this->get('Categories'); $this->categories = $categories; $this->registers = $model->getRegisters($this->state->get('event.id')); $isregistered = $this->get('UserIsRegistered'); // check for data error if (empty($this->item)) { $app->enqueueMessage(JText::_('JERROR_AN_ERROR_HAS_OCCURRED'), 'error'); return false; } // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseWarning(500, implode("\n", $errors)); return false; } // Create a shortcut for $item and params. $item = $this->item; $params = $this->params; // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'event' && $menuitem->query['id'] == $item->id); // Add router helpers. $item->slug = $item->alias ? ($item->id.':'.$item->alias) : $item->id; $item->venueslug = $item->localias ? ($item->locid.':'.$item->localias) : $item->locid; // Check to see which parameters should take priority if ($useMenuItemParams) { // Merge so that the menu item params take priority $pagetitle = $params->def('page_title', $menuitem->title ? $menuitem->title : $item->title); $params->def('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); // Load layout from active query (in case it is an alternative menu item) if (isset($menuitem->query['layout'])) { $this->setLayout($menuitem->query['layout']); } else // Single-event menu item layout takes priority over alt layout for an event if ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $item->params->merge($params); } else { // Merge the menu item params with the event params so that the event params take priority $pagetitle = $item->title; $params->set('page_title', $pagetitle); $params->set('page_heading', $pagetitle); $params->set('show_page_heading', 1); // ensure page heading is shown $pathway->addItem($pagetitle, JRoute::_(JemHelperRoute::getEventRoute($item->slug))); // Check for alternative layouts (since we are not in a single-event menu item) // Single-event menu item layout takes priority over alt layout for an event if ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $temp = clone($params); $temp->merge($item->params); $item->params = $temp; } $offset = $this->state->get('list.offset'); // Check the view access to the event (the model has already computed the values). if (!$item->params->get('access-view')) { // && !$item->params->get('show_noauth') && $user->get('guest')) { - not supported yet JError::raiseWarning(403, JText::_('JERROR_ALERTNOAUTHOR')); return; } if ($item->params->get('show_intro', '1') == '1') { $item->text = $item->introtext.' '.$item->fulltext; } elseif ($item->fulltext) { $item->text = $item->fulltext; } else { $item->text = $item->introtext; } // Process the content plugins // JPluginHelper::importPlugin('content'); $results = $dispatcher->trigger('onContentPrepare', array ('com_jem.event', &$item, &$this->params, $offset)); $item->event = new stdClass(); $results = $dispatcher->trigger('onContentAfterTitle', array('com_jem.event', &$item, &$this->params, $offset)); $item->event->afterDisplayTitle = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentBeforeDisplay', array('com_jem.event', &$item, &$this->params, $offset)); $item->event->beforeDisplayContent = trim(implode("\n", $results)); $results = $dispatcher->trigger('onContentAfterDisplay', array('com_jem.event', &$item, &$this->params, $offset)); $item->event->afterDisplayContent = trim(implode("\n", $results)); // Increment the hit counter of the event. if (!$this->params->get('intro_only') && $offset == 0) { $model->hit(); } // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx')); $this->print_link = JRoute::_(JemHelperRoute::getRoute($item->slug).'&print=1&tmpl=component'); // Get images $this->dimage = JemImage::flyercreator($item->datimage, 'event'); $this->limage = JemImage::flyercreator($item->locimage, 'venue'); // 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 user can edit the event $permissions->canEditEvent = $user->can('edit', 'event', $item->id, $item->created_by); $permissions->canPublishEvent = $user->can('publish', 'event', $item->id, $item->created_by); // Check if user can edit the venue $permissions->canEditVenue = $user->can('edit', 'venue', $item->locid, $item->venueowner); $permissions->canPublishVenue = $user->can('publish', 'venue', $item->locid, $item->venueowner); $this->permissions = $permissions; $this->showeventstate = $permissions->canEditEvent || $permissions->canPublishEvent; $this->showvenuestate = $permissions->canEditVenue || $permissions->canPublishVenue; // Timecheck for registration $now = strtotime(date("Y-m-d")); $date = empty($item->dates) ? $now : strtotime($item->dates); $enddate = empty($item->enddates) ? $date : strtotime($item->enddates); $timecheck = $now - $date; // on open date $timecheck is 0 // let's build the registration handling $formhandler = 0; // too late to unregister if ($isregistered) { // is the user allready registered at the event if ($now <= $enddate) { // allows unregister on open date $formhandler = 3; } } elseif ($timecheck > 0) { // check if it is too late to register and overwrite $formhandler $formhandler = 1; } elseif (!$userId) { // user doesn't have an ID (mostly guest) $formhandler = 2; } else { $formhandler = 4; } if ($formhandler >= 3) { $js = "function check(checkbox, send) { if(checkbox.checked==true){ send.disabled = false; } else { send.disabled = true; }}"; $document->addScriptDeclaration($js); } $this->formhandler = $formhandler; // generate Metatags $meta_keywords = array(); if (!empty($this->item->meta_keywords)) { $keywords = explode(",", $this->item->meta_keywords); foreach ($keywords as $keyword) { if (preg_match("/[\/[\/]/", $keyword)) { $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword))); $buffer = $this->keyword_switcher($keyword, $this->item, $categories, $jemsettings->formattime, $jemsettings->formatdate); if (!empty($buffer)) { $meta_keywords[] = $buffer; } } else { $meta_keywords[] = $keyword; } } $document->setMetadata('keywords', implode(', ', $meta_keywords)); } if (!empty($this->item->meta_description)) { $description = explode("[", $this->item->meta_description); $description_content = ""; foreach ($description as $desc) { $keyword = substr($desc, 0, strpos($desc, "]", 0)); if ($keyword != "") { $description_content .= $this->keyword_switcher($keyword, $this->item, $categories, $jemsettings->formattime, $jemsettings->formatdate); $description_content .= substr($desc, strpos($desc, "]", 0) + 1); } else { $description_content .= $desc; } } } else { $description_content = ""; } $document->setDescription(strip_tags($description_content)); // load dispatcher for JEM plugins (comments) $item->pluginevent = new stdClass(); if ($this->print) { $item->pluginevent->onEventEnd = false; } else { JPluginHelper::importPlugin('jem', 'comments'); $results = $dispatcher->trigger('onEventEnd', array($item->did, $this->escape($item->title))); $item->pluginevent->onEventEnd = trim(implode("\n", $results)); } // create flag if ($item->country) { $item->countryimg = JemHelperCountries::getCountryFlag($item->country); } $this->isregistered = $isregistered; $this->dispatcher = $dispatcher; $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->_prepareDocument(); 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 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); }
/** * Creates the Category View */ function display($tpl = null) { //initialize variables $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $document = JFactory::getDocument(); $vsettings = JemHelper::viewSettings('vcategory'); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $print = $jinput->getBool('print'); $state = $this->get('State'); $params = $state->params; $uri = JFactory::getURI(); $pathway = $app->getPathWay(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); # load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); //get data from model $state = $this->get('State'); $params = $state->params; $items = $this->get('Items'); $category = $this->get('Category'); $children = $this->get('Children'); $parent = $this->get('Parent'); $pagination = $this->get('Pagination'); if ($category == false) { return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND')); } //are events available? if (!$items) { $noevents = 1; } else { $noevents = 0; } // Decide which parameters should take priority $useMenuItemParams = $menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'category' && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default') && $menuitem->query['id'] == $category->id; // get variables $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $filter_order = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_filtertype', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $search = $db->escape(trim(JString::strtolower($search))); $task = $jinput->getCmd('task'); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; //search filter $filters = array(); $filters[] = JHtml::_('select.option', '0', '— ' . JText::_('COM_JEM_GLOBAL_SELECT_FILTER') . ' —'); 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')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size' => '1', 'class' => 'inputbox input-medium'), 'value', 'text', $filter_type); // search filter $lists['search'] = $search; // Add feed links $link = '&format=feed&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); //create the pathway $cats = new JEMCategories($category->id); $parents = $cats->getParentlist(); foreach ($parents as $parent) { $pathway->addItem($this->escape($parent->catname), JRoute::_(JemHelperRoute::getCategoryRoute($parent->slug))); } // Show page heading specified on menu item or category title as heading - idea taken from com_content. // // Check to see which parameters should take priority // If the current view is the active menuitem and an category view for this category, then the menu item params take priority if ($useMenuItemParams) { $pagetitle = $params->get('page_title', $menuitem->title ? $menuitem->title : $category->catname); $pageheading = $params->get('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { $pagetitle = $category->catname; $pageheading = $pagetitle; $params->set('show_page_heading', 1); // ensure page heading is shown $pathway->addItem($category->catname, JRoute::_(JemHelperRoute::getCategoryRoute($category->slug))); } $pageclass_sfx = $params->get('pageclass_sfx'); if ($task == 'archive') { $pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getCategoryRoute($category->slug) . '&task=archive')); $print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) . '&task=archive&print=1&tmpl=component'); $pagetitle .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE'); } else { $print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) . '&print=1&tmpl=component'); } if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } $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 $this->document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); $document->setMetadata('keywords', $category->meta_keywords); $document->setDescription(strip_tags($category->meta_description)); //Check if the user has access to the form $maintainer = JemUser::ismaintainer('add'); $genaccess = JemUser::validate_user($jemsettings->evdelrec, $jemsettings->delivereventsyes); if ($maintainer || $genaccess || $user->authorise('core.create', 'com_jem')) { $dellink = 1; } else { $dellink = 0; } # Check if the user has access to the add-venueform $maintainer2 = JemUser::venuegroups('add'); $genaccess2 = JemUser::validate_user($jemsettings->locdelrec, $jemsettings->deliverlocsyes); if ($maintainer2 || $genaccess2) { $this->addvenuelink = 1; } else { $this->addvenuelink = 0; } // Create the pagination object $pagination = $this->get('Pagination'); //Generate Categorydescription if (empty($category->description)) { $description = JText::_('COM_JEM_NO_DESCRIPTION'); } else { //execute plugins $category->text = $category->description; $category->title = $category->catname; JPluginHelper::importPlugin('content'); $app->triggerEvent('onContentPrepare', array('com_jem.category', &$category, &$params, 0)); $description = $category->text; } $cimage = JemImage::flyercreator($category->image, 'category'); $children = array($category->id => $children); $this->lists = $lists; $this->action = $uri->toString(); $this->cimage = $cimage; $this->rows = $items; $this->noevents = $noevents; $this->print_link = $print_link; $this->params = $params; $this->dellink = $dellink; $this->task = $task; $this->description = $description; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->vsettings = $vsettings; $this->settings = $settings; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->maxLevel = $params->get('maxLevel', -1); $this->category = $category; $this->children = $children; $this->parent = $parent; $this->user = $user; $this->print = $print; parent::display($tpl); }
/** * Method to save the form data. * * @param $data array */ public function save($data) { $date = JFactory::getDate(); $app = JFactory::getApplication(); $jinput = $app->input; $user = JFactory::getUser(); $jemsettings = JEMHelper::config(); $settings = JemHelper::globalattribs(); $veditevent = JemHelper::viewSettings('veditevent'); $fileFilter = new JInput($_FILES); $table = $this->getTable(); # Check if we're in the front or back if ($app->isAdmin()) { $backend = true; } else { $backend = false; } $cats = $data['cats']; $data['author_ip'] = $jinput->getString('author_ip'); ## Recurrence - check option ## # if the option to hide the recurrence/other tab has been set (front) then # we should ignore the recurrence variables. $option_othertab = $veditevent->get('editevent_show_othertab'); if ($option_othertab) { $hide_othertab = false; } else { $hide_othertab = true; } if ($backend || $hide_othertab == false) { ############## ## HOLIDAYS ## ############## if (isset($data['activated'])) { if ($data['activated'] == null) { $holidays = array(); } else { $holidays = $data['activated']; } } else { $holidays = array(); } $countryholiday = $jinput->getInt('recurrence_country_holidays', ''); ################ ## RECURRENCE ## ################ # check if a startdate has been set if (isset($data['dates'])) { if ($data['dates'] == null) { $dateSet = false; } else { $dateSet = true; } } else { $dateSet = false; } if (!isset($data['recurrence_freq'])) { $data['recurrence_freq'] = 0; } # implode weekday values # @todo implement check to see if days have been selected in case of freq week if (isset($data['recurrence_weekday'])) { $data['recurrence_weekday'] = implode(',', $data['recurrence_weekday']); } # blank recurrence-fields # # if we don't have a startdate or a recurrence-type then # the recurrence-fields within the event-table will be blanked. # # but the recurrence_group field will stay filled as it's not removed by the user. if (empty($data['dates']) || $data['recurrence_freq'] == '0') { $data['recurrence_count'] = ''; $data['recurrence_freq'] = ''; $data['recurrence_interval'] = ''; $data['recurrence_until'] = ''; $data['recurrence_weekday'] = ''; $data['recurrence_exdates'] = ''; } # the exdates are not stored in the event-table but they are trown in an variable if (isset($data['recurrence_exdates'])) { $exdates = $data['recurrence_exdates']; } else { $exdates = false; } } # parent-Save if (parent::save($data)) { // At this point we do have an id. $pk = $this->getState($this->getName() . '.id'); if (isset($data['featured'])) { $this->featured($pk, $data['featured']); } $checkAttachName = $jinput->post->get('attach-name', '', 'array'); if ($checkAttachName) { # attachments, new ones first $attachments = array(); $attachments = $fileFilter->get('attach', array(), 'array'); $attachments['customname'] = $jinput->post->get('attach-name', array(), 'array'); $attachments['description'] = $jinput->post->get('attach-desc', array(), 'array'); $attachments['access'] = $jinput->post->get('attach-access', array(), 'array'); JEMAttachment::postUpload($attachments, 'event' . $pk); # and update old ones $old = array(); $old['id'] = $jinput->post->get('attached-id', array(), 'array'); $old['name'] = $jinput->post->get('attached-name', array(), 'array'); $old['description'] = $jinput->post->get('attached-desc', array(), 'array'); $old['access'] = $jinput->post->get('attached-access', array(), 'array'); foreach ($old['id'] as $k => $id) { $attach = array(); $attach['id'] = $id; $attach['name'] = $old['name'][$k]; $attach['description'] = $old['description'][$k]; $attach['access'] = $old['access'][$k]; JEMAttachment::update($attach); } } # Store categories $cats = $data['cats']; $db = $this->getDbo(); $query = $db->getQuery(true); $query->delete($db->quoteName('#__jem_cats_event_relations')); $query->where('itemid = ' . $pk); $db->setQuery($query); $db->execute(); foreach ($cats as $cat) { $db = $this->getDbo(); $query = $db->getQuery(true); // Insert columns. $columns = array('catid', 'itemid'); // Insert values. $values = array($cat, $pk); // Prepare the insert query. $query->insert($db->quoteName('#__jem_cats_event_relations'))->columns($db->quoteName($columns))->values(implode(',', $values)); // Reset the query using our newly populated query object. $db->setQuery($query); $db->execute(); } if ($backend || $hide_othertab == false) { # check for recurrence # when part of a recurrence_set it will not perform the generating function /* $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select('id'); $query->from($db->quoteName('#__jem_recurrence')); $query->where(array('exdate IS NULL','itemid ='.$pk)); $db->setQuery($query); $recurrence_set = $db->loadResult(); */ $table->load($pk); # check recurrence if ($table->recurrence_group) { # this event is part of a recurrence-group # # check for groupid & groupid_ref (recurrence_table) # - groupid = $item->recurrence_group # - groupid_ref = $item->recurrence_group # - Itemid = $item->id $db = JFactory::getDbo(); $query = $db->getQuery(true); $query->select(array('count(id)')); $query->from('#__jem_recurrence'); $query->where(array('groupid= ' . $table->recurrence_group, 'itemid= ' . $pk, 'groupid = groupid_ref')); $db->setQuery($query); $rec_groupset_check = $db->loadResult(); if ($rec_groupset_check == '1') { $recurrence_set = true; } else { $recurrence_set = false; } } else { $recurrence_set = false; } ## check values, pass check before we continue to generate additional events ## # - do we have an interval? # - does the event has a date? # - is the event part of a recurrenceset? if ($table->recurrence_interval > 0 && !$table->dates == null && $recurrence_set == null) { # recurrence_interval is bigger then 0 # we do have a startdate # the event is not part of a recurrence-set # we passed the check but now we'll pass some variables to the generating functions # exdates: the dates filled # table: the row info if ($this->state->task == 'apply' || $this->state->task == 'save') { JemHelper::generate_events($table, $exdates, $holidays); } } } return true; } return false; }
/** * Creates the Venuesview */ function display($tpl = null) { $app = JFactory::getApplication(); $jinput = $app->input; $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $vsettings = JemHelper::viewSettings('vvenues'); $user = JFactory::getUser(); $print = $jinput->getBool('print'); //get menu information $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $app->getParams(); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // Request variables $task = $jinput->getCmd('task'); $rows = $this->get('Items'); $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?view=venues&task=archive')); $print_link = JRoute::_('index.php?view=venues&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?view=venues&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); $document->setMetadata('keywords', $pagetitle); // Check if the user has access to the add-eventform $maintainer = JemUser::ismaintainer('add'); $genaccess = JemUser::validate_user($jemsettings->evdelrec, $jemsettings->delivereventsyes); if ($maintainer || $genaccess || $user->authorise('core.create', 'com_jem')) { $addeventlink = 1; } else { $addeventlink = 0; } //Check if the user has access to the add-venueform $maintainer2 = JemUser::venuegroups('add'); $genaccess2 = JemUser::validate_user($jemsettings->locdelrec, $jemsettings->deliverlocsyes); if ($maintainer2 || $genaccess2) { $addvenuelink = 1; } else { $addvenuelink = 0; } // Create the pagination object $pagination = $this->get('Pagination'); $this->rows = $rows; $this->print_link = $print_link; $this->params = $params; $this->addvenuelink = $addvenuelink; $this->addeventlink = $addeventlink; $this->pagination = $pagination; $this->item = $menuitem; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->vsettings = $vsettings; $this->task = $task; $this->pagetitle = $pagetitle; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print = $print; $this->app = $app; parent::display($tpl); }
/** * Retrieve Categories * * Due to multi-cat this function is needed * filter-index (4) is pointing to the cats */ function getCategories($id) { $user = JFactory::getUser(); $levels = $user->getAuthorisedViewLevels(); $app = JFactory::getApplication(); $settings = JemHelper::globalattribs(); # Query $db = JFactory::getDBO(); $query = $db->getQuery(true); $case_when_c = ' CASE WHEN '; $case_when_c .= $query->charLength('c.alias'); $case_when_c .= ' THEN '; $id_c = $query->castAsChar('c.id'); $case_when_c .= $query->concatenate(array($id_c, 'c.alias'), ':'); $case_when_c .= ' ELSE '; $case_when_c .= $id_c . ' END as catslug'; $query->select(array('DISTINCT c.id', 'c.catname', 'c.access', 'c.path', 'c.checked_out AS cchecked_out', 'c.color', $case_when_c)); $query->from('#__jem_categories as c'); $query->join('LEFT', '#__jem_cats_event_relations AS rel ON rel.catid = c.id'); $query->select(array('a.id AS multi')); $query->join('LEFT', '#__jem_events AS a ON a.id = rel.itemid'); $query->where('rel.itemid =' . (int) $id); ################### ## FILTER-ACCESS ## ################### # Filter by access level. $access = $this->getState('filter.access'); if ($access) { $groups = implode(',', $user->getAuthorisedViewLevels()); $query->where('c.access IN (' . $groups . ')'); } ################### ## FILTER-SEARCH ## ################### # define variables $filter = $this->getState('filter.filtertype'); $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('c.id = ' . (int) substr($search, 3)); } else { $search = $db->Quote('%' . $db->escape($search, true) . '%'); if ($search) { if ($filter == 4) { $query->where('c.catname LIKE ' . $search); } } } } $db->setQuery($query); $cats = $db->loadObjectList(); return $cats; }
/** * validates guest rights */ static function validate_guest($option = false) { $user = JFactory::getUser(); $guest = $user->get('guest'); $settings = JemHelper::globalattribs(); if ($guest) { # check if he global setting has been set $addevent = $settings->get('guest_addevent', 0); if (!$addevent) { return false; } # then check if we have 1 of the antispam measures enabled # if not then the guest is not allowed to submit events $mathquiz = $settings->get('guest_as_math', 0); $captcha = $settings->get('guest_as_captcha', 0); if (!$mathquiz && !$captcha) { return false; } return true; } }
static function formatSchemaOrgDateTime($dateStart, $timeStart, $dateEnd = "", $timeEnd = "") { $settings = JemHelper::globalattribs(); $output = ""; $formatD = "Y-m-d"; $formatT = "%H:%M"; if(JemHelper::isValidDate($dateStart)) { $content = self::formatdate($dateStart, $formatD); if($settings->get('global_show_timedetails','1') && $timeStart) { $content .= 'T'.self::formattime($timeStart, $formatT, false); } $output .= '<meta itemprop="startDate" content="'.$content.'" />'; if(JemHelper::isValidDate($dateEnd)) { $content = self::formatdate($dateEnd, $formatD); if($settings->get('global_show_timedetails','1') && $timeEnd) { $content .= 'T'.self::formattime($timeEnd, $formatT, false); } $output .= '<meta itemprop="endDate" content="'.$content.'" />'; } } else { // Open date if($settings->get('global_show_timedetails','1')) { if($timeStart) { $content = self::formattime($timeStart, $formatT, false); $output .= '<meta itemprop="startDate" content="'.$content.'" />'; } // Display end time only when both times are set if($timeStart && $timeEnd) { $content .= self::formattime($timeEnd, $formatT, false); $output .= '<meta itemprop="endDate" content="'.$content.'" />'; } } } return $output; }
protected function getOptions() { // Initialise variables. $options = array(); $published = $this->element['published'] ? $this->element['published'] : array(0, 1); $name = (string) $this->element['name']; $action = (string) $this->element['action']; $frontedit = $this->element['frontedit']; $jinput = JFactory::getApplication()->input; $db = JFactory::getDbo(); $a_id = $jinput->get('a_id', null); // retrieve data if ($frontedit) { $user = JFactory::getUser(); $jemsettings = JEMHelper::config(); $userid = (int) $user->get('id'); $superuser = JEMUser::superuser(); $levels = $user->getAuthorisedViewLevels(); $settings = JemHelper::globalattribs(); $guestcat = $settings->get('guest_category', '0'); $jinput = JFactory::getApplication()->input; $valguest = JEMUser::validate_guest(); $name = (string) $this->element['name']; $db = JFactory::getDbo(); $auth_joomlagr = $user->getAuthorisedGroups(); $oldCat = 0; $query = $db->getQuery(true)->select('a.id AS value, a.catname AS text, a.level, a.published')->from('#__jem_categories AS a')->join('LEFT', $db->quoteName('#__jem_categories') . ' AS b ON a.lft > b.lft AND a.rgt < b.rgt'); if (is_numeric($published)) { $query->where('a.published = ' . (int) $published); } elseif (is_array($published)) { JArrayHelper::toInteger($published); $query->where('a.published IN (' . implode(',', $published) . ')'); } // specific code if (!$valguest) { $validated = false; if ($superuser) { // no need to restrict to category's $validated = true; } if (!$validated) { // in this case it's going to be difficult // catch the groupnumber of the user+add rights $query2 = $db->getQuery(true); $query2->select(array('gr.id')); $query2->from($db->quoteName('#__jem_groups') . ' AS gr'); $query2->join('LEFT', '#__jem_groupmembers AS g ON g.group_id = gr.id'); $query2->where(array('g.member = ' . (int) $user->get('id'), $db->quoteName('gr.addevent') . ' =1', 'g.member NOT LIKE 0')); $db->setQuery($query2); $groupnumber = $db->loadColumn(); // is the user member of a group with edit rights? if ($groupnumber) { // restrict submission into maintained categories only $query->where(array('a.groupid IN (' . implode(',', $groupnumber) . ')')); } else { return false; } } } else { // $specified guest category $query->where(array('a.id = ' . $guestcat)); } $query->group('a.id, a.catname, a.level, a.lft, a.rgt, a.parent_id, a.published')->order('a.lft ASC'); $db->setQuery($query); } try { $options = $db->loadObjectList(); } catch (RuntimeException $e) { JError::raiseWarning(500, $e->getMessage); } // Pad the option text with spaces using depth level as a multiplier. for ($i = 0, $n = count($options); $i < $n; $i++) { // remove root if ($this->element['removeroot'] == true) { if ($options[$i]->level == 0) { unset($options[$i]); continue; } $options[$i]->level = $options[$i]->level - 1; } if ($options[$i]->published == 1) { $options[$i]->text = str_repeat('- ', $options[$i]->level) . $options[$i]->text; } else { $options[$i]->text = str_repeat('- ', $options[$i]->level) . '[' . $options[$i]->text . ']'; } } // Merge any additional options in the XML definition. $options = array_merge(parent::getOptions(), $options); return $options; }
/** * venues-query */ function buildQueryVenues() { $app = JFactory::getApplication(); $params = JemHelper::globalattribs(); $filter_order = $app->getUserStateFromRequest('com_jem.selectvenue.filter_order', 'filter_order', 'l.venue', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.selectvenue.filter_order_Dir', 'filter_order_Dir', 'ASC', '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.selectvenue.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.selectvenue.filter_search', 'filter_search', '', 'string'); $search = $this->_db->escape(trim(JString::strtolower($search))); // Query $db = JFactory::getDBO(); $query = $db->getQuery(true); $query->select(array('l.id', 'l.state', 'l.city', 'l.country', 'l.published', 'l.venue', 'l.ordering')); $query->from('#__jem_venues as l'); // where $where = array(); $where[] = 'l.published = 1'; /* something to search for? (we like to search for "0" too) */ if ($search || $search === "0") { switch ($filter_type) { case 1: /* Search venues */ $where[] = 'LOWER(l.venue) LIKE "%' . $search . '%"'; break; case 2: // Search city $where[] = 'LOWER(l.city) LIKE "%' . $search . '%"'; break; case 3: // Search state $where[] = 'LOWER(l.state) LIKE "%' . $search . '%"'; } } if ($params->get('global_show_ownedvenuesonly')) { $user = JFactory::getUser(); $userid = $user->get('id'); $where[] = ' created_by = ' . (int) $userid; } $query->where($where); if (strtoupper($filter_order_Dir) !== 'DESC') { $filter_order_Dir = 'ASC'; } // ordering if ($filter_order && $filter_order_Dir) { $orderby = $filter_order . ' ' . $filter_order_Dir; } else { $orderby = array('l.venue ASC', 'l.ordering ASC'); } $query->order($orderby); return $query; }
/** * Creates the Category View */ function display($tpl=null) { if ($this->getLayout() == 'calendar') { ### Category Calendar view ### $app = JFactory::getApplication(); // Load tooltips behavior JHtml::_('behavior.tooltip'); //initialize variables $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $user = JemFactory::getUser(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $app->getParams(); $uri = JFactory::getURI(); $pathway = $app->getPathWay(); $print = $app->input->getBool('print', false); // 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 date variables $year = (int)$app->input->getInt('yearID', strftime("%Y")); $month = (int)$app->input->getInt('monthID', strftime("%m")); $catid = $app->input->getInt('id', 0); if (empty($catid)) { $catid = $params->get('id'); } // get data from model and set the month $model = $this->getModel('CategoryCal'); $model->setDate(mktime(0, 0, 1, $month, 1, $year)); $category = $this->get('Category', 'CategoryCal'); $rows = $this->get('Items', 'CategoryCal'); // 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', false, false, $catid); $permissions->canAddVenue = $user->can('add', 'venue', false, false, $catid); $itemid = $app->input->getInt('Itemid', 0); $partItemid = ($itemid > 0) ? '&Itemid='.$itemid : ''; $partCatid = ($catid > 0) ? '&id=' . $catid : ''; $url_base = 'index.php?option=com_jem&view=category&layout=calendar' . $partCatid . $partItemid; $partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : ''); $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&catid='.$catid); $this->rows = $rows; $this->catid = $catid; $this->params = $params; $this->jemsettings = $jemsettings; $this->permissions = $permissions; $this->cal = $cal; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print_link = $print_link; } else { ### Category List view ### //initialize variables $app = JFactory::getApplication(); $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $user = JemFactory::getUser(); $print = $app->input->getBool('print', false); JHtml::_('behavior.tooltip'); // get menu information $params = $app->getParams(); $uri = JFactory::getURI(); $pathway = $app->getPathWay(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // get data from model $state = $this->get('State'); $params = $state->params; $items = $this->get('Items'); $category = $this->get('Category'); $children = $this->get('Children'); $parent = $this->get('Parent'); $pagination = $this->get('Pagination'); if ($category == false) { return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND')); } // are events available? if (!$items) { $noevents = 1; } else { $noevents = 0; } // Decide which parameters should take priority $useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem' && $menuitem->query['view'] == 'category' && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default') && $menuitem->query['id'] == $category->id); // get variables $itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0); $this->showsubcats = (bool)$params->get('usecat', 1); $this->showemptysubcats = (bool)$params->get('showemptychilds', 1); $filter_order = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd'); $filter_order_Dir = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', '', 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_filtertype', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_search', 'filter_search', '', 'string'); $task = $app->input->get('task', ''); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // search filter $filters = array(); 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); // search filter $lists['search']= $search; // Add feed links $link = '&format=feed&id='.$category->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); // create the pathway $cats = new JEMCategories($category->id); $parents = $cats->getParentlist(); foreach($parents as $parent) { $pathway->addItem($this->escape($parent->catname), JRoute::_(JemHelperRoute::getCategoryRoute($parent->slug)) ); } // Show page heading specified on menu item or category title as heading - idea taken from com_content. // // Check to see which parameters should take priority // If the current view is the active menuitem and an category view for this category, then the menu item params take priority if ($useMenuItemParams) { $pagetitle = $params->get('page_title', $menuitem->title ? $menuitem->title : $category->catname); $pageheading = $params->get('page_heading', $pagetitle); $pathway->setItemName(1, $menuitem->title); } else { $pagetitle = $category->catname; $pageheading = $pagetitle; $params->set('show_page_heading', 1); // ensure page heading is shown $pathway->addItem($category->catname, JRoute::_(JemHelperRoute::getCategoryRoute($category->slug)) ); } $pageclass_sfx = $params->get('pageclass_sfx'); if ($task == 'archive') { $pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getCategoryRoute($category->slug).'&task=archive')); $print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&task=archive&print=1&tmpl=component'); $pagetitle .= ' - '.JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - '.JText::_('COM_JEM_ARCHIVE'); } else { $print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&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 $this->document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); $document->setMetadata('keywords', $category->meta_keywords); $document->setDescription(strip_tags($category->meta_description)); // Check if the user has permission to add things $permissions = new stdClass(); $permissions->canAddEvent = $user->can('add', 'event', false, false, $category->id); $permissions->canAddVenue = $user->can('add', 'venue', false, false, $category->id); // Create the pagination object $pagination = $this->get('Pagination'); // Generate Categorydescription if (empty ($category->description)) { $description = JText::_('COM_JEM_NO_DESCRIPTION'); } else { // execute plugins $category->text = $category->description; $category->title = $category->catname; JPluginHelper::importPlugin('content'); $app->triggerEvent('onContentPrepare', array('com_jem.category', &$category, &$params, 0)); $description = $category->text; } $cimage = JemImage::flyercreator($category->image,'category'); $children = array($category->id => $children); $this->lists = $lists; $this->action = $uri->toString(); $this->cimage = $cimage; $this->rows = $items; $this->noevents = $noevents; $this->print_link = $print_link; $this->params = $params; $this->dellink = $permissions->canAddEvent; // deprecated $this->permissions = $permissions; $this->task = $task; $this->description = $description; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->maxLevel = $params->get('maxLevel', -1); $this->category = $category; $this->children = $children; $this->parent = $parent; $this->user = $user; } 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(); $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')); }
/** * Method to get venue data. * * @param integer The id of the venue. * @return mixed item data object on success, false on failure. */ public function getItem($itemId = null) { $jemsettings = JEMHelper::config(); // Initialise variables. $itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id'); // Get a row instance. $table = $this->getTable(); // Attempt to load the row. $return = $table->load($itemId); // Check for a table object error. if ($return === false && $table->getError()) { $this->setError($table->getError()); return false; } $properties = $table->getProperties(1); $value = JArrayHelper::toObject($properties, 'JObject'); // Convert attrib field to Registry. //$registry = new JRegistry(); //$registry->loadString($value->attribs); $globalsettings = JemHelper::globalattribs(); $globalregistry = new JRegistry(); $globalregistry->loadString($globalsettings); $value->params = clone $globalregistry; //$value->params->merge($registry); // Compute selected asset permissions. $user = JFactory::getUser(); $userId = $user->get('id'); $asset = 'com_jem.venue.' . $value->id; // Check general edit permission first. if ($user->authorise('core.edit', $asset)) { $value->params->set('access-edit', true); } elseif (!empty($userId) && $user->authorise('core.edit.own', $asset)) { // Check for a valid user and that they are the owner. if ($userId == $value->created_by) { $value->params->set('access-edit', true); } } // Check edit state permission. if ($itemId) { // Existing item $value->params->set('access-change', $user->authorise('core.edit.state', $asset)); } else { $value->params->set('access-change', $user->authorise('core.edit.state', 'com_jem')); } $value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false; $files = JemAttachment::getAttachments('venue' . $itemId); $value->attachments = $files; if (empty($itemId)) { $value->country = $jemsettings->defaultCountry; } if (!empty($value->locimage)) { if (strpos($value->locimage, 'images/') !== false) { # the image selected contains the images path } else { # the image selected doesn't have the /images/ path # we're looking at the locimage so we'll append the venues folder $value->locimage = 'images/jem/venues/' . $value->locimage; } } return $value; }