Commit 9c91f7e0fd26aac8f0a48e6822050ab5f4c31569

Authored by Yarik
1 parent 09abb556

Yarik

Showing 1 changed file with 49 additions and 25 deletions   Show diff stats
frontend/views/road-width/index.php
1 1 <?php
2 2  
3   -use yii\helpers\Html;
4   -use yii\grid\GridView;
  3 + use common\models\RoadWidth;
  4 + use yii\helpers\Html;
  5 + use yii\grid\GridView;
5 6  
6   -/* @var $this yii\web\View */
7   -/* @var $searchModel common\models\RoadWidthSearch */
8   -/* @var $dataProvider yii\data\ActiveDataProvider */
  7 + /* @var $this yii\web\View */
  8 + /* @var $searchModel common\models\RoadWidthSearch */
  9 + /* @var $dataProvider yii\data\ActiveDataProvider */
9 10  
10   -$this->title = 'Road Widths';
11   -$this->params['breadcrumbs'][] = $this->title;
  11 + $this->title = 'Ширина проїзної частини';
  12 + $this->params[ 'breadcrumbs' ][] = $this->title;
12 13 ?>
13 14 <div class="road-width-index">
14 15  
... ... @@ -16,28 +17,51 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
16 17 <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
17 18  
18 19 <p>
19   - <?= Html::a('Create Road Width', ['create'], ['class' => 'btn btn-success']) ?>
  20 + <?= Html::a('Create Road Width', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
20 21 </p>
21 22 <?= GridView::widget([
22 23 'dataProvider' => $dataProvider,
23   - 'filterModel' => $searchModel,
24   - 'columns' => [
25   - ['class' => 'yii\grid\SerialColumn'],
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + [ 'class' => 'yii\grid\SerialColumn' ],
  27 + [
  28 + 'attribute' => 'region_id',
  29 + 'value' => function($model) {
  30 + /**
  31 + * @var RoadWidth $model
  32 + */
  33 + return $model->region->name;
  34 + },
  35 + ],
  36 + [
  37 + 'attribute' => 'road_id',
  38 + 'value' => function($model) {
  39 + /**
  40 + * @var RoadWidth $model
  41 + */
  42 + return $model->road->name;
  43 + },
  44 + ],
  45 + [
  46 + 'attribute' => 'begin',
  47 + 'value' => function($model) {
  48 + /**
  49 + * @var RoadWidth $model
  50 + */
  51 + return $model->getBeginString();
  52 + },
  53 + ],
  54 + [
  55 + 'attribute' => 'end',
  56 + 'value' => function($model) {
  57 + /**
  58 + * @var RoadWidth $model
  59 + */
  60 + return $model->getEndString();
  61 + },
  62 + ],
26 63  
27   - 'road_width_id',
28   - 'region_id',
29   - 'road_id',
30   - 'begin',
31   - 'end',
32   - // 'width_roadside_left',
33   - // 'width_reverse_road',
34   - // 'width_strip',
35   - // 'width_roadway_forward',
36   - // 'width_roadside_right',
37   - // 'count_lane_left',
38   - // 'count_lane_right',
39   -
40   - ['class' => 'yii\grid\ActionColumn'],
  64 + [ 'class' => 'yii\grid\ActionColumn' ],
41 65 ],
42 66 ]); ?>
43 67 </div>
... ...