itstructure /
yii2-template-multilanguage
| 1 | <?php |
||
| 2 | |||
| 3 | use yii\helpers\{Html, Url}; |
||
| 4 | use yii\widgets\DetailView; |
||
| 5 | |||
| 6 | /* @var $this yii\web\View */ |
||
| 7 | /* @var $model app\models\Technology */ |
||
| 8 | |||
| 9 | $this->title = $model->name; |
||
| 10 | $this->params['breadcrumbs'][] = [ |
||
| 11 | 'label' => Yii::t('technologies', 'Technologies'), |
||
| 12 | 'url' => [ |
||
| 13 | $this->params['urlPrefix'].'index' |
||
| 14 | ] |
||
| 15 | ]; |
||
| 16 | $this->params['breadcrumbs'][] = $this->title; |
||
| 17 | ?> |
||
| 18 | |||
| 19 | <style> |
||
| 20 | h5 { |
||
| 21 | font-weight: bold; |
||
| 22 | padding: 5px; |
||
| 23 | } |
||
| 24 | </style> |
||
| 25 | |||
| 26 | <div class="technologies-view"> |
||
| 27 | |||
| 28 | <p> |
||
| 29 | <?php echo Html::a(Yii::t('app', 'Update'), [ |
||
| 30 | $this->params['urlPrefix'].'update', |
||
| 31 | 'id' => $model->id |
||
| 32 | ], [ |
||
| 33 | 'class' => 'btn btn-primary' |
||
| 34 | ]) ?> |
||
| 35 | |||
| 36 | <?php echo Html::a(Yii::t('app', 'Delete'), [ |
||
| 37 | $this->params['urlPrefix'].'delete', |
||
| 38 | 'id' => $model->id |
||
| 39 | ], [ |
||
| 40 | 'class' => 'btn btn-danger', |
||
| 41 | 'data'=>[ |
||
| 42 | 'method' => 'post', |
||
| 43 | 'confirm' => Yii::t('app', 'Are you sure you want to do this action?'), |
||
| 44 | ] |
||
| 45 | ]) ?> |
||
| 46 | </p> |
||
| 47 | |||
| 48 | <?php echo DetailView::widget([ |
||
| 49 | 'model' => $model, |
||
| 50 | 'attributes' => [ |
||
| 51 | 'id', |
||
| 52 | [ |
||
| 53 | 'label' => Yii::t('app', 'Icon'), |
||
| 54 | 'value' => function($model) { |
||
| 55 | /* @var $model app\models\Technology */ |
||
| 56 | return Html::tag('i', '', ['class' => empty($model->icon) ? 'fa fa-file fa-2x' : $model->icon]); |
||
| 57 | }, |
||
| 58 | 'format' => 'raw', |
||
| 59 | ], |
||
| 60 | [ |
||
| 61 | 'attribute' => 'name', |
||
| 62 | 'label' => Yii::t('technologies', 'Name'), |
||
| 63 | ], |
||
| 64 | [ |
||
| 65 | 'attribute' => 'share', |
||
| 66 | 'label' => Yii::t('technologies', 'Share'), |
||
| 67 | ], |
||
| 68 | [ |
||
| 69 | 'label' => Yii::t('technologies', 'Parent about records'), |
||
| 70 | 'value' => function ($model) { |
||
| 71 | /* @var $model app\models\Technology */ |
||
| 72 | $aboutRecords = ''; |
||
| 73 | foreach ($model->about as $aboutRecord) { |
||
| 74 | $aboutRecords .= Html::tag('li', |
||
| 75 | Html::a($aboutRecord->getDefaultTranslate('title'), |
||
| 76 | Url::to(['/'.$this->params['shortLanguage'].'/admin/about/view', 'id' => $aboutRecord->id]), |
||
|
0 ignored issues
–
show
Comprehensibility
Best Practice
introduced
by
Loading history...
|
|||
| 77 | [ |
||
| 78 | 'target' => '_blank' |
||
| 79 | ] |
||
| 80 | ) |
||
| 81 | ); |
||
| 82 | } |
||
| 83 | |||
| 84 | return empty($aboutRecords) ? '' : Html::tag('ul', $aboutRecords, [ |
||
| 85 | 'style' => 'margin-left: 10px; padding-left: 10px;' |
||
| 86 | ]); |
||
| 87 | }, |
||
| 88 | 'format' => 'raw', |
||
| 89 | ], |
||
| 90 | [ |
||
| 91 | 'attribute' => 'created_at', |
||
| 92 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||
| 93 | 'label' => Yii::t('app', 'Created date'), |
||
| 94 | ], |
||
| 95 | [ |
||
| 96 | 'attribute' => 'updated_at', |
||
| 97 | 'format' => ['date', 'dd.MM.Y HH:mm:ss'], |
||
| 98 | 'label' => Yii::t('app', 'Updated date'), |
||
| 99 | ], |
||
| 100 | ], |
||
| 101 | ]) ?> |
||
| 102 | |||
| 103 | </div> |
||
| 104 |