Revision 6146,
1.3 KB
checked in by niltonneto, 12 years ago
(diff) |
Ticket #2507 - Restruturado diretório para alinhamento com projeto REST.
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[6019] | 1 | <?php |
---|
| 2 | |
---|
[6146] | 3 | class ContactPictureResource extends CatalogServiceAdapter { |
---|
[6019] | 4 | public function post($request){ |
---|
| 5 | // to Receive POST Params (use $this->params) |
---|
| 6 | parent::post($request); |
---|
| 7 | |
---|
| 8 | if($this-> isLoggedIn() && $this->getParam('contactID') != null) |
---|
| 9 | { |
---|
| 10 | $contact = array(); |
---|
| 11 | // User Contact |
---|
| 12 | if($this->getParam('contactType') == 1){ |
---|
| 13 | $query = 'select A.id_contact, A.photo from phpgw_cc_contact A where A.id_contact='.$this->getParam('contactID').' and A.id_owner='.$this -> getUserId(); |
---|
| 14 | if (!$this->getDb()->query($query)) |
---|
| 15 | return false; |
---|
| 16 | if($this->getDb()->next_record()) { |
---|
| 17 | $row = $this->getDb()->row(); |
---|
| 18 | if($row['photo'] != null) { |
---|
| 19 | $contact[] = array( |
---|
| 20 | 'contactID' => $row['id_contact'], |
---|
| 21 | 'contactImagePicture' => ($row['photo'] != null ? base64_encode($row['photo']) : "") |
---|
| 22 | ); |
---|
| 23 | } |
---|
| 24 | } |
---|
| 25 | } |
---|
| 26 | // Global Catalog |
---|
| 27 | elseif($this->getParam('contactType') == 2){ |
---|
| 28 | $photo = $this->getUserLdapPhoto(urldecode($this->getParam('contactID'))); |
---|
| 29 | $contact[] = array( |
---|
| 30 | 'contactID' => $this->getParam('contactID'), |
---|
| 31 | 'contactImagePicture' => ($photo != null ? base64_encode($photo[0]) : "") |
---|
| 32 | ); |
---|
| 33 | |
---|
| 34 | } |
---|
| 35 | $result = array ('contacts' => $contact); |
---|
| 36 | $this->setResult($result); |
---|
| 37 | } |
---|
| 38 | //to Send Response (JSON RPC format) |
---|
| 39 | return $this->getResponse(); |
---|
| 40 | } |
---|
| 41 | |
---|
| 42 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.