relations.php
1.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<?php
use yii\helpers\Html;
use yii\grid\GridView;
/* @var $this yii\web\View */
$this->title = Yii::t('relation', 'Relations');
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="relation-sections">
<h1><?= Html::encode($this->title) ?></h1>
<?php
$dataProvider = new \yii\data\ArrayDataProvider([
'allModels' => $relations,
'sort' => [
'attributes' => ['name', 'key', 'entity1_label', 'entity2_label'],
],
'pagination' => [
'pageSize' => 10,
],
]);
?>
<?= GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
['class' => 'yii\grid\SerialColumn'],
'name',
'key',
'entity1_label',
'entity2_label',
[
'class' => 'yii\grid\ActionColumn',
'template' => '{view}',
'buttons' => [
'view' => function ($url, $model) {
return Html::a('<span class="glyphicon glyphicon-th-list"></span>', $url, [
'title' => Yii::t('relation', 'View pars'),
]);
},
],
'urlCreator' => function ($action, $model) {
if ($action === 'view') {
$url ='/admin/relation/manage/pars?relation='. $model['key'];
return $url;
}
}
],
],
]); ?>
</div>