/** * Lists all Person models. * @return mixed */ public function actionIndex() { $searchModel = new PersonSearch(); $queryParams = array_merge(array(), Yii::$app->request->queryParams); $queryParams['PersonSearch']['is_student'] = true; $dataProvider = $searchModel->search($queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
/** * Export data * @return mixed */ public function actionExport() { $searchModel = new PersonSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams, ['prs_type' => Person::PERSON_TYPE_GUEST, 'prs_active' => 1]); $sDir = Yii::getAlias('@webroot/assets'); $sFileName = $sDir . DIRECTORY_SEPARATOR . 'guest-' . date('Y-m-d-H-i-s') . '.xls'; $this->clearDestinationDir($sDir, 'xls', time() - 300); $this->exportToFile($dataProvider, $sFileName); Yii::$app->response->sendFile($sFileName); }
/** * Lists all Person models. * @return mixed */ public function actionIndex() { $searchModel = new PersonSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }