index.php
4.12 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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
<?php
/**
* @var View $this
* @var ActiveDataProvider $dataProvider
*/
use common\models\RoadPassport;
use frontend\assets\StatementAsset;
use yii\data\ActiveDataProvider;
use yii\grid\GridView;
use yii\helpers\Html;
use yii\helpers\Url;
use yii\web\View;
$points_url = Url::to(['point/get']);
$this->registerJs("var points_url = '".$points_url."';", $this::POS_HEAD);
$this->title = 'My Yii Application';
StatementAsset::register($this);
?>
<div class="controls">
</div>
<div class="site-index">
<div class="col-xs-12 top_control">
</div>
<div class="col-xs-12">
<div id="map">
</div>
</div>
<div class="col-xs-12">
<div id="control">
<p class="h3 text-center">
Відомість
</p>
<p class="text-center">
автомобільних доріг станом на
<ins class="bold"><?php echo date('d F Y') . ' р.'; ?></ins>
</p>
<?php
echo GridView::widget([
'dataProvider' => $dataProvider,
'columns' => [
[
'attribute' => 'road.index',
'value' => function($model, $key, $index, $column) {
/**
* @var RoadPassport $model
*/
$value = '';
$value .= $model->road->roadType->value;
$value .= '-';
$value .= str_pad($model->road->index, 2, '0', STR_PAD_LEFT);
return $value;
},
'label' => 'Державний індекс та номер',
],
[
'attribute' => 'road.name',
],
[
'attribute' => 'road.roadType.definition',
'label' => 'Народно-господарське значення',
],
[
'attribute' => 'begin',
'value' => function($model, $key, $index, $column) {
/**
* @var RoadPassport $model
*/
$value = floor($model->begin) . '+';
$value .= str_pad(( $model->begin - floor($model->begin) ) * 1000, 3, '0', STR_PAD_LEFT);
return $value;
},
],
[
'attribute' => 'end',
'value' => function($model, $key, $index, $column) {
/**
* @var RoadPassport $model
*/
$value = floor($model->end) . '+';
$value .= str_pad(( $model->end - floor($model->end) ) * 1000, 3, '0', STR_PAD_LEFT);
return $value;
},
],
[
'class' => 'yii\grid\Column',
'header' => 'Траса',
'content' => function($model, $key, $index, $column) {
return Html::tag('span', '', [
'class' => 'glyphicon glyphicon-road show-route',
'data' => [
'key' => $key,
],
]);
},
],
],
])
?>
</div>
</div>
<div class="clearfix"></div>
</div>