Changeset 7859 for sandbox/webservice
- Timestamp:
- 02/05/13 17:22:09 (12 years ago)
- Location:
- sandbox/webservice/api/rest
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/rest/admin/CreateUserResource.php
r7813 r7859 132 132 } 133 133 134 $this->setResult( array( " result" => true ) );134 $this->setResult( array( "createUser" => true ) ); 135 135 } 136 136 else -
sandbox/webservice/api/rest/admin/DeleteUserResource.php
r7814 r7859 42 42 } 43 43 44 $this->setResult( array( " result" => true ) );44 $this->setResult( array( "deleteUser" => true ) ); 45 45 } 46 46 else -
sandbox/webservice/api/rest/admin/EditUserResource.php
r7814 r7859 43 43 $return['accountDescription'] = $fields['corporative_information_description']; 44 44 45 $this->setResult( array( " result" => $return ));45 $this->setResult( array( "editUser" => $return )); 46 46 } 47 47 else -
sandbox/webservice/api/rest/admin/RenameUserResource.php
r7813 r7859 66 66 67 67 68 $this->setResult( array( "re sult" => true ) );68 $this->setResult( array( "renameUser" => true ) ); 69 69 } 70 70 else -
sandbox/webservice/api/rest/admin/SearchUserResource.php
r7813 r7859 28 28 $list = $this->listUsers( $searchUser ); 29 29 30 $user = array(); 31 32 foreach( $list as $_u ) 33 { 34 $user['accountId'] = $_u['account_id']; 35 $user['accountLid'] = $_u['account_lid']; 36 $user['accountCn'] = $_u['account_cn']; 37 $user['accountMail'] = $_u['account_mail']; 38 } 39 30 40 if( count($list) > 0 ) 31 41 { 32 $this->setResult( array( " result" => $list) );42 $this->setResult( array( "searchUser" => $user ) ); 33 43 } 34 44 else -
sandbox/webservice/api/rest/catalog/ContactsResource.php
r7489 r7859 12 12 $search = trim($this->getParam('search')); 13 13 $search = ($search ? mb_convert_encoding($search,"ISO_8859-1", "UTF8") : ""); 14 14 $contactID = $this->getParam('contactID'); 15 16 $search_string = "%$search%"; 17 18 $arr_params = array(); 19 15 20 if($this->getParam('contactType') == 1) { 16 if($search != "") { 17 $query_contact = "(A.alias ilike '%$search%' or A.names_ordered ilike '%$search%' or C.connection_value ilike '%$search%') and"; 21 if($search != "") { 22 $arr_params[] = $search_string; 23 $arr_params[] = $search_string; 24 $arr_params[] = $search_string; 25 $query_contact = "(A.alias ilike ? or A.names_ordered ilike ? or C.connection_value ilike ?) and"; 18 26 } 19 27 elseif($this->getParam('contactID') > 0){ 20 $query_contact = 'A.id_contact='.$this->getParam('contactID').' and'; 28 $arr_params[] = $contactID; 29 $query_contact = "A.id_contact = ? and "; 21 30 } 22 31 } 23 32 elseif($this->getParam('contactType') == 2){ 24 33 if($this-> getMinArgumentSearch() <= strlen($search)) 25 return $this->getGlobalContacts($search, $ this->getParam('contactID'));34 return $this->getGlobalContacts($search, $contactID ); 26 35 else{ 27 36 Errors::runException("CATALOG_MIN_ARGUMENT_SEARCH", $this-> getMinArgumentSearch()); … … 29 38 } 30 39 } 40 41 //ADICIONA O ID_OWNER 42 $arr_params[] = $this->getUserId(); 31 43 32 $query = 'select B.id_typeof_contact_connection, A.photo, 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, '. 33 'phpgw_cc_contact_conns B, phpgw_cc_connections C where A.id_contact = B.id_contact and B.id_connection = C.id_connection '. 34 ' and '.$query_contact.' A.id_owner='.$this -> getUserId().' group by '. 35 ' B.id_typeof_contact_connection, A.photo, 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)'; 36 37 if (!$this->getDb()->query($query)) 38 return false; 39 44 $query = 'select 45 B.id_typeof_contact_connection, 46 A.photo, 47 A.id_contact, 48 A.alias, 49 A.given_names, 50 A.family_names, 51 A.names_ordered, 52 A.birthdate, 53 A.notes, 54 C.connection_value 55 from 56 phpgw_cc_contact A, 57 phpgw_cc_contact_conns B, 58 phpgw_cc_connections C 59 where 60 A.id_contact = B.id_contact and 61 B.id_connection = C.id_connection and 62 '.$query_contact.' 63 A.id_owner = ? 64 group by 65 B.id_typeof_contact_connection, 66 A.photo, 67 A.id_contact, 68 A.alias, 69 A.given_names, 70 A.family_names, 71 A.names_ordered, 72 A.birthdate, 73 A.notes, 74 C.connection_value 75 order by 76 lower(A.names_ordered)'; 77 78 $resQuery = $this->getDb()->Link_ID->query($query,$arr_params); 79 40 80 $contacts = array(); 41 while($ this->getDb()->next_record()) {42 $row = $this->getDb()->row(); 81 while($row = $resQuery->fetchRow()) { 82 43 83 $id = $row['id_contact']; 44 84 $contactType = ($row['id_typeof_contact_connection'] == 2 ? 'contactPhones' : 'contactMails'); 45 85 46 86 if($contacts[$id] != null){ 47 87 $contacts[$id][$contactType][] = $row['connection_value']; … … 61 101 } 62 102 } 63 $result = array ('contacts' => array_values($contacts)); 103 104 $result = array ( 'contacts' => array_values($contacts)); 64 105 $this->setResult($result); 65 106 } -
sandbox/webservice/api/rest/dispatch.php
r7855 r7859 1 1 <?php 2 2 3 define('API_DIRECTORY','/var/www/expresso /api/rest', True);3 define('API_DIRECTORY','/var/www/expresso_22/api/rest', True); 4 4 5 5 // load libraries
Note: See TracChangeset
for help on using the changeset viewer.