/** * @param string $sWhere * @return string */ protected function getCalUserByWhere($sWhere) { $aMap = api_AContainer::DbReadKeys(CCalUser::GetStaticMap()); $aMap = array_map(array($this, 'escapeColumn'), $aMap); $sSql = 'SELECT %s FROM %sacal_users_data WHERE %s'; return sprintf($sSql, implode(', ', $aMap), $this->Prefix(), $sWhere); }
/** * Obtains CCalUser object by query-string. * * @param string $sSql Query-string for obtaining CCalUser object. * * @return CCalUser */ protected function _getCalUserBySql($sSql) { $oCalUser = false; if ($this->oConnection->Execute($sSql)) { $oCalUser = null; $oRow = $this->oConnection->GetNextRecord(); if ($oRow) { $oCalUser = new CCalUser(0); $oCalUser->InitByDbRow($oRow); } $this->oConnection->FreeResult(); } $this->throwDbExceptionIfExist(); return $oCalUser; }
/** * Updates calendar user settings. * * @api * * @param CCalUser $oCalUser CCalUser object. * * @return bool */ public function updateCalUser(CCalUser $oCalUser) { $bResult = false; try { if ($oCalUser->isValid()) { $bUseOnlyHookUpdate = false; CApi::Plugin()->RunHook('api-update-cal-user', array(&$oCalUser, &$bUseOnlyHookUpdate)); if (!$bUseOnlyHookUpdate) { if (!$this->oStorage->updateCalUser($oCalUser)) { $this->moveStorageExceptionToManager(); throw new CApiManagerException(Errs::UserManager_CalUserUpdateFailed); } } } $bResult = true; } catch (CApiBaseException $oException) { $bResult = false; $this->setLastException($oException); } return $bResult; }