1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace hipanel\modules\hosting\menus; |
4
|
|
|
|
5
|
|
|
use hipanel\widgets\ModalButton; |
6
|
|
|
use hiqdev\menumanager\Menu; |
7
|
|
|
use Yii; |
8
|
|
|
use yii\helpers\Html; |
9
|
|
|
use yii\helpers\StringHelper; |
10
|
|
|
|
11
|
|
|
class HdomainDetailMenu extends Menu |
12
|
|
|
{ |
13
|
|
|
public $model; |
14
|
|
|
|
15
|
|
|
public $blockReasons = []; |
16
|
|
|
|
17
|
|
|
public function items() |
18
|
|
|
{ |
19
|
|
|
$url = 'http://' . $this->model->domain . '/'; |
20
|
|
|
|
21
|
|
|
return [ |
22
|
|
|
[ |
23
|
|
|
'label' => Yii::t('hipanel:hosting', 'Go to site {link}', ['link' => StringHelper::truncate($url, 15)]), |
24
|
|
|
'icon' => 'fa-paper-plane', |
25
|
|
|
'url' => $url, |
26
|
|
|
'encode' => false, |
27
|
|
|
'linkOptions' => [ |
28
|
|
|
'target' => '_blank', |
29
|
|
|
], |
30
|
|
|
], |
31
|
|
|
[ |
32
|
|
|
'label' => Yii::t('hipanel:hosting', 'Advanced settings'), |
33
|
|
|
'icon' => 'fa-pencil', |
34
|
|
|
'url' => ['/hosting/vhost/advanced-config', 'id' => $this->model->id], |
35
|
|
|
'visible' => !$this->model->isAlias(), |
36
|
|
|
], |
37
|
|
|
[ |
38
|
|
|
'label' => Yii::t('hipanel:hosting', 'Proxy settings'), |
39
|
|
|
'icon' => 'fa-adjust', |
40
|
|
|
'url' => ['/hosting/vhost/manage-proxy', 'id' => $this->model->id], |
41
|
|
|
'visible' => !$this->model->isAlias(), |
42
|
|
|
], |
43
|
|
|
[ |
44
|
|
|
'label' => $this->renderView('_block', ['model' => $this->model, 'blockReasons' => $this->blockReasons]), |
45
|
|
|
'encode' => false, |
46
|
|
|
'visible' => Yii::$app->user->can('support') && Yii::$app->user->id !== $this->model->client_id && !$this->model->isAlias(), |
47
|
|
|
], |
48
|
|
|
[ |
49
|
|
|
'label' => ModalButton::widget([ |
50
|
|
|
'model' => $this->model, |
51
|
|
|
'scenario' => 'delete', |
52
|
|
|
'button' => [ |
53
|
|
|
'label' => '<i class="fa fa-fw fa-trash-o"></i> ' . Yii::t('hipanel', 'Delete'), |
54
|
|
|
], |
55
|
|
|
'modal' => [ |
56
|
|
|
'header' => Html::tag('h4', Yii::t('hipanel:hosting', 'Confirm domain deleting')), |
57
|
|
|
'headerOptions' => ['class' => 'label-danger'], |
58
|
|
|
'footer' => [ |
59
|
|
|
'label' => Yii::t('hipanel:hosting', 'Delete domain'), |
60
|
|
|
'data-loading-text' => Yii::t('hipanel', 'Deleting...'), |
61
|
|
|
'class' => 'btn btn-danger', |
62
|
|
|
] |
63
|
|
|
], |
64
|
|
|
'body' => Yii::t('hipanel:hosting', |
65
|
|
|
'Are you sure to delete domain {name}? All files under domain root on the server will stay untouched. You can delete them manually later.', |
66
|
|
|
['name' => $this->model->domain] |
67
|
|
|
) |
68
|
|
|
]), |
69
|
|
|
'encode' => false, |
70
|
|
|
], |
71
|
|
|
]; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
public function getViewPath() |
75
|
|
|
{ |
76
|
|
|
return '@vendor/hiqdev/hipanel-module-hosting/src/views/hdomain'; |
77
|
|
|
} |
78
|
|
|
} |
79
|
|
|
|