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\menus; |
12
|
|
|
|
13
|
|
|
use hipanel\widgets\BlockModalButton; |
14
|
|
|
use hipanel\widgets\SettingsModal; |
15
|
|
|
use hipanel\widgets\SimpleOperation; |
16
|
|
|
use Yii; |
17
|
|
|
|
18
|
|
|
class AccountDetailMenu extends \hipanel\menus\AbstractDetailMenu |
19
|
|
|
{ |
20
|
|
|
public $model; |
21
|
|
|
|
22
|
|
|
public $blockReasons = []; |
23
|
|
|
|
24
|
|
|
public function items() |
25
|
|
|
{ |
26
|
|
|
return [ |
27
|
|
|
[ |
28
|
|
|
'label' => SettingsModal::widget([ |
29
|
|
|
'model' => $this->model, |
30
|
|
|
'title' => Yii::t('hipanel', 'Change password'), |
31
|
|
|
'headerOptions' => ['class' => 'label-danger'], |
32
|
|
|
'icon' => 'fa-key fa-flip-horizontal fa-fw', |
33
|
|
|
'scenario' => 'change-password', |
34
|
|
|
]), |
35
|
|
|
'encode' => false, |
36
|
|
|
'visible' => true, |
37
|
|
|
], |
38
|
|
|
[ |
39
|
|
|
'label' => SettingsModal::widget([ |
40
|
|
|
'model' => $this->model, |
41
|
|
|
'title' => Yii::t('hipanel:hosting:account', 'IP address restrictions'), |
42
|
|
|
'headerOptions' => ['class' => 'label-warning'], |
43
|
|
|
'icon' => 'fa-arrows-alt fa-fw', |
44
|
|
|
'scenario' => 'set-allowed-ips', |
45
|
|
|
]), |
46
|
|
|
'encode' => false, |
47
|
|
|
'visible' => true, |
48
|
|
|
], |
49
|
|
|
[ |
50
|
|
|
'label' => SettingsModal::widget([ |
51
|
|
|
'model' => $this->model, |
52
|
|
|
'title' => Yii::t('hipanel:hosting', 'Mail settings'), |
53
|
|
|
'headerOptions' => ['class' => 'label-info'], |
54
|
|
|
'icon' => 'fa-envelope fa-fw', |
55
|
|
|
'scenario' => 'set-mail-settings', |
56
|
|
|
]), |
57
|
|
|
'encode' => false, |
58
|
|
|
'visible' => $this->model->canSetMailSettings(), |
59
|
|
|
'disabled' => $this->model->isOperable(), |
60
|
|
|
], |
61
|
|
|
[ |
62
|
|
|
'label' => SettingsModal::widget([ |
63
|
|
|
'model' => $this->model, |
64
|
|
|
'title' => Yii::t('hipanel:hosting:account', 'System settings'), |
65
|
|
|
'headerOptions' => ['class' => 'label-info'], |
66
|
|
|
'icon' => 'fa fa-fw fa-cog', |
67
|
|
|
'scenario' => 'set-system-settings', |
68
|
|
|
]), |
69
|
|
|
'encode' => false, |
70
|
|
|
], |
71
|
|
|
[ |
72
|
|
|
'label' => SettingsModal::widget([ |
73
|
|
|
'model' => $this->model, |
74
|
|
|
'title' => Yii::t('hipanel:hosting:account', 'Global vhost options'), |
75
|
|
|
'headerOptions' => ['class' => 'label-info'], |
76
|
|
|
'icon' => 'fa fa-fw fa-bars', |
77
|
|
|
'scenario' => 'set-ghost-options', |
78
|
|
|
]), |
79
|
|
|
'encode' => false, |
80
|
|
|
], |
81
|
|
|
[ |
82
|
|
|
'label' => BlockModalButton::widget(['model' => $this->model]), |
83
|
|
|
'encode' => false, |
84
|
|
|
'visible' => Yii::$app->user->can('support') && Yii::$app->user->id !== $this->model->client_id, |
85
|
|
|
], |
86
|
|
|
'delete' => [ |
87
|
|
|
'label' => SimpleOperation::widget([ |
88
|
|
|
'model' => $this->model, |
89
|
|
|
'scenario' => 'delete', |
90
|
|
|
'buttonLabel' => '<i class="fa fa-fw fa-trash-o"></i>' . Yii::t('hipanel', 'Delete'), |
91
|
|
|
'buttonClass' => '', |
92
|
|
|
'body' => Yii::t('hipanel:hosting:account', 'Are you sure you want to delete account {name}?', ['name' => $this->model->login]), |
93
|
|
|
'modalHeaderLabel' => Yii::t('hipanel:hosting:account', 'Confirm account deleting'), |
94
|
|
|
'modalHeaderOptions' => ['class' => 'label-danger'], |
95
|
|
|
'modalFooterLabel' => Yii::t('hipanel:hosting:account', 'Delete account'), |
96
|
|
|
'modalFooterLoading' => Yii::t('hipanel:hosting:account', 'Deleting account'), |
97
|
|
|
'modalFooterClass' => 'btn btn-danger', |
98
|
|
|
]), |
99
|
|
|
'encode' => false, |
100
|
|
|
'visible' => true, |
101
|
|
|
], |
102
|
|
|
]; |
103
|
|
|
} |
104
|
|
|
|
105
|
|
|
public function getViewPath() |
106
|
|
|
{ |
107
|
|
|
return '@vendor/hiqdev/hipanel-module-hosting/src/views/account'; |
108
|
|
|
} |
109
|
|
|
} |
110
|
|
|
|