Exemple #1
0
 /**
  * Export data without division to section
  * @return mixed
  */
 public function actionExportall()
 {
     $searchModel = new DocladSearch();
     $searchModel->conferenceid = Yii::$app->db->createCommand('Select s.sec_cnf_id' . ' From ' . Usersection::tableName() . ' us, ' . Section::tableName() . ' s' . ' Where s.sec_id = us.usec_section_id And us.usec_section_primary = 1 And us.usec_user_id = :uid', [':uid' => Yii::$app->user->getId()])->queryColumn();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     //        echo nl2br(print_r($searchModel->conferenceid, true));
     //        return;
     $sDir = Yii::getAlias('@webroot/assets');
     $sFileName = $sDir . DIRECTORY_SEPARATOR . 'doclad-all-' . date('Y-m-d-H-i-s') . '.xls';
     $this->clearDestinationDir($sDir, 'xls', time() - 300);
     $this->exportToFile($dataProvider, $sFileName);
     Yii::$app->response->sendFile($sFileName);
     //        return $this->renderContent(
     //            Html::a(
     //                'Загрузить',
     //                substr($sFileName, str_replace(DIRECTORY_SEPARATOR, '/', strlen($_SERVER['DOCUMENT_ROOT'])))
     //            )
     //        );
 }
Exemple #2
0
 /**
  * Lists all Doclad models.
  * @return mixed
  */
 public function actionIndex()
 {
     $searchModel = new DocladSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }
 /**
  * @return string
  */
 public function actionList()
 {
     $aDop = ['doc_us_id' => Yii::$app->user->getId()];
     $searchModel = new DocladSearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams, $aDop);
     return $this->render('//doclad/userdoclist', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider]);
 }