-
Notifications
You must be signed in to change notification settings - Fork 9
/
ExportFile.php
54 lines (45 loc) · 1.16 KB
/
ExportFile.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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
53
54
<?php
/**
* Created by PhpStorm.
* User: phpNT - http://phpnt.com
* Date: 05.07.2016
* Time: 21:24
*/
namespace phpnt\exportFile;
use yii\base\Widget;
use yii\helpers\Json;
class ExportFile extends Widget
{
public $model;
public $queryParams = [];
public $getAll = false;
public $title = false;
public $csvCharset = 'UTF-8';
public $buttonClass = 'btn btn-primary';
public $blockClass = 'pull-left';
public $blockStyle = 'padding: 5px;';
public $xls = true;
public $xlsButtonName = 'MS Excel';
public $csv = true;
public $csvButtonName = 'CSV';
public $word = true;
public $wordButtonName = 'MS Word';
public $html = true;
public $htmlButtonName = 'HTML';
public $pdf = true;
public $pdfButtonName = 'PDF';
public function init()
{
$this->queryParams = Json::encode($this->queryParams);
parent::init();
}
public function run()
{
return $this->render(
'view',
[
'widget' => $this
]
);
}
}