本文整理汇总了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);
}
示例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;
}
示例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;
}
示例4: __construct
public function __construct($fields)
{
foreach ($fields as $field => $rules) {
$this->_fields[$field] = null;
$this->_rules[$field] = $rules;
}
parent::__construct();
}
示例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 = '');
}
示例6: foreach
/**
*
* Declares attribute labels.
*
**/
function __construct($scenario = 'insert')
{
// инициализируем поля
foreach ($this->attributeLabels() as $key => $value) {
$this->_attributes[$key] = "";
}
parent::__construct($scenario);
}
示例7: __construct
public function __construct($scenario = '')
{
parent::__construct($scenario);
for ($i = 2; $i <= self::count; ++$i) {
$this->_data['title_' . $i] = '';
$this->_data['value_' . $i] = '';
}
}
示例8: __construct
public function __construct($model = null)
{
parent::__construct();
if ($model != null) {
$this->login = $model->login;
$this->name = $model->nome;
}
}
示例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);
}
示例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();
}
示例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;
}
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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] = '';
}
}