Completed
Push — master ( 92156c...43c17e )
by Andrii
25:32 queued 10:20
created

UtilizationColumn::getDataCellValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.9
c 0
b 0
f 0
cc 1
nc 1
nop 3
1
<?php
2
/**
3
 * Hosting Plugin for HiPanel
4
 *
5
 * @link      https://github.com/hiqdev/hipanel-module-hosting
6
 * @package   hipanel-module-hosting
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hipanel\modules\hosting\grid;
12
13
use hiqdev\higrid\DataColumn;
14
use Yii;
15
use yii\bootstrap\Progress;
16
17
class UtilizationColumn extends DataColumn
18
{
19
    public $format = 'html';
20
21
    public function init()
22
    {
23
        parent::init();
24
        $this->label = Yii::t('hipanel.hosting.ipam', 'Utilization');
25
    }
26
27
    public function getDataCellValue($model, $key, $index)
28
    {
29
        $prc = mt_rand(1, 84);
30
31
        return Progress::widget([
32
            'percent' => $prc,
33
            'label' => $prc . '%',
34
            'barOptions' => ['class' => 'progress-bar-success'],
35
            'options' => ['style' => 'background-color: grey;'],
36
        ]);
37
    }
38
}
39