getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); $this->setState('filter.search', $search); /* $accessId = $app->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', null, 'int'); $this->setState('filter.access', $accessId);*/ $state = $app->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '', 'string'); $this->setState('filter.published', $state); $language = $app->getUserStateFromRequest($this->context.'.filter.language', 'filter_language', ''); $this->setState('filter.language', $language); // Load the parameters. $params = ComponentHelper::getParams('com_phocamaps'); $this->setState('params', $params); // List state information. parent::populateState('a.title', 'asc'); } protected function getStoreId($id = '') { // Compile the store id. $id .= ':'.$this->getState('filter.search'); //$id .= ':'.$this->getState('filter.access'); $id .= ':'.$this->getState('filter.published'); $id .= ':'.$this->getState('filter.icon_id'); return parent::getStoreId($id); } protected function getListQuery() { // Create a new query object. $db = $this->getDbo(); $query = $db->getQuery(true); // Select the required fields from the table. $query->select( $this->getState( 'list.select', 'a.*' ) ); $query->from('`#__phocamaps_icon` AS a'); // Join over the language $query->select('l.title AS language_title'); $query->join('LEFT', '`#__languages` AS l ON l.lang_code = a.language'); // Join over the users for the checked out user. $query->select('uc.name AS editor'); $query->join('LEFT', '#__users AS uc ON uc.id=a.checked_out'); // Filter by access level. /* if ($access = $this->getState('filter.access')) { $query->where('a.access = '.(int) $access); }*/ // Filter by published state. $published = $this->getState('filter.published'); if (is_numeric($published)) { $query->where('a.published = '.(int) $published); } else if ($published === '') { $query->where('(a.published IN (0, 1))'); } // Filter by search in title $search = $this->getState('filter.search'); if (!empty($search)) { if (stripos($search, 'id:') === 0) { $query->where('a.id = '.(int) substr($search, 3)); } else { $search = $db->Quote('%'.$db->escape($search, true).'%'); $query->where('( a.title LIKE '.$search.' OR a.alias LIKE '.$search.')'); } } // Add the list ordering clause. //$orderCol = $this->state->get('list.ordering'); //$orderDirn = $this->state->get('list.direction'); $orderCol = $this->state->get('list.ordering', 'title'); $orderDirn = $this->state->get('list.direction', 'asc'); if ($orderCol != 'a.ordering') { $orderCol = 'a.ordering'; } $query->order($db->escape($orderCol.' '.$orderDirn)); //echo nl2br(str_replace('#__', 'jos_', $query->__toString())); return $query; } } ?>