Exemplo n.º 1
0
 /**
  * Creates the search View
  *
  * @since 0.9
  */
 function display($tpl = null)
 {
     $mainframe =& JFactory::getApplication();
     //initialize variables
     $document =& JFactory::getDocument();
     $elsettings =& redEVENTHelper::config();
     $menu =& JSite::getMenu();
     $item = $menu->getActive();
     $params =& $mainframe->getParams();
     $uri =& JFactory::getURI();
     $pathway =& $mainframe->getPathWay();
     //add css file
     $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/redevent.css');
     $document->addCustomTag('<!--[if IE]><style type="text/css">.floattext{zoom:1;}, * html #eventlist dd { height: 1%; }</style><![endif]-->');
     // add javascript
     JHTML::_('behavior.mootools');
     $document->addScript($this->baseurl . '/components/com_redevent/assets/js/search.js');
     // get variables
     $task = JRequest::getWord('task');
     $pop = JRequest::getBool('pop');
     //get data from model
     $rows =& $this->get('Data');
     $customs =& $this->get('ListCustomFields');
     $customsfilters =& $this->get('CustomFilters');
     $total =& $this->get('Total');
     // Create the pagination object
     $pageNav = $this->get('Pagination');
     $limitstart = $pageNav->limitstart;
     $limit = $pageNav->limit;
     $state =& $this->get('state');
     // set in the model
     $filter_country = $state->get('filter_country');
     $filter_city = $state->get('filter_city');
     $filter_state = $state->get('filter_state');
     $filter_venue = $state->get('filter_venue');
     $filter_date_from = $state->get('filter_date_from');
     $filter_date_to = $state->get('filter_date_to');
     $filter_venuecategory = $state->get('filter_venuecategory');
     $filter_category = $mainframe->getUserStateFromRequest('com_redevent.search.filter_category', 'filter_category', $params->get('category', 0), 'int');
     $filter_event = $state->get('filter_event');
     $filter_customs = $state->get('filter_customs');
     //are events available?
     if (!$rows) {
         $noevents = 1;
         $filter = $this->get('Filter');
         if (!$filter) {
             $nofilter = 1;
         }
     } else {
         $noevents = 0;
         $nofilter = 0;
     }
     //params
     $params->def('page_title', $item->title);
     if ($pop) {
         //If printpopup set true
         $params->set('popup', 1);
         $this->setLayout('print');
     }
     if ($task == 'archive') {
         $pathway->addItem(JText::_('COM_REDEVENT_ARCHIVE'), JRoute::_('index.php?option=com_redevent&view=search&task=archive'));
         $print_link = JRoute::_('index.php?option=com_redevent&view=search&task=archive&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title') . ' - ' . JText::_('COM_REDEVENT_ARCHIVE');
     } else {
         $print_link = JRoute::_('index.php?option=com_redevent&view=search&tmpl=component&pop=1');
         $pagetitle = $params->get('page_title');
     }
     //Set Page title
     $this->document->setTitle($pagetitle);
     //create select lists
     $lists = $this->_buildSortLists();
     if ($params->get('category', 0) == 0) {
         $catoptions = array();
         $catoptions[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_category'));
         $catoptions = array_merge($catoptions, $this->get('CategoriesOptions'));
         $selectedcats = $filter_category ? array($filter_category) : array();
         //build select
         $lists['categories'] = JHTML::_('select.genericlist', $catoptions, 'filter_category', 'size="1" class="inputbox dynfilter"', 'value', 'text', $selectedcats);
         unset($catoptions);
     }
     $vcatoptions = array();
     $vcatoptions[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_venue_category'));
     $vcatoptions = array_merge($vcatoptions, redEVENTHelper::getVenuesCatOptions());
     $selectedcats = $filter_venuecategory ? array($filter_venuecategory) : array();
     //build select
     $lists['vcategories'] = JHTML::_('select.genericlist', $vcatoptions, 'filter_venuecategory', 'size="1" class="inputbox dynfilter"', 'value', 'text', $selectedcats);
     unset($catoptions);
     // country filter
     $countries = array();
     $countries[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_country'));
     $countries = array_merge($countries, $this->get('CountryOptions'));
     $lists['countries'] = JHTML::_('select.genericlist', $countries, 'filter_country', 'class="inputbox"', 'value', 'text', $filter_country);
     unset($countries);
     // state filter
     $states = array();
     $states[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_state'));
     $states = array_merge($states, $this->get('StateOptions'));
     $lists['states'] = JHTML::_('select.genericlist', $states, 'filter_state', 'class="inputbox"', 'value', 'text', $filter_state);
     unset($states);
     // city filter
     $cities = array();
     $cities[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_city'));
     $cities = array_merge($cities, $this->get('CityOptions'));
     $lists['cities'] = JHTML::_('select.genericlist', $cities, 'filter_city', 'class="inputbox"', 'value', 'text', $filter_city);
     unset($cities);
     // venues filter
     $venues = array();
     $venues[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Select_venue'));
     $venues = array_merge($venues, $this->get('VenuesOptions'));
     $lists['venues'] = JHTML::_('select.genericlist', $venues, 'filter_venue', 'class="inputbox dynfilter"', 'value', 'text', $filter_venue);
     unset($venues);
     // events filter
     $options = array();
     $options[] = JHTML::_('select.option', '0', JText::_('COM_REDEVENT_Search_select_event'));
     $options = array_merge($options, $this->get('EventsOptions'));
     $lists['events'] = JHTML::_('select.genericlist', $options, 'filter_event', 'class="inputbox dynfilter"', 'value', 'text', $filter_event);
     unset($venues);
     // remove previously set filter in get
     $uri->delVar('filter');
     $uri->delVar('filter_type');
     $uri->delVar('filter_category');
     $uri->delVar('filter_venuecategory');
     $uri->delVar('filter_venue');
     $uri->delVar('filter_event');
     $uri->delVar('filter_continent');
     $uri->delVar('filter_country');
     $uri->delVar('filter_state');
     $uri->delVar('filter_city');
     $uri->delVar('filter_date_from');
     $uri->delVar('filter_date_to');
     $uri->delVar('filtercustom');
     $this->assign('lists', $lists);
     $this->assign('total', $total);
     $this->assign('action', JRoute::_(RedeventHelperRoute::getSearchRoute()));
     $this->assignRef('rows', $rows);
     $this->assignRef('customs', $customs);
     $this->assignRef('customsfilters', $customsfilters);
     $this->assignRef('task', $task);
     $this->assignRef('noevents', $noevents);
     $this->assignRef('nofilter', $nofilter);
     $this->assignRef('print_link', $print_link);
     $this->assignRef('params', $params);
     $this->assignRef('dellink', $dellink);
     $this->assignRef('pageNav', $pageNav);
     $this->assignRef('elsettings', $elsettings);
     $this->assignRef('pagetitle', $pagetitle);
     $this->assign('filter_country', $filter_country);
     $this->assign('filter_state', $filter_state);
     $this->assign('filter_date_from', $filter_date_from);
     $this->assign('filter_date_to', $filter_date_to);
     $this->assign('filter_customs', $filter_customs);
     $cols = explode(',', $params->get('lists_columns', 'date, title, venue, city, category'));
     $cols = redEVENTHelper::validateColumns($cols);
     $this->assign('columns', $cols);
     parent::display($tpl);
 }
Exemplo n.º 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);
 }