Exemplo n.º 1
0
 public static function getCategoryRoute($id)
 {
     if (!isset(self::$FixedItemid)) {
         $settings = JEMHelper::globalattribs();
         $defaultItemid = $settings->get('default_Itemid');
     } else {
         if (isset(self::$FixedItemid)) {
             $defaultItemid = self::$FixedItemid;
         }
     }
     $needles = array('category' => array((int) $id));
     // Create the link
     $link = 'index.php?option=com_jem&view=category&id=' . $id;
     // If no category view works try categories
     $needles['categories'] = array(self::ARTIFICALID);
     $category = new JEMCategories($id);
     if ($category) {
         $needles['categories'] = array_reverse($category->getPath());
     }
     if ($item = self::_findItem($needles)) {
         $link .= '&Itemid=' . $item;
     } elseif ($item = self::_findItem()) {
         if (isset($defaultItemid)) {
             $link .= '&Itemid=' . $defaultItemid;
         }
     }
     return $link;
 }
Exemplo n.º 2
0
	public function getInput()
	{
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
			$attr .= ' disabled="disabled"';
		}

		//$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';

		// Output
		$currentid = JFactory::getApplication()->input->getInt('id');
		$categories = JEMCategories::getCategoriesTree();


		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query = 'SELECT DISTINCT catid FROM #__jem_cats_event_relations WHERE itemid = '. $db->quote($currentid);

		$db->setQuery($query);
		$selectedcats = $db->loadColumn();

		return JEMCategories::buildcatselect($categories, 'cid[]', $selectedcats, 0, trim($attr));
	}
Exemplo n.º 3
0
	/**
	 * Method to auto-populate the model state.
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		$app           = JFactory::getApplication();
		$jinput        = $app->input;
		$task          = $jinput->getCmd('task', '');
		$params        = $app->getParams();
		$top_category  = $params->get('top_category', 0);
		$startdayonly  = $params->get('show_only_start', false);
		$numberOfWeeks = $params->get('nrweeks', '1');
		$firstweekday  = $params->get('firstweekday', 1);

		# params
		$this->setState('params', $params);

		# publish state
		$this->_populatePublishState($task);

		###########
		## DATES ##
		###########

		#only select events within specified dates. (chosen weeknrs)

		$config = JFactory::getConfig();
		$offset = $config->get('offset');
		date_default_timezone_set($offset);
		$datetime = new DateTime();
		// If week starts Monday we use dayoffset 1, on Sunday we use 0 but 7 if today is Sunday.
		$dayoffset = ($firstweekday == 1) ? 1 : ((($firstweekday == 0) && ($datetime->format('N') == 7)) ? 7 : 0);
		$datetime->setISODate($datetime->format('Y'), $datetime->format('W'), $dayoffset);
		$filter_date_from = $datetime->format('Y-m-d');
		$datetime->modify('+'.$numberOfWeeks.' weeks'.' -1 day'); // just to be compatible to php < 5.3 ;-)
		$filter_date_to   = $datetime->format('Y-m-d');

		$where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), ' . $this->_db->quote($filter_date_from) . ') >= 0';
		$this->setState('filter.calendar_from', $where);
		$this->setState('filter.date.from', $filter_date_from);

		$where = ' DATEDIFF(a.dates, ' . $this->_db->quote($filter_date_to) . ') <= 0';
		$this->setState('filter.calendar_to', $where);
		$this->setState('filter.date.to', $filter_date_to);


		##################
		## TOP-CATEGORY ##
		##################

		if ($top_category) {
			$children = JEMCategories::getChilds($top_category);
			if (count($children)) {
				$where = 'rel.catid IN ('. implode(',', $children) .')';
				$this->setState('filter.category_top', $where);
			}
		}

		# set filter
		$this->setState('filter.calendar_startdayonly', (bool)$startdayonly);
		$this->setState('filter.groupby', 'a.id');
	}
Exemplo n.º 4
0
	/**
	 * Method to auto-populate the model state.
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		# parent::populateState($ordering, $direction);
		$app 			= JFactory::getApplication();
		$jemsettings	= JemHelper::config();
		$jinput			= JFactory::getApplication()->input;
		$itemid 		= $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
		$params 		= $app->getParams();
		$task           = $jinput->get('task','','cmd');
		$top_category 	= $params->get('top_category', 0);
		$startdayonly 	= $params->get('show_only_start', false);

		# params
		$this->setState('params', $params);

		# publish state
		$this->_populatePublishState($task);

		###########
		## DATES ##
		###########

		#only select events within specified dates. (chosen month)
		$monthstart	= mktime(0, 0, 1, strftime('%m', $this->_date), 1, strftime('%Y', $this->_date));
		$monthend	= mktime(0, 0, -1, strftime('%m', $this->_date)+1, 1, strftime('%Y', $this->_date));

		$filter_date_from	= $this->_db->Quote(strftime('%Y-%m-%d', $monthstart));
		$filter_date_to		= $this->_db->Quote(strftime('%Y-%m-%d', $monthend));

		$where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), '. $filter_date_from .') >= 0';
		$this->setState('filter.calendar_from',$where);

		$where = ' DATEDIFF(a.dates, '. $filter_date_to .') <= 0';
		$this->setState('filter.calendar_to',$where);

		##################
		## TOP-CATEGORY ##
		##################

		if ($top_category) {
			$children = JEMCategories::getChilds($top_category);
			if (count($children)) {
				$where = 'rel.catid IN ('. implode(',', $children) .')';
				$this->setState('filter.category_top', $where);
			}
		}

		# set filter
		$this->setState('filter.calendar_multiday',true);
		$this->setState('filter.calendar_startdayonly',(bool)$startdayonly);
		$this->setState('filter.groupby',array('a.id'));
	}
Exemplo n.º 5
0
 protected function getOptions()
 {
     $db = JFactory::getDbo();
     $options = JEMCategories::getCategoriesTree();
     try {
         $options = $db->loadObjectList();
     } catch (RuntimeException $e) {
         JError::raiseWarning(500, $e->getMessage);
     }
     // Merge any additional options in the XML definition.
     $options = array_merge(parent::getOptions(), $options);
     return $options;
 }
Exemplo n.º 6
0
 public function display($tpl = null)
 {
     // Load pane behavior
     jimport('joomla.html.pane');
     // initialise variables
     $document = JFactory::getDocument();
     // Load css
     JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
     // Cause of group limits we can't use class here to build the categories tree
     $categories = $this->get('Categories');
     // build selectlists
     $categories = JEMCategories::buildcatselect($categories, 'cid[]', null, 0, 'multiple="multiple" size="8 class="inputbox"');
     $this->categories = $categories;
     // add toolbar
     $this->addToolbar();
     parent::display($tpl);
 }
Exemplo n.º 7
0
	public function getInput()
	{
		$attr = '';

		// Initialize some field attributes.
		$attr .= $this->element['class'] ? ' class="'.(string) $this->element['class'].'"' : '';

		// To avoid user's confusion, readonly="true" should imply disabled="true".
		if ((string) $this->element['readonly'] == 'true' || (string) $this->element['disabled'] == 'true') {
			$attr .= ' disabled="disabled"';
		}

		//$attr .= $this->element['size'] ? ' size="'.(int) $this->element['size'].'"' : '';
		$attr .= $this->multiple ? ' multiple="multiple"' : '';

		// Initialize JavaScript field attributes.
		$attr .= $this->element['onchange'] ? ' onchange="'.(string) $this->element['onchange'].'"' : '';


		//$attr .= $this->element['required'] ? ' class="required modal-value"' : "";

// 		if ($this->required) {
// 			$class = ' class="required modal-value"';
// 		}

		// Output

		//$categories = JEMCategories::getCategoriesTree(0);
		//$Lists['parent_id'] 		= JEMCategories::buildcatselect($categories, 'parent_id', $row->parent_id, 1);

		$currentid = JFactory::getApplication()->input->getInt('id');
		$categories = JEMCategories::getCategoriesTree(0);

		$db		= JFactory::getDbo();
		$query	= $db->getQuery(true);
		$query = 'SELECT DISTINCT parent_id FROM #__jem_categories WHERE id = '. $db->quote($currentid);

		$db->setQuery($query);
		$currentparent_id = $db->loadColumn();

		return JEMCategories::buildcatselect($categories, 'parent_id', $currentparent_id, 1);
	}
Exemplo n.º 8
0
	/**
	 * logic to get the categories
	 *
	 * @access public
	 * @return void
	 */
	function getCategories($id)
	{
		$db          = JFactory::getDbo();
		$user        = JemFactory::getUser();
		$userid      = (int) $user->get('id');

		if (empty($id)) {
			// for new events also show all categories user is allowed to see, disable non-useable categories
			// (to show same list in both cases, and allow "unusable" parents for structuring)
			$mitems = $user->getJemCategories('add', 'event', array('use_disable' => true));
		} else {
			$query = $db->getQuery(true);
			$query = 'SELECT COUNT(*)'
				. ' FROM #__jem_events AS e'
				. ' WHERE e.id = ' . $db->quote($id)
				. '   AND e.created_by = ' . $db->quote($userid);
			$db->setQuery($query);
			$owner = $db->loadResult();

			// on edit show all categories user is allowed to see, disable non-useable categories
			$mitems = $user->getJemCategories(array('add', 'edit'), 'event', array('use_disable' => true, 'owner' => $owner));
		}

		if (!$mitems)
		{
			$mitems = array();
			$children = array();

			$parentid = 0;
		}
		else
		{
			$children = array();
			// First pass - collect children
			foreach ($mitems as $v)
			{
				$pt = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : array();
				array_push($list, $v);
				$children[$pt] = $list;
			}

			// list childs of "root" which has no parent and normally id 1
			$parentid = intval(@isset($children[0][0]->id) ? $children[0][0]->id : 1);
		}

		//get list of the items
		$list = JEMCategories::treerecurse($parentid, '', array(), $children, 9999, 0, 0);

		// append orphaned categories
		if (count($mitems) > count($list)) {
			foreach ($children as $k => $v) {
				if (($k > 1) && !array_key_exists($k, $list)) {
					$list = JEMCategories::treerecurse($k, '?&nbsp;', $list, $children, 999, 0, 0);
				}
			}
		}

		return $list;
	}
Exemplo n.º 9
0
 /**
  * Method to get category data for the current category
  *
  * @param	int		An optional ID
  */
 public function getCategory()
 {
     if (!is_object($this->_item)) {
         if (isset($this->state->params)) {
             $params = $this->state->params;
             $options = array();
             $options['countItems'] = $params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0);
         } else {
             $options['countItems'] = 0;
         }
         $categories = new JEMCategories($this->getState('category.id', 'root'));
         $this->_item = $categories->get($this->getState('category.id', 'root'));
         // Compute selected asset permissions.
         if (is_object($this->_item)) {
             $user = JFactory::getUser();
             $userId = $user->get('id');
             $asset = 'com_jem.category.' . $this->_item->id;
             // Check general create permission.
             if ($user->authorise('core.create', $asset)) {
                 $this->_item->getParams()->set('access-create', true);
             }
             $this->_children = $this->_item->getChildren();
             $this->_parent = false;
             if ($this->_item->getParent()) {
                 $this->_parent = $this->_item->getParent();
             }
             $this->_rightsibling = $this->_item->getSibling();
             $this->_leftsibling = $this->_item->getSibling(false);
         } else {
             $this->_children = false;
             $this->_parent = false;
         }
     }
     return $this->_item;
 }
Exemplo n.º 10
0
 /**
  * logic to get the categories
  *
  * @access public
  * @return void
  */
 function getCategoryTree()
 {
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     // Get the paramaters of the active menu item
     $params = $app->getParams('com_jem');
     $top_id = $params->get('top_category', 1);
     $user = JFactory::getUser();
     // Support Joomla access levels instead of single group id
     $levels = $user->getAuthorisedViewLevels();
     $where = ' WHERE c.published = 1 AND c.access IN (' . implode(',', $levels) . ')';
     //get the maintained categories and the categories whithout any group
     //or just get all if somebody have edit rights
     $query = 'SELECT c.*' . ' FROM #__jem_categories AS c' . $where . ' ORDER BY c.ordering';
     $db->setQuery($query);
     $mitems = $db->loadObjectList();
     // Check for a database error.
     if ($db->getErrorNum()) {
         JError::raiseNotice(500, $db->getErrorMsg());
     }
     if (!$mitems) {
         $mitems = array();
         $children = array();
         $parentid = $mitems;
     } else {
         $mitems_temp = $mitems;
         $children = array();
         // First pass - collect children
         foreach ($mitems as $v) {
             $pt = $v->parent_id;
             $list = @$children[$pt] ? $children[$pt] : array();
             array_push($list, $v);
             $children[$pt] = $list;
         }
         $parentid = intval($mitems[0]->parent_id);
     }
     //get list of the items
     $list = JEMCategories::treerecurse($top_id, '', array(), $children, 9999, 0, 0);
     return $list;
 }
Exemplo n.º 11
0
	/**
	 * Method to get categories item data
	 *
	 * @access public
	 * @return array
	 */
	function getData()
	{
		$app	= JFactory::getApplication();
		$db		= JFactory::getDBO();
		$itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

		static $items;

		if (isset($items)) {
			return $items;
		}

		$limit				= $app->getUserStateFromRequest('com_jem.limit', 'limit', $app->getCfg('list_limit'), 'int');
		$limitstart 		= $app->getUserStateFromRequest('com_jem.limitstart', 'limitstart', 0, 'int');
		$limitstart			= $limit ? (int)(floor($limitstart / $limit) * $limit) : 0;
		$filter_order		= $app->getUserStateFromRequest('com_jem.categoryelement.filter_order', 'filter_order', 'c.lft', 'cmd');
		$filter_order_Dir	= $app->getUserStateFromRequest('com_jem.categoryelement.filter_order_Dir', 'filter_order_Dir', '', 'word');
		$filter_state		= $app->getUserStateFromRequest('com_jem.categoryelement.'.$itemid.'.filter_state', 'filter_state', '', 'string');
		$search				= $app->getUserStateFromRequest('com_jem.categoryelement.'.$itemid.'.filter_search', 'filter_search', '', 'string');
		$search				= $db->escape(trim(JString::strtolower($search)));

		$filter_order		= JFilterInput::getinstance()->clean($filter_order, 'cmd');
		$filter_order_Dir	= JFilterInput::getinstance()->clean($filter_order_Dir, 'word');

		$orderby = ' ORDER BY ' . $filter_order . ' ' . $filter_order_Dir;

		$state = array(1);

		if (is_numeric($filter_state)) {
				$where = ' WHERE c.published = '.(int) $filter_state;
		} else {
			$where = ' WHERE c.published IN (' . implode(',', $state) . ')';
			//$where .= ' AND c.alias NOT LIKE "root"';
		}

		$where2 = ' AND c.published IN (' . implode(',', $state) . ')';
		//$where2 .= ' AND c.alias NOT LIKE "root"';

		// select the records
		// note, since this is a tree we have to do the limits code-side
		if ($search) {
			$query = 'SELECT c.id FROM #__jem_categories AS c' . ' WHERE LOWER(c.catname) LIKE ' . $db->Quote('%' . $this->_db->escape($search, true) . '%', false) . $where2;
			$db->setQuery($query);
			$search_rows = $db->loadColumn();
		}

		$query = 'SELECT c.*, u.name AS editor, g.title AS groupname, gr.name AS catgroup'
				. ' FROM #__jem_categories AS c' . ' LEFT JOIN #__viewlevels AS g ON g.id = c.access'
				. ' LEFT JOIN #__users AS u ON u.id = c.checked_out'
				. ' LEFT JOIN #__jem_groups AS gr ON gr.id = c.groupid'
				. $where
				// . ' ORDER BY c.parent_id, c.ordering';
				. $orderby;

		$db->setQuery($query);
		$mitems = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum()) {
			JError::raiseNotice(500, $db->getErrorMsg());
		}

		if (! $mitems) {
			$mitems = array();
			$children = array();

			$parentid = $mitems;
		} else {
			$children = array();
			// First pass - collect children
			foreach ($mitems as $v) {
				$pt = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : array();
				array_push($list, $v);
				$children[$pt] = $list;
			}

			// list childs of "root" which has no parent and normally id 1
			$parentid = intval(@isset($children[0][0]->id) ? $children[0][0]->id : 1);
		}

		// get list of the items
		$list = JEMCategories::treerecurse($parentid, '', array(), $children, 9999, 0, 0);

		// eventually only pick out the searched items.
		if ($search) {
			$list1 = array();

			foreach ($search_rows as $sid) {
				foreach ($list as $item) {
					if ($item->id == $sid) {
						$list1[] = $item;
					}
				}
			}
			// replace full list with found items
			$list = $list1;
		}

		$total = count($list);

		jimport('joomla.html.pagination');
		$this->_pagination = new JPagination($total, $limitstart, $limit);

		// slice out elements based on limits
		$list = array_slice($list, $this->_pagination->limitstart, $this->_pagination->limit);

		return $list;
	}
Exemplo n.º 12
0
 /**
  * Method to auto-populate the model state.
  */
 protected function populateState($ordering = null, $direction = null)
 {
     # parent::populateState($ordering, $direction);
     $app = JFactory::getApplication();
     $jemsettings = JemHelper::config();
     $jinput = JFactory::getApplication()->input;
     $itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
     $params = $app->getParams();
     $task = $jinput->getCmd('task');
     $top_category = $params->get('top_category', 0);
     $startdayonly = $params->get('show_only_start', false);
     $numberOfWeeks = $params->get('nrweeks', '1');
     $firstweekday = $params->get('firstweekday', 1);
     # params
     $this->setState('params', $params);
     # publish state
     $this->setState('filter.published', 1);
     # access
     $this->setState('filter.access', true);
     ###########
     ## DATES ##
     ###########
     #only select events within specified dates. (chosen weeknrs)
     $config = JFactory::getConfig();
     $offset = $config->get('offset');
     $year = date('Y');
     date_default_timezone_set($offset);
     $datetime = new DateTime();
     $datetime->setISODate($year, $datetime->format("W"), 7);
     if ($firstweekday == 1) {
         if (date('N', time()) == 1) {
             #it's monday and monday is startdate;
             $filter_date_from = $datetime->modify('-6 day');
             $filter_date_from = $datetime->format('Y-m-d') . "\n";
             $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day');
             $filter_date_to = $datetime->format('Y-m-d') . "\n";
         } else {
             # it's not monday but monday is startdate;
             $filter_date_from = $datetime->modify('-6 day');
             $filter_date_from = $datetime->format('Y-m-d') . "\n";
             $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day');
             $filter_date_to = $datetime->format('Y-m-d') . "\n";
         }
     }
     if ($firstweekday == 0) {
         if (date('N', time()) == 7) {
             #it's sunday and sunday is startdate;
             $filter_date_from = $datetime->format('Y-m-d') . "\n";
             $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks' . '- 1 day');
             $filter_date_to = $datetime->format('Y-m-d') . "\n";
         } else {
             #it's not sunday and sunday is startdate;
             $filter_date_from = $datetime->modify('-7 day');
             $filter_date_from = $datetime->format('Y-m-d') . "\n";
             $filter_date_to = $datetime->modify('+' . $numberOfWeeks . ' weeks');
             $filter_date_to = $datetime->format('Y-m-d') . "\n";
         }
     }
     $where = ' DATEDIFF(IF (a.enddates IS NOT NULL, a.enddates, a.dates), \'' . $filter_date_from . '\') >= 0';
     $this->setState('filter.calendar_from', $where);
     $where = ' DATEDIFF(a.dates, \'' . $filter_date_to . '\') <= 0';
     $this->setState('filter.calendar_to', $where);
     ##################
     ## TOP-CATEGORY ##
     ##################
     if ($top_category) {
         $children = JEMCategories::getChilds($top_category);
         if (count($children)) {
             $where = 'rel.catid IN (' . implode(',', $children) . ')';
             $this->setState('filter.category_top', $where);
         }
     }
     $this->setState('filter.groupby', 'a.id');
     $this->setState('filter.calendar_startdayonly', $startdayonly);
 }
Exemplo n.º 13
0
	/**
	 * logic to get the categories
	 *
	 * @return void
	 */
	public function getCategories()
	{
		// @todo alter function

		$db    = JFactory::getDBO();
		$where = ' WHERE c.published = 1';
		$query = 'SELECT c.* FROM #__jem_categories AS c' . $where . ' ORDER BY parent_id, c.lft';
		$db->setQuery($query);

		$mitems = $db->loadObjectList();

		// Check for a database error.
		if ($db->getErrorNum()){
			JError::raiseNotice(500, $db->getErrorMsg());
		}

		if (!$mitems) {
			$children = array();
			$mitems = array();
			$parentid = 0;
		} else {
			$children = array();
			// First pass - collect children
			foreach ($mitems as $v) {
				$pt = $v->parent_id;
				$list = @$children[$pt] ? $children[$pt] : array();
				array_push($list, $v);
				$children[$pt] = $list;
			}

			// list childs of "root" which has no parent and normally id 1
			$parentid = intval(@isset($children[0][0]->id) ? $children[0][0]->id : 1);
		}

		//get list of the items
		$list = JEMCategories::treerecurse($parentid, '', array(), $children, 9999, 0, 0);

		return $list;
	}
Exemplo n.º 14
0
	/**
	 * Method to auto-populate the model state.
	 */
	protected function populateState($ordering = null, $direction = null)
	{
		# parent::populateState($ordering, $direction);

		$app               = JFactory::getApplication();
		$jemsettings       = JemHelper::config();
		$jinput            = JFactory::getApplication()->input;
		$itemid            = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);

		$params            = $app->getParams();
		$task              = $jinput->getCmd('task', '');
		$requestVenueId    = $jinput->getInt('locid', 0);
		$requestCategoryId = $jinput->getInt('catid', 0);
		$item              = $jinput->getInt('Itemid', 0);

		$locid = $app->getUserState('com_jem.venuecal.locid'.$item);
		if ($locid) {
			$this->setstate('filter.filter_locid',$locid);
		}

		// maybe list of venue ids from calendar module
		$locids = explode(',', $jinput->getString('locids', ''));
		foreach ($locids as $id) {
			if ((int)$id > 0) {
				$venues[] = (int)$id;
			}
		}
		if (!empty($venues)) {
			$this->setstate('filter.venue_id', $venues);
			$this->setstate('filter.venue_id.include', true);
		}

		$cal_category_catid = $app->getUserState('com_jem.categorycal.catid'.$item);
		if ($cal_category_catid) {
			$this->setState('filter.req_catid',$cal_category_catid);
		}

		// maybe list of venue ids from calendar module
		$catids = explode(',', $jinput->getString('catids', ''));
		foreach ($catids as $id) {
			if ((int)$id > 1) { // don't accept 'root'
				$cats[] = (int)$id;
			}
		}
		if (!empty($cats)) {
			$this->setstate('filter.category_id', $cats);
			$this->setstate('filter.category_id.include', true);
		}

		// maybe top category is given by calendar view
		$top_category = $jinput->getInt('topcat', 0);
		if ($top_category > 0) { // accept 'root'
			$children = JEMCategories::getChilds($top_category);
			if (count($children)) {
				$where = 'rel.catid IN ('. implode(',', $children) .')';
				$this->setState('filter.category_top', $where);
			}
		}

		# limit/start

		/* in J! 3.3.6 limitstart is removed from request - but we need it! */
		if ($app->input->getInt('limitstart', null) === null) {
			$app->setUserState('com_jem.day.'.$itemid.'.limitstart', 0);
		}

		$limit = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.limit', 'limit', $jemsettings->display_num, 'int');
		$this->setState('list.limit', $limit);

		$limitstart = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.limitstart', 'limitstart', 0, 'int');
		$limitstart = $limit ? (int)(floor($limitstart / $limit) * $limit) : 0;
		$this->setState('list.start', $limitstart);

		# Search
		$search = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_search', 'filter_search', '', 'string');
		$this->setState('filter.filter_search', $search);

		# FilterType
		$filtertype = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_type', 'filter_type', '', 'int');
		$this->setState('filter.filter_type', $filtertype);

		# filter_order
		$orderCol = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order', 'filter_order', 'a.dates', 'cmd');
		$this->setState('filter.filter_ordering', $orderCol);

		# filter_direction
		$listOrder = $app->getUserStateFromRequest('com_jem.day.'.$itemid.'.filter_order_Dir', 'filter_order_Dir', 'ASC', 'word');
		$this->setState('filter.filter_direction', $listOrder);

		if ($orderCol == 'a.dates') {
			$orderby = array('a.dates ' . $listOrder, 'a.times ' . $listOrder);
		} else {
			$orderby = $orderCol . ' ' . $listOrder;
		}
		$this->setState('filter.orderby', $orderby);

		# params
		$this->setState('params', $params);

		# published
		/// @todo bring given pub together with eventslist's unpub calculation (_populatePublishState())
		$pub = explode(',', $jinput->getString('pub', ''));
		$published = array();
		// sanitize remote data
		foreach ($pub as $val) {
			if (((int)$val >= 1) && ((int)$val <= 2)) {
				$published[] = (int)$val;
			}
		}
		// default to 'published'
		if (empty($published)) {
			//$published[] = 1;
			$this->_populatePublishState($task);
		} else {
			$this->setState('filter.published', $published);
		}

		# request venue-id
		if ($requestVenueId) {
			$this->setState('filter.req_venid',$requestVenueId);
		}

		# request cat-id
		if ($requestCategoryId) {
			$this->setState('filter.req_catid',$requestCategoryId);
		}

		# groupby
		$this->setState('filter.groupby',array('a.id'));
	}
Exemplo n.º 15
0
	/**
	 * recursive function to build the familly tree
	 *
	 * @param int category id
	 * @param array children indexed by parent id
	 * @return array of category descendants
	 */
	protected static function _getChildsRecurse($id, $childs)
	{
		$result = array($id);

		if (!empty($childs[$id])) {
			foreach ($childs[$id] AS $c) {
				$result = array_merge($result, JEMCategories::_getChildsRecurse($c->id, $childs));
			}
		}

		return $result;
	}
Exemplo n.º 16
0
 function getCategories($id)
 {
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select(array('c.id', 'c.catname', 'c.checked_out AS cchecked_out'));
     $query->from('#__jem_categories AS c');
     $query->join('LEFT', '#__jem_cats_event_relations AS rel ON rel.catid = c.id');
     $query->where('rel.itemid = ' . (int) $id);
     $db->setQuery($query);
     $this->_cats = $db->loadObjectList();
     $count = count($this->_cats);
     for ($i = 0; $i < $count; $i++) {
         $item = $this->_cats[$i];
         $cats = new JEMCategories($item->id);
         $item->parentcats = $cats->getParentlist();
     }
     return $this->_cats;
 }
Exemplo n.º 17
0
	/**
	 * Method to get category data for the current category
	 *
	 * @param	int		An optional ID
	 */
	public function getCategory()
	{
		if (!is_object($this->_item)) {
			$options = array();

			if (isset($this->state->params)) {
				$params = $this->state->params;
				$options['countItems'] = ($params->get('show_cat_num_articles', 1) || !$params->get('show_empty_categories_cat', 0)) ? 1 : 0;
			}
			else {
				$options['countItems'] = 0;
			}

			$where_pub = $this->_getPublishWhere('i');
			if (!empty($where_pub)) {
				$options['published_where'] = '(' . implode(' OR ', $where_pub) . ')';
			} else {
				// something wrong - fallback to published events
				$options['published_where'] = 'i.published = 1';
			}

			$catId = $this->getState('category.id', 'root');
			$categories = new JEMCategories($catId, $options);
			$this->_item = $categories->get($catId);

			// Compute selected asset permissions.
			if (is_object($this->_item)) { // a JEMCategoryNode object
				$user   = JemFactory::getUser();
				$userId = $user->get('id');

				// Check general or category specific create permission.
				$this->_item->getParams()->set('access-create', $user->can('add', 'event', false, false, $this->_item->id));

				$this->_children = $this->_item->getChildren();

				$this->_parent = $this->_item->getParent();
				if (empty($this->_parent)) {
					$this->_parent = false;
				}

				$this->_rightsibling = $this->_item->getSibling();
				$this->_leftsibling = $this->_item->getSibling(false);
			}
			else {
				$this->_children = false;
				$this->_parent = false;
			}
		}

		return $this->_item;
	}
Exemplo n.º 18
0
 /**
  * Updating files: 302->303
  */
 private function update303()
 {
     ###############################
     ## # update calendar entries ##
     ###############################
     require_once JPATH_SITE . '/components/com_jem/classes/categories.class.php';
     $types = array('calendar', 'category', 'venue');
     foreach ($types as $type) {
         $db = JFactory::getDbo();
         $query = $db->getQuery(true);
         $query->select('id, link, params');
         $query->from('#__menu');
         if ($type == 'calendar') {
             $query->where(array("link LIKE 'index.php?option=com_jem&view=calendar'"));
         } else {
             $query->where(array("link LIKE 'index.php?option=com_jem&view=" . $type . "&layout=calendar%'"));
         }
         $query->order('id');
         $db->setQuery($query);
         $items = $db->loadObjectList();
         foreach ($items as $item) {
             # set params
             $params = json_decode($item->params, true);
             if ($type == 'category' || $type == 'venue') {
                 # get id nr
                 $id = strstr($item->link, '&id=');
                 $id = str_replace('&id=', '', $id);
                 if ($type == 'category') {
                     $params['catids'] = $id;
                     $params['catidsfilter'] = 1;
                 }
                 if ($type == 'venue') {
                     $params['venueids'] = $id;
                     $params['venueidsfilter'] = 1;
                 }
             }
             if ($type == 'calendar') {
                 # retrieve value 'top_category'
                 if (isset($params['top_category'])) {
                     $top_category = $params['top_category'];
                     $childs = JEMCategories::getChilds($top_category);
                     # see if we're dealing with root as first array value
                     # if so then we're taking that value and are hiding it so it will display all other categories
                     $first = reset($childs);
                     if ($first == 0 || $first == 1) {
                         $params['catids'] = 1;
                         $params['catidsfilter'] = 0;
                     } else {
                         if (count($childs) > 1) {
                             # strip of first value as that one is the category it's retreving childs from
                             $reorder = array_shift($childs);
                             $params['catids'] = $childs;
                             $params['catidsfilter'] = 1;
                         }
                     }
                 } else {
                     $params['catids'] = 1;
                     $params['catidsfilter'] = 0;
                 }
             }
             # store params + new link value
             $paramsString = json_encode($params);
             $query = $db->getQuery(true);
             $query->update('#__menu')->set(array('params = ' . $db->quote($paramsString), 'link = ' . $db->Quote('index.php?option=com_jem&view=calendar')))->where(array("id = " . $item->id));
             $db->setQuery($query);
             $db->execute();
         }
     }
 }
Exemplo n.º 19
0
	/**
	 * Creates the Category View
	 */
	function display($tpl=null)
	{
		if ($this->getLayout() == 'calendar')
		{
			### Category Calendar view ###

			$app = JFactory::getApplication();

			// Load tooltips behavior
			JHtml::_('behavior.tooltip');

			//initialize variables
			$document 		= JFactory::getDocument();
			$jemsettings 	= JemHelper::config();
			$user			= JemFactory::getUser();
			$menu 			= $app->getMenu();
			$menuitem		= $menu->getActive();
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$print			= $app->input->getBool('print', false);

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCss('calendar');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			$evlinkcolor = $params->get('eventlinkcolor');
			$evbackgroundcolor = $params->get('eventbackgroundcolor');
			$currentdaycolor = $params->get('currentdaycolor');
			$eventandmorecolor = $params->get('eventandmorecolor');

			$style = '
			div#jem .eventcontentinner a, div#jem .eventandmore a {color:' . $evlinkcolor . ';}
			.eventcontentinner {background-color:'.$evbackgroundcolor .';}
			.eventandmore {background-color:'.$eventandmorecolor .';}
			.today .daynum {background-color:'.$currentdaycolor.';}';
			$document->addStyleDeclaration($style);

			// add javascript (using full path - see issue #590)
			JHtml::_('script', 'media/com_jem/js/calendar.js');

			// Retrieve date variables
			$year  = (int)$app->input->getInt('yearID', strftime("%Y"));
			$month = (int)$app->input->getInt('monthID', strftime("%m"));

			$catid = $app->input->getInt('id', 0);
			if (empty($catid)) {
				$catid = $params->get('id');
			}

			// get data from model and set the month
			$model = $this->getModel('CategoryCal');
			$model->setDate(mktime(0, 0, 1, $month, 1, $year));

			$category	= $this->get('Category', 'CategoryCal');
			$rows		= $this->get('Items', 'CategoryCal');

			// Set Page title
			$pagetitle   = $params->def('page_title', $menuitem->title);
			$params->def('page_heading', $params->get('page_title'));
			$pageclass_sfx = $params->get('pageclass_sfx');

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			$document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event', false, false, $catid);
			$permissions->canAddVenue = $user->can('add', 'venue', false, false, $catid);

			$itemid = $app->input->getInt('Itemid', 0);
			$partItemid = ($itemid > 0) ? '&Itemid='.$itemid : '';
			$partCatid = ($catid > 0) ? '&id=' . $catid : '';
			$url_base = 'index.php?option=com_jem&view=category&layout=calendar' . $partCatid . $partItemid;
			$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');

			$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');

			// init calendar
			$cal = new JEMCalendar($year, $month, 0);
			$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
			$cal->setFirstWeekDay($params->get('firstweekday', 1));
			$cal->enableDayLinks('index.php?option=com_jem&view=day&catid='.$catid);

			$this->rows          = $rows;
			$this->catid         = $catid;
			$this->params        = $params;
			$this->jemsettings   = $jemsettings;
			$this->permissions   = $permissions;
			$this->cal           = $cal;
			$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
			$this->print_link    = $print_link;

		} else
		{
			### Category List view ###

			//initialize variables
			$app 			= JFactory::getApplication();
			$document 		= JFactory::getDocument();
			$jemsettings 	= JemHelper::config();
			$settings 		= JemHelper::globalattribs();
			$user			= JemFactory::getUser();
			$print			= $app->input->getBool('print', false);

			JHtml::_('behavior.tooltip');

			// get menu information
			$params 		= $app->getParams();
			$uri 			= JFactory::getURI();
			$pathway 		= $app->getPathWay();
			$menu			= $app->getMenu();
			$menuitem		= $menu->getActive();

			// Load css
			JemHelper::loadCss('jem');
			JemHelper::loadCustomCss();
			JemHelper::loadCustomTag();

			if ($print) {
				JemHelper::loadCss('print');
				$document->setMetaData('robots', 'noindex, nofollow');
			}

			// get data from model
			$state		= $this->get('State');
			$params		= $state->params;
			$items		= $this->get('Items');
			$category	= $this->get('Category');
			$children	= $this->get('Children');
			$parent		= $this->get('Parent');
			$pagination = $this->get('Pagination');

			if ($category == false)
			{
				return JError::raiseError(404, JText::_('JGLOBAL_CATEGORY_NOT_FOUND'));
			}

			// are events available?
			if (!$items) {
				$noevents = 1;
			} else {
				$noevents = 0;
			}

			// Decide which parameters should take priority
			$useMenuItemParams = ($menuitem && $menuitem->query['option'] == 'com_jem'
			                                && $menuitem->query['view']   == 'category'
			                                && (!isset($menuitem->query['layout']) || $menuitem->query['layout'] == 'default')
			                                && $menuitem->query['id']     == $category->id);

			// get variables
			$itemid				= $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);

			$this->showsubcats      = (bool)$params->get('usecat', 1);
			$this->showemptysubcats = (bool)$params->get('showemptychilds', 1);

			$filter_order		= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order', 'filter_order', 	'a.dates', 'cmd');
			$filter_order_Dir	= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_order_Dir', 'filter_order_Dir',	'', 'word');
			$filter_type		= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_filtertype', 'filter_type', '', 'int');
			$search 			= $app->getUserStateFromRequest('com_jem.category.'.$itemid.'.filter_search', 'filter_search', '', 'string');
			$task 				= $app->input->get('task', '');

			// table ordering
			$lists['order_Dir'] = $filter_order_Dir;
			$lists['order'] 	= $filter_order;

			// search filter
			$filters = array();

			if ($jemsettings->showtitle == 1) {
				$filters[] = JHtml::_('select.option', '1', JText::_('COM_JEM_TITLE'));
			}
			if ($jemsettings->showlocate == 1) {
				$filters[] = JHtml::_('select.option', '2', JText::_('COM_JEM_VENUE'));
			}
			if ($jemsettings->showcity == 1) {
				$filters[] = JHtml::_('select.option', '3', JText::_('COM_JEM_CITY'));
			}
			if ($jemsettings->showcat == 1) {
				$filters[] = JHtml::_('select.option', '4', JText::_('COM_JEM_CATEGORY'));
			}
			if ($jemsettings->showstate == 1) {
				$filters[] = JHtml::_('select.option', '5', JText::_('COM_JEM_STATE'));
			}
			$lists['filter'] = JHtml::_('select.genericlist', $filters, 'filter_type', array('size'=>'1','class'=>'inputbox'), 'value', 'text', $filter_type);

			// search filter
			$lists['search']= $search;

			// Add feed links
			$link = '&format=feed&id='.$category->id.'&limitstart=';
			$attribs = array('type' => 'application/rss+xml', 'title' => 'RSS 2.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=rss'), 'alternate', 'rel', $attribs);
			$attribs = array('type' => 'application/atom+xml', 'title' => 'Atom 1.0');
			$this->document->addHeadLink(JRoute::_($link . '&type=atom'), 'alternate', 'rel', $attribs);

			// create the pathway
			$cats		= new JEMCategories($category->id);
			$parents	= $cats->getParentlist();

			foreach($parents as $parent) {
				$pathway->addItem($this->escape($parent->catname), JRoute::_(JemHelperRoute::getCategoryRoute($parent->slug)) );
			}

			// Show page heading specified on menu item or category title as heading - idea taken from com_content.
			//
			// Check to see which parameters should take priority
			// If the current view is the active menuitem and an category view for this category, then the menu item params take priority
			if ($useMenuItemParams) {
				$pagetitle   = $params->get('page_title', $menuitem->title ? $menuitem->title : $category->catname);
				$pageheading = $params->get('page_heading', $pagetitle);
				$pathway->setItemName(1, $menuitem->title);
			} else {
				$pagetitle   = $category->catname;
				$pageheading = $pagetitle;
				$params->set('show_page_heading', 1); // ensure page heading is shown
				$pathway->addItem($category->catname, JRoute::_(JemHelperRoute::getCategoryRoute($category->slug)) );
			}
			$pageclass_sfx = $params->get('pageclass_sfx');

			if ($task == 'archive') {
				$pathway->addItem(JText::_('COM_JEM_ARCHIVE'), JRoute::_(JemHelperRoute::getCategoryRoute($category->slug).'&task=archive'));
				$print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&task=archive&print=1&tmpl=component');
				$pagetitle   .= ' - '.JText::_('COM_JEM_ARCHIVE');
				$pageheading .= ' - '.JText::_('COM_JEM_ARCHIVE');
			} else {
				$print_link = JRoute::_(JemHelperRoute::getCategoryRoute($category->id) .'&print=1&tmpl=component');
			}

			$params->set('page_heading', $pageheading);

			// Add site name to title if param is set
			if ($app->getCfg('sitename_pagetitles', 0) == 1) {
				$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
			}
			elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
				$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
			}

			// Set Page title & Meta data
			$this->document->setTitle($pagetitle);
			$document->setMetaData('title', $pagetitle);
			$document->setMetadata('keywords', $category->meta_keywords);
			$document->setDescription(strip_tags($category->meta_description));

			// Check if the user has permission to add things
			$permissions = new stdClass();
			$permissions->canAddEvent = $user->can('add', 'event', false, false, $category->id);
			$permissions->canAddVenue = $user->can('add', 'venue', false, false, $category->id);

			// Create the pagination object
			$pagination = $this->get('Pagination');

			// Generate Categorydescription
			if (empty ($category->description)) {
				$description = JText::_('COM_JEM_NO_DESCRIPTION');
			} else {
				// execute plugins
				$category->text  = $category->description;
				$category->title = $category->catname;
				JPluginHelper::importPlugin('content');
				$app->triggerEvent('onContentPrepare', array('com_jem.category', &$category, &$params, 0));
				$description = $category->text;
			}

			$cimage = JemImage::flyercreator($category->image,'category');

			$children = array($category->id => $children);

			$this->lists			= $lists;
			$this->action			= $uri->toString();
			$this->cimage			= $cimage;
			$this->rows				= $items;
			$this->noevents			= $noevents;
			$this->print_link		= $print_link;
			$this->params			= $params;
			$this->dellink			= $permissions->canAddEvent; // deprecated
			$this->permissions		= $permissions;
			$this->task				= $task;
			$this->description		= $description;
			$this->pagination		= $pagination;
			$this->jemsettings		= $jemsettings;
			$this->settings			= $settings;
			$this->pageclass_sfx	= htmlspecialchars($pageclass_sfx);
			$this->maxLevel			= $params->get('maxLevel', -1);
			$this->category			= $category;
			$this->children			= $children;
			$this->parent			= $parent;
			$this->user				= $user;
		}

		parent::display($tpl);
	}
Exemplo n.º 20
0
	function getCategories($id)
	{
		$query = 'SELECT DISTINCT c.id, c.catname, c.checked_out AS cchecked_out'
				. ' FROM #__jem_categories AS c'
				. ' LEFT JOIN #__jem_cats_event_relations AS rel ON rel.catid = c.id'
				. ' WHERE rel.itemid = '.(int)$id
				;

		$this->_db->setQuery( $query );

		$this->_cats = $this->_db->loadObjectList();

		$count = count($this->_cats);
		for($i = 0; $i < $count; $i++)
		{
			$item = $this->_cats[$i];
			$cats = new JEMCategories($item->id);
			$item->parentcats = $cats->getParentlist();
		}

		return $this->_cats;
	}
Exemplo n.º 21
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', '&mdash; ' . JText::_('COM_JEM_GLOBAL_SELECT_FILTER') . ' &mdash;');
     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);
 }