public function init() { $this->filtered_options = $this->options; if (empty($_POST)) { if ($this->element && $this->element->{$this->relation}) { foreach ($this->element->{$this->relation} as $item) { $this->selected_ids[] = $item->{$this->relation_id_field}; unset($this->filtered_options[$item->{$this->relation_id_field}]); } } elseif (!$this->element || !$this->element->id) { if (is_array($this->default_options)) { $this->selected_ids = $this->default_options; foreach ($this->default_options as $id) { unset($this->filtered_options[$id]); } } } } else { if (isset($_POST[$this->field]) && is_array($_POST[$this->field])) { foreach ($_POST[$this->field] as $id) { $this->selected_ids[] = $id; unset($this->filtered_options[$id]); } } elseif (isset($_POST[CHtml::modelName($this->element)][$this->relation])) { foreach ($_POST[CHtml::modelName($this->element)][$this->relation] as $id) { $this->selected_ids[] = $id; unset($this->filtered_options[$id]); } } } //NOTE: don't call parent init as the field behaviour doesn't work for the relations attribute with models }
public function __construct(array $models, $config = array()) { $this->_models = $models; $this->setId(CHtml::modelName($this->_models[0])); foreach ($config as $key => $value) { $this->{$key} = $value; } }
/** * Publishes the required assets */ public function init() { parent::init(); if (!isset($this->htmlOptions['id']) && !isset($this->fileKey)) { $this->htmlOptions['id'] = \CHtml::modelName($this->model); } elseif (!isset($this->htmlOptions['id']) && isset($this->fileKey)) { $this->htmlOptions['id'] = \CHtml::modelName($this->model) . $this->fileKey; } if (!isset($this->htmlOptions['enctype'])) { $this->htmlOptions['enctype'] = 'multipart/form-data'; } }
public function getView() { if ($this->view) { return $this->view; } $model = CHtml::modelName($this); if (strstr($model, '_')) { $segments = explode('_', $model); $model = array_pop(explode('_', $model)); } return '_' . strtolower(preg_replace('/^Report/', '', $model)); }
public function init() { if (empty($_POST)) { if (isset($this->element->{$this->field})) { $this->checked[$this->field] = (bool) $this->element->{$this->field}; } else { $this->checked[$this->field] = false; } } else { $this->checked[$this->field] = (bool) @$_POST[CHtml::modelName($this->element)][$this->field]; } }
/** * Constructor. * @param mixed $modelClass the model class (e.g. 'Post') or the model finder instance * (e.g. <code>Post::model()</code>, <code>Post::model()->published()</code>). * @param array $config configuration (name=>value) to be applied as the initial property values of this class. */ public function __construct($modelClass, $config = array()) { if (is_string($modelClass)) { $this->modelClass = $modelClass; $this->model = $this->createModel($this->modelClass); } elseif ($modelClass instanceof Model) { $this->modelClass = get_class($modelClass); $this->model = $modelClass; } $this->setId(\CHtml::modelName($this->model)); foreach ($config as $key => $value) { $this->{$key} = $value; } }
/** * Allow the user to enter a promo code to receive a specified price. * * @author Drozdenko Anna */ public function run() { $model = new PromoCodeModel('search'); if (isset($_POST[\CHtml::modelName($model)])) { $model->attributes = $_POST[\CHtml::modelName($model)]; if (PromoCodeType::DISCOUNT_TYPE_PERCENTAGE == $model->discountType) { $model->scenario = 'percentage'; } if ($model->save()) { $this->controller->refresh(); } } $dataProvider = new \CActiveDataProvider('yii_ext\\promo\\models\\PromoCodeModel', array('pagination' => array('pageSize' => 20))); $this->controller->render($this->view, array('model' => $model, 'dataProvider' => $dataProvider)); }
public function init() { parent::init(); if (empty($_POST)) { if ($this->selected_item !== null) { $this->value = $this->selected_item; } elseif (isset($this->element->{$this->field})) { $this->value = $this->element->{$this->field}; } } else { $this->value = @$_POST[CHtml::modelName($this->element)][$this->field]; } if ($this->no_element) { $this->name = $this->field; } }
public function actionAdd() { $model = new TicketsForm(); $ticketModel = new Tickets(); if (isset($_POST[CHtml::modelName($model)])) { $model->setAttributes($_POST[CHtml::modelName($model)]); if ($model->validate()) { $transaction = db()->beginTransaction(); try { // Сохраняю тикет $ticket = new Tickets(); $ticket->category_id = $model->category_id; $ticket->priority = $model->priority; $ticket->date_incident = $model->date_incident; $ticket->char_name = $model->char_name; $ticket->title = $model->title; $ticket->new_message_for_admin = 1; $ticket->gs_id = user()->getGsId(); $ticket->status = Tickets::STATUS_ON; $ticket->save(FALSE); $ticketId = db()->getLastInsertID(); // Сохраняю переписку для тикета $ticketAnswer = new TicketsAnswers(); $ticketAnswer->ticket_id = $ticketId; $ticketAnswer->text = $model->text; $ticketAnswer->save(FALSE); // Логирую действие юзера if (app()->params['user_actions_log']) { $log = new UserActionsLog(); $log->user_id = user()->getId(); $log->action_id = UserActionsLog::ACTION_CREATE_TICKET; $log->save(FALSE); } notify()->adminNoticeTicketAdd(array('user' => user()->getUser(), 'ticket' => $ticket)); user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('main', 'Тикет создан.')); $transaction->commit(); $this->redirect(array('index')); } catch (Exception $e) { $transaction->rollback(); user()->setFlash(FlashConst::MESSAGE_ERROR, Yii::t('main', 'Произошла ошибка! Попробуйте повторить позже.')); Yii::log($e->getMessage(), CLogger::LEVEL_ERROR, __METHOD__ . ' ' . __LINE__); } $this->refresh(); } } $this->render('//cabinet/tickets/add', array('model' => $model, 'ticketModel' => $ticketModel)); }
private function getMatchingImgs($imgs, $assetManager) { $matchImgs = array(); $className = CHtml::modelName($this->owner); $fields = implode('|', $this->owner->fieldImages()); //\bname_name-(filippo|pino)-(6|5|9).jpg+\b $pattern = "/" . $className . "-" . "(" . $fields . ")-(.*).jpg/i"; foreach ($imgs as $img) { if (preg_match($pattern, $img, $matches)) { $matchImgs[$matches[2]] = $assetManager->getPublishedPathOfAlias(self::FIELDS_IMAGES_ALIAS) . DIRECTORY_SEPARATOR . basename($matches[0]); } } if (empty($matchImgs)) { return array(); } return $matchImgs; }
public function __construct($modelClass, $query, $config = array()) { if ($query instanceof ESphinxQL === false) { throw new CException("Query param must be instance of EsphinxQL"); } if (is_string($modelClass)) { $this->modelClass = $modelClass; $this->model = CActiveRecord::model($this->modelClass); } elseif ($modelClass instanceof CActiveRecord) { $this->modelClass = get_class($modelClass); $this->model = $modelClass; } $this->setId(CHtml::modelName($this->model)); $this->query = $query; foreach ($config as $key => $value) { $this->{$key} = $value; } }
public static function validate($models, $attributes = null, $loadInput = true) { $result = array(); if (!is_array($models)) { $models = array($models); } foreach ($models as $model) { $modelName = CHtml::modelName($model); if ($loadInput && isset($_POST[$modelName])) { $model->attributes = $_POST[$modelName]; } $model->validate($attributes); foreach ($model->getErrors() as $attribute => $errors) { $result[CHtml::activeId($model, $attribute)] = $errors; } } return $result; }
public function init() { $this->filtered_options = $this->options; if (empty($_POST)) { if ($this->element && $this->element->{$this->relation}) { foreach ($this->element->{$this->relation} as $item) { $this->selected_ids[] = $item->{$this->relation_id_field}; unset($this->filtered_options[$item->{$this->relation_id_field}]); } } else { if (!$this->element || !$this->element->id) { if (is_array($this->default_options)) { $this->selected_ids = $this->default_options; foreach ($this->default_options as $id) { unset($this->filtered_options[$id]); } } } } } else { if (isset($_POST[$this->field])) { foreach ($_POST[$this->field] as $id) { $this->selected_ids[] = $id; unset($this->filtered_options[$id]); } } else { if (isset($_POST[CHtml::modelName($this->element)][$this->relation])) { foreach ($_POST[CHtml::modelName($this->element)][$this->relation] as $id) { $this->selected_ids[] = $id; unset($this->filtered_options[$id]); } } } } // if the widget has javascript, load it in if (file_exists("protected/widgets/js/" . get_class($this) . ".js")) { $this->assetFolder = Yii::app()->getAssetManager()->publish('protected/widgets/js'); } //NOTE: don't call parent init as the field behaviour doesn't work for the relations attribute with models }
/** * 用户登录 */ public function actionLogin() { /** @var CMemCache $memCache */ $memCache = Yii::app()->memCache; $memCache->set('test', 1111, 10); echo $memCache->get('test'); exit; $this->layout = '//layouts/main'; if (!$this->app->user->isGuest) { $this->redirect(array('index')); } $model = new LoginForm('create'); $model->unsetAttributes(); $modelName = CHtml::modelName($model); if (isset($_POST[$modelName])) { $model->setAttributes($_POST[$modelName]); if ($model->validate() && $model->login()) { $this->redirect($this->app->user->returnUrl); } } $this->render($this->action->id, ['model' => $model]); }
/** * Validates an array of model instances and returns the results in JSON format. * This is a helper method that simplifies the way of writing AJAX validation code for tabular input. * @param mixed $models an array of model instances. * @param array $attributes list of attributes that should be validated. Defaults to null, * meaning any attribute listed in the applicable validation rules of the models should be * validated. If this parameter is given as a list of attributes, only * the listed attributes will be validated. * @param boolean $loadInput whether to load the data from $_POST array in this method. * If this is true, the model will be populated from <code>$_POST[ModelClass][$i]</code>. * @return string the JSON representation of the validation error messages. */ public static function validateTabular($models, $attributes = null, $loadInput = true) { $result = array(); if (!is_array($models)) { $models = array($models); } foreach ($models as $i => $model) { $modelName = CHtml::modelName($model); if ($loadInput && isset($_POST[$modelName][$i])) { $model->attributes = $_POST[$modelName][$i]; } $model->validate($attributes); foreach ($model->getErrors() as $attribute => $errors) { $result[CHtml::activeId($model, '[' . $i . ']' . $attribute)] = $errors; } } return function_exists('json_encode') ? json_encode($result) : CJSON::encode($result); }
<?php echo $this->renderPartial('//admin/_form_errors', array('errors' => $errors)); ?> <?php $form = $this->beginWidget('BaseEventTypeCActiveForm', array('id' => 'worklist-form', 'enableAjaxValidation' => false, 'focus' => '#Worklist_name', 'layoutColumns' => array('label' => 2, 'field' => 5))); ?> <?php echo $form->textField($definition, 'name', array('autocomplete' => Yii::app()->params['html_autocomplete']), null, array('field' => 2)); ?> <?php echo $form->textArea($definition, 'description'); ?> <?php $this->widget('application.widgets.RRuleField', array('element' => $definition, 'field' => 'rrule', 'name' => CHtml::modelName($definition) . '[rrule]')); ?> <?php echo $form->textField($definition, 'start_time', array('autocomplete' => Yii::app()->params['html_autocomplete']), null, array('field' => 1)); ?> <?php echo $form->textField($definition, 'end_time', array('autocomplete' => Yii::app()->params['html_autocomplete'], 'append-text' => '<i>Appointments will match on any time <b>before</b> the end time specified here.</i>'), null, array('field' => 1, 'append-text' => 6)); ?> <?php echo $form->formActions(array('cancel-uri' => '/worklistAdmin/definitions')); ?> <?php $this->endWidget(); ?>
</a> </div> </div> </div> <div class="element-eye left-eye column right side<?php if (!$element->hasLeft()) { ?> inactive<?php } ?> " data-side="left"> <div class="active-form"> <a href="#" class="icon-remove-side remove-side">Remove side</a> <div class="row field-row"> <div class="large-3 column"><label for="<?php echo CHtml::modelName($element) . '[left_target_iop_id]'; ?> ">Target IOP:</label></div> <div class="large-3 column"><?php echo $form->dropDownList($element, 'left_target_iop_id', $targetIOPS, array('nowrapper' => true, 'empty' => '- Select -')); ?> </div> <p class="large-1 column end">mmHg</p> </div> </div> <div class="inactive-form"> <div class="add-side"> <a href="#"> Add left side <span class="icon-add-side"></span> </a> </div>
echo ' style="display: none;"'; } ?> > <?php $html_options = array('style' => 'margin-bottom: 10px; width: 240px;', 'options' => array(), 'empty' => '- Please select -', 'div_id' => CHtml::modelName($element) . '_' . $side . '_fluidtypes', 'label' => 'Findings'); $fts = \OEModule\OphCiExamination\models\OphCiExamination_OCT_FluidType::model()->activeOrPk($element->fluidTypeValues)->findAll(); foreach ($fts as $ft) { $html_options['options'][(string) $ft->id] = array('data-order' => $ft->display_order); } echo $form->multiSelectList($element, CHtml::modelName($element) . '[' . $side . '_fluidtypes]', $side . '_fluidtypes', 'id', CHtml::listData($fts, 'id', 'name'), array(), $html_options, false, false, null, false, false, array('label' => 4, 'field' => 6)); ?> <div class="row"> <div class="large-4 column"> <label for="<?php echo CHtml::modelName($element) . '_' . $side . '_fluidstatus_id'; ?> "> <?php echo $element->getAttributeLabel($side . '_fluidstatus_id'); ?> : </label> </div> <div class="large-6 column end"> <?php echo $form->dropDownList($element, $side . '_fluidstatus_id', '\\OEModule\\OphCiExamination\\models\\OphCiExamination_OCT_FluidStatus', array('nowrapper' => true, 'empty' => ' - Please Select - ')); ?> </div> </div> </div>
/** * @param models\Element_OphCoCvi_ClericalInfo $element * @param $data * @param $index * @throws \Exception */ public function saveComplexAttributes_Element_OphCoCvi_ClericalInfo(models\Element_OphCoCvi_ClericalInfo $element, $data, $index) { $model_name = \CHtml::modelName($element); if (array_key_exists($model_name, $data)) { $answer_data = array_key_exists('patient_factors', $data[$model_name]) ? $data[$model_name]['patient_factors'] : array(); $element->updatePatientFactorAnswers($answer_data); } }
<?php /** * OpenEyes * * (C) Moorfields Eye Hospital NHS Foundation Trust, 2008-2011 * (C) OpenEyes Foundation, 2011-2013 * This file is part of OpenEyes. * OpenEyes is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. * OpenEyes is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. * You should have received a copy of the GNU General Public License along with OpenEyes in a file titled COPYING. If not, see <http://www.gnu.org/licenses/>. * * @package OpenEyes * @link http://www.openeyes.org.uk * @author OpenEyes <*****@*****.**> * @copyright Copyright (c) 2008-2011, Moorfields Eye Hospital NHS Foundation Trust * @copyright Copyright (c) 2011-2013, OpenEyes Foundation * @license http://www.gnu.org/licenses/gpl-3.0.html The GNU General Public License V3.0 */ $form = new BaseEventTypeCActiveForm(); $base_name = CHtml::modelName($value) . "[{$side}_values][{$index}]"; echo $form->dropDownList($value, 'qualitative_reading_id', CHtml::listData($scale->values, 'id', 'name'), array('nowrapper' => true, 'name' => "{$base_name}[qualitative_reading_id]"));
?> column"> <label for="<?php echo CHtml::modelName($element) . '_' . $field . '_0'; ?> "> <?php echo CHtml::encode($element->getAttributeLabel($field)); ?> : </label> </div> <div class="large-<?php echo $layoutColumns['field']; ?> column end"> <?php } ?> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => $name, 'id' => CHtml::modelName($element) . '_' . $field . '_0', 'options' => array_merge($options, array('showAnim' => 'fold', 'dateFormat' => Helper::NHS_DATE_FORMAT_JS)), 'value' => preg_match('/^[0-9]{4}-[0-9]{2}-[0-9]{2}$/', $value) ? Helper::convertMySQL2NHS($value) : $value, 'htmlOptions' => $htmlOptions)); ?> <?php if (!@$htmlOptions['nowrapper']) { ?> </div> </div> <?php }
/** * @param CModel $element * @param string $field * @param array $htmlOptions * @param array $layoutColumns */ public function passwordField($element, $field, $htmlOptions = array(), $layoutColumns = array()) { $htmlOptions['password'] = 1; $this->widget('application.widgets.TextField', array('element' => $element, 'name' => CHtml::modelName($element) . "[{$field}]", 'field' => $field, 'htmlOptions' => $htmlOptions, 'layoutColumns' => $layoutColumns)); }
/** * Set the attributes of the given $elements from the given structured array. * Returns any validation errors that arise. * * @param array $data * @throws Exception * @return array $errors */ protected function setAndValidateElementsFromData($data) { $errors = array(); $elements = array(); // only process data for elements that are part of the element type set for the controller event type foreach ($this->event_type->getAllElementTypes() as $element_type) { $el_cls_name = $element_type->class_name; $f_key = CHtml::modelName($el_cls_name); if (isset($data[$f_key])) { $keys = array_keys($data[$f_key]); if (is_array($data[$f_key][$keys[0]]) && !count(array_filter(array_keys($data[$f_key]), 'is_string'))) { // there is more than one element of this type $pk_field = $el_cls_name::model()->tableSchema->primaryKey; foreach ($data[$f_key] as $i => $attrs) { if (!$this->event->isNewRecord && !isset($attrs[$pk_field])) { throw new Exception("missing primary key field for multiple elements for editing an event"); } if ($pk = @$attrs[$pk_field]) { $element = $el_cls_name::model()->findByPk($pk); } else { $element = $element_type->getInstance(); } $element->attributes = Helper::convertNHS2MySQL($attrs); $this->setElementComplexAttributesFromData($element, $data, $i); $element->event = $this->event; $elements[] = $element; } } else { if ($this->event->isNewRecord || !($element = $el_cls_name::model()->find('event_id=?', array($this->event->id)))) { $element = $element_type->getInstance(); } $element->attributes = Helper::convertNHS2MySQL($data[$f_key]); $this->setElementComplexAttributesFromData($element, $data); $element->event = $this->event; $elements[] = $element; } } elseif ($element_type->required) { $errors['Event'][] = $element_type->name . ' is required'; $elements[] = $element_type->getInstance(); } } if (!count($elements)) { $errors['Event'][] = 'Cannot create an event without at least one element'; } // assign $this->open_elements = $elements; // validate foreach ($this->open_elements as $element) { $this->setValidationScenarioForElement($element); if (!$element->validate()) { $name = $element->getElementTypeName(); foreach ($element->getErrors() as $errormsgs) { foreach ($errormsgs as $error) { $errors[$name][] = $error; } } } } //event date if (isset($data['Event']['event_date'])) { $event = $this->event; $event->event_date = Helper::convertNHS2MySQL($data['Event']['event_date']); if (!$event->validate()) { foreach ($event->getErrors() as $errormsgs) { foreach ($errormsgs as $error) { $errors['Event'][] = $error; } } } } return $errors; }
</div> </div> <div class="inactive-form"> <div class="add-side"> <a href="#"> Add left side <span class="icon-add-side"></span> </a> </div> </div> </div> </div> <script id="visualacuity_reading_template" type="text/html"> <?php $default_reading = OEModule\OphCiExamination\models\OphCiExamination_VisualAcuity_Reading::model(); $default_reading->init(); $this->renderPartial('form_Element_OphCiExamination_VisualAcuity_Reading', array('name_stub' => CHtml::modelName($element) . '[{{side}}_readings]', 'key' => '{{key}}', 'side' => '{{side}}', 'values' => $values, 'val_options' => $val_options, 'methods' => $methods, 'asset_path' => $this->getAssetPathForElement($element), 'reading' => $default_reading)); ?> </script> <?php $assetManager = Yii::app()->getAssetManager(); $baseAssetsPath = Yii::getPathOfAlias('application.assets'); $assetManager->publish($baseAssetsPath . '/components/chosen/'); Yii::app()->clientScript->registerScriptFile($assetManager->getPublishedUrl($baseAssetsPath . '/components/chosen/') . '/chosen.jquery.min.js'); Yii::app()->clientScript->registerCssFile($assetManager->getPublishedUrl($baseAssetsPath . '/components/chosen/') . '/chosen.min.css'); ?> <script type="text/javascript"> $(document).ready(function() { OphCiExamination_VisualAcuity_method_ids = [ <?php $first = true; foreach ($methods as $index => $method) {
?> </section> <?php } else { ?> <section class="<?php echo implode(' ', $section_classes); ?> element-no-display" data-element-type-id="<?php echo $element->elementType->id; ?> " data-element-type-class="<?php echo CHtml::modelName($element->elementType->class_name); ?> " data-element-type-name="<?php echo $element->elementType->name; ?> " data-element-display-order="<?php echo $element->elementType->display_order; ?> "> <?php echo $content; ?>
<?php echo $element->getAttributeLabel($side . '_cortical_id'); ?> : </label> <?php $html_options = array(); foreach (OEModule\OphCiExamination\models\OphCiExamination_AnteriorSegment_Cortical::model()->findAll() as $option) { $html_options[(string) $option->id] = array('data-value' => $option->value); } echo $form->dropDownList($element, $side . '_cortical_id', 'OEModule\\OphCiExamination\\models\\OphCiExamination_AnteriorSegment_Cortical', array('options' => $html_options, 'nowrapper' => true)); ?> </div> <div class="field-row"> <label for="<?php echo CHtml::modelName($element) . '_' . $side . '_description'; ?> "> <?php echo $element->getAttributeLabel($side . '_description'); ?> : </label> <?php echo CHtml::activeTextArea($element, $side . '_description', array('rows' => "2", 'class' => 'autosize clearWithEyedraw')); ?> </div> <div class="field-row"> <label> <?php echo CHtml::activeCheckBox($element, $side . '_phako', array('class' => 'clearWithEyedraw'));
/** * Редактирование кода * * @params int $code_id */ public function actionCodeEdit($code_id) { $model = BonusCodes::model()->findByPk($code_id); if (!$model) { throw new CHttpException(404, Yii::t('backend', 'Код не найден')); } if (isset($_POST[CHtml::modelName($model)])) { $model->setScenario('form_code'); $model->setAttributes($_POST[CHtml::modelName($model)]); if ($model->save()) { user()->setFlash(FlashConst::MESSAGE_SUCCESS, Yii::t('backend', 'Изменения сохранены.')); $this->refresh(); } } $this->render('//bonuses/codes/form', array('model' => $model)); }
/** * User Login */ public function actionLogin() { $login = new LoginUser(); if (isset($_POST[CHtml::modelName($login)])) { $login->attributes = $_POST[CHtml::modelName($login)]; if ($login->validate() && $login->login()) { $module = $this->module; $this->redirect(["/"]); } } $this->render('login', ['login' => $login]); }
?> <?php echo $htmlOptions['class']; } ?> " type="range" id="<?php echo CHtml::modelName($element); ?> _<?php echo $field; ?> " name="<?php echo CHtml::modelName($element); ?> [<?php echo $field; ?> ]" min="<?php echo $min; ?> " max="<?php echo $max; ?> " value="<?php echo $value;
/** * Overrides parent __construct (). * @param string $uid (optional) If set, will be used to uniquely identify this data * provider. This overrides the default behavior of using the model name as the uid. * * This method is Copyright (c) 2008-2014 by Yii Software LLC * http://www.yiiframework.com/license/ */ public function __construct($modelClass, $config = array()) { if (isset($config['dbPersistentGridSettings'])) { $this->dbPersistentGridSettings = $config['dbPersistentGridSettings']; } if (isset($config['disablePersistentGridSettings'])) { $this->disablePersistentGridSettings = $config['disablePersistentGridSettings']; } if (isset($config['uid'])) { $this->uid = $config['uid']; } if (is_string($modelClass)) { $this->modelClass = $modelClass; $this->model = $this->getModel($this->modelClass); if (property_exists($this->model, 'uid')) { $this->model->uid = $this->uid; } } elseif ($modelClass instanceof CActiveRecord) { $this->modelClass = get_class($modelClass); $this->model = $modelClass; } /* x2modstart */ $this->attachBehaviors(array('SmartDataProviderBehavior' => array('class' => 'SmartDataProviderBehavior', 'settingsBehavior' => $this->dbPersistentGridSettings ? 'GridViewDbSettingsBehavior' : 'GridViewSessionSettingsBehavior'))); /* x2modend */ /* x2modstart */ if ($this->uid !== null) { $this->setId($this->uid); } else { /* x2modend */ $this->setId(CHtml::modelName($this->model)); /* x2modstart */ } /* x2modend */ foreach ($config as $key => $value) { $this->{$key} = $value; } /* x2modstart */ $this->storeSettings(); /* x2modend */ }