/** * Lists all LEADERSHIPROLES models. * @return mixed */ public function actionIndex() { $searchModel = new RoleSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]); }
public function actionExcel() { $searchModel = new RoleSearch(); $dataProvider = $searchModel->search(Yii::$app->request->queryParams); $modelAttribute = new Role(); $not = Util::excelNot(); foreach ($modelAttribute->attributeLabels() as $k => $v) { if (!in_array($k, $not)) { $attributes[$k] = $v; } } $models = $dataProvider->getModels(); $objReader = \PHPExcel_IOFactory::createReader('Excel5'); $objPHPExcel = $objReader->load(Yii::getAlias(Util::templateExcel())); $excelChar = Util::excelChar(); return $this->render('_excel', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'attributes' => $attributes, 'models' => $models, 'objReader' => $objReader, 'objPHPExcel' => $objPHPExcel, 'excelChar' => $excelChar]); }