/** * Method to get the Events * * @access public * @return array */ function &getEvents() { $jinput = JFactory::getApplication()->input; $pop = $jinput->getBool('pop'); // Lets load the content if it doesn't already exist if (empty($this->_events)) { $query = $this->_buildQueryEvents(); $pagination = $this->getEventsPagination(); if ($pop) { $this->_events = $this->_getList($query); } else { $pagination = $this->getEventsPagination(); $this->_events = $this->_getList($query, $pagination->limitstart, $pagination->limit); } } if ($this->_events) { $this->_events = JEMHelper::getAttendeesNumbers($this->_events); $count = count($this->_events); for ($i = 0; $i < $count; $i++) { $item = $this->_events[$i]; $item->categories = $this->getCategories($item->eventid); //remove events without categories (users have no access to them) if (empty($item->categories)) { unset($this->_events[$i]); } } } return $this->_events; }
/** * Method to get the userinformation of edited/submitted events * @return object */ public function getItems() { $items = parent::getItems(); $user = JFactory::getUser(); $userId = $user->get('id'); $guest = $user->get('guest'); $groups = $user->getAuthorisedViewLevels(); $input = JFactory::getApplication()->input; $filter = $this->getState('filter.filtertype'); $search = $this->getState('filter.search'); foreach ($items as $index => $item) { $item->categories = $this->getCategories($item->id); # check if the item-categories is empty # in case of filtering we will unset the items without the requested category if ($search) { if ($filter == 4) { if (empty($item->categories)) { unset($items[$index]); } } } } $items = JEMHelper::getAttendeesNumbers($items); if ($items) { return $items; } return array(); }
/** * Method to get the Events * * @access public * @return array */ function & getEvents() { $pop = JFactory::getApplication()->input->getBool('pop', false); $user = JemFactory::getUser(); $userId = $user->get('id'); if (empty($userId)) { $this->_events = array(); return array(); } // Lets load the content if it doesn't already exist if (empty($this->_events)) { $query = $this->_buildQueryEvents(); $pagination = $this->getEventsPagination(); if ($pop) { $this->_events = $this->_getList($query); } else { $pagination = $this->getEventsPagination(); $this->_events = $this->_getList($query, $pagination->limitstart, $pagination->limit); } } if ($this->_events) { foreach ($this->_events as $i => $item) { $item->categories = $this->getCategories($item->eventid); //remove events without categories (users have no access to them) if (empty($item->categories)) { unset($this->_events[$i]); } else { if (empty($item->params)) { // Set event params. $registry = new JRegistry(); $registry->loadString($item->attribs); $item->params = clone JEMHelper::globalattribs(); $item->params->merge($registry); } # edit state access permissions. $item->params->set('access-change', $user->can('publish', 'event', $item->id, $item->created_by)); } } JEMHelper::getAttendeesNumbers($this->_events); // does directly edit events } return $this->_events; }