original_string: public function actionSortCategory()
      {
          if (!Yii::$app->request->isAjax) {
              return $this->redirect(['admin/categories']);
          }
          if (!User::can(Rbac::PERM_UPDATE_CATEGORY)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'You are not allowed to perform this action.'),
                  ['class' => 'text-danger']
              );
          }
  
          $modelId = Yii::$app->request->post('id');
          $new = Yii::$app->request->post('new');
          if (!is_numeric($modelId) || !is_numeric($new)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'Sorry! Sorting parameters are wrong.'),
                  ['class' => 'text-danger']
              );
          }
  
          $moved = Category::find()->where(['id' => $modelId])->limit(1)->one();
          if (empty($moved)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'Sorry! We can not find Category with this ID.'),
                  ['class' => 'text-danger']
              );
          }
          if ($moved->newOrder((int)$new)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok-circle'])
                  . ' ' . Yii::t('podium/view', "New categories' order has been saved."),
                  ['class' => 'text-success']
              );
          }
          return Html::tag('span',
              Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
              . ' ' . Yii::t('podium/view', "Sorry! We can not save new categories' order."),
              ['class' => 'text-danger']
          );
      }
code: public function actionSortCategory()
      {
          if (!Yii::$app->request->isAjax) {
              return $this->redirect(['admin/categories']);
          }
          if (!User::can(Rbac::PERM_UPDATE_CATEGORY)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'You are not allowed to perform this action.'),
                  ['class' => 'text-danger']
              );
          }
  
          $modelId = Yii::$app->request->post('id');
          $new = Yii::$app->request->post('new');
          if (!is_numeric($modelId) || !is_numeric($new)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'Sorry! Sorting parameters are wrong.'),
                  ['class' => 'text-danger']
              );
          }
  
          $moved = Category::find()->where(['id' => $modelId])->limit(1)->one();
          if (empty($moved)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
                  . ' ' . Yii::t('podium/view', 'Sorry! We can not find Category with this ID.'),
                  ['class' => 'text-danger']
              );
          }
          if ($moved->newOrder((int)$new)) {
              return Html::tag('span',
                  Html::tag('span', '', ['class' => 'glyphicon glyphicon-ok-circle'])
                  . ' ' . Yii::t('podium/view', "New categories' order has been saved."),
                  ['class' => 'text-success']
              );
          }
          return Html::tag('span',
              Html::tag('span', '', ['class' => 'glyphicon glyphicon-warning-sign'])
              . ' ' . Yii::t('podium/view', "Sorry! We can not save new categories' order."),
              ['class' => 'text-danger']
          );
      }
code_tokens: public function actionSortCategory ( ) { if ( ! Yii :: $ app -> request -> isAjax ) { return $ this -> redirect ( [ 'admin/categories' ] ) ; } if ( ! User :: can ( Rbac :: PERM_UPDATE_CATEGORY ) ) { return Html :: tag ( 'span' , Html :: tag ( 'span' , '' , [ 'class' => 'glyphicon glyphicon-warning-sign' ] ) . ' ' . Yii :: t ( 'podium/view' , 'You are not allowed to perform this action.' ) , [ 'class' => 'text-danger' ] ) ; } $ modelId = Yii :: $ app -> request -> post ( 'id' ) ; $ new = Yii :: $ app -> request -> post ( 'new' ) ; if ( ! is_numeric ( $ modelId ) || ! is_numeric ( $ new ) ) { return Html :: tag ( 'span' , Html :: tag ( 'span' , '' , [ 'class' => 'glyphicon glyphicon-warning-sign' ] ) . ' ' . Yii :: t ( 'podium/view' , 'Sorry! Sorting parameters are wrong.' ) , [ 'class' => 'text-danger' ] ) ; } $ moved = Category :: find ( ) -> where ( [ 'id' => $ modelId ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ moved ) ) { return Html :: tag ( 'span' , Html :: tag ( 'span' , '' , [ 'class' => 'glyphicon glyphicon-warning-sign' ] ) . ' ' . Yii :: t ( 'podium/view' , 'Sorry! We can not find Category with this ID.' ) , [ 'class' => 'text-danger' ] ) ; } if ( $ moved -> newOrder ( ( int ) $ new ) ) { return Html :: tag ( 'span' , Html :: tag ( 'span' , '' , [ 'class' => 'glyphicon glyphicon-ok-circle' ] ) . ' ' . Yii :: t ( 'podium/view' , "New categories' order has been saved." ) , [ 'class' => 'text-success' ] ) ; } return Html :: tag ( 'span' , Html :: tag ( 'span' , '' , [ 'class' => 'glyphicon glyphicon-warning-sign' ] ) . ' ' . Yii :: t ( 'podium/view' , "Sorry! We can not save new categories' order." ) , [ 'class' => 'text-danger' ] ) ; }
docstring: Updating the categories order.
  @return string|Response
docstring_tokens: Updating the categories order .