MailDetailMenu::getViewPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 0
cts 4
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 2
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 MailDetailMenu extends \hipanel\menus\AbstractDetailMenu
18
{
19
    public $model;
20
21
    public function items()
22
    {
23
        return [
24
            [
25
                'label' => Yii::t('hipanel', 'Update'),
26
                'icon' => 'fa-pencil',
27
                'url' => ['update', 'id' => $this->model->id],
28
                'visible' => $this->model->state !== 'deleted',
29
            ],
30
            [
31
                'label' => $this->render('_change-password', ['model' => $this->model]),
32
                'encode' => false,
33
                'visible' => $this->model->canChangePassword(),
34
            ],
35
            [
36
                'label' => ModalButton::widget([
37
                    'model' => $this->model,
38
                    'scenario' => 'delete',
39
                    'button' => [
40
                        'label' => '<i class="fa fa-fw fa-trash-o"></i> ' . Yii::t('hipanel', 'Delete'),
41
                    ],
42
                    'modal' => [
43
                        'header' => Html::tag('h4', Yii::t('hipanel:hosting', 'Confirm mailbox deleting')),
44
                        'headerOptions' => ['class' => 'label-danger'],
45
                        'footer' => [
46
                            'label' => Yii::t('hipanel:hosting', 'Delete mailbox'),
47
                            'data-loading-text' => Yii::t('hipanel', 'Deleting...'),
48
                            'class' => 'btn btn-danger',
49
                        ],
50
                    ],
51
                    'body' => Yii::t('hipanel:hosting',
52
                        'Are you sure to delete mail {name}?',
53
                        ['name' => Html::tag('b', $this->model->mail)]
54
                    ),
55
                ]),
56
                'encode' => false,
57
            ],
58
        ];
59
    }
60
61
    public function getViewPath()
62
    {
63
        return '@vendor/hiqdev/hipanel-module-hosting/src/views/mail';
64
    }
65
}
66