Пример #1
0
 /**
  * Lists all Post models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new PostSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $modelComment = new PostComment();
     $countPending = $modelComment->getCount($modelComment::COMMENT_MODER_PENDING, $modelComment::TYPE_OF_COMMENT);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'countPending' => $countPending]);
 }
Пример #2
0
 /**
  * Finds the PostComment model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return PostComment the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = PostComment::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Пример #3
0
 /**
  * Колличество комментариев блога требующих проверки
  * @return int
  */
 public static function getCountCommentPending()
 {
     $modelComment = new PostComment();
     return $modelComment->getCount($modelComment::COMMENT_MODER_PENDING, $modelComment::TYPE_OF_COMMENT);
 }