Beispiel #1
0
 /**
  * @param int $iUserId
  * @param string $sSearch
  * @param int $iRequestLimit
  * @param int $iSharedTenantId = null
  * @return bool|array
  */
 public function GetSuggestGroupItems($iUserId, $sSearch, $iRequestLimit, $iSharedTenantId = null)
 {
     $mGroupItems = false;
     if ($this->oConnection->Execute($this->oCommandCreator->GetSuggestGroupItems($iUserId, $sSearch, $iRequestLimit))) {
         $mGroupItems = array();
         while (false !== ($oRow = $this->oConnection->GetNextRecord())) {
             $oItem = new CContactListItem();
             $oItem->InitByDbRowWithType('group', $oRow);
             $oContactItems = $this->getContactItems($iUserId, EContactSortField::Frequency, ESortOrder::ASC, 0, 99, '', '', $oItem->Id, $iSharedTenantId);
             $aEmails = array();
             foreach ($oContactItems as $oContactItem) {
                 $aEmails[] = $oContactItem->UseFriendlyName && 0 < strlen(trim($oContactItem->Name)) ? '"' . trim($oContactItem->Name) . '" <' . trim($oContactItem->Email) . '>' : trim($oContactItem->Email);
             }
             $oItem->Email = implode(', ', $aEmails);
             if (!empty($oItem->Email)) {
                 $mGroupItems[] = $oItem;
             }
             unset($oItem);
         }
     }
     return $mGroupItems;
 }