Completed
Push — master ( 58aba0...79ae68 )
by Dmitry
28:02 queued 13:03
created

ChangeGridView::defaultColumns()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 22
rs 9.2
cc 1
eloc 14
nc 1
nop 0
1
<?php
2
3
/*
4
 * Finance module for HiPanel
5
 *
6
 * @link      https://github.com/hiqdev/hipanel-module-finance
7
 * @package   hipanel-module-finance
8
 * @license   BSD-3-Clause
9
 * @copyright Copyright (c) 2015-2016, HiQDev (http://hiqdev.com/)
10
 */
11
12
namespace hipanel\modules\server\grid;
13
14
use hipanel\modules\server\helpers\ServerHelper;
15
use hipanel\modules\server\widgets\OSFormatter;
16
use Yii;
17
18
class ChangeGridView extends \hipanel\modules\finance\grid\ChangeGridView
19
{
20
    public static function defaultColumns()
21
    {
22
        return array_merge(parent::defaultColumns(), [
23
            'user_comment' => [
24
                'value' => function ($model) {
25
                    return $model->user_comment . ': ' . $model->params['purpose'];
26
                }
27
            ],
28
            'tech_details' => [
29
                'format' => 'raw',
30
                'label' => Yii::t('hipanel/finance/change', 'Operation details'),
31
                'value' => function ($model) {
32
                    $params = $model->params;
33
                    return OSFormatter::widget([
34
                        'osimages' => ServerHelper::getOsimages($params['tariff_type']),
35
                        'imageName' => $params['osimage'],
36
                        'infoCircle' => false,
37
                    ]);
38
                }
39
            ],
40
        ]);
41
    }
42
}
43