original_string: public function actionChangeStatus($id, $value)
      {
          $model = $this->findModel($id);
          if (empty($model)) {
              Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'User {id} not found.', ['id' => $id]));
          } else {
              $model->status = $value;
              $model->pageSize = intval($this->module->params['pageSizeAdmin']);
              $result = $model->save(true, ['status']); // update only status field
              if ($result) {
                  Yii::$app->session->setFlash('success', Yii::t($this->tcModule, 'Status changed.'));
              } else {
                  foreach ($model->errors as $attribute => $errors) {
                      Yii::$app->session->setFlash('error',
                          Yii::t($this->tcModule, "Status didn't change.")
                        . ' '
                        . Yii::t($this->tcModule, "Error on field: '{field}'.", ['field' => $attribute])
                        . ' ' . $errors[0]
                      );
                      break;
                  }
              }
          }
          return $this->redirect(['index',
              'id' => $id,
              'page' => empty($model->page) ? 1 : $model->page,
          ]);
      }
code: public function actionChangeStatus($id, $value)
      {
          $model = $this->findModel($id);
          if (empty($model)) {
              Yii::$app->session->setFlash('error', Yii::t($this->tcModule, 'User {id} not found.', ['id' => $id]));
          } else {
              $model->status = $value;
              $model->pageSize = intval($this->module->params['pageSizeAdmin']);
              $result = $model->save(true, ['status']); // update only status field
              if ($result) {
                  Yii::$app->session->setFlash('success', Yii::t($this->tcModule, 'Status changed.'));
              } else {
                  foreach ($model->errors as $attribute => $errors) {
                      Yii::$app->session->setFlash('error',
                          Yii::t($this->tcModule, "Status didn't change.")
                        . ' '
                        . Yii::t($this->tcModule, "Error on field: '{field}'.", ['field' => $attribute])
                        . ' ' . $errors[0]
                      );
                      break;
                  }
              }
          }
          return $this->redirect(['index',
              'id' => $id,
              'page' => empty($model->page) ? 1 : $model->page,
          ]);
      }
code_tokens: public function actionChangeStatus ( $ id , $ value ) { $ model = $ this -> findModel ( $ id ) ; if ( empty ( $ model ) ) { Yii :: $ app -> session -> setFlash ( 'error' , Yii :: t ( $ this -> tcModule , 'User {id} not found.' , [ 'id' => $ id ] ) ) ; } else { $ model -> status = $ value ; $ model -> pageSize = intval ( $ this -> module -> params [ 'pageSizeAdmin' ] ) ; $ result = $ model -> save ( true , [ 'status' ] ) ; // update only status field if ( $ result ) { Yii :: $ app -> session -> setFlash ( 'success' , Yii :: t ( $ this -> tcModule , 'Status changed.' ) ) ; } else { foreach ( $ model -> errors as $ attribute => $ errors ) { Yii :: $ app -> session -> setFlash ( 'error' , Yii :: t ( $ this -> tcModule , "Status didn't change." ) . ' ' . Yii :: t ( $ this -> tcModule , "Error on field: '{field}'." , [ 'field' => $ attribute ] ) . ' ' . $ errors [ 0 ] ) ; break ; } } } return $ this -> redirect ( [ 'index' , 'id' => $ id , 'page' => empty ( $ model -> page ) ? 1 : $ model -> page , ] ) ; }
docstring: Change status of user.
  @param integer $id
  @param integer $value
  @return mixed
docstring_tokens: Change status of user .