public function login() { if ($this->_identity === null) { throw CException('Use LoginForm::authenticate() before'); } if ($this->_identity->errorCode === UserIdentity::ERROR_NONE) { Yii::app()->user->login($this->_identity, 3600 * 24 * 14); return true; } else { return false; } }
private function createHotelBookerComponent() { $hotelBookerComponent = new HotelBookerComponent(); $hotelBookerComponent->setHotelBookerFromHotel($this->item->hotel, $this->item->searchParams); $currentHotelBooker = $hotelBookerComponent->getCurrent(); $currentHotelBooker->orderBookingId = self::$bookingContactInfo->id; $currentHotelBooker->status = 'enterCredentials'; if (!$currentHotelBooker->save()) { $errMsg = 'Couldn\'t save hotel booker instanse' . PHP_EOL . CVarDumper::dumpAsString($currentHotelBooker->getErrors()); throw CException($errMsg); } else { Yii::trace("HotelBooker successfully saved. It's id:" . $hotelBookerComponent->getCurrent()->id, 'HotelTripElementWorkflow.createWorkflowAndLinkItWithItem'); } return $hotelBookerComponent; }
public function init() { parent::init(); if (@class_exists('AmazonS3', true) == false) { include_once 'AWSSDKforPHP/sdk.class.php'; } if (@class_exists('AmazonS3', true) == false) { throw CException('This extension require AWSSDKforPHP library'); } if (empty($this->key) || empty($this->secret)) { throw CException('This extension need access key and secret access key to be set.'); } Yii::import('ext.amazon.components.*'); Yii::registerAutoloader(array('CFLoader', 'autoloader')); }
public function deleteAllByAttributes($attributes, $condition = '', $params = array()) { throw CException('delete is not available on view.'); }
/** * Magic getter for {@link requirements} * @return type * @throws CException */ public function getRequirements() { if (!isset($this->_requirements)) { $reqScript = implode(DIRECTORY_SEPARATOR, array(Yii::app()->basePath, 'components', 'views', 'requirements.php')); if (!is_readable($reqScript)) { throw new CException(Yii::t('admin', "Requirements check script at {path} is missing or not readable.", array('{path}' => $reqScript))); } // The following two variables used internally by the requirements // checking script: $returnArray = true; $thisFile = Yii::app()->request->scriptFile; $this->_requirements = @(require_once $reqScript); if (!$this->_requirements) { CException(Yii::t('admin', "Requirements check script encountered an internal error.")); } } return $this->_requirements; }