/** * Get a JEM user object. * * Returns the global {@link JemUser} object, only creating it if it doesn't already exist. * * @param integer $id The user to load - Must be an integer or null for current user. * * @return JemUser object * * @see JemUser * @since 2.1.5 */ public static function getUser($id = null) { if (is_null($id)) { $instance = self::getSession()->get('user'); $id = ($instance instanceof JUser) ? $instance->id : 0; } return JemUser::getInstance($id); }
/** * Creates the Day View */ function display($tpl = null) { // Initialize variables $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $user = JFactory::getUser(); $params = $app->getParams(); $db = JFactory::getDBO(); $uri = JFactory::getURI(); $task = $jinput->getCmd('task'); $pathway = $app->getPathWay(); $jinput = $app->input; $print = $jinput->getBool('print'); // 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', null); $requestCategoryId = $jinput->getInt('catid', null); $requestDate = $jinput->getInt('id', null); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); // get variables $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $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'); $search = $db->escape(trim(JString::strtolower($search))); // 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 // 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')); } $this->document->setTitle($pagetitle); // Are events available? if (!$rows) { $noevents = 1; } else { $noevents = 0; } if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } if ($requestVenueId) { $print_link = JRoute::_('index.php?view=day&tmpl=component&print=1&locid=' . $requestVenueId . '&id=' . $requestDate); } elseif ($requestCategoryId) { $print_link = JRoute::_('index.php?view=day&tmpl=component&print=1&catid=' . $requestCategoryId . '&id=' . $requestDate); } else { $print_link = JRoute::_('index.php?view=day&tmpl=component&print=1&id=' . $requestDate); } //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; } //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'); $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); //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 && !$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')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size' => '1', 'class' => 'inputbox'), 'value', 'text', $filter_type); // search filter $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 = $dellink; $this->pagination = $pagination; $this->action = $uri->toString(); $this->task = $task; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->lists = $lists; $this->daydate = $daydate; $this->showdaydate = $showdaydate; // if true daydate will be shown as h2 sub heading $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print = $print; // Doesn't really help - each view has less or more specific needs. //$this->prepareDocument(); parent::display($tpl); }
/** * 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); }
/** * Creates the edit button * * @param int $Itemid * @param int $id * @param array $params * @param int $allowedtoedit * @param string $view * * Views: * Event, Venue */ static function editbutton($item, $params, $attribs, $allowedtoedit, $view) { if ($allowedtoedit) { $app = JFactory::getApplication(); # check for print if ($app->input->getInt('print')) { return; } # Ignore if the state is negative. if ($item->published < 0) { return; } // Initialise variables. $user = JFactory::getUser(); $app = JFactory::getApplication(); $userId = $user->get('id'); $uri = JFactory::getURI(); $settings = JemHelper::globalattribs(); $jemsettings = JemHelper::config(); JHtml::_('bootstrap.tooltip'); switch ($view) { case 'editevent': if (property_exists($item, 'checked_out') && property_exists($item, 'checked_out_time') && $item->checked_out > 0 && $item->checked_out != $userId) { $checkoutUser = JFactory::getUser($item->checked_out); $button = JHtml::_('image', 'system/checked_out.png', NULL, NULL, true); $date = JHtml::_('date', $item->checked_out_time); $tooltip = JText::sprintf('COM_JEM_GLOBAL_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date; return '<span class="hasTooltip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>'; } $text = JHtml::_('image', 'com_jem/calendar_edit.png', JText::_('COM_JEM_EDIT_EVENT'), NULL, true); $id = $item->did; $desc = JText::_('COM_JEM_EDIT_EVENT_DESC'); $title = JText::_('COM_JEM_EDIT_EVENT'); $url = 'index.php?option=com_jem&task=editevent.edit&a_id=' . $id . '&return=' . base64_encode(urlencode($uri)); break; case 'editvenue': if (property_exists($item, 'vChecked_out') && property_exists($item, 'vChecked_out_time') && $item->vChecked_out > 0 && $item->vChecked_out != $userId) { $checkoutUser = JFactory::getUser($item->vChecked_out); $button = JHtml::_('image', 'system/checked_out.png', NULL, NULL, true); $date = JHtml::_('date', $item->vChecked_out_time); $tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_JEM_GLOBAL_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date; return '<span class="hasTooltip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>'; } $text = JHtml::_('image', 'com_jem/calendar_edit.png', JText::_('COM_JEM_EDIT_VENUE'), NULL, true); $id = $item->locid; $desc = JText::_('COM_JEM_EDIT_VENUE_DESC'); $title = JText::_('COM_JEM_EDIT_VENUE'); $url = 'index.php?option=com_jem&task=editvenue.edit&a_id=' . $id . '&return=' . base64_encode(urlencode($uri)); break; case 'venue': if (property_exists($item, 'vChecked_out') && property_exists($item, 'vChecked_out_time') && $item->vChecked_out > 0 && $item->vChecked_out != $userId) { $checkoutUser = JFactory::getUser($item->vChecked_out); $button = JHtml::_('image', 'system/checked_out.png', NULL, NULL, true); $date = JHtml::_('date', $item->vChecked_out_time); $tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_JEM_GLOBAL_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date; return '<span class="hasTooltip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>'; } $text = JHtml::_('image', 'com_jem/calendar_edit.png', JText::_('COM_JEM_EDIT_VENUE'), NULL, true); $id = $item->id; $desc = JText::_('COM_JEM_EDIT_VENUE_DESC'); $title = JText::_('COM_JEM_EDIT_VENUE'); $url = 'index.php?option=com_jem&task=editvenue.edit&a_id=' . $id . '&return=' . base64_encode(urlencode($uri)); break; case 'eventslist': # check if we're allowed to edit $maintainer = JemUser::ismaintainer('edit', $item->id); $genaccess = JemUser::editaccess($jemsettings->eventowner, $item->created_by, $jemsettings->eventeditrec, $jemsettings->eventedit); if ($maintainer || $genaccess || $user->authorise('core.edit', 'com_jem')) { # @todo finetune attribs/params if (property_exists($item, 'Checked_out') && property_exists($item, 'Checked_out_time') && $item->Checked_out > 0 && $item->Checked_out != $userId) { $checkoutUser = JFactory::getUser($item->Checked_out); $button = JHtml::_('image', 'system/checked_out.png', NULL, NULL, true); $date = JHtml::_('date', $item->Checked_out_time); $tooltip = JText::_('JLIB_HTML_CHECKED_OUT') . ' :: ' . JText::sprintf('COM_JEM_GLOBAL_CHECKED_OUT_BY', $checkoutUser->name) . ' <br /> ' . $date; return '<span class="hasTooltip" title="' . htmlspecialchars($tooltip, ENT_COMPAT, 'UTF-8') . '">' . $button . '</span>'; } $text = JHtml::_('image', 'com_jem/calendar_edit.png', JText::_('COM_JEM_EDIT_EVENT'), NULL, true); $id = $item->id; $desc = JText::_('COM_JEM_EDIT_EVENT_DESC'); $title = JText::_('COM_JEM_EDIT_EVENT'); $url = 'index.php?option=com_jem&task=editevent.edit&a_id=' . $id . '&return=' . base64_encode(urlencode($uri)); break; } else { return; } } if (!$url) { return; // we need at least url to generate useful output } $tip = JHtml::tooltipText($title, $desc, 0); $attribs = array(); $attribs['title'] = $tip; $attribs['class'] = 'hasTooltip'; $output = JHtml::_('link', JRoute::_($url), $text, $attribs); return $output; } }
/** * 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); }
/** * Categories-View */ function display($tpl = null) { $app = JFactory::getApplication(); $jinput = JFactory::getApplication()->input; $settings = JemHelper::globalattribs(); $document = JFactory::getDocument(); $jemsettings = JemHelper::config(); $vsettings = JemHelper::viewSettings('vcategories'); $settings = JemHelper::globalattribs(); $user = JFactory::getUser(); $print = $jinput->getBool('print'); $task = $jinput->getCmd('task'); $model = $this->getModel(); $id = $jinput->getInt('id', 1); $rows = $this->get('Data'); $pagination = $this->get('Pagination'); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } //get menu information $menu = $app->getMenu(); $menuitem = $menu->getActive(); $global = new JRegistry(); $global->loadString($settings); $params = clone $global; $params->merge($global); if ($menu = $app->getMenu()->getActive()) { $params->merge($menu->params); } $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=categories&id=' . $id . '&task=archive')); $print_link = JRoute::_('index.php?option=com_jem&view=categories&id=' . $id . '&task=archive&print=1&tmpl=component'); $pagetitle .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $pageheading .= ' - ' . JText::_('COM_JEM_ARCHIVE'); $params->set('page_heading', $pageheading); } else { $print_link = JRoute::_('index.php?option=com_jem&view=categories&id=' . $id . '&print=1&tmpl=component'); } // Add site name to title if param is set if ($app->getCfg('sitename_pagetitles', 0) == 1) { $pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle); } elseif ($app->getCfg('sitename_pagetitles', 0) == 2) { $pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename')); } //Set Page title $document->setTitle($pagetitle); $document->setMetaData('title', $pagetitle); //Check if the user has 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; } // Get events if requested if ($params->get('detcat_nr', 0) > 0) { foreach ($rows as $row) { $row->events = $model->getEventdata($row->id); } } $this->rows = $rows; $this->task = $task; $this->params = $params; $this->dellink = $dellink; $this->pagination = $pagination; $this->item = $menuitem; $this->jemsettings = $jemsettings; $this->vsettings = $vsettings; $this->settings = $settings; $this->pagetitle = $pagetitle; $this->print_link = $print_link; $this->model = $model; $this->id = $id; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print = $print; parent::display($tpl); }
/** * Creates the Simple List View */ function display($tpl = null) { $app = JFactory::getApplication(); $jinput = $app->input; //initialize variables $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 = JFactory::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'] == 'search'; // 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.' . $itemid . '.filter_continent', 'filter_continent', '', 'string'); $filter_country = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.filter_country', 'filter_country', '', 'string'); $filter_city = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.filter_city', 'filter_city', '', 'string'); $filter_date_from = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.filter_date_from', 'filter_date_from', '', 'string'); $filter_date_to = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.filter_date_to', 'filter_date_to', '', 'string'); $filter_category = $app->getUserStateFromRequest('com_jem.search.' . $itemid . '.filter_category', 'filter_category', 0, 'int'); $task = $jinput->getCmd('task'); //get data from model $rows = $this->get('Data'); //are events available? if (!$rows) { $noevents = 1; } else { $noevents = 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?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); //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; } //create select lists # @todo alter $lists = $this->_buildSortLists(); if ($lists['filter']) { //$uri->setVar('filter', $jinput->getString('filter')); //$filter = $app->getUserStateFromRequest('com_jem.jem.filter', 'filter', '', 'string'); $uri->setVar('filter', $lists['filter']); $uri->setVar('filter_type', $jinput->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->dellink = $dellink; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $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); }
/** * Creates the output for the Event view */ function display($tpl = null) { $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $userId = $user->get('id'); $dispatcher = JEventDispatcher::getInstance(); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $jinput = $app->input; $this->KunenaConfig = $this->get('KunenaConfig'); $this->params = $app->getParams('com_jem'); $this->item = $this->get('Item'); $this->print = $jinput->getBool('print'); $this->state = $this->get('State'); $this->user = $user; $this->jemsettings = $jemsettings; $this->settings = $settings; $categories = $this->get('Categories'); $this->categories = $categories; $isregistered = $this->get('UserIsRegistered'); // 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; $this->registers = $model->getRegisters($this->state->get('event.id')); // 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') == false) { 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 if ($item->datimage) { $this->dimage = JemImage::flyercreator($item->datimage, 'event'); } else { $this->dimage = false; } if ($item->locimage) { $this->limage = JemImage::flyercreator($item->locimage, 'venue'); } else { $this->limage = false; } $this->img_position = $settings->get('img_position', 1); // 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')) { $this->addeventlink = 1; } else { $this->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) { $this->addvenuelink = 1; } else { $this->addvenuelink = 0; } // Check if user can edit $maintainer5 = JemUser::ismaintainer('edit', $item->did); $genaccess5 = JemUser::editaccess($jemsettings->eventowner, $item->created_by, $jemsettings->eventeditrec, $jemsettings->eventedit); if ($maintainer5 || $genaccess5 || $user->authorise('core.edit', 'com_jem')) { $this->allowedtoeditevent = 1; } else { $this->allowedtoeditevent = 0; } //Check if the user has access to the edit-venueform $maintainer3 = JemUser::venuegroups('edit'); $genaccess3 = JemUser::editaccess($jemsettings->venueowner, $item->venueowner, $jemsettings->venueeditrec, $jemsettings->venueedit); if ($maintainer3 || $genaccess3) { $this->allowedtoeditvenue = 1; } else { $this->allowedtoeditvenue = 0; } //Timecheck for registration $now = strtotime(date("Y-m-d")); $date = strtotime($item->dates); $timecheck = $now - $date; //let's build the registration handling $formhandler = 0; //is the user allready registered at the event if ($isregistered) { $formhandler = 3; } elseif ($timecheck > 0 && !is_null($item->dates)) { //check if it is too late to register and overwrite $formhandler $formhandler = 1; } elseif (!$user->get('id')) { //is the user registered at joomla and overwrite $formhandler if not $formhandler = 2; } else { $formhandler = 4; } if ($formhandler >= 3) { $js = "function check(checkbox, send) {\n\t\t\t\tif(checkbox.checked==true){\n\t\t\t\t\tsend.disabled = false;\n\t\t\t\t} else {\n\t\t\t\t\tsend.disabled = true;\n\t\t\t\t}}"; $document->addScriptDeclaration($js); } $this->formhandler = $formhandler; // generate Metatags $meta_keywords_content = ""; if (!empty($this->item->meta_keywords)) { $keywords = explode(",", $this->item->meta_keywords); foreach ($keywords as $keyword) { if ($meta_keywords_content != "") { $meta_keywords_content .= ", "; } if (preg_match("/[\\/[\\/]/", $keyword)) { $keyword = trim(str_replace("[", "", str_replace("]", "", $keyword))); $buffer = $this->keyword_switcher($keyword, $this->item, $categories, $jemsettings->formattime, $jemsettings->formatdate); if ($buffer != "") { $meta_keywords_content .= $buffer; } else { $meta_keywords_content = substr($meta_keywords_content, 0, strlen($meta_keywords_content) - 2); // remove the comma and the white space } } else { $meta_keywords_content .= $keyword; } } $document->setMetadata('keywords', $meta_keywords_content); } 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)); # 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; // 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); }
/** * Creates the Venue View */ function display($tpl = null) { // initialize variables $app = JFactory::getApplication(); $jinput = $app->input; $document = JFactory::getDocument(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $vsettings = JemHelper::viewSettings('vvenue'); $db = JFactory::getDBO(); $state = $this->get('State'); $params = $state->params; $pathway = $app->getPathWay(); $uri = JFactory::getURI(); $task = $jinput->getCmd('task'); $user = JFactory::getUser(); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $print = $jinput->getBool('print'); $this->state = $this->get('State'); // 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'); // are events available? if (!$rows) { $noevents = 1; } else { $noevents = 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'); $search = $db->escape(trim(JString::strtolower($search))); // 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&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 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; } // Check if the user has access to the edit-venueform $maintainer3 = JemUser::venuegroups('edit'); $genaccess3 = JemUser::editaccess($jemsettings->venueowner, $venue->created, $jemsettings->venueeditrec, $jemsettings->venueedit); if ($maintainer3 || $genaccess3) { $allowedtoeditvenue = 1; } else { $allowedtoeditvenue = 0; } // 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; } // 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); } # 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; // Create the pagination object $pagination = $this->get('Pagination'); // filters $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->showcat == 1) { $filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size' => '1', 'class' => 'inputbox input-medium'), '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->addvenuelink = $addvenuelink; $this->addeventlink = $addeventlink; $this->limage = $limage; $this->venuedescription = $venuedescription; $this->pagination = $pagination; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->vsettings = $vsettings; $this->item = $menuitem; $this->pagetitle = $pagetitle; $this->task = $task; $this->allowedtoeditvenue = $allowedtoeditvenue; $this->pageclass_sfx = htmlspecialchars($pageclass_sfx); $this->print = $print; parent::display($tpl); }
/** * Creates the Simple List View */ function display($tpl = null) { // initialize variables $state = $this->get('State'); $document = JFactory::getDocument(); $app = JFactory::getApplication(); $jinput = $app->input; $jemsettings = JemHelper::config(); $settings = JemHelper::globalattribs(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $params = $state->params; $uri = JFactory::getURI(); $db = JFactory::getDBO(); $user = JFactory::getUser(); $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0); $print = $jinput->getBool('print'); $admin = JEMUser::superuser(); $task = $jinput->getCmd('task'); $template = $app->getTemplate(); // Load css JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); if ($print) { JemHelper::loadCss('print'); $document->setMetaData('robots', 'noindex, nofollow'); } // userstate variables $filter_order = $app->getUserStateFromRequest('com_jem.eventslist.' . $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.eventslist.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word'); $filter_type = $app->getUserStateFromRequest('com_jem.eventslist.' . $itemid . '.filter_type', 'filter_type', '', 'int'); $search = $app->getUserStateFromRequest('com_jem.eventslist.' . $itemid . '.filter_search', 'filter_search', '', 'string'); $search = $db->escape(trim(JString::strtolower($search))); // table ordering $lists['order_Dir'] = $filter_order_Dir; $lists['order'] = $filter_order; // get data from model $rows = $this->get('Items'); // are events available? if (!$rows) { $noevents = 1; } else { $noevents = 0; } # print-link if ($task == 'archive') { $print_link = JRoute::_('index.php?view=eventslist&task=archive&tmpl=component&print=1'); } else { $print_link = JRoute::_('index.php?view=eventslist&tmpl=component&print=1'); } // 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) { $addvenuelink = 1; } else { $addvenuelink = 0; } // 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')); } if ($jemsettings->showcat == 1) { $filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY')); } $lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size' => '1', 'class' => 'inputbox input-medium'), 'value', 'text', $filter_type); $lists['search'] = $search; $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); $this->pagination = $this->get('Pagination'); $this->lists = $lists; $this->action = $uri->toString(); $this->rows = $rows; $this->task = $task; $this->noevents = $noevents; $this->params = $params; $this->addvenuelink = $addvenuelink; $this->dellink = $dellink; $this->jemsettings = $jemsettings; $this->settings = $settings; $this->print = $print; $this->print_link = $print_link; $this->admin = $admin; $this->_prepareDocument(); parent::display($tpl); }
/** * Editvenue-View */ public function display($tpl = null) { // Initialise variables. $jemsettings = JemHelper::config(); $app = JFactory::getApplication(); $user = JFactory::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'); $this->settings2 = JemHelper::globalattribs(); // 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 guest if (!$user || $user->id == 0) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } if (empty($this->item->id)) { // Check if the user has access to the form $maintainer = JemUser::venuegroups('add'); $delloclink = JemUser::validate_user($jemsettings->locdelrec, $jemsettings->deliverlocsyes); if ($maintainer || $delloclink) { $dellink = true; } else { $dellink = false; } $authorised = $user->authorise('core.create', 'com_jem') || $dellink; } else { // Check if user can edit $maintainer = JemUser::venuegroups('edit'); $genaccess = JemUser::editaccess($jemsettings->venueowner, $this->item->created_by, $jemsettings->venueeditrec, $jemsettings->venueedit); if ($maintainer || $genaccess) { $edit = true; } else { $edit = false; } $authorised = $this->item->params->get('access-edit') || $edit; } 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; } 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; } $access2 = JemHelper::getAccesslevelOptions(); $this->access = $access2; // Load css JemHelper::loadCss('geostyle'); JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); JemHelper::loadCustomTag(); // Load script JHtml::_('bootstrap.framework'); JHtml::_('script', 'com_jem/attachments.js', false, true); # 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; $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->jemsettings = $jemsettings; $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; $this->_prepareDocument(); parent::display($tpl); }
public function display($tpl = null) { if ($this->getLayout() == 'choosevenue') { $this->_displaychoosevenue($tpl); return; } if ($this->getLayout() == 'choosecontact') { $this->_displaychoosecontact($tpl); return; } // Initialise variables. $jemsettings = JEMHelper::config(); $app = JFactory::getApplication(); $user = JFactory::getUser(); $valguest = JEMUser::validate_guest(); $document = JFactory::getDocument(); $model = $this->getModel(); $menu = $app->getMenu(); $menuitem = $menu->getActive(); $pathway = $app->getPathway(); $url = JUri::root(); $template = $app->getTemplate(); $settings = JemHelper::globalattribs(); $vsettings = JemHelper::viewSettings('veditevent'); $this->vsettings = $vsettings; $this->settings = $settings; $this->valguest = $valguest; // 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'); if ($valguest == false) { // check for guest if (!$user || $user->id == 0) { $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); return false; } } if (empty($this->item->id)) { // Check if the user has access to the form $maintainer = JemUser::ismaintainer('add'); $genaccess = JemUser::validate_user($jemsettings->evdelrec, $jemsettings->delivereventsyes); if ($maintainer || $genaccess) { $dellink = true; } else { $dellink = false; } $valguest = JEMUser::validate_guest(); $authorised = $user->authorise('core.create', 'com_jem') || (count($user->getAuthorisedCategories('com_jem', 'core.create')) || $valguest || $dellink); } else { // Check if user can edit $maintainer5 = JemUser::ismaintainer('edit', $this->item->id); $genaccess5 = JemUser::editaccess($jemsettings->eventowner, $this->item->created_by, $jemsettings->eventeditrec, $jemsettings->eventedit); if ($maintainer5 || $genaccess5) { $allowedtoeditevent = true; } else { $allowedtoeditevent = false; } $authorised = $this->item->params->get('access-edit') || $allowedtoeditevent; } 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'] == 'editevent' && 0 == $item->id; // menu item is always for new event $title = $item->id == 0 ? JText::_('COM_JEM_EDITEVENT_ADD_EVENT') : JText::sprintf('COM_JEM_EDITEVENT_EDIT_EVENT', $item->title); 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 event if there is one set if (isset($menuitem->query['layout'])) { $this->setLayout($menuitem->query['layout']); } elseif ($layout = $item->params->get('event_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 definitely no introtext. $params->set('show_introtext', 0); $pathway->addItem($pagetitle, ''); // link not required here so '' is ok // Check for alternative layouts (since we are not in a edit-event menu item) // Load layout from event if one is set if ($layout = $item->params->get('event_layout')) { $this->setLayout($layout); } $temp = clone $params; $temp->merge($item->params); $item->params = $temp; } 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(); // check for recurrence if ($this->item->recurrence_type != 0 || $this->item->recurrence_first_id != 0) { $tmp->recurrence_type = 0; $tmp->recurrence_first_id = 0; } // $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; } $access2 = JEMHelper::getAccesslevelOptions(); $this->access = $access2; // add css file JemHelper::loadCss('jem'); JemHelper::loadCustomCss(); # Load scripts JHtml::_('bootstrap.framework'); if ($vsettings->get('editevent_show_attachmentstab', 1)) { JHtml::_('script', 'com_jem/attachments.js', false, true); } if ($vsettings->get('editevent_show_othertab', 1)) { JHtml::_('script', 'com_jem/other.js', false, true); JHtml::_('script', 'com_jem/recurrence.js', false, true); } JHtml::_('script', 'com_jem/seo.js', false, true); if (JEMUser::validate_guest()) { JHtml::_('script', 'com_jem/antispam.js', false, true); } JHtml::_('behavior.tabstate'); // Escape strings for HTML output $this->pageclass_sfx = htmlspecialchars($item->params->get('pageclass_sfx')); $this->dimage = JemImage::flyercreator($this->item->datimage, 'event'); $this->jemsettings = $jemsettings; $this->infoimage = JHtml::_('image', 'com_jem/icon-16-hint.png', JText::_('COM_JEM_NOTES'), NULL, true); $this->user = $user; if ($params->get('enable_category') == 1) { $this->form->setFieldAttribute('catid', 'default', $params->get('catid', 1)); $this->form->setFieldAttribute('catid', 'readonly', 'true'); } $this->_prepareDocument(); parent::display($tpl); }