public function init() { parent::init(); if (!$this->model->isNewRecord) { $this->answers = $this->model->answer; } }
public function init() { parent::init(); if (!$this->model->asa('FileUploadableBehavior') instanceof FileUploadableBehavior) { $this->model->attachBehavior('FileUploadableBehavior', array('class' => 'fileUpload.FileUploadableBehavior', 'resetScope' => true)); } Yii::app()->clientScript->registerCoreScript('jquery.ui'); }
public function init() { parent::init(); if ($this->isInt()) { $this->model->addValidator(CValidator::createValidator('numerical', $this->model, $this->attributeName, array('on' => 'backendInsert, backendUpdate'))); } else { $this->model->addValidator(CValidator::createValidator('length', $this->model, $this->attributeName, array('on' => 'backendInsert, backendUpdate', 'max' => 255))); } }
public function init() { parent::init(); $this->roles = Yii::app()->authManager->getAuthItems(CAuthItem::TYPE_ROLE); if (!$this->model->isNewRecord) { $currentRoles = Yii::app()->authManager->getAuthItems(CAuthItem::TYPE_ROLE, $this->model->id_user); foreach ($currentRoles as $role) { $this->currentRoles[] = $role->name; } } }
public function init() { parent::init(); if (!$this->model->asa('DateTimeBehavior') instanceof DateTimeBehavior) { $this->model->attachBehavior('DateTimeBehavior', array('class' => 'ygin.components.dateTime.DateTimeBehavior')); } $objectParam = $this->getObjectParameter(); $dateTimeForm = new DateTimeForm(); $dateTimeForm->dateTimeAttribute = $objectParam->getFieldName(); $dateTimeForm->isTimeAvailable = $this->getIsTimeAvailable(); $dateTimeForm->owner = $this->model; if ($objectParam->isRequired()) { $dateTimeForm->required = true; } $this->model->addDateTimeForm($dateTimeForm); }
public function init() { parent::init(); // Элемент работает с одним типом пхп скрипта. $idPhpScriptType = HU::get(ObjectUrlRule::PARAM_SYSTEM_MODULE); $idPhpScript = $this->model->{$this->attributeName}; if ($idPhpScript == null && $idPhpScriptType == null) { $this->render = false; return; } if ($idPhpScript != null) { $this->phpScript = PhpScriptInstance::model()->findByAttributes(array('id_php_script' => $idPhpScript)); if ($this->phpScript == null) { $this->error = 'Ошибка определения обработчика. Возможно, был удален php-скрипт, привязанный к данному экземпляру.'; return; } } else { if ($idPhpScriptType != null) { // новый раздел $this->phpScript = new PhpScriptInstance(); $this->phpScript->id_php_script_type = $idPhpScriptType; } } }
public function init() { parent::init(); $this->model->addValidator(CValidator::createValidator('length', $this->model, $this->attributeName, array('on' => 'backendInsert, backendUpdate', 'max' => 255))); }
public function init() { parent::init(); $this->model->addValidator(CValidator::createValidator('required', $this->model, array($this->attributeName), array('on' => 'backendInsert'))); }
public function init() { parent::init(); $this->modules = SiteModule::model()->resetScope()->findAll(); }
public function init() { parent::init(); $this->htmlOptions = CMap::mergeArray(array('class' => 'b-instance-list-select-multi'), $this->htmlOptions); $this->columnHtmlOptions = CMap::mergeArray(array('class' => $this->htmlOptions['class'], 'offset' => 'col-md-offset-1'), $this->columnHtmlOptions); }