public function loadModel($id)
 {
     if (($model = EavSetExtended::model()->findByPk($id)) === null) {
         throw new CHttpException(404, Yii::t('EavModule.eav', 'Page was not found!'));
     }
     return $model;
 }
 public function run($id)
 {
     $model = EavSetExtended::model()->findByPk($id);
     if (is_null($model)) {
         throw new CHttpException(404);
     }
     $request = Yii::app()->request;
     $formName = get_class($model);
     if (is_null($request->getPost($formName))) {
         $this->controller->render('update', array('model' => $model));
         Yii::app()->end();
     }
     $attributes = $request->getPost($formName);
     $attachedAttributes = isset($attributes['attachedEavAttributes']) ? $attributes['attachedEavAttributes'] : array();
     $orderedAttributes = isset($attributes['orderedEavAttributes']) ? $attributes['orderedEavAttributes'] : array();
     $model->setAttributes($request->getPost($formName));
     $model->setAttachedEavAttributes($attachedAttributes);
     $model->setOrderedEavAttributes($orderedAttributes);
     if ($model->save()) {
         Yii::app()->getComponent('user')->setFlash('success', Yii::t('EavModule.eavactiverecord', 'The attribute set has been successfully updated'));
     } else {
         Yii::app()->getComponent('user')->setFlash('error', Yii::t('EavModule.eavactiverecord', 'A validation error has occurred while processing your request'));
     }
     $this->controller->render('update', array('model' => $model));
 }
 public function loadModel($id)
 {
     if (($model = EavSetExtended::model()->findByPk($id)) === null) {
         throw new CHttpException(404, 'Страница не найдена');
     }
     return $model;
 }
 public function run()
 {
     $criteria = new CDbCriteria();
     $pages = new CPagination(EavSetExtended::model()->count());
     $pages->pageSize = $this->getController()->getModule()->getItemsPerPage();
     $pages->applyLimit($criteria);
     $sort = new CSort('EavSetExtended');
     $sort->attributes = array('id', 'name');
     $sort->applyOrder($criteria);
     $model = EavSetExtended::model()->findAll($criteria);
     $this->controller->render('index', array('model' => $model, 'sort' => $sort, 'pages' => $pages));
 }
 public function run($id)
 {
     $model = EavSetExtended::model()->findByPk($id);
     if (is_null($model)) {
         throw new CHttpException(404);
     }
     try {
         if ($model->delete()) {
             Yii::app()->getComponent('user')->setFlash('success', Yii::t('EavModule.eavactiverecord', 'The attribute set has been successfully deleted'));
         } else {
             Yii::app()->getComponent('user')->setFlash('error', Yii::t('EavModule.eavactiverecord', 'An error occurred while deleting the attribute set'));
         }
     } catch (CDbException $ex) {
         Yii::app()->getComponent('user')->setFlash('error', Yii::t('EavModule.eavactiverecord', 'The attribute set cannot be deleted because it is in use'));
     }
     $this->controller->redirect(array('set/index'));
 }
Example #6
0
?>
</div>

<?php 
echo $form->errorSummary($model);
?>

<div class="row">
    <div class="col-sm-3">
        <?php 
echo $form->dropDownListGroup($model, 'category_id', ['widgetOptions' => ['data' => RealtyCategory::model()->categoryList, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('RealtyModule.realty', '--choose--'), 'data-original-title' => $model->getAttributeLabel('category_id'), 'data-content' => $model->getAttributeDescription('category_id'), 'data-container' => 'body']]]);
?>
    </div>
    <div class="col-sm-3">
        <?php 
echo $form->dropDownListGroup($model, 'eav_set_id', ['widgetOptions' => ['data' => EavSetExtended::model()->list, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('RealtyModule.realty', '--choose--'), 'data-original-title' => $model->getAttributeLabel('eav_set_id'), 'data-content' => $model->getAttributeDescription('eav_set_id'), 'data-container' => 'body']]]);
?>
    </div>
</div>

<div class="row">
    <div class="col-sm-3">
        <?php 
echo $form->dropDownListGroup($model, 'status', ['widgetOptions' => ['data' => $model->statusList, 'htmlOptions' => ['class' => 'popover-help', 'empty' => Yii::t('RealtyModule.realty', '--choose--'), 'data-original-title' => $model->getAttributeLabel('status'), 'data-content' => $model->getAttributeDescription('status'), 'data-container' => 'body']]]);
?>
    </div>
    <div class="col-sm-3">
        <?php 
echo $form->textFieldGroup($model, 'icon', ['widgetOptions' => ['htmlOptions' => ['data-original-title' => $model->getAttributeLabel('icon'), 'data-content' => $model->getAttributeDescription('icon')]]]);
?>
    </div>
Example #7
0
    <div class="row-fluid control-group <?php 
echo $model->hasErrors('alias') ? 'error' : '';
?>
">
        <?php 
echo $form->textFieldRow($model, 'alias', array('class' => 'span7', 'maxlength' => 250));
?>
    </div>

    <div class='row-fluid control-group <?php 
echo $model->hasErrors("eav_set_id") ? "error" : "";
?>
'>
        <?php 
echo $form->dropDownListRow($model, 'eav_set_id', EavSetExtended::model()->list, array('class' => 'span3', 'empty' => 'Выберите связанную группу атрибутов'));
?>
    </div>

    <div class='row-fluid control-group <?php 
echo $model->hasErrors("status") ? "error" : "";
?>
'>
        <?php 
echo $form->dropDownListRow($model, 'status', $model->statusList, array('class' => 'span7'));
?>
    </div>

    <div class="row-fluid control-group <?php 
echo $model->hasErrors('top_block') ? 'error' : '';
?>