Issues (1313)

views/admin/qualities/view.php (3 issues)

1
<?php
2
3
use yii\helpers\{Html, Url};
4
use yii\widgets\DetailView;
5
use Itstructure\FieldWidgets\TableMultilanguage;
6
use Itstructure\AdminModule\models\Language;
7
8
/* @var $this yii\web\View */
9
/* @var $model app\models\Quality|app\models\QualityLanguage */
10
11
$this->title = $model->getDefaultTranslate('title');
0 ignored issues
show
The method getDefaultTranslate() does not exist on app\models\QualityLanguage. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

11
$this->title = $model->/** @scrutinizer ignore-call */ getDefaultTranslate('title');
Loading history...
12
$this->params['breadcrumbs'][] = [
13
    'label' => Yii::t('qualities', 'Qualities'),
14
    'url' => [
15
        $this->params['urlPrefix'].'index'
16
    ]
17
];
18
$this->params['breadcrumbs'][] = $this->title;
19
?>
20
21
<style>
22
    h5 {
23
        font-weight: bold;
24
        padding: 5px;
25
    }
26
</style>
27
28
<div class="qualities-view">
29
30
    <p>
31
        <?php echo Html::a(Yii::t('app', 'Update'), [
32
            $this->params['urlPrefix'].'update',
33
            'id' => $model->id
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on app\models\QualityLanguage. Since you implemented __get, consider adding a @property annotation.
Loading history...
34
        ], [
35
            'class' => 'btn btn-primary'
36
        ]) ?>
37
38
        <?php echo Html::a(Yii::t('app', 'Delete'), [
39
            $this->params['urlPrefix'].'delete',
40
            'id' => $model->id
41
        ], [
42
            'class' => 'btn btn-danger',
43
            'data'=>[
44
                'method' => 'post',
45
                'confirm' => Yii::t('app', 'Are you sure you want to do this action?'),
46
            ]
47
        ]) ?>
48
    </p>
49
50
    <h3><?php echo Yii::t('app', 'Translate'); ?></h3>
51
    <?php echo TableMultilanguage::widget([
52
        'fields' => [
53
            [
54
                'name' => 'title',
55
                'label' => Yii::t('app', 'Title'),
56
            ],
57
            [
58
                'name' => 'description',
59
                'label' => Yii::t('app', 'Description'),
60
            ]
61
        ],
62
        'model'         => $model,
63
        'languageModel' => new Language(),
64
    ]) ?>
65
66
    <?php echo DetailView::widget([
67
        'model' => $model,
68
        'attributes' => [
69
            'id',
70
            [
71
                'label' => Yii::t('app', 'Icon'),
72
                'value' => function($model) {
73
                    /* @var $model app\models\Quality */
74
                    return Html::tag('i', '', ['class' => empty($model->icon) ? 'fa fa-file fa-2x' : $model->icon]);
75
                },
76
                'format' => 'raw',
77
            ],
78
            [
79
                'label' => Yii::t('qualities', 'Parent about records'),
80
                'value' => function ($model) {
81
                    /* @var $model app\models\Quality */
82
                    $aboutRecords = '';
83
                    foreach ($model->about as $aboutRecord) {
84
                        $aboutRecords .= Html::tag('li',
85
                            Html::a($aboutRecord->getDefaultTranslate('title'),
86
                                Url::to(['/'.$this->params['shortLanguage'].'/admin/about/view', 'id' => $aboutRecord->id]),
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $this seems to be never defined.
Loading history...
87
                                [
88
                                    'target' => '_blank'
89
                                ]
90
                            )
91
                        );
92
                    }
93
94
                    return empty($aboutRecords) ? '' : Html::tag('ul', $aboutRecords, [
95
                        'style' => 'margin-left: 10px; padding-left: 10px;'
96
                    ]);
97
                },
98
                'format' => 'raw',
99
            ],
100
            [
101
                'attribute' => 'created_at',
102
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
103
                'label' => Yii::t('app', 'Created date'),
104
            ],
105
            [
106
                'attribute' => 'updated_at',
107
                'format' =>  ['date', 'dd.MM.Y HH:mm:ss'],
108
                'label' => Yii::t('app', 'Updated date'),
109
            ],
110
        ],
111
    ]) ?>
112
113
</div>
114