/** * Список книг. * * @return string */ public function actionIndex() { $modelBook = new Book(); $dataProvider = $modelBook->search(Yii::$app->request->get()); $authorIds = Yii::$app->request->get('authors', []); $tagIds = Yii::$app->request->get('tags', []); Book::applyFilterForRelatedData($dataProvider->query, $tagIds, $authorIds); return $this->render('index', ['modelBook' => $modelBook, 'dataProvider' => $dataProvider, 'authorIds' => $authorIds, 'tagIds' => $tagIds]); }
public function actionIndex() { $filterModel = new Book(); if (Yii::$app->request->get('Book')) { $filterModel->load(Yii::$app->request->get()); } $getArray = Yii::$app->request->get(); $getArray['Book'] = $filterModel->getArrayForLink(); $this->_registerJs(); return $this->render('index', ['dataProvider' => $filterModel->search(), 'filterModel' => $filterModel, 'authors' => Author::find()->all(), 'getArray' => $getArray]); }
private function renderList() { $model = new Book(); $searchParams = Yii::$app->request->get('Book'); if ($searchParams) { $model->setAttributes($searchParams, false); $model->dateFrom = $searchParams['dateFrom']; $model->dateTo = $searchParams['dateTo']; } $provider = $model->search(); return $this->render('index', ['provider' => $provider, 'model' => $model]); }
/** * Главная страница админки. * * @return string */ public function actionIndex() { $modelBook = new Book(); $dataProvider = $modelBook->search(Yii::$app->request->get()); return $this->render('/back/book/index', ['modelBook' => $modelBook, 'dataProvider' => $dataProvider]); }