/** * @param string $sCalendarId * @param string $sEventId * @return bool */ public function getGroupEvent($sCalendarId, $sEventId) { $aResult = array(); if ($this->oConnection->Execute($this->oCommandCreator->getGroupEvent($sCalendarId, $sEventId))) { $aResult = $this->oConnection->GetResultAsAssocArrays(); $this->oConnection->FreeResult(); } return $aResult; }
/** * @param CAccount $oAccount * * @return array */ public function FoldersOrder($oAccount) { $aList = array(); if ($this->oConnection->Execute($this->oCommandCreator->FoldersOrder($oAccount))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $sOrder = $oRow->folders_order; if (!empty($sOrder)) { $aOrder = @json_decode($sOrder, 3); if (is_array($aOrder) && 0 < count($aOrder)) { $aList = $aOrder; } } } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $aList; }
/** * Updates a list of senders wich are considered safe to show external images coming from. * * @param string $iUserId User identifier. * @param string $sEmail Email of sender wich is considered safe. * * @return bool */ public function setSafetySender($iUserId, $sEmail) { $bResult = false; if ($this->oConnection->Execute($this->oCommandCreator->getSafetySenderQuery($iUserId, $sEmail))) { $oRow = $this->oConnection->GetNextRecord(); if (!$oRow) { $bResult = $this->oConnection->Execute($this->oCommandCreator->insertSafetySenderQuery($iUserId, $sEmail)); } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $bResult; }
/** * @param string $sSearchDesc Default value is empty string. * @param int $iTenantId Default value is **0**. * * @return int|false */ public function getDomainCount($sSearchDesc = '', $iTenantId = 0) { $iResultCount = false; if ($this->oConnection->Execute($this->oCommandCreator->getDomainCount($sSearchDesc, $iTenantId))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $iResultCount = (int) $oRow->domains_count; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $iResultCount; }
/** * @param CHelpdeskUser $oHelpdeskUser * @param CHelpdeskPost $oThread * * @return int */ public function GetPostsCount(CHelpdeskUser $oHelpdeskUser, $oThread) { $iResult = 0; if ($this->oConnection->Execute($this->oCommandCreator->GetPostsCount($oHelpdeskUser, $oThread))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $iResult = (int) $oRow->item_count; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $iResult; }
/** * @param CSocial &$oSocial * * @return bool */ public function isSocialExists(CSocial $oSocial) { $bResult = false; if ($this->oConnection->Execute($this->oCommandCreator->isSocialExists($oSocial->IdAccount, $oSocial->TypeStr))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $bResult = 0 < (int) $oRow->social_count; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $bResult; }
/** * @return array|bool */ private function parseGetMinDbResult() { $mResult = false; $oRow = $this->oConnection->GetNextRecord(); if ($oRow && !empty($oRow->data)) { $aData = @\json_decode($oRow->data, true); if (is_array($aData) && 0 < count($aData)) { $mResult = $aData; } } $this->oConnection->FreeResult(); return $mResult; }
/** * @param string $sType * @param string $sIdSocial * @return string */ public function SocialExists($sType, $sIdSocial) { $bResult = false; if ($this->oConnection->Execute($this->oCommandCreator->SocialExists($sType, $sIdSocial))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $bResult = 0 < (int) $oRow->social_count; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $bResult; }
/** * @param int $iIdTenant * @param string $sSocialName * * @return array | false */ public function GetSocialByName($iIdTenant, $sSocialName) { $oSocial = null; if ($this->oConnection->Execute($this->oCommandCreator->GetSocialByName($iIdTenant, $sSocialName))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $oSocial = new CTenantSocials(); $oSocial->InitByDbRow($oRow); } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $oSocial; }
/** * @param CTenant $oTenant * * @return bool */ public function TenantExists(CTenant $oTenant) { $bResult = false; $niExceptTenantId = 0 < $oTenant->IdTenant ? $oTenant->IdTenant : null; if ($this->oConnection->Execute($this->oCommandCreator->TenantExists($oTenant->Login, $niExceptTenantId))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow && 0 < (int) $oRow->tenants_count) { $bResult = true; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $bResult; }
/** * @param int $iSubscriptionID * * @return array|bool */ public function getSubscriptionById($iSubscriptionID) { $mResult = false; if ($this->oConnection->Execute($this->oCommandCreator->getSubscriptionById($iSubscriptionID))) { $oRow = $this->oConnection->GetNextRecord(); if ($oRow && isset($oRow->id_tenant) && 0 < (int) $oRow->id_tenant) { $oSubscription = new CSubscription((int) $oRow->id_tenant); $oSubscription->InitByDbRow($oRow); $mResult = $oSubscription; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $mResult; }
/** * * @param type $sType * @param type $aViewAttrs * @param type $iOffset * @param type $iLimit * @param type $aSearchAttrs * @param type $sOrderBy * @param type $iSortOrder * @param type $aIdsOrUUIDs * @return \AEntity */ public function getEntities($sType, $aViewAttrs = array(), $iOffset = 0, $iLimit = 20, $aSearchAttrs = array(), $sOrderBy = '', $iSortOrder = \ESortOrder::ASC, $aIdsOrUUIDs = array()) { $mResult = false; if ($aViewAttrs === null) { $aViewAttrs = array(); } else { if (count($aViewAttrs) === 0) { $this->oConnection->Execute($this->oCommandCreator->getAttributesNamesByEntityType($sType)); while (false !== ($oRow = $this->oConnection->GetNextRecord())) { $aViewAttrs[] = $oRow->name; } $this->oConnection->FreeResult(); } } if ($this->oConnection->Execute($this->oCommandCreator->getEntities($sType, $aViewAttrs, $iOffset, $iLimit, $aSearchAttrs, $sOrderBy, $iSortOrder, $aIdsOrUUIDs))) { $oRow = null; $mResult = array(); while (false !== ($oRow = $this->oConnection->GetNextRecord())) { if (class_exists($sType)) { $oEntity = call_user_func($sType . '::createInstance'); } else { $oEntity = new \AEntity($sType); } $oEntity->iId = (int) $oRow->entity_id; $oEntity->sUUID = $oRow->entity_uuid; $oEntity->sModuleName = $oRow->entity_module; foreach (get_object_vars($oRow) as $sKey => $mValue) { if (strrpos($sKey, 'attr_', -5) !== false) { $sAttrKey = substr($sKey, 5); $oEntity->{$sAttrKey} = \CAttribute::createInstance($sAttrKey, $mValue, null, $oEntity->isEncryptedAttribute($sAttrKey), $oEntity->iId); } } $mResult[] = $oEntity; } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $mResult; }