/**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function create()
 {
     $model = new Boxes();
     // Uncomment the following line if AJAX validation is needed
     // $this->performAjaxValidation($model);
     if (isset($_POST['Boxes'])) {
         $model->attributes = $_POST['Boxes'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', gT('New box created'));
             $this->getController()->redirect(array('admin/homepagesettings'));
         } else {
             Yii::app()->user->setFlash('error', gT('Could not create new box'));
         }
     }
     $this->_renderWrappedTemplate('homepagesettings', 'create', array('model' => $model));
 }
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function create()
 {
     $model = new Boxes();
     if (isset($_POST['Boxes'])) {
         $model->attributes = $_POST['Boxes'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', gT('New box created'));
             if (isset($_POST['saveandclose'])) {
                 $this->getController()->redirect(array('admin/homepagesettings'));
             } else {
                 $this->getController()->redirect(array('admin/homepagesettings/sa/update/id/' . $model->id));
             }
         } else {
             Yii::app()->user->setFlash('error', gT('Could not create new box'));
         }
     }
     $this->_renderWrappedTemplate('homepagesettings', 'create', array('model' => $model));
 }
Пример #3
0
 /**
  * Creates a new model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  */
 public function create()
 {
     if (!Permission::model()->hasGlobalPermission('settings', 'update')) {
         Yii::app()->session['flashmessage'] = gT('Access denied!');
         $this->getController()->redirect($this->createUrl("/admin/homepagesettings"));
     }
     $model = new Boxes();
     if (isset($_POST['Boxes'])) {
         $model->attributes = $_POST['Boxes'];
         if ($model->save()) {
             Yii::app()->user->setFlash('success', gT('New box created'));
             if (isset($_POST['saveandclose'])) {
                 $this->getController()->redirect(array('admin/homepagesettings'));
             } else {
                 $this->getController()->redirect(array('admin/homepagesettings/sa/update/id/' . $model->id));
             }
         } else {
             Yii::app()->user->setFlash('error', gT('Could not create new box'));
         }
     }
     $this->_renderWrappedTemplate('homepagesettings', 'create', array('model' => $model));
 }