[5595] | 1 | <?php |
---|
| 2 | |
---|
| 3 | include_once("Expresso.php"); |
---|
| 4 | |
---|
| 5 | class Catalog extends Expresso { |
---|
| 6 | |
---|
| 7 | public function getUserContacts($params){ |
---|
| 8 | if($this->isLoggedIn($params)) { |
---|
[5681] | 9 | $query = 'select A.id_contact, A.alias, A.given_names, A.family_names, A.names_ordered, A.birthdate, A.notes, C.connection_value from phpgw_cc_contact A, '. |
---|
| 10 | 'phpgw_cc_contact_conns B, phpgw_cc_connections C where '. |
---|
| 11 | 'A.id_contact = B.id_contact and B.id_connection = C.id_connection '. |
---|
| 12 | 'and B.id_typeof_contact_connection = 1 and A.id_owner='.$this -> getUserId().' group by '. |
---|
| 13 | ' A.id_contact, A.alias, A.given_names, A.family_names,A.names_ordered,A.birthdate, A.notes,C.connection_value order by lower(A.names_ordered)'; |
---|
[5595] | 14 | |
---|
[5681] | 15 | if (!$this->getDb()->query($query)) |
---|
| 16 | return false; |
---|
[5595] | 17 | |
---|
[5681] | 18 | $contacts = array(); |
---|
| 19 | while($this->getDb()->next_record()) { |
---|
| 20 | $row = $this->getDb()->row(); |
---|
| 21 | $contacts[] = array( |
---|
| 22 | 'contactID' => $row['id_contact'], |
---|
| 23 | 'MailAddress' => $row['connection_value'], |
---|
| 24 | 'AliasName' => $row['alias'], |
---|
| 25 | 'FirstName' => $row['given_names'], |
---|
| 26 | 'LastName' => $row['family_names'], |
---|
| 27 | 'FullName' => $row['names_ordered'], |
---|
| 28 | 'BirthDate' => $row['birthdate'], |
---|
| 29 | 'Notes' => $row['notes'], |
---|
| 30 | // 'ImagePicture' => null |
---|
| 31 | ); |
---|
| 32 | |
---|
| 33 | } |
---|
| 34 | $this->result = array ('contacts' => $contacts); |
---|
| 35 | } |
---|
| 36 | |
---|
[5595] | 37 | return $this->getResponse(); |
---|
| 38 | } |
---|
| 39 | |
---|
| 40 | public function getGlobalContacts($params){ |
---|
| 41 | |
---|
| 42 | if($this->isLoggedIn($params)) { |
---|
[5681] | 43 | $this->result = array ('contacts' => $contacts); |
---|
[5595] | 44 | } |
---|
| 45 | return $this->getResponse(); |
---|
| 46 | } |
---|
[5681] | 47 | } |
---|