/**
  * Update status
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     if ($new === true) {
         $model = new OrderStatus();
         $model->unsetAttributes();
     } else {
         $model = OrderStatus::model()->findByPk($_GET['id']);
     }
     if (!$model) {
         throw new CHttpException(404, Yii::t('OrdersModule.admin', 'Статус не найден.'));
     }
     $form = new SAdminForm('application.modules.orders.views.admin.statuses.statusForm', $model);
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['OrderStatus'];
         if ($model->validate()) {
             $model->save();
             $this->setFlashMessage(Yii::t('OrdersModule.admin', 'Изменения успешно сохранены'));
             if (isset($_POST['REDIRECT'])) {
                 $this->smartRedirect($model);
             } else {
                 $this->redirect('create');
             }
         }
     }
     $this->render('update', array('model' => $model, 'form' => $form));
 }
 /**
  *
  */
 public function actionIndex()
 {
     $model = new OrderStatus('search');
     $model->unsetAttributes();
     if ($data = Yii::app()->getRequest()->getQuery('OrderStatus')) {
         $model->setAttributes($data);
     }
     $this->render('index', ['model' => $model]);
 }
 /**
  * Update status
  * @param bool $new
  * @throws CHttpException
  */
 public function actionUpdate($new = false)
 {
     if ($new === true) {
         $model = new OrderStatus();
         $model->unsetAttributes();
     } else {
         $model = OrderStatus::model()->findByPk($_GET['id']);
     }
     if (!$model) {
         throw new CHttpException(404, Yii::t('CartModule.admin', 'NO_STATUSES'));
     }
     $title = $model->isNewRecord ? Yii::t('CartModule.admin', 'CONTROL_STATUSES', 1) : Yii::t('CartModule.admin', 'CONTROL_STATUSES', 0);
     $this->breadcrumbs = array(Yii::t('CartModule.admin', 'STATUSES') => $this->createUrl('index'), $model->isNewRecord ? Yii::t('CartModule.admin', 'CONTROL_STATUSES', 1) : Html::encode($model->name));
     $this->pageName = $title;
     if (Yii::app()->request->isPostRequest) {
         $model->attributes = $_POST['OrderStatus'];
         if ($model->validate()) {
             $model->save();
             $this->redirect('index');
         }
     }
     $this->render('update', array('model' => $model));
 }