public function actionIndex($status = null, $object = null)
 {
     $searchModel = new CommentsSearch();
     if ($status != null) {
         $searchModel->status = $status;
     }
     if ($object != null) {
         $searchModel->object = $object;
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
Пример #2
0
 /**
  * @inheritdoc
  */
 public function run()
 {
     $model = self::baseComment();
     //$model->showPublic = $this->showPublic;
     //$models = $model->getComments();
     $this->registerClientScript();
     $searchModel = new CommentsSearch();
     $searchModel->object = $this->object;
     $searchModel->object_id = $this->object_id;
     if ($this->orderBy != null) {
         $searchModel->orderBy = $this->orderBy;
     }
     if ($this->showPublic) {
         $searchModel->status = Comments::STATUS_PUBLIC;
     }
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $this->paginationParams);
     // Рендерим представление
     echo $this->render('index', ['id' => $this->getId(), 'model' => $model, 'dataProvider' => $dataProvider, 'title' => $this->title, 'level' => 0, 'maxLevel' => self::MAX_LEVEL, 'sendButtonText' => $this->sendButtonText, 'cancelButtonText' => $this->cancelButtonText, 'createButtonTxt' => $this->createButtonTxt]);
 }