1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* Server module for HiPanel |
4
|
|
|
* |
5
|
|
|
* @link https://github.com/hiqdev/hipanel-module-server |
6
|
|
|
* @package hipanel-module-server |
7
|
|
|
* @license BSD-3-Clause |
8
|
|
|
* @copyright Copyright (c) 2015-2019, HiQDev (http://hiqdev.com/) |
9
|
|
|
*/ |
10
|
|
|
|
11
|
|
|
namespace hipanel\modules\server\menus; |
12
|
|
|
|
13
|
|
|
use hipanel\widgets\BlockModalButton; |
14
|
|
|
use hipanel\widgets\SimpleOperation; |
15
|
|
|
use Yii; |
16
|
|
|
|
17
|
|
|
class ServerDetailMenu extends \hipanel\menus\AbstractDetailMenu |
18
|
|
|
{ |
19
|
|
|
public $model; |
20
|
|
|
|
21
|
|
|
public $blockReasons; |
22
|
|
|
|
23
|
|
|
public function items() |
24
|
|
|
{ |
25
|
|
|
$actions = ServerActionsMenu::create([ |
26
|
|
|
'model' => $this->model, |
27
|
|
|
])->items(); |
28
|
|
|
|
29
|
|
|
$user = Yii::$app->user; |
30
|
|
|
|
31
|
|
|
$items = array_merge($actions, [ |
32
|
|
|
[ |
33
|
|
|
'label' => Yii::t('hipanel:server', 'Resources'), |
34
|
|
|
'icon' => 'fa-area-chart', |
35
|
|
|
'url' => ['resources', 'id' => $this->model->id], |
36
|
|
|
'visible' => Yii::$app->user->can('support'), |
|
|
|
|
37
|
|
|
'linkOptions' => [ |
38
|
|
|
'data-pjax' => 0, |
39
|
|
|
], |
40
|
|
|
], |
41
|
|
|
[ |
42
|
|
|
'label' => SimpleOperation::widget([ |
43
|
|
|
'model' => $this->model, |
44
|
|
|
'scenario' => 'reset-password', |
45
|
|
|
'buttonLabel' => '<i class="fa fa-refresh"></i>' . Yii::t('hipanel:server', 'Reset root password'), |
46
|
|
|
'buttonClass' => '', |
47
|
|
|
'body' => Yii::t('hipanel:server', 'Are you sure you want to reset the root password on {name} server? You will get your new root password on the e-mail.'), |
48
|
|
|
'modalHeaderLabel' => Yii::t('hipanel:server', 'Confirm root password resetting'), |
49
|
|
|
'modalHeaderOptions' => ['class' => 'label-danger'], |
50
|
|
|
'modalFooterLabel' => Yii::t('hipanel:server', 'Reset root password'), |
51
|
|
|
'modalFooterLoading' => Yii::t('hipanel:server', 'Resetting...'), |
52
|
|
|
'modalFooterClass' => 'btn btn-danger', |
53
|
|
|
]), |
54
|
|
|
'visible' => $this->model->isPwChangeSupported() && $user->can('server.control-system'), |
|
|
|
|
55
|
|
|
'encode' => false, |
56
|
|
|
], |
57
|
|
|
[ |
58
|
|
|
'label' => BlockModalButton::widget(['model' => $this->model]), |
59
|
|
|
'visible' => ($user->can('server.enable-block') || ($user->can('server.disable-block'))) && $user->not($this->model->client_id), |
60
|
|
|
'encode' => false, |
61
|
|
|
], |
62
|
|
|
[ |
63
|
|
|
'label' => SimpleOperation::widget([ |
64
|
|
|
'model' => $this->model, |
65
|
|
|
'scenario' => 'delete', |
66
|
|
|
'buttonLabel' => '<i class="fa fa-fw fa-trash-o"></i>' . Yii::t('hipanel', 'Delete'), |
67
|
|
|
'buttonClass' => '', |
68
|
|
|
'body' => Yii::t('hipanel:server', 'Are you sure you want to delete server {name}? You will loose everything!', ['name' => $this->model->name]), |
69
|
|
|
'modalHeaderLabel' => Yii::t('hipanel:server', 'Confirm server deleting'), |
70
|
|
|
'modalHeaderOptions' => ['class' => 'label-danger'], |
71
|
|
|
'modalFooterLabel' => Yii::t('hipanel:server', 'Delete server'), |
72
|
|
|
'modalFooterLoading' => Yii::t('hipanel:server', 'Deleting server'), |
73
|
|
|
'modalFooterClass' => 'btn btn-danger', |
74
|
|
|
]), |
75
|
|
|
'encode' => false, |
76
|
|
|
'visible' => Yii::$app->user->can('server.delete'), |
77
|
|
|
], |
78
|
|
|
]); |
79
|
|
|
unset($items['view']); |
80
|
|
|
|
81
|
|
|
return $items; |
82
|
|
|
} |
83
|
|
|
|
84
|
|
|
public function getViewPath() |
85
|
|
|
{ |
86
|
|
|
return '@vendor/hiqdev/hipanel-module-server/src/views/server'; |
87
|
|
|
} |
88
|
|
|
} |
89
|
|
|
|
This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.
This is most likely a typographical error or the method has been renamed.