1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
use yii\helpers\Url; |
4
|
|
|
use yii\helpers\Html; |
5
|
|
|
use yii\widgets\DetailView; |
6
|
|
|
use yii\grid\GridView; |
7
|
|
|
|
8
|
|
|
/* @var $this yii\web\View */ |
9
|
|
|
/* @var $model app\models\Screen */ |
10
|
|
|
|
11
|
|
|
$this->title = $model->name; |
12
|
|
|
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Screens'), 'url' => ['index']]; |
13
|
|
|
$this->params['breadcrumbs'][] = $this->title; |
14
|
|
|
?> |
15
|
|
|
<div class="screen-view"> |
16
|
|
|
|
17
|
|
|
<h1><?= Html::encode($this->title) ?></h1> |
18
|
|
|
|
19
|
|
|
<p> |
20
|
|
|
<?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> |
21
|
|
|
<?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [ |
22
|
|
|
'class' => 'btn btn-danger', |
23
|
|
|
'data' => [ |
24
|
|
|
'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'), |
25
|
|
|
'method' => 'post', |
26
|
|
|
], |
27
|
|
|
]) ?> |
28
|
|
|
<?= Html::a(Yii::t('app', 'Preview'), ['/frontend/screen', 'id' => $model->id, 'preview' => true], ['class' => 'btn btn-success']) ?> |
29
|
|
|
<?= Html::a(Yii::t('app', 'Reload'), ['/frontend/force-reload', 'id' => $model->id], ['class' => 'btn btn-success']) ?> |
30
|
|
|
</p> |
31
|
|
|
|
32
|
|
|
<?= DetailView::widget([ |
33
|
|
|
'model' => $model, |
34
|
|
|
'attributes' => [ |
35
|
|
|
'name', |
36
|
|
|
'description', |
37
|
|
|
'duration', |
38
|
|
|
[ |
39
|
|
|
'label' => \Yii::t('app', 'Template'), |
40
|
|
|
'value' => $model->template->name, |
41
|
|
|
], |
42
|
|
|
], |
43
|
|
|
]) ?> |
44
|
|
|
|
45
|
|
|
<p> |
46
|
|
|
<?= Html::a(Yii::t('app', 'Add flow'), ['link', 'id' => $model->id], ['class' => 'btn btn-success']) ?> |
47
|
|
|
</p> |
48
|
|
|
|
49
|
|
|
<?= GridView::widget([ |
50
|
|
|
'dataProvider' => $dataProvider, |
51
|
|
|
'columns' => [ |
52
|
|
|
'name', |
53
|
|
|
'description', |
54
|
|
|
|
55
|
|
|
[ |
56
|
|
|
'class' => 'yii\grid\ActionColumn', |
57
|
|
|
'controller' => 'flow', |
58
|
|
|
'template' => '{view} {update} {unlink}', |
59
|
|
|
'buttons' => [ |
60
|
|
View Code Duplication |
'unlink' => function ($url, $_model) use ($model) { |
|
|
|
|
61
|
|
|
return Html::a('<span class="glyphicon glyphicon-remove"></span>', Url::to(['unlink', 'id' => $model->id, 'flowId' => $_model->id])); |
62
|
|
|
}, |
63
|
|
|
], |
64
|
|
|
], |
65
|
|
|
], |
66
|
|
|
]); ?> |
67
|
|
|
|
68
|
|
|
</div> |
69
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.