Changeset 12722
- Timestamp:
- 10/09/07 22:26:53 (1 year ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/midcom/midcom.helper.datamanager2/callback/select/grouplister.php
r3650 r12722 103 103 $this->_process_options($options); 104 104 } 105 106 return true; 105 107 } 106 108 … … 216 218 * @param mixed $key The key to look up. 217 219 */ 218 function _load_group($key )220 function _load_group($key, $return=false) 219 221 { 220 222 if ($this->_list_all_done) … … 251 253 $value = $group->{$this->_value_field}; 252 254 $this->_loaded_groups[$key] = $value; 253 } 255 if ($return) 256 { 257 return $group; 258 } 259 } 260 } 261 262 /** 263 * Chooser related methods 264 */ 265 266 function get_key_data($key) 267 { 268 return $this->_load_group($key, true); 269 } 270 271 function run_search($query, &$request) 272 { 273 $qb = midcom_db_group::new_query_builder(); 274 275 $qb->begin_group('OR'); 276 $qb->add_constraint('name', 'LIKE', $query); 277 $qb->add_constraint('official', 'LIKE', $query); 278 $qb->end_group(); 279 280 $results = $qb->execute(); 281 282 if (count($results) <= 0) 283 { 284 return false; 285 } 286 287 return $results; 254 288 } 255 289 trunk/midcom/midcom.helper.datamanager2/callback/select/personlister.php
r12708 r12722 103 103 $this->_process_options($options); 104 104 } 105 106 return true; 105 107 } 106 108 … … 218 220 * @param mixed $key The key to look up. 219 221 */ 220 function _load_person($key )222 function _load_person($key, $return=false) 221 223 { 222 224 if ($this->_list_all_done) … … 255 257 $value = $person->{$this->_value_field}; 256 258 $this->_loaded_persons[$key] = $value; 257 } 259 260 if ($return) 261 { 262 return $person; 263 } 264 } 265 } 266 267 /** 268 * Chooser related methods 269 */ 270 271 function get_key_data($key) 272 { 273 return $this->_load_person($key, true); 274 } 275 276 function run_search($query, &$request) 277 { 278 $qb = midcom_db_person::new_query_builder(); 279 280 $qb->begin_group('OR'); 281 $qb->add_constraint('firstname', 'LIKE', $query); 282 $qb->add_constraint('lastname', 'LIKE', $query); 283 $qb->add_constraint('username', 'LIKE', $query); 284 $qb->add_constraint('email', 'LIKE', $query); 285 $qb->add_constraint('city', 'LIKE', $query); 286 $qb->add_constraint('postcode', 'LIKE', $query); 287 $qb->end_group(); 288 289 $results = $qb->execute(); 290 291 if (count($results) <= 0) 292 { 293 return false; 294 } 295 296 return $results; 258 297 } 259 298
