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-2016, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\hosting\grid; |
12
|
|
|
|
13
|
|
|
use hipanel\grid\ActionColumn; |
14
|
|
|
use hipanel\grid\MainColumn; |
15
|
|
|
use hipanel\grid\RefColumn; |
16
|
|
|
use hipanel\modules\hosting\widgets\account\State; |
17
|
|
|
use hipanel\modules\hosting\widgets\account\Type; |
18
|
|
|
use hipanel\modules\server\grid\ServerColumn; |
19
|
|
|
use hipanel\widgets\ArraySpoiler; |
20
|
|
|
use Yii; |
21
|
|
|
|
22
|
|
|
class AccountGridView extends \hipanel\grid\BoxedGridView |
23
|
|
|
{ |
24
|
|
|
public function columns() |
25
|
|
|
{ |
26
|
|
|
return array_merge(parent::columns(), [ |
27
|
|
|
'account' => [ |
28
|
|
|
'class' => MainColumn::class, |
29
|
|
|
'label' => Yii::t('hipanel', 'Account'), |
30
|
|
|
'attribute' => 'login', |
31
|
|
|
'filterAttribute' => 'login_like', |
32
|
|
|
], |
33
|
|
|
'state' => [ |
34
|
|
|
'class' => RefColumn::class, |
35
|
|
|
'format' => 'raw', |
36
|
|
|
'i18nDictionary' => 'hipanel:hosting', |
37
|
|
|
'value' => function ($model) { |
38
|
|
|
return State::widget(compact('model')); |
39
|
|
|
}, |
40
|
|
|
'gtype' => 'state,account', |
41
|
|
|
], |
42
|
|
|
'server' => [ |
43
|
|
|
'class' => ServerColumn::class, |
44
|
|
|
], |
45
|
|
|
'sshftp_ips' => [ |
46
|
|
|
'attribute' => 'sshftp_ips', |
47
|
|
|
'format' => 'raw', |
48
|
|
|
'value' => function ($model) { |
49
|
|
|
return ArraySpoiler::widget([ |
50
|
|
|
'data' => $model->sshftp_ips, |
51
|
|
|
'visibleCount' => 3, |
52
|
|
|
]); |
53
|
|
|
}, |
54
|
|
|
], |
55
|
|
|
'actions' => [ |
56
|
|
|
'class' => ActionColumn::class, |
57
|
|
|
'template' => '{view} {delete}', |
58
|
|
|
], |
59
|
|
|
'type' => [ |
60
|
|
|
'class' => RefColumn::class, |
61
|
|
|
'i18nDictionary' => 'hipanel:hosting', |
62
|
|
|
'format' => 'raw', |
63
|
|
|
'value' => function ($model) { |
64
|
|
|
return Type::widget(compact('model')); |
65
|
|
|
}, |
66
|
|
|
'gtype' => 'type,account', |
67
|
|
|
], |
68
|
|
|
]); |
69
|
|
|
} |
70
|
|
|
} |
71
|
|
|
|