Completed
Push — master ( 1142dc...bcea81 )
by Klochok
04:41
created

MailDetailMenu   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 48
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 48
ccs 0
cts 42
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
B items() 0 38 1
A getViewPath() 0 4 1
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 MailDetailMenu extends Menu
11
{
12
    public $model;
13
14
    public function items()
15
    {
16
        return [
17
            [
18
                'label' => Yii::t('hipanel', 'Update'),
19
                'icon' => 'fa-pencil',
20
                'url' => ['update', 'id' => $this->model->id],
21
            ],
22
            [
23
                'label' => $this->renderView('_change-password', ['model' => $this->model]),
24
                'encode' => false,
25
                'visible' => $this->model->canChangePassword(),
26
            ],
27
            [
28
                'label' => ModalButton::widget([
29
                    'model' => $this->model,
30
                    'scenario' => 'delete',
31
                    'button' => [
32
                        'label' => '<i class="fa fa-fw fa-trash-o"></i> ' . Yii::t('hipanel', 'Delete'),
33
                    ],
34
                    'modal' => [
35
                        'header' => Html::tag('h4', Yii::t('hipanel:hosting', 'Confirm mailbox deleting')),
36
                        'headerOptions' => ['class' => 'label-danger'],
37
                        'footer' => [
38
                            'label' => Yii::t('hipanel:hosting', 'Delete mailbox'),
39
                            'data-loading-text' => Yii::t('hipanel', 'Deleting...'),
40
                            'class' => 'btn btn-danger',
41
                        ]
42
                    ],
43
                    'body' => Yii::t('hipanel:hosting',
44
                        'Are you sure to delete mail {name}?',
45
                        ['name' => Html::tag('b', $this->model->mail)]
46
                    )
47
                ]),
48
                'encode' => false,
49
            ],
50
        ];
51
    }
52
53
    public function getViewPath()
54
    {
55
        return '@vendor/hiqdev/hipanel-module-hosting/src/views/mail';
56
    }
57
}
58