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 hipanel\modules\hosting\menus\CrontabActionsMenu; |
14
|
|
|
use hipanel\modules\server\grid\ServerColumn; |
15
|
|
|
use hiqdev\yii2\menus\grid\MenuColumn; |
16
|
|
|
use Yii; |
17
|
|
|
use yii\helpers\Html; |
18
|
|
|
|
19
|
|
|
class CrontabGridView extends \hipanel\grid\BoxedGridView |
20
|
|
|
{ |
21
|
|
|
public function columns() |
22
|
|
|
{ |
23
|
|
|
return array_merge(parent::columns(), [ |
24
|
|
|
'crontab' => [ |
25
|
|
|
'attribute' => 'crontab', |
26
|
|
|
'format' => 'html', |
27
|
|
|
'enableSorting' => false, |
28
|
|
|
'value' => function ($model, $key, $index) { |
|
|
|
|
29
|
|
|
$label = Yii::t('hipanel:hosting', '{0, plural, one{# record} other{# records}}', $model->cronRecordCount); |
30
|
|
|
|
31
|
|
|
return Html::a($label, ['view', 'id' => $key], ['class' => 'bold', 'data-pjax' => 0]); |
32
|
|
|
}, |
33
|
|
|
], |
34
|
|
|
'server' => [ |
35
|
|
|
'sortAttribute' => 'server', |
36
|
|
|
'attribute' => 'server_id', |
37
|
|
|
'class' => ServerColumn::class, |
38
|
|
|
], |
39
|
|
|
'account' => [ |
40
|
|
|
'sortAttribute' => 'account', |
41
|
|
|
'attribute' => 'account_id', |
42
|
|
|
'class' => AccountColumn::class, |
43
|
|
|
], |
44
|
|
|
'client', |
45
|
|
|
'state' => [ |
46
|
|
|
'enableSorting' => false, |
47
|
|
|
'attribute' => 'state', |
48
|
|
|
'value' => function ($model) { |
49
|
|
|
return Yii::t('hipanel:hosting:cron:states', $model->state); |
50
|
|
|
}, |
51
|
|
|
], |
52
|
|
|
'actions' => [ |
53
|
|
|
'class' => MenuColumn::class, |
54
|
|
|
'menuClass' => CrontabActionsMenu::class, |
55
|
|
|
], |
56
|
|
|
]); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
This check looks from parameters that have been defined for a function or method, but which are not used in the method body.