當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CFormModel::__construct方法代碼示例

本文整理匯總了PHP中CFormModel::__construct方法的典型用法代碼示例。如果您正苦於以下問題:PHP CFormModel::__construct方法的具體用法?PHP CFormModel::__construct怎麽用?PHP CFormModel::__construct使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在CFormModel的用法示例。


在下文中一共展示了CFormModel::__construct方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * 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);
 }
開發者ID:EurekaSolutions,項目名稱:proyectoestudio,代碼行數:30,代碼來源:HUserInfoForm.php

示例2: __construct

 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;
 }
開發者ID:eneelkant,項目名稱:oprecx-project,代碼行數:7,代碼來源:InterviewSlotForm.php

示例3: __construct

 /**
  * 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;
 }
開發者ID:ankitbishtkec,項目名稱:generic-ecommerce-website,代碼行數:30,代碼來源:CheckoutSecondStageForm.php

示例4: __construct

 public function __construct($fields)
 {
     foreach ($fields as $field => $rules) {
         $this->_fields[$field] = null;
         $this->_rules[$field] = $rules;
     }
     parent::__construct();
 }
開發者ID:Telemedellin,項目名稱:tm,代碼行數:8,代碼來源:CustomForm.php

示例5: __construct

 public function __construct($scenario = '')
 {
     $this->options = Option::model()->findAll();
     foreach ($this->options as $k => $v) {
         $this->{$v->key} = $v->value;
     }
     parent::__construct($scenario = '');
 }
開發者ID:airycanon,項目名稱:go9999_v2,代碼行數:8,代碼來源:OptionForm.php

示例6: foreach

 /**
  *
  *  Declares attribute labels.
  *
  **/
 function __construct($scenario = 'insert')
 {
     // инициализируем поля
     foreach ($this->attributeLabels() as $key => $value) {
         $this->_attributes[$key] = "";
     }
     parent::__construct($scenario);
 }
開發者ID:Kapodastr,項目名稱:grow,代碼行數:13,代碼來源:Settings.php

示例7: __construct

 public function __construct($scenario = '')
 {
     parent::__construct($scenario);
     for ($i = 2; $i <= self::count; ++$i) {
         $this->_data['title_' . $i] = '';
         $this->_data['value_' . $i] = '';
     }
 }
開發者ID:alexanderkuz,項目名稱:test-yii2,代碼行數:8,代碼來源:OptionForm.php

示例8: __construct

 public function __construct($model = null)
 {
     parent::__construct();
     if ($model != null) {
         $this->login = $model->login;
         $this->name = $model->nome;
     }
 }
開發者ID:elikristina,項目名稱:portalcegov,代碼行數:8,代碼來源:NewLoginForm.php

示例9: __construct

 /**
  * 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);
 }
開發者ID:andryluthfi,項目名稱:annotation-tools,代碼行數:14,代碼來源:RegisterForm.php

示例10: __construct

 /**
  * 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();
 }
開發者ID:fandikurnia,項目名稱:CiiMS,代碼行數:16,代碼來源:CiiSettingsModel.php

示例11: __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;
     }
 }
開發者ID:alexanderkuz,項目名稱:test-yii2,代碼行數:11,代碼來源:CargoCostForm.php

示例12: __construct

 /**
  * 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);
 }
開發者ID:josemanuel3dx,項目名稱:SEMMIO,代碼行數:17,代碼來源:PollExportForm.php

示例13: __construct

 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();
     }
 }
開發者ID:kot-ezhva,項目名稱:ygin,代碼行數:13,代碼來源:ParameterSearchForm.php

示例14: __construct

 /**
  * 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);
     }
 }
開發者ID:ankitbishtkec,項目名稱:generic-ecommerce-website,代碼行數:16,代碼來源:TiffinPriceTimeSelectionForm.php

示例15: __construct

 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] = '';
     }
 }
開發者ID:alexanderkuz,項目名稱:test-yii2,代碼行數:14,代碼來源:AreaForm.php


注:本文中的CFormModel::__construct方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。