/** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void */ protected function populateState($ordering = null, $direction = null) { $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context . '.filter_state', 'filter_state'); $this->setState('filter.state', $state); parent::populateState('a.name', 'asc'); }
/** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void */ protected function populateState($ordering = null, $direction = null) { $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); $state = $this->getUserStateFromRequest($this->context . '.filter_state', 'filter_state'); $this->setState('filter.state', $state); $filter = $this->getUserStateFromRequest($this->context . '.filter_access', 'filter_access'); $this->setState('filter.access', $filter); $filter = $this->getUserStateFromRequest($this->context . '.filter_language', 'filter_language'); $this->setState('filter.language', $filter); parent::populateState('c.lft', 'asc'); }
/** * Method to auto-populate the model state. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void */ protected function populateState($ordering = null, $direction = null) { // Get the filterable columns. $columns = $this->getFilterableColumns(); // Search filter. $search = $this->getUserStateFromRequest($this->context . '.filter.search', 'filter_search'); $this->setState('filter.search', $search); foreach ($columns as $name => $column) { $filterName = str_replace('.', '_', $name); $filter = $this->getUserStateFromRequest($this->context . '.filter.' . $name, 'filter_' . $filterName); $this->setState('filter.' . $name, $filter); } // If we have a name or title filter, order by this column. if (isset($filterFields['name'])) { parent::populateState($filterFields['name'], 'DESC'); } elseif (isset($filterFields['title'])) { parent::populateState($filterFields['title'], 'DESC'); } else { parent::populateState(); } }
/** * Method to auto-populate the model state. * * This method should only be called once per instantiation and is designed * to be called on the first call to the getState() method unless the model * configuration flag to ignore the request is set. * * Note. Calling getState in this method will result in recursion. * * @param string $ordering An optional ordering field. * @param string $direction An optional direction (asc|desc). * * @return void * * @throws RuntimeException */ protected function populateState($ordering = 'rank', $direction = 'ASC') { $event_id = JFactory::getApplication()->getUserStateFromRequest($this->context . '.event_id', 'event_id', 0, 'int'); $event_id = $event_id ? $event_id : JFactory::getApplication()->input->getInt('event_id', 0); if (!$event_id) { throw new RuntimeException('event_id is required'); } $this->setState('event_id', $event_id); return parent::populateState($ordering, $direction); }
/** * Method to auto-populate the model state. * * @param string $ordering [description] * @param string $direction [description] * * @return void */ protected function populateState($ordering = 'i.name', $direction = 'ASC') { $app = JFactory::getApplication(); $filterSearch = $this->getUserStateFromRequest($this->context . '.filter_search', 'filter_search'); $this->setState('filter.search', $filterSearch); $value = $app->getUserStateFromRequest('global.list.limit', $this->paginationPrefix . 'limit', $app->getCfg('list_limit'), 'uint'); $limit = $value; $this->setState('list.limit', $limit); $value = $app->getUserStateFromRequest($this->context . '.limitstart', $this->paginationPrefix . 'limitstart', 0); $limitstart = $limit != 0 ? floor($value / $limit) * $limit : 0; $this->setState('list.start', $limitstart); parent::populateState($ordering, $direction); }