mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-16 22:42:16 +00:00
Added new Function SearchPerson
This commit is contained in:
@@ -18,7 +18,7 @@ class Person_model extends DB_Model
|
||||
public function getPersonKontaktByZugangscode($zugangscode, $email)
|
||||
{
|
||||
$this->addJoin('public.tbl_kontakt', 'person_id');
|
||||
|
||||
|
||||
return $this->loadWhere(array('zugangscode' => $zugangscode, 'kontakt' => $email));
|
||||
}
|
||||
|
||||
@@ -135,4 +135,21 @@ class Person_model extends DB_Model
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Searches a Person
|
||||
* @param $filter Term to search for.
|
||||
* @return DB-result
|
||||
*/
|
||||
public function searchPerson($filter)
|
||||
{
|
||||
$this->addSelect('vorname, nachname, gebdatum, person_id');
|
||||
$result = $this->loadWhere(
|
||||
'lower(nachname) like '.$this->db->escape('%'.$filter.'%')."
|
||||
OR lower(vorname) like ".$this->db->escape('%'.$filter.'%')."
|
||||
OR lower(nachname || ' ' || vorname) like ".$this->db->escape('%'.$filter.'%')."
|
||||
OR lower(vorname || ' ' || nachname) like ".$this->db->escape('%'.$filter.'%'));
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user