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