source: sandbox/webservice/api/json-rpc/Catalog.php @ 5681

Revision 5681, 1.5 KB checked in by niltonneto, 12 years ago (diff)

Ticket #2507 - Implementada primeira parte do método Catalog.getUserContacts().

  • Property svn:executable set to *
Line 
1<?php
2
3include_once("Expresso.php");
4
5class Catalog extends Expresso {       
6       
7        public function getUserContacts($params){
8                if($this->isLoggedIn($params)) {
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)';
14                       
15                        if (!$this->getDb()->query($query))
16                                return false;
17                       
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
37                return $this->getResponse();
38        }       
39       
40        public function getGlobalContacts($params){
41               
42                if($this->isLoggedIn($params)) {
43                        $this->result = array ('contacts' => $contacts);
44                }
45                return $this->getResponse();
46        }
47}
Note: See TracBrowser for help on using the repository browser.