Completed
Push — master ( 26123a...ef3c8f )
by Klochok
11:26
created

IndexExport::getItems()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 15
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 0
1
<?php
2
3
namespace hipanel\widgets;
4
5
use Yii;
6
use yii\base\Widget;
7
use yii\bootstrap\ButtonDropdown;
8
9
class IndexExport extends Widget
10
{
11
    public $representationCollection;
12
13
    public function run()
14
    {
15
        return ButtonDropdown::widget([
16
            'label' => '<i class="fa fa-share-square-o"></i>&nbsp;' . Yii::t('hipanel', 'Export'),
17
            'encodeLabel' => false,
18
            'options' => ['class' => 'btn-default btn-sm'],
19
            'dropdown' => [
20
                'items' => $this->getItems(),
21
            ],
22
        ]);
23
    }
24
25
    protected function getItems()
26
    {
27
        return [
28
            [
29
                'url' => ['export', 'format' => 'csv'],
30
                'label' => '<i class="fa fa-file-code-o"></i>' . Yii::t('hipanel', 'CSV'),
31
                'encode' => false,
32
            ],
33
            [
34
                'url' => ['export', 'format' => 'tsv'],
35
                'label' => '<i class="fa fa-file-code-o"></i>' . Yii::t('hipanel', 'TSV'),
36
                'encode' => false,
37
            ],
38
        ];
39
    }
40
}
41