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
|
|
|
|
10
|
|
|
class DbDetailMenu extends Menu |
11
|
|
|
{ |
12
|
|
|
public $model; |
13
|
|
|
|
14
|
|
|
public function items() |
15
|
|
|
{ |
16
|
|
|
return [ |
17
|
|
|
[ |
18
|
|
|
'label' => $this->renderView('_change-password', ['model' => $this->model]), |
19
|
|
|
'encode' => false, |
20
|
|
|
], |
21
|
|
|
[ |
22
|
|
|
'label' => ModalButton::widget([ |
23
|
|
|
'model' => $this->model, |
24
|
|
|
'scenario' => 'truncate', |
25
|
|
|
'button' => [ |
26
|
|
|
'label' => '<i class="fa fa-fw fa-file-o"></i>' . Yii::t('hipanel:hosting', 'Truncate'), |
27
|
|
|
], |
28
|
|
|
'modal' => [ |
29
|
|
|
'header' => Html::tag('h4', Yii::t('hipanel:hosting', 'Confirm database truncating')), |
30
|
|
|
'headerOptions' => ['class' => 'label-danger'], |
31
|
|
|
'footer' => [ |
32
|
|
|
'label' => Yii::t('hipanel:hosting', 'Truncate database'), |
33
|
|
|
'data-loading-text' => Yii::t('hipanel', 'Performing...'), |
34
|
|
|
'class' => 'btn btn-danger', |
35
|
|
|
] |
36
|
|
|
], |
37
|
|
|
'body' => Yii::t('hipanel:hosting', |
38
|
|
|
'Are you sure that to truncate database {name}? All tables will be dropped, all data will be lost!', |
39
|
|
|
['name' => Html::tag('b', $this->model->name)] |
40
|
|
|
) |
41
|
|
|
]), |
42
|
|
|
'encode' => false, |
43
|
|
|
], |
44
|
|
|
[ |
45
|
|
|
'label' => ModalButton::widget([ |
46
|
|
|
'model' => $this->model, |
47
|
|
|
'scenario' => 'delete', |
48
|
|
|
'button' => [ |
49
|
|
|
'label' => '<i class="fa fa-fw fa-trash-o"></i>' . Yii::t('hipanel', 'Delete'), |
50
|
|
|
], |
51
|
|
|
'modal' => [ |
52
|
|
|
'header' => Html::tag('h4', Yii::t('hipanel:hosting', 'Confirm database deleting')), |
53
|
|
|
'headerOptions' => ['class' => 'label-danger'], |
54
|
|
|
'footer' => [ |
55
|
|
|
'label' => Yii::t('hipanel:hosting', 'Delete database'), |
56
|
|
|
'data-loading-text' => Yii::t('hipanel', 'Deleting...'), |
57
|
|
|
'class' => 'btn btn-danger', |
58
|
|
|
] |
59
|
|
|
], |
60
|
|
|
'body' => Yii::t('hipanel:hosting', 'Are you sure to delete database {name}? All tables will be dropped, all data will be lost!', |
61
|
|
|
['name' => Html::tag('b', $this->model->name)] |
62
|
|
|
) |
63
|
|
|
]), |
64
|
|
|
'encode' => false, |
65
|
|
|
], |
66
|
|
|
]; |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
public function getViewPath() |
70
|
|
|
{ |
71
|
|
|
return '@vendor/hiqdev/hipanel-module-hosting/src/views/db'; |
72
|
|
|
} |
73
|
|
|
} |
74
|
|
|
|