original_string: public function actionNewForum($cid = null)
      {
          $category = Category::find()->where(['id' => $cid])->limit(1)->one();
          if (empty($category)) {
              $this->error(Yii::t('podium/flash', 'Sorry! We can not find Category with this ID.'));
              return $this->redirect(['admin/categories']);
          }
          $model = new Forum();
          $model->category_id = $category->id;
          $model->visible = 1;
          $model->sort = 0;
          if ($model->load(Yii::$app->request->post()) && $model->save()) {
              Log::info('Forum added', $model->id, __METHOD__);
              $this->success(Yii::t('podium/flash', 'New forum has been created.'));
              return $this->redirect(['admin/forums', 'cid' => $category->id]);
          }
          return $this->render('forum', [
              'model' => $model,
              'forums' => Forum::find()->where(['category_id' => $category->id])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all(),
              'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
          ]);
      }
code: public function actionNewForum($cid = null)
      {
          $category = Category::find()->where(['id' => $cid])->limit(1)->one();
          if (empty($category)) {
              $this->error(Yii::t('podium/flash', 'Sorry! We can not find Category with this ID.'));
              return $this->redirect(['admin/categories']);
          }
          $model = new Forum();
          $model->category_id = $category->id;
          $model->visible = 1;
          $model->sort = 0;
          if ($model->load(Yii::$app->request->post()) && $model->save()) {
              Log::info('Forum added', $model->id, __METHOD__);
              $this->success(Yii::t('podium/flash', 'New forum has been created.'));
              return $this->redirect(['admin/forums', 'cid' => $category->id]);
          }
          return $this->render('forum', [
              'model' => $model,
              'forums' => Forum::find()->where(['category_id' => $category->id])->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all(),
              'categories' => Category::find()->orderBy(['sort' => SORT_ASC, 'id' => SORT_ASC])->all()
          ]);
      }
code_tokens: public function actionNewForum ( $ cid = null ) { $ category = Category :: find ( ) -> where ( [ 'id' => $ cid ] ) -> limit ( 1 ) -> one ( ) ; if ( empty ( $ category ) ) { $ this -> error ( Yii :: t ( 'podium/flash' , 'Sorry! We can not find Category with this ID.' ) ) ; return $ this -> redirect ( [ 'admin/categories' ] ) ; } $ model = new Forum ( ) ; $ model -> category_id = $ category -> id ; $ model -> visible = 1 ; $ model -> sort = 0 ; if ( $ model -> load ( Yii :: $ app -> request -> post ( ) ) && $ model -> save ( ) ) { Log :: info ( 'Forum added' , $ model -> id , __METHOD__ ) ; $ this -> success ( Yii :: t ( 'podium/flash' , 'New forum has been created.' ) ) ; return $ this -> redirect ( [ 'admin/forums' , 'cid' => $ category -> id ] ) ; } return $ this -> render ( 'forum' , [ 'model' => $ model , 'forums' => Forum :: find ( ) -> where ( [ 'category_id' => $ category -> id ] ) -> orderBy ( [ 'sort' => SORT_ASC , 'id' => SORT_ASC ] ) -> all ( ) , 'categories' => Category :: find ( ) -> orderBy ( [ 'sort' => SORT_ASC , 'id' => SORT_ASC ] ) -> all ( ) ] ) ; }
docstring: Adding new forum.
  @param int $cid parent category ID
  @return string|Response
docstring_tokens: Adding new forum .