setDBO(VoxelCareDB::getDatabase()); $view =JRequest::getVar('view'); $this->searchfranchise = $mainframe->getUserStateFromRequest( "$option.$view.searchfranchise", 'searchfranchise', '', 'string' ); if (!$this->searchfranchise) { $userId = LegacyHelper::getUserId(); $this->_db->setQuery("SELECT uf.franchise id FROM jos_vxc_userfranchise uf WHERE uf.userid = ".$userId); $this->searchfranchise = $this->_db->loadResult(); } } function _buildQuery() { $this->_query = "SELECT id, name, template FROM #__vxc_prefabmodel ORDER BY name"; return $this->_query; } function getUsers() { $franchiseId = $this->searchfranchise; if (!$franchiseId ) return array(); $db =& $this->_db; $sql = "SELECT u.id id , u.name name FROM #__vxc_user u LEFT JOIN #__vxc_userfranchise uf ON u.id = uf.userid WHERE uf.franchise = $franchiseId AND uf.deleted IS NOT TRUE ORDER BY u.name ASC"; $db->setQuery($sql); return $db->loadObjectList(); } function getData() { if (empty($this->_data)) { $query = $this->_buildQuery(); $this->_data = $this->_getList($query); } return $this->_data; } } ?>