Changeset 5681
- Timestamp:
- 03/08/12 18:44:26 (11 years ago)
- Location:
- sandbox/webservice/api
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/json-rpc/Catalog.php
r5595 r5681 4 4 5 5 class Catalog extends Expresso { 6 var $ldap;7 var $db;8 9 private function getLdap(){10 if($this->ldap == null) {11 12 }13 14 return $this->ldap;15 }16 17 private function getDb(){18 if($this->ldap == null) {19 20 }21 return $this->db;22 }23 24 6 25 7 public function getUserContacts($params){ 26 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)'; 27 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); 28 35 } 29 30 $this->result = array ( 31 'contacts' => $contacts 32 ); 33 36 34 37 return $this->getResponse(); 35 38 } … … 38 41 39 42 if($this->isLoggedIn($params)) { 40 43 $this->result = array ('contacts' => $contacts); 41 44 } 42 43 $this->result = array (44 'contacts' => $contacts45 );46 47 45 return $this->getResponse(); 48 46 } -
sandbox/webservice/api/json-rpc/Expresso.php
r5633 r5681 4 4 5 5 protected $expressoVersion; 6 protected $ldap; 6 7 var $result; 7 8 var $error; … … 24 25 } 25 26 27 protected function getUserId(){ 28 return $GLOBALS['phpgw_info']['user']['account_id']; 29 } 30 31 protected function getLdap(){ 32 if($this->ldap == null) { 33 $this->ldap = $GLOBALS['phpgw']->common->ldapConnect(); 34 } 35 36 return $this->ldap; 37 } 38 39 protected function getDb(){ 40 return $GLOBALS['phpgw']->db; 41 } 42 26 43 27 44 protected function isLoggedIn($params){ -
sandbox/webservice/api/webservice.php
r5633 r5681 7 7 "Expresso.getExpressoVersion", 8 8 "Mail.getUserFolders", 9 "Mail.getUserMessages" 9 "Mail.getUserMessages", 10 "Catalog.getUserContacts", 10 11 ); 11 12
Note: See TracChangeset
for help on using the changeset viewer.