Changeset 7489 for sandbox/webservice/api/adapters
- Timestamp:
- 11/01/12 10:35:51 (11 years ago)
- Location:
- sandbox/webservice/api/adapters
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
sandbox/webservice/api/adapters/CalendarAdapter.php
r7465 r7489 19 19 } 20 20 21 protected function getEvents( $month, $year)21 protected function getEvents($month, $year) 22 22 { 23 23 $bo = CreateObject('calendar.bocalendar',1); -
sandbox/webservice/api/adapters/CatalogAdapter.php
r7465 r7489 93 93 $params = array ("search_for" => $search); 94 94 $result = $this->getLdapCatalog()->quicksearch($params); 95 // Reconnect for searching other attributes. 96 $this->getLdapCatalog()->ldapConnect(true); 97 foreach($result as $i => $row) { 98 if(is_int($i)) { 99 $contacts[$i] = array( 100 'contactMails' => array($result[$i]['mail']), 101 'contactPhones' => array($result[$i]['phone']), 102 'contactAlias' => "", 103 'contactFullName' => ($result[$i]['cn'] != null ? mb_convert_encoding($row['cn'],"UTF8", "ISO_8859-1") : ""), 104 'contactBirthDate' => "", 105 'contactNotes' => "" 106 ); 107 // Buscar atributos faltantes. 108 $otherAttrs = $this->getUserLdapAttrs($result[$i]['mail']); 109 if(is_array($otherAttrs)) 110 $contacts[$i] = array_merge($otherAttrs, $contacts[$i]); 95 96 if ( array_key_exists('error', $result)) 97 { 98 Errors::runException("CATALOG_MANY_RESULTS"); 99 } 100 else 101 { 102 // Reconnect for searching other attributes. 103 $this->getLdapCatalog()->ldapConnect(true); 104 foreach($result as $i => $row) { 105 if(is_int($i)) { 106 $contacts[$i] = array( 107 'contactMails' => array($result[$i]['mail']), 108 'contactPhones' => array($result[$i]['phone']), 109 'contactAlias' => "", 110 'contactFullName' => ($result[$i]['cn'] != null ? mb_convert_encoding($row['cn'],"UTF8", "ISO_8859-1") : ""), 111 'contactBirthDate' => "", 112 'contactNotes' => "" 113 ); 114 // Buscar atributos faltantes. 115 $otherAttrs = $this->getUserLdapAttrs($result[$i]['mail']); 116 if(is_array($otherAttrs)) 117 $contacts[$i] = array_merge($otherAttrs, $contacts[$i]); 118 } 111 119 } 112 }113 // Force ldap close114 ldap_close($this->getLdapCatalog()->ds);115 if( count($contacts) )116 {117 $result = array ('contacts' => $contacts);118 $this->setResult($result);119 return $this->getResponse();120 }121 else122 {123 Errors::runException("CATALOG_NO_RESULTS");124 }120 // Force ldap close 121 ldap_close($this->getLdapCatalog()->ds); 122 if( count($contacts) ) 123 { 124 $result = array ('contacts' => $contacts); 125 $this->setResult($result); 126 return $this->getResponse(); 127 } 128 else 129 { 130 Errors::runException("CATALOG_NO_RESULTS"); 131 } 132 } 125 133 } 126 134 }
Note: See TracChangeset
for help on using the changeset viewer.