/** * Scenario is required for this model, and also we need info about model, that we will be validating * * @access public */ public function __construct($model, $emailAtt, $nameAtt = null, $scenario = 'both') { if (empty($emailAtt)) { throw new CException('$emailAtt can not be empty! Please specify email attribute name.'); } $this->email = $model->{$emailAtt}; if (empty($nameAtt)) { $scenario = 'email'; } else { $this->username = $model->{$nameAtt}; } // correcting scenarios, if some of fields is not empty if ($this->scenario == 'both') { if (!empty($this->email)) { $this->scenario = 'username'; } if (!empty($this->username)) { $this->scenario = 'email'; } } $this->nameAtt = $nameAtt; $this->emailAtt = $emailAtt; $this->_model = $model; parent::__construct($scenario); }
public function __construct($scenario = '', $rec_id = null, $user_id = null, $slotid = null) { parent::__construct($scenario); $this->_recId = $rec_id; $this->_userId = $user_id; $this->_slotId = $slotid; }
/** * constructor with arguments */ public function __construct($orderId, $userId) { parent::__construct(); $this->orderId = $orderId; $this->encryptedOrderId = Yii::app()->getSecurityManager()->hashData($orderId); $selectedOrders = null; //if order id belongs to current user and is in 'order_start' status //(other status mean order has already crossed the checkout process once) //as order id's input has been added to checkout action to facilitate the //order resumption. Note: As order is being modified or created in this function //do check before any POST or GET if order can be modified. Order can be modified //only and only if it is in 'order-start' status. $selectedOrders = AOrder::model()->findAll(array('order' => 'id', 'condition' => 'is_deleted = "no" AND ordered_by2user_details = ' . $userId . ' AND order_unique_id = "' . $orderId . '" ' . ' AND status = "order_start" ')); if (!isset($selectedOrders) || count($selectedOrders) < 1) { $this->render('cart_error', array('errorMessage' => "Either this page does not exists or has expired or you are not allowed to view this page.", 'link' => CHtml::normalizeUrl(array('cart/checkout')))); Yii::app()->end(); } $this->totalItemsInOrder = 0; foreach ($selectedOrders as $row) { $this->tiffinPriceTimeSelectionArr[] = new TiffinPriceTimeSelectionForm($row, $this->encryptedOrderId); $this->destinationLocality = $row->destination_locality; $this->totalItemsInOrder = $this->totalItemsInOrder + $row->num_of_units; } $this->totalAmountInWallet = AppCommonWallet::getTotalAmountInWalletForUser($userId); $this->amountUsedFromWallet = 0; $this->userId = $userId; }
public function __construct($fields) { foreach ($fields as $field => $rules) { $this->_fields[$field] = null; $this->_rules[$field] = $rules; } parent::__construct(); }
public function __construct($scenario = '') { $this->options = Option::model()->findAll(); foreach ($this->options as $k => $v) { $this->{$v->key} = $v->value; } parent::__construct($scenario = ''); }
/** * * Declares attribute labels. * **/ function __construct($scenario = 'insert') { // инициализируем поля foreach ($this->attributeLabels() as $key => $value) { $this->_attributes[$key] = ""; } parent::__construct($scenario); }
public function __construct($scenario = '') { parent::__construct($scenario); for ($i = 2; $i <= self::count; ++$i) { $this->_data['title_' . $i] = ''; $this->_data['value_' . $i] = ''; } }
public function __construct($model = null) { parent::__construct(); if ($model != null) { $this->login = $model->login; $this->name = $model->nome; } }
/** * Construct the form based on scenario and User model given. * @param string $scenario scenario applied * @param User $user User model to be initialiazed */ public function __construct($scenario = '', $user = null) { $this->user = $user; if ($this->user) { $this->attributes = $this->user->attributes; $this->unsetAttributes(['password']); } parent::__construct($scenario); }
/** * Constructor for CiiSettingsModel * * When this class is initialized, load up the appropriate properties using __get. This ensures that we can reference * protected properties inside the class while we're using it (see Themes) */ public function __construct() { // Protected properties s $reflection = new ReflectionClass($this); $properties = $reflection->getProperties(ReflectionProperty::IS_PROTECTED); foreach ($properties as $property) { $this->{$property->name} = $this->__get($property->name); } return parent::__construct(); }
public function __construct($scenario = '') { parent::__construct($scenario); for ($i = 2; $i <= self::count; ++$i) { $this->_data['cost_value_' . $i] = null; $this->_data['cost_currency_id_' . $i] = 1; $this->_data['cost_type_id_' . $i] = 4; $this->_data['cash_' . $i] = 0; $this->_data['nds_include_' . $i] = 0; } }
/** * Constructor. * @param Poll $poll The poll model to export. * @param string $scenario Name of the scenario that this model is used in. */ public function __construct($poll, $scenario = '') { if (get_class($poll) == 'Poll') { $this->_poll = $poll; $this->_choices = $poll->choices; $this->_votes = $poll->votes; $this->_totalVotes = $poll->totalVotes; } else { throw new CException('Invalid Poll object.'); } parent::__construct($scenario); }
public function __construct(DaObject $object, $scenario = '') { parent::__construct($scenario); $this->_object = $object; foreach ($object->parameters as $parameter) { if (in_array($parameter->getType(), self::$_allowedTypes)) { $this->_searchParameters[] = new SearchParameter($parameter); } } if (($defaultParam = $object->getParameterObjectByField($object->getFieldCaption())) != null) { $this->parameter = $defaultParam->getIdParameter(); } }
/** * constructor with arguments */ public function __construct($aOrderObj, $encryptedOrderId) { parent::__construct(); $this->aOrderObj = $aOrderObj; $this->tiffinId = $aOrderObj->order2tiffin; $this->quantity = $aOrderObj->num_of_units; $this->encryptedOrderId = $encryptedOrderId; $this->allowedAPriceTimeObjArray = AppCommon::getAllowedAPriceTimeObjForGivenTiffinAndQuantity($this->tiffinId, $this->quantity); if (!isset($this->allowedAPriceTimeObjArray) || count($this->allowedAPriceTimeObjArray) < 1) { //redirect to first checkout stage screen for order editing Yii::app()->getRequest()->redirect(Yii::app()->getRequest()->getHostInfo() . Yii::app()->getRequest()->getScriptUrl() . '/cart/checkout/id/' . $this->encryptedOrderId); } }
public function __construct($scenario = '') { parent::__construct($scenario); for ($i = 2; $i <= self::count; ++$i) { $this->_data['from_' . $i] = ''; $this->_data['to_' . $i] = ''; $this->_data['height_' . $i] = ''; $this->_data['price_' . $i] = ''; $this->_data['currency_id_' . $i] = ''; $this->_data['srok_' . $i] = ''; $this->_data['nds_include_' . $i] = ''; $this->_data['payment_' . $i] = ''; } }
/** * * @param Recruitment $rec * @param int $user_id */ function __construct($scenario = '', $rec = null, $divisions = null) { $this->_rec = $rec; $this->_allDivisions = $divisions; $this->min_choice = $rec->div_min; $this->max_choice = $rec->div_max; parent::__construct($scenario); $this->_allDivisionsName = array(); /* @var $division Division */ foreach ($this->_allDivisions as $division) { $this->_allDivisionsName[$division->div_id] = $division->name; } $this->choices = array(); //$this->setUserId($user_id); }
public function __construct($scenario = '') { parent::__construct($scenario); for ($i = 2; $i <= self::count; ++$i) { $this->_data['from_' . $i . '_name'] = ''; $this->_data['from_' . $i . '_radius'] = 0; $this->_data['from_' . $i . '_address_lat'] = 0; $this->_data['from_' . $i . '_address_long'] = 0; $this->_data['from_' . $i . '_ind'] = 0; $this->_data['to_' . $i . '_name'] = ''; $this->_data['to_' . $i . '_radius'] = 0; $this->_data['to_' . $i . '_address_lat'] = 0; $this->_data['to_' . $i . '_address_long'] = 0; $this->_data['to_' . $i . '_ind'] = 0; } }
public function __construct($scenario = '') { parent::__construct($scenario); $attrs = $this->getAttributes(); $attrkeys = array_keys($attrs); foreach ($attrs as $key => $value) { $_p_data = Yii::app()->request->getParam(get_class($this)); if (isset($_p_data[$key])) { $this->{$key} = $this->_filterWord($_p_data[$key]); } elseif (Yii::app()->request->getParam($key) != null) { $this->{$key} = $this->_filterWord(Yii::app()->request->getParam($key)); } elseif (isset($_FILES[$key])) { $this->{$key} = $_FILES[$key]; } } }
public function __construct($scenario = 'database') { $drivers = array(); if (extension_loaded('pdo')) { $drivers = CDbConnection::getAvailableDrivers(); } foreach ($drivers as $driver) { if (isset($this->db_names[$driver])) { $this->supported_db_types[$driver] = $this->db_names[$driver]; } } asort($this->supported_db_types); parent::__construct(); // Default is database $this->setScenario($scenario); }
/** * @param Veranstaltung $veranstaltung * @param Antrag[] $alle_antraege * @param bool $aenderungsantraege */ public function __construct($veranstaltung, $alle_antraege, $aenderungsantraege) { parent::__construct(); $this->veranstaltung = $veranstaltung; $this->alle_antraege = []; $this->alle_aenderungsantraege = []; foreach ($alle_antraege as $antrag) { if ($antrag->status != Antrag::$STATUS_GELOESCHT) { $this->alle_antraege[] = $antrag; if ($aenderungsantraege) { foreach ($antrag->aenderungsantraege as $aend) { if ($aend->status != Aenderungsantrag::$STATUS_GELOESCHT) { $this->alle_aenderungsantraege[] = $aend; } } } } } }
/** * Constructor. * * @param string $scenario name of the scenario that this model is used in. */ public function __construct($scenario = self::SCENARIO_FILTERING) { parent::__construct($scenario); }
public function __construct($scenario = '') { parent::__construct($scenario); self::$loginWithField = $this->getLoginWithField(); }
public function __construct($scenario = '') { Yii::import('ext.BraintreeApi.BraintreeApi'); $this->BraintreeApi = new BraintreeApi(); parent::__construct($scenario); }
public function __construct() { parent::__construct(); }
function __construct() { parent::__construct(); $this->command = Yii::app()->db->createCommand(); $this->connection = Yii::app()->db; }
function __construct($idCompra = null) { $this->idCompra = $idCompra; parent::__construct(); }
public function __construct(User $userModel, $scenario = '') { $this->userModel = $userModel; parent::__construct($scenario); }
/** * Constructor Method * * @access public * @return void */ public function __construct($scenario = '') { parent::__construct($scenario); \application\components\EventManager::attach($this); }
/** * Инициализация модели * @param array $config Массив из конфига * @param string $scenario Сценарий валидации */ public function __construct($config, $scenario = '') { parent::__construct($scenario); $this->setConfig($config); }
public function __construct($profile, $scenario = '') { $this->_profile = $profile; parent::__construct($scenario); }