config/config/DealerLimitsController.php
/**
     * Updates an existing DealerLimits model.
     * If update is successful, the browser will be redirected to the 'view' page.
     * @param integer $id
     * @return mixed
     */
Updates an existing DealerLimits model.
If update is successful, the browser will be redirected to the 'view' page.
@param integer $id
@return mixed
Updates an existing DealerLimits model . If update is successful the browser will be redirected to the ' view ' page . @param integer $id @return mixed
public function actionUpdate($id)
    {
        $accses_model = new Access();
        $accses_info = $accses_model->GetAccsessToPage(Yii::$app->user->identity->login, "1");
        if (isset($accses_info[0]) && ($accses_info[0]["access_level"] == "C")) {
            $model = $this->findModel($id);
            if ($model->load(Yii::$app->request->post())) {
                if($model->save()){
                    Yii::$app->session->setFlash('success', Yii::t('dealer-limits', 'Изменения успешно внесены'));
                    return $this->redirect(['update', 'id' => $model->dealer_id]);
                }else{
                    Yii::$app->session->setFlash('error', Yii::t('dealer-limits', 'Не удалось внести изменения'));
                    return $this->render('update', [
                        'model' => $model,
                    ]);
                }
            } else {
                return $this->render('update', [
                    'model' => $model,
                ]);
            }
        } else {
            return Yii::$app->response->redirect(['site/index']);
        }
    }
public function actionUpdate ( $ id ) { $ accses_model = new Access ( ) ; $ accses_info = $ accses_model -> GetAccsessToPage ( Yii :: $ app -> user -> identity -> login , " 1 " ) ; if ( isset ( $ accses_info [ 0 ] ) && ( $ accses_info [ 0 ] [ " access_level " ] == " C " ) ) { $ model = $ this -> findModel ( $ id ) ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) ) { if ( $ model -> save ( ) ) { Yii :: $ app -> session -> setFlash ( 'success' , Yii :: t ( 'dealer-limits' , 'Изменения успешно внесены')); return $ this -> redirect ( [ 'update' , 'id' => $ model -> dealer_id ] ) ; } else { Yii :: $ app -> session -> setFlash ( 'error' , Yii :: t ( 'dealer-limits' , 'Не удалось внести изменения')); return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; } } else { return $ this -> render ( 'update' , [ 'model' => $ model , ] ) ; } } else { return Yii :: $ app -> response -> redirect ( [ 'site/index' ] ) ; } }
Updates an existing DealerLimits model.
Updates an existing DealerLimits model .