80a6eda8
alex
примерный макет е...
|
1
2
3
4
5
|
<?php
namespace backend\controllers;
|
80a6eda8
alex
примерный макет е...
|
6
|
use yii\web\Controller;
|
80a6eda8
alex
примерный макет е...
|
7
|
use yii\filters\VerbFilter;
|
80a6eda8
alex
примерный макет е...
|
8
9
|
use common\models\dummy\DateModel;
use Yii;
|
8c54b055
alex
Добавлен експорт ...
|
10
11
12
13
14
15
|
use common\models\Customer;
use PhpOffice\PhpSpreadsheet\Spreadsheet;
use PhpOffice\PhpSpreadsheet\Writer\Xlsx;
use console\controllers\PdfController;
|
80a6eda8
alex
примерный макет е...
|
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
class ExportController extends Controller{
public function behaviors()
{
return [
'verbs' => [
'class' => VerbFilter::className(),
'actions' => [
'view' => [ 'POST' ],
],
],
];
}
public function actionIndex(){
// $model=new DynamicModel(['timeFrom','timeTo']);
// $model->addRule(['timeFrom','timeTo'],'string');
$model=new DateModel();
return $this->render('index',[
'model' => $model
]);
}
public function actionView(){
|
8c54b055
alex
Добавлен експорт ...
|
53
|
|
80a6eda8
alex
примерный макет е...
|
54
55
|
$model=new DateModel();
$model->load(Yii::$app->request->post());
|
8c54b055
alex
Добавлен експорт ...
|
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
$controller=new PdfController('pdf',Yii::$app);
$a=$controller->runAction('view',[
$model
]);
$exportInfo = json_decode($a);
if($exportInfo->status==false){
# выдать что данных нету
return $this->render('index',[
'status' => false,
'model' => $model,
'reason' => $exportInfo->reason,
]);
}
else{
return Yii::$app->response->sendFile("../../frontend/web/files/xls/".$exportInfo->file);
}
|
80a6eda8
alex
примерный макет е...
|
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
|
}
}
|