DbDetailMenu   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 64
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 4

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 4
dl 0
loc 64
ccs 0
cts 58
cp 0
rs 10
c 0
b 0
f 0

2 Methods

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