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

IndexExport   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 32
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 3
dl 0
loc 32
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A run() 0 11 1
A getItems() 0 15 1
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