Esempio n. 1
0
 /**
  * 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);
 }
Esempio n. 2
0
 /**
  * venues-query
  */
 function buildQueryVenues()
 {
     $app = JFactory::getApplication();
     $params = JemHelper::globalattribs();
     $vsettings = JemHelper::viewSettings('veditevent');
     $jinput = $app->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $filter_order = $app->getUserStateFromRequest('com_jem.selectvenue.' . $itemid . '.filter_order', 'filter_order', 'l.venue', 'cmd');
     $filter_order_Dir = $app->getUserStateFromRequest('com_jem.selectvenue.' . $itemid . '.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.' . $itemid . '.filter_type', 'filter_type', '', 'int');
     $search = $app->getUserStateFromRequest('com_jem.selectvenue.' . $itemid . '.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 ($vsettings->get('global_show_ownedvenuesonly', 1)) {
         $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;
 }
Esempio n. 3
0
    /**
     * 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);
    }
Esempio n. 4
0
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * 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);
 }
Esempio n. 6
0
 /**
  * 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);
 }
Esempio n. 7
0
 /**
  * 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', '&mdash; ' . JText::_('COM_JEM_GLOBAL_SELECT_FILTER') . ' &mdash;');
     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);
 }
Esempio n. 8
0
 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);
 }