Esempio n. 1
0
 /**
  * @param $accountId
  * @param $folderId
  * @param $id
  * @param $m
  * @param IAccount $account
  * @param $mailBox
  * @return mixed
  */
 private function enhanceMessage($accountId, $folderId, $id, $m, IAccount $account, $mailBox)
 {
     $json = $m->getFullMessage($account->getEmail(), $mailBox->getSpecialRole());
     $json['senderImage'] = $this->contactsIntegration->getPhoto($m->getFromEmail());
     if (isset($json['hasHtmlBody'])) {
         $json['htmlBodyUrl'] = $this->buildHtmlBodyUrl($accountId, $folderId, $id);
     }
     if (isset($json['attachment'])) {
         $json['attachment'] = $this->enrichDownloadUrl($accountId, $folderId, $id, $json['attachment']);
     }
     if (isset($json['attachments'])) {
         $json['attachments'] = array_map(function ($a) use($accountId, $folderId, $id) {
             return $this->enrichDownloadUrl($accountId, $folderId, $id, $a);
         }, $json['attachments']);
         // show images first
         usort($json['attachments'], function ($a, $b) {
             if (isset($a['isImage']) && !isset($b['isImage'])) {
                 return -1;
             } elseif (!isset($a['isImage']) && isset($b['isImage'])) {
                 return 1;
             } else {
                 Util::naturalSortCompare($a['fileName'], $b['fileName']);
             }
         });
         return $json;
     }
     return $json;
 }
Esempio n. 2
0
 /**
  * @param $accountId
  * @param $folderId
  * @param $id
  * @param $m
  * @param $account
  * @param $mailBox
  * @return mixed
  */
 private function enhanceMessage($accountId, $folderId, $id, $m, $account, $mailBox)
 {
     $json = $m->getFullMessage($account->getEmail(), $mailBox->getSpecialRole());
     $json['senderImage'] = $this->contactsIntegration->getPhoto($m->getFromEmail());
     if (isset($json['hasHtmlBody'])) {
         $json['htmlBodyUrl'] = $this->buildHtmlBodyUrl($accountId, $folderId, $id);
     }
     if (isset($json['attachment'])) {
         $json['attachment'] = $this->enrichDownloadUrl($accountId, $folderId, $id, $json['attachment']);
     }
     if (isset($json['attachments'])) {
         $json['attachments'] = array_map(function ($a) use($accountId, $folderId, $id) {
             return $this->enrichDownloadUrl($accountId, $folderId, $id, $a);
         }, $json['attachments']);
         return $json;
     }
     return $json;
 }
Esempio n. 3
0
 /**
  * @NoAdminRequired
  * @param string $term
  * @return array
  */
 public function autoComplete($term)
 {
     return $this->contactsIntegration->getMatchingRecipient($term);
 }