コード例 #1
0
 /**
  * get list of categories as options, according to acl
  *
  * @return array
  */
 function getCategoriesOptions()
 {
     $app =& JFactory::getApplication();
     $filter_venuecategory = JRequest::getVar('filter_venuecategory');
     $filter_venue = JRequest::getVar('filter_venue');
     $task = JRequest::getWord('task');
     $acl =& UserAcl::getInstance();
     $gids = $acl->getUserGroupsIds();
     if (!is_array($gids) || !count($gids)) {
         $gids = array(0);
     }
     $gids = implode(',', $gids);
     //Get Events from Database
     $query = ' SELECT c.id ' . ' FROM #__redevent_event_venue_xref AS x' . ' INNER JOIN #__redevent_events AS a ON a.id = x.eventid' . ' INNER JOIN #__redevent_venues AS l ON l.id = x.venueid' . ' LEFT JOIN #__redevent_venue_category_xref AS xvcat ON l.id = xvcat.venue_id' . ' LEFT JOIN #__redevent_venues_categories AS vc ON xvcat.category_id = vc.id' . ' INNER JOIN #__redevent_event_category_xref AS xcat ON xcat.event_id = a.id' . ' INNER JOIN #__redevent_categories AS c ON c.id = xcat.category_id' . ' LEFT JOIN #__redevent_groups_venues AS gv ON gv.venue_id = l.id AND gv.group_id IN (' . $gids . ')' . ' LEFT JOIN #__redevent_groups_venues_categories AS gvc ON gvc.category_id = vc.id AND gvc.group_id IN (' . $gids . ')' . ' LEFT JOIN #__redevent_groups_categories AS gc ON gc.category_id = c.id AND gc.group_id IN (' . $gids . ')';
     $where = array();
     // First thing we need to do is to select only the published events
     if ($task == 'archive') {
         $where[] = ' x.published = -1 ';
         $where[] = ' a.published <> 0 ';
     } else {
         $where[] = ' x.published = 1 ';
         $where[] = ' a.published <> 0 ';
     }
     // filter category
     if ($filter_venuecategory) {
         $category = $this->getVenueCategory((int) $filter_venuecategory);
         $where[] = '(vc.id = ' . $this->_db->Quote($category->id) . ' OR (vc.lft > ' . $this->_db->Quote($category->lft) . ' AND vc.rgt < ' . $this->_db->Quote($category->rgt) . '))';
     }
     if ($filter_venue) {
         $where[] = ' l.id = ' . $this->_db->Quote($filter_venue);
     }
     //acl
     $where[] = ' (l.private = 0 OR gv.id IS NOT NULL) ';
     $where[] = ' (c.private = 0 OR gc.id IS NOT NULL) ';
     $where[] = ' (vc.private = 0 OR vc.private IS NULL OR gvc.id IS NOT NULL) ';
     if (count($where)) {
         $query .= ' WHERE ' . implode(' AND ', $where);
     }
     $query .= ' GROUP BY c.id ';
     $this->_db->setQuery($query);
     $res = $this->_db->loadResultArray();
     return redEVENTHelper::getEventsCatOptions(true, false, $res);
 }
コード例 #2
0
 /**
  * Creates the Venuesview
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     $uri =& JFactory::getURI();
     //get menu information
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $task = JRequest::getWord('task');
     if ($item) {
         $title = $item->title;
     } else {
         $title = JText::_('COM_REDEVENT_Venues_map');
         $params->set('page_title', $title);
     }
     //add css file
     if (!$params->get('custom_css')) {
         $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     } else {
         $document->addStyleSheet($params->get('custom_css'));
     }
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // specific for eventsmap
     JHTML::_('behavior.mootools');
     $document->addScript('http://maps.google.com/maps/api/js?sensor=false');
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/markermanager.js');
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/venuesmap.js');
     // filters
     $vcat = $mainframe->getUserStateFromRequest('com_redevent.venuesmap.vcat', 'vcat', $params->def('vcat', 0), 'int');
     $cat = $mainframe->getUserStateFromRequest('com_redevent.venuesmap.cat', 'cat', $params->def('cat', 0), 'int');
     $custom = $this->get('CustomFilters');
     $filter_customs = $mainframe->getUserStateFromRequest('com_redevent.venuesmap.filter_customs', 'filtercustom', array(), 'array');
     $rows =& $this->get('Data');
     $countries = $this->get('Countries');
     //Add needed scripts if the lightbox effect is enabled
     JHTML::_('behavior.modal');
     //pathway
     $pathway =& $mainframe->getPathWay();
     if ($task == 'archive') {
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE'), JRoute::_('index.php?view=venues&task=archive'));
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
         $print_link = JRoute::_('index.php?view=venues&task=archive&pop=1&tmpl=component');
     } else {
         $pagetitle = $params->get('page_title');
         $print_link = JRoute::_('index.php?view=venues&pop=1&tmpl=component');
     }
     $lists = array();
     // venues categories
     $vcat_options = redEVENTHelper::getVenuesCatOptions(false);
     array_unshift($vcat_options, JHTML::_('select.option', 0, JText::_('COM_REDEVENT_ALL')));
     $lists['venuescats'] = JHTML::_('select.genericlist', $vcat_options, 'vcat', '', 'value', 'text', $vcat);
     // events categories
     $cat_options = redEVENTHelper::getEventsCatOptions(false);
     array_unshift($cat_options, JHTML::_('select.option', 0, JText::_('COM_REDEVENT_ALL')));
     $lists['eventscats'] = JHTML::_('select.genericlist', $cat_options, 'cat', '', 'value', 'text', $cat);
     $lists['customfilters'] = $custom;
     //Set Page title
     $this->document->setTitle($pagetitle);
     $document->setMetadata('keywords', $pagetitle);
     $ajaxurl = 'index.php?option=com_redevent&view=venue&tmpl=component';
     if ($vcat) {
         $ajaxurl .= '&vcat=' . $vcat;
     }
     if ($cat) {
         $ajaxurl .= '&cat=' . $vcat;
     }
     $this->assignRef('rows', $rows);
     $this->assignRef('countries', $countries);
     $this->assignRef('params', $params);
     $this->assignRef('item', $item);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('task', $task);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assignRef('lists', $lists);
     $this->assign('action', JRoute::_('index.php?option=com_redevent&view=venuesmap'));
     $this->assign('ajaxurl', $ajaxurl);
     $this->assign('filter_customs', $filter_customs);
     parent::display($tpl);
 }