|
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\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' => BlockModalButton::widget(['model' => $this->model]), |
|
63
|
|
|
'encode' => false, |
|
64
|
|
|
'visible' => Yii::$app->user->can('support') && Yii::$app->user->id !== $this->model->client_id, |
|
65
|
|
|
], |
|
66
|
|
|
'delete' => [ |
|
67
|
|
|
'label' => SimpleOperation::widget([ |
|
68
|
|
|
'model' => $this->model, |
|
69
|
|
|
'scenario' => 'delete', |
|
70
|
|
|
'skipCheckOperable' => true, |
|
71
|
|
|
'buttonLabel' => '<i class="fa fa-fw fa-trash-o"></i>' . Yii::t('hipanel', 'Delete'), |
|
72
|
|
|
'buttonClass' => '', |
|
73
|
|
|
'body' => Yii::t('hipanel:hosting:account', 'Are you sure you want to delete account {name}?', ['name' => $this->model->login]), |
|
74
|
|
|
'modalHeaderLabel' => Yii::t('hipanel:hosting:account', 'Confirm account deleting'), |
|
75
|
|
|
'modalHeaderOptions' => ['class' => 'label-danger'], |
|
76
|
|
|
'modalFooterLabel' => Yii::t('hipanel:hosting:account', 'Delete account'), |
|
77
|
|
|
'modalFooterLoading' => Yii::t('hipanel:hosting:account', 'Deleting account'), |
|
78
|
|
|
'modalFooterClass' => 'btn btn-danger', |
|
79
|
|
|
]), |
|
80
|
|
|
'encode' => false, |
|
81
|
|
|
'visible' => true, |
|
82
|
|
|
], |
|
83
|
|
|
]; |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
public function getViewPath() |
|
87
|
|
|
{ |
|
88
|
|
|
return '@vendor/hiqdev/hipanel-module-hosting/src/views/account'; |
|
89
|
|
|
} |
|
90
|
|
|
} |
|
91
|
|
|
|