Changeset 2137 for trunk/workflow/inc/local
- Timestamp:
- 03/02/10 16:24:13 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/workflow/inc/local/classes/class.wf_location.php
r2136 r2137 167 167 return $output; 168 168 } 169 /** 170 * Busca os estados brasileiros 171 * @return mixed (array ou boolean) 172 * @access public 173 */ 174 function getStates() 175 { 176 $sql = 177 "SELECT 178 id_state, 179 state_name 180 FROM 181 phpgw_cc_state 182 WHERE 183 id_country = 'BR' 169 /** 170 * Busca as cidades por parte do nome, sem considerar maiúsculas e/ou minúsculas e nem acentuação (retorna 10 resultados) 171 * @param string Parte do nome da cidade 172 * @param int $state_id Numero ID do estado 173 * @param bool $include_districts True, busca cidades e distritos. False, busca apenas cidades. 174 * @return mixed (array ou boolean) 175 * @access public 176 */ 177 function getCitiesByKey($key, $state_id = 0, $include_districts = true) 178 { 179 if (!is_string($key) || !is_numeric($state_id) || !is_bool($include_districts)) 180 return false; 181 182 $where = ""; 183 if($state_id > 0){ 184 $where = " AND c.id_state = " . $state_id; 185 } 186 187 if(!$include_districts){ 188 $where = " AND c.is_district = 'F' "; 189 } 190 191 $sql = 192 "SELECT 193 c.id_city AS id_city, 194 c.city_name AS city_name, 195 s.id_state AS id_state, 196 s.state_name AS state_name, 197 s.state_symbol AS state_symbol 198 FROM 199 phpgw_cc_state s, 200 phpgw_cc_city c 201 WHERE 202 c.id_state = s.id_state AND 203 s.id_country = 'BR' AND 204 TO_ASCII(c.city_name) ILIKE TO_ASCII('" . $key . "%') 205 " . $where . " 184 206 ORDER BY 185 state_name"; 207 city_name 208 LIMIT 10"; 186 209 187 210 $result = $this->db->query($sql); … … 192 215 return $output; 193 216 } 217 /** 218 * Busca os estados brasileiros 219 * @return mixed (array ou boolean) 220 * @access public 221 */ 222 function getStates() 223 { 224 $sql = 225 "SELECT 226 id_state, 227 state_name 228 FROM 229 phpgw_cc_state 230 WHERE 231 id_country = 'BR' 232 ORDER BY 233 state_name"; 234 235 $result = $this->db->query($sql); 236 $output = array(); 237 while ($row = $result->fetchRow()) 238 $output[] = $row; 239 240 return $output; 241 } 194 242 } 195 243 ?>
Note: See TracChangeset
for help on using the changeset viewer.