Commit 31f7c78afdceee6815e2b6c0eca01a44953793aa

Authored by Yarik
1 parent 2ebaccd7

Yarik

Showing 40 changed files with 3208 additions and 19 deletions   Show diff stats
common/models/BusStop.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "bus_stop".
  9 + *
  10 + * @property integer $bus_stop_id
  11 + * @property integer $road_id
  12 + * @property integer $region_id
  13 + * @property integer $settlement_id
  14 + * @property double $location_right
  15 + * @property double $location_left
  16 + * @property integer $surface_type_id
  17 + * @property integer $area_stop_availability
  18 + * @property integer $area_land_availability
  19 + * @property integer $pocket_availability
  20 + * @property integer $toilet_availability
  21 + * @property integer $year_build
  22 + * @property integer $year_repair
  23 + * @property integer $state_common_id
  24 + *
  25 + * @property Region $region
  26 + * @property Road $road
  27 + * @property Settlement $settlement
  28 + * @property StateCommon $stateCommon
  29 + * @property SurfaceType $surfaceType
  30 + */
  31 +class BusStop extends \yii\db\ActiveRecord
  32 +{
  33 + /**
  34 + * @inheritdoc
  35 + */
  36 + public static function tableName()
  37 + {
  38 + return 'bus_stop';
  39 + }
  40 +
  41 + /**
  42 + * @inheritdoc
  43 + */
  44 + public function rules()
  45 + {
  46 + return [
  47 + [['road_id', 'region_id', 'settlement_id', 'surface_type_id', 'area_stop_availability', 'area_land_availability', 'pocket_availability', 'toilet_availability', 'year_build', 'year_repair', 'state_common_id'], 'integer'],
  48 + [['location_right', 'location_left'], 'number'],
  49 + [['region_id'], 'exist', 'skipOnError' => true, 'targetClass' => Region::className(), 'targetAttribute' => ['region_id' => 'region_id']],
  50 + [['road_id'], 'exist', 'skipOnError' => true, 'targetClass' => Road::className(), 'targetAttribute' => ['road_id' => 'road_id']],
  51 + [['settlement_id'], 'exist', 'skipOnError' => true, 'targetClass' => Settlement::className(), 'targetAttribute' => ['settlement_id' => 'settlement_id']],
  52 + [['state_common_id'], 'exist', 'skipOnError' => true, 'targetClass' => StateCommon::className(), 'targetAttribute' => ['state_common_id' => 'state_common_id']],
  53 + [['surface_type_id'], 'exist', 'skipOnError' => true, 'targetClass' => SurfaceType::className(), 'targetAttribute' => ['surface_type_id' => 'surface_type_id']],
  54 + ];
  55 + }
  56 +
  57 + /**
  58 + * @inheritdoc
  59 + */
  60 + public function attributeLabels()
  61 + {
  62 + return [
  63 + 'bus_stop_id' => 'Індекс',
  64 + 'road_id' => 'Дорога',
  65 + 'region_id' => 'Область',
  66 + 'settlement_id' => 'Назва населеного пункту',
  67 + 'location_right' => 'Місцезнаходження, км+ справа',
  68 + 'location_left' => 'Місцезнаходження, км+ зліва',
  69 + 'surface_type_id' => 'Тип покриття',
  70 + 'area_stop_availability' => 'Наявність елементів зупин. майдан',
  71 + 'area_land_availability' => 'Наявність елементів посад. майдан',
  72 + 'pocket_availability' => 'Наявність елементів заїзна кишеня',
  73 + 'toilet_availability' => 'Наявність елементів туалет',
  74 + 'year_build' => 'Рік будівництва',
  75 + 'year_repair' => 'Рік ремонту',
  76 + 'state_common_id' => 'Технічний стан',
  77 + ];
  78 + }
  79 +
  80 + /**
  81 + * @return \yii\db\ActiveQuery
  82 + */
  83 + public function getRegion()
  84 + {
  85 + return $this->hasOne(Region::className(), ['region_id' => 'region_id']);
  86 + }
  87 +
  88 + /**
  89 + * @return \yii\db\ActiveQuery
  90 + */
  91 + public function getRoad()
  92 + {
  93 + return $this->hasOne(Road::className(), ['road_id' => 'road_id']);
  94 + }
  95 +
  96 + /**
  97 + * @return \yii\db\ActiveQuery
  98 + */
  99 + public function getSettlement()
  100 + {
  101 + return $this->hasOne(Settlement::className(), ['settlement_id' => 'settlement_id']);
  102 + }
  103 +
  104 + /**
  105 + * @return \yii\db\ActiveQuery
  106 + */
  107 + public function getStateCommon()
  108 + {
  109 + return $this->hasOne(StateCommon::className(), ['state_common_id' => 'state_common_id']);
  110 + }
  111 +
  112 + /**
  113 + * @return \yii\db\ActiveQuery
  114 + */
  115 + public function getSurfaceType()
  116 + {
  117 + return $this->hasOne(SurfaceType::className(), ['surface_type_id' => 'surface_type_id']);
  118 + }
  119 +
  120 + public function getRightString()
  121 + {
  122 + return floor($this->location_right) . '+' . ( str_pad(round(( $this->location_right - floor($this->location_right) ) * 1000), 3, '0', STR_PAD_LEFT) );
  123 + }
  124 +
  125 + public function getLeftString()
  126 + {
  127 + return floor($this->location_left) . '+' . ( str_pad(round(( $this->location_left - floor($this->location_left) ) * 1000), 3, '0', STR_PAD_LEFT) );
  128 + }
  129 +}
... ...
common/models/BusStopSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\BusStop;
  9 +
  10 +/**
  11 + * BusStopSearch represents the model behind the search form about `common\models\BusStop`.
  12 + */
  13 +class BusStopSearch extends BusStop
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['bus_stop_id', 'road_id', 'region_id', 'settlement_id', 'surface_type_id', 'area_stop_availability', 'area_land_availability', 'pocket_availability', 'toilet_availability', 'year_build', 'year_repair', 'state_common_id'], 'integer'],
  22 + [['location_right', 'location_left'], 'number'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = BusStop::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'bus_stop_id' => $this->bus_stop_id,
  63 + 'road_id' => $this->road_id,
  64 + 'region_id' => $this->region_id,
  65 + 'settlement_id' => $this->settlement_id,
  66 + 'location_right' => $this->location_right,
  67 + 'location_left' => $this->location_left,
  68 + 'surface_type_id' => $this->surface_type_id,
  69 + 'area_stop_availability' => $this->area_stop_availability,
  70 + 'area_land_availability' => $this->area_land_availability,
  71 + 'pocket_availability' => $this->pocket_availability,
  72 + 'toilet_availability' => $this->toilet_availability,
  73 + 'year_build' => $this->year_build,
  74 + 'year_repair' => $this->year_repair,
  75 + 'state_common_id' => $this->state_common_id,
  76 + ]);
  77 +
  78 + return $dataProvider;
  79 + }
  80 +}
... ...
common/models/DepartmentAffiliation.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "department_affiliation".
  9 + *
  10 + * @property integer $department_affiliation_id
  11 + * @property string $name
  12 + *
  13 + * @property ServiceObject[] $serviceObjects
  14 + */
  15 +class DepartmentAffiliation extends \yii\db\ActiveRecord
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public static function tableName()
  21 + {
  22 + return 'department_affiliation';
  23 + }
  24 +
  25 + /**
  26 + * @inheritdoc
  27 + */
  28 + public function rules()
  29 + {
  30 + return [
  31 + [['name'], 'string', 'max' => 255],
  32 + ];
  33 + }
  34 +
  35 + /**
  36 + * @inheritdoc
  37 + */
  38 + public function attributeLabels()
  39 + {
  40 + return [
  41 + 'department_affiliation_id' => 'Department Affiliation ID',
  42 + 'name' => 'Name',
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * @return \yii\db\ActiveQuery
  48 + */
  49 + public function getServiceObjects()
  50 + {
  51 + return $this->hasMany(ServiceObject::className(), ['department_affiliation_id' => 'department_affiliation_id']);
  52 + }
  53 +}
... ...
common/models/RoadSurface.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "road_surface".
  9 + *
  10 + * @property integer $road_surface_id
  11 + * @property integer $road_id
  12 + * @property integer $region_id
  13 + * @property integer $road_direction_id
  14 + * @property double $begin
  15 + * @property double $end
  16 + * @property integer $surface_type_id
  17 + * @property integer $surface_treatment_id
  18 + * @property integer $state_common_id
  19 + *
  20 + * @property Region $region
  21 + * @property Road $road
  22 + * @property RoadDirection $roadDirection
  23 + * @property StateCommon $stateCommon
  24 + * @property SurfaceTreatment $surfaceTreatment
  25 + * @property SurfaceType $surfaceType
  26 + */
  27 +class RoadSurface extends \yii\db\ActiveRecord
  28 +{
  29 + /**
  30 + * @inheritdoc
  31 + */
  32 + public static function tableName()
  33 + {
  34 + return 'road_surface';
  35 + }
  36 +
  37 + /**
  38 + * @inheritdoc
  39 + */
  40 + public function rules()
  41 + {
  42 + return [
  43 + [['road_id', 'region_id', 'road_direction_id', 'surface_type_id', 'surface_treatment_id', 'state_common_id'], 'integer'],
  44 + [['begin', 'end'], 'number'],
  45 + [['region_id'], 'exist', 'skipOnError' => true, 'targetClass' => Region::className(), 'targetAttribute' => ['region_id' => 'region_id']],
  46 + [['road_id'], 'exist', 'skipOnError' => true, 'targetClass' => Road::className(), 'targetAttribute' => ['road_id' => 'road_id']],
  47 + [['road_direction_id'], 'exist', 'skipOnError' => true, 'targetClass' => RoadDirection::className(), 'targetAttribute' => ['road_direction_id' => 'road_direction_id']],
  48 + [['state_common_id'], 'exist', 'skipOnError' => true, 'targetClass' => StateCommon::className(), 'targetAttribute' => ['state_common_id' => 'state_common_id']],
  49 + [['surface_treatment_id'], 'exist', 'skipOnError' => true, 'targetClass' => SurfaceTreatment::className(), 'targetAttribute' => ['surface_treatment_id' => 'surface_treatment_id']],
  50 + [['surface_type_id'], 'exist', 'skipOnError' => true, 'targetClass' => SurfaceType::className(), 'targetAttribute' => ['surface_type_id' => 'surface_type_id']],
  51 + ];
  52 + }
  53 +
  54 + /**
  55 + * @inheritdoc
  56 + */
  57 + public function attributeLabels()
  58 + {
  59 + return [
  60 + 'road_surface_id' => 'Індекс',
  61 + 'road_id' => 'Дорога',
  62 + 'region_id' => 'Область',
  63 + 'road_direction_id' => 'Напрямок смуги руху',
  64 + 'begin' => 'Місцезнаходження, км+ початок',
  65 + 'end' => 'Місцезнаходження, км+ кінець',
  66 + 'surface_type_id' => 'Тип покриття',
  67 + 'surface_treatment_id' => 'Тип поверхневої обробки',
  68 + 'state_common_id' => 'Стан покриття',
  69 + ];
  70 + }
  71 +
  72 + /**
  73 + * @return \yii\db\ActiveQuery
  74 + */
  75 + public function getRegion()
  76 + {
  77 + return $this->hasOne(Region::className(), ['region_id' => 'region_id']);
  78 + }
  79 +
  80 + /**
  81 + * @return \yii\db\ActiveQuery
  82 + */
  83 + public function getRoad()
  84 + {
  85 + return $this->hasOne(Road::className(), ['road_id' => 'road_id']);
  86 + }
  87 +
  88 + /**
  89 + * @return \yii\db\ActiveQuery
  90 + */
  91 + public function getRoadDirection()
  92 + {
  93 + return $this->hasOne(RoadDirection::className(), ['road_direction_id' => 'road_direction_id']);
  94 + }
  95 +
  96 + /**
  97 + * @return \yii\db\ActiveQuery
  98 + */
  99 + public function getStateCommon()
  100 + {
  101 + return $this->hasOne(StateCommon::className(), ['state_common_id' => 'state_common_id']);
  102 + }
  103 +
  104 + /**
  105 + * @return \yii\db\ActiveQuery
  106 + */
  107 + public function getSurfaceTreatment()
  108 + {
  109 + return $this->hasOne(SurfaceTreatment::className(), ['surface_treatment_id' => 'surface_treatment_id']);
  110 + }
  111 +
  112 + /**
  113 + * @return \yii\db\ActiveQuery
  114 + */
  115 + public function getSurfaceType()
  116 + {
  117 + return $this->hasOne(SurfaceType::className(), ['surface_type_id' => 'surface_type_id']);
  118 + }
  119 +
  120 + public function getBeginString()
  121 + {
  122 + return floor($this->begin) . '+' . ( str_pad(round(( $this->begin - floor($this->begin) ) * 1000), 3, '0', STR_PAD_LEFT) );
  123 + }
  124 +
  125 + public function getEndString()
  126 + {
  127 + return floor($this->end) . '+' . ( str_pad(round(( $this->end - floor($this->end) ) * 1000), 3, '0', STR_PAD_LEFT) );
  128 + }
  129 +}
... ...
common/models/RoadSurfaceSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\RoadSurface;
  9 +
  10 +/**
  11 + * RoadSurfaceSearch represents the model behind the search form about `common\models\RoadSurface`.
  12 + */
  13 +class RoadSurfaceSearch extends RoadSurface
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['road_surface_id', 'road_id', 'region_id', 'road_direction_id', 'surface_type_id', 'surface_treatment_id', 'state_common_id'], 'integer'],
  22 + [['begin', 'end'], 'number'],
  23 + ];
  24 + }
  25 +
  26 + /**
  27 + * @inheritdoc
  28 + */
  29 + public function scenarios()
  30 + {
  31 + // bypass scenarios() implementation in the parent class
  32 + return Model::scenarios();
  33 + }
  34 +
  35 + /**
  36 + * Creates data provider instance with search query applied
  37 + *
  38 + * @param array $params
  39 + *
  40 + * @return ActiveDataProvider
  41 + */
  42 + public function search($params)
  43 + {
  44 + $query = RoadSurface::find();
  45 +
  46 + // add conditions that should always apply here
  47 +
  48 + $dataProvider = new ActiveDataProvider([
  49 + 'query' => $query,
  50 + ]);
  51 +
  52 + $this->load($params);
  53 +
  54 + if (!$this->validate()) {
  55 + // uncomment the following line if you do not want to return any records when validation fails
  56 + // $query->where('0=1');
  57 + return $dataProvider;
  58 + }
  59 +
  60 + // grid filtering conditions
  61 + $query->andFilterWhere([
  62 + 'road_surface_id' => $this->road_surface_id,
  63 + 'road_id' => $this->road_id,
  64 + 'region_id' => $this->region_id,
  65 + 'road_direction_id' => $this->road_direction_id,
  66 + 'begin' => $this->begin,
  67 + 'end' => $this->end,
  68 + 'surface_type_id' => $this->surface_type_id,
  69 + 'surface_treatment_id' => $this->surface_treatment_id,
  70 + 'state_common_id' => $this->state_common_id,
  71 + ]);
  72 +
  73 + return $dataProvider;
  74 + }
  75 +}
... ...
common/models/ServiceObject.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "service_object".
  9 + *
  10 + * @property integer $service_object_id
  11 + * @property integer $road_id
  12 + * @property integer $region_id
  13 + * @property integer $service_object_type_id
  14 + * @property integer $settlement_id
  15 + * @property integer $department_affiliation_id
  16 + * @property double $location_right
  17 + * @property double $location_left
  18 + * @property double $location_axis
  19 + * @property double $distance
  20 + * @property double $capacity
  21 + * @property string $arrangement_elements
  22 + *
  23 + * @property DepartmentAffiliation $departmentAffiliation
  24 + * @property Region $region
  25 + * @property Road $road
  26 + * @property ServiceObjectType $serviceObjectType
  27 + * @property Settlement $settlement
  28 + */
  29 +class ServiceObject extends \yii\db\ActiveRecord
  30 +{
  31 + /**
  32 + * @inheritdoc
  33 + */
  34 + public static function tableName()
  35 + {
  36 + return 'service_object';
  37 + }
  38 +
  39 + /**
  40 + * @inheritdoc
  41 + */
  42 + public function rules()
  43 + {
  44 + return [
  45 + [['road_id', 'region_id', 'service_object_type_id', 'settlement_id', 'department_affiliation_id'], 'integer'],
  46 + [['location_right', 'location_left', 'location_axis', 'distance', 'capacity'], 'number'],
  47 + [['arrangement_elements'], 'string'],
  48 + [['department_affiliation_id'], 'exist', 'skipOnError' => true, 'targetClass' => DepartmentAffiliation::className(), 'targetAttribute' => ['department_affiliation_id' => 'department_affiliation_id']],
  49 + [['region_id'], 'exist', 'skipOnError' => true, 'targetClass' => Region::className(), 'targetAttribute' => ['region_id' => 'region_id']],
  50 + [['road_id'], 'exist', 'skipOnError' => true, 'targetClass' => Road::className(), 'targetAttribute' => ['road_id' => 'road_id']],
  51 + [['service_object_type_id'], 'exist', 'skipOnError' => true, 'targetClass' => ServiceObjectType::className(), 'targetAttribute' => ['service_object_type_id' => 'service_object_type_id']],
  52 + [['settlement_id'], 'exist', 'skipOnError' => true, 'targetClass' => Settlement::className(), 'targetAttribute' => ['settlement_id' => 'settlement_id']],
  53 + ];
  54 + }
  55 +
  56 + /**
  57 + * @inheritdoc
  58 + */
  59 + public function attributeLabels()
  60 + {
  61 + return [
  62 + 'service_object_id' => 'Індекс',
  63 + 'road_id' => 'Дорога',
  64 + 'region_id' => 'Область',
  65 + 'service_object_type_id' => 'Вид споруди чи об\'єкту',
  66 + 'settlement_id' => 'Назва підприємства та населеного пункту',
  67 + 'department_affiliation_id' => 'Відоча приналежність',
  68 + 'location_right' => 'Місцезнаходження, км+ справа',
  69 + 'location_left' => 'Місцезнаходження, км+ зліва',
  70 + 'location_axis' => 'Місцезнаходження, км+ по осі',
  71 + 'distance' => 'Відстань до об\'єкту від вісі дор., м',
  72 + 'capacity' => 'Потужність',
  73 + 'arrangement_elements' => 'Елементи облаштування',
  74 + ];
  75 + }
  76 +
  77 + /**
  78 + * @return \yii\db\ActiveQuery
  79 + */
  80 + public function getDepartmentAffiliation()
  81 + {
  82 + return $this->hasOne(DepartmentAffiliation::className(), ['department_affiliation_id' => 'department_affiliation_id']);
  83 + }
  84 +
  85 + /**
  86 + * @return \yii\db\ActiveQuery
  87 + */
  88 + public function getRegion()
  89 + {
  90 + return $this->hasOne(Region::className(), ['region_id' => 'region_id']);
  91 + }
  92 +
  93 + /**
  94 + * @return \yii\db\ActiveQuery
  95 + */
  96 + public function getRoad()
  97 + {
  98 + return $this->hasOne(Road::className(), ['road_id' => 'road_id']);
  99 + }
  100 +
  101 + /**
  102 + * @return \yii\db\ActiveQuery
  103 + */
  104 + public function getServiceObjectType()
  105 + {
  106 + return $this->hasOne(ServiceObjectType::className(), ['service_object_type_id' => 'service_object_type_id']);
  107 + }
  108 +
  109 + /**
  110 + * @return \yii\db\ActiveQuery
  111 + */
  112 + public function getSettlement()
  113 + {
  114 + return $this->hasOne(Settlement::className(), ['settlement_id' => 'settlement_id']);
  115 + }
  116 +
  117 + public function getLeftString()
  118 + {
  119 + return floor($this->location_left) . '+' . ( str_pad(round(( $this->location_left - floor($this->location_left) ) * 1000), 3, '0', STR_PAD_LEFT) );
  120 + }
  121 +
  122 + public function getRightString()
  123 + {
  124 + return floor($this->location_right) . '+' . ( str_pad(round(( $this->location_right - floor($this->location_right) ) * 1000), 3, '0', STR_PAD_LEFT) );
  125 + }
  126 +
  127 + public function getAxisString()
  128 + {
  129 + return floor($this->location_axis) . '+' . ( str_pad(round(( $this->location_axis - floor($this->location_axis) ) * 1000), 3, '0', STR_PAD_LEFT) );
  130 + }
  131 +}
... ...
common/models/ServiceObjectSearch.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +use yii\base\Model;
  7 +use yii\data\ActiveDataProvider;
  8 +use common\models\ServiceObject;
  9 +
  10 +/**
  11 + * ServiceObjectSearch represents the model behind the search form about `common\models\ServiceObject`.
  12 + */
  13 +class ServiceObjectSearch extends ServiceObject
  14 +{
  15 + /**
  16 + * @inheritdoc
  17 + */
  18 + public function rules()
  19 + {
  20 + return [
  21 + [['service_object_id', 'road_id', 'region_id', 'service_object_type_id', 'settlement_id', 'department_affiliation_id'], 'integer'],
  22 + [['location_right', 'location_left', 'location_axis', 'distance', 'capacity'], 'number'],
  23 + [['arrangement_elements'], 'safe'],
  24 + ];
  25 + }
  26 +
  27 + /**
  28 + * @inheritdoc
  29 + */
  30 + public function scenarios()
  31 + {
  32 + // bypass scenarios() implementation in the parent class
  33 + return Model::scenarios();
  34 + }
  35 +
  36 + /**
  37 + * Creates data provider instance with search query applied
  38 + *
  39 + * @param array $params
  40 + *
  41 + * @return ActiveDataProvider
  42 + */
  43 + public function search($params)
  44 + {
  45 + $query = ServiceObject::find();
  46 +
  47 + // add conditions that should always apply here
  48 +
  49 + $dataProvider = new ActiveDataProvider([
  50 + 'query' => $query,
  51 + ]);
  52 +
  53 + $this->load($params);
  54 +
  55 + if (!$this->validate()) {
  56 + // uncomment the following line if you do not want to return any records when validation fails
  57 + // $query->where('0=1');
  58 + return $dataProvider;
  59 + }
  60 +
  61 + // grid filtering conditions
  62 + $query->andFilterWhere([
  63 + 'service_object_id' => $this->service_object_id,
  64 + 'road_id' => $this->road_id,
  65 + 'region_id' => $this->region_id,
  66 + 'service_object_type_id' => $this->service_object_type_id,
  67 + 'settlement_id' => $this->settlement_id,
  68 + 'department_affiliation_id' => $this->department_affiliation_id,
  69 + 'location_right' => $this->location_right,
  70 + 'location_left' => $this->location_left,
  71 + 'location_axis' => $this->location_axis,
  72 + 'distance' => $this->distance,
  73 + 'capacity' => $this->capacity,
  74 + ]);
  75 +
  76 + $query->andFilterWhere(['like', 'arrangement_elements', $this->arrangement_elements]);
  77 +
  78 + return $dataProvider;
  79 + }
  80 +}
... ...
common/models/ServiceObjectType.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "service_object_type".
  9 + *
  10 + * @property integer $service_object_type_id
  11 + * @property string $name
  12 + *
  13 + * @property ServiceObject[] $serviceObjects
  14 + */
  15 +class ServiceObjectType extends \yii\db\ActiveRecord
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public static function tableName()
  21 + {
  22 + return 'service_object_type';
  23 + }
  24 +
  25 + /**
  26 + * @inheritdoc
  27 + */
  28 + public function rules()
  29 + {
  30 + return [
  31 + [['name'], 'string', 'max' => 255],
  32 + ];
  33 + }
  34 +
  35 + /**
  36 + * @inheritdoc
  37 + */
  38 + public function attributeLabels()
  39 + {
  40 + return [
  41 + 'service_object_type_id' => 'Service Object Type ID',
  42 + 'name' => 'Name',
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * @return \yii\db\ActiveQuery
  48 + */
  49 + public function getServiceObjects()
  50 + {
  51 + return $this->hasMany(ServiceObject::className(), ['service_object_type_id' => 'service_object_type_id']);
  52 + }
  53 +}
... ...
common/models/SurfaceTreatment.php 0 → 100644
  1 +<?php
  2 +
  3 +namespace common\models;
  4 +
  5 +use Yii;
  6 +
  7 +/**
  8 + * This is the model class for table "surface_treatment".
  9 + *
  10 + * @property integer $surface_treatment_id
  11 + * @property string $name
  12 + *
  13 + * @property RoadSurface[] $roadSurfaces
  14 + */
  15 +class SurfaceTreatment extends \yii\db\ActiveRecord
  16 +{
  17 + /**
  18 + * @inheritdoc
  19 + */
  20 + public static function tableName()
  21 + {
  22 + return 'surface_treatment';
  23 + }
  24 +
  25 + /**
  26 + * @inheritdoc
  27 + */
  28 + public function rules()
  29 + {
  30 + return [
  31 + [['name'], 'string', 'max' => 255],
  32 + ];
  33 + }
  34 +
  35 + /**
  36 + * @inheritdoc
  37 + */
  38 + public function attributeLabels()
  39 + {
  40 + return [
  41 + 'surface_treatment_id' => 'Surface Treatment ID',
  42 + 'name' => 'Name',
  43 + ];
  44 + }
  45 +
  46 + /**
  47 + * @return \yii\db\ActiveQuery
  48 + */
  49 + public function getRoadSurfaces()
  50 + {
  51 + return $this->hasMany(RoadSurface::className(), ['surface_treatment_id' => 'surface_treatment_id']);
  52 + }
  53 +}
... ...
console/migrations/m160712_130834_create_road_surface.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\db\Migration;
  4 +
  5 +/**
  6 + * Handles the creation for table `road_surface`.
  7 + */
  8 +class m160712_130834_create_road_surface extends Migration
  9 +{
  10 + /**
  11 + * @inheritdoc
  12 + */
  13 + public function up()
  14 + {
  15 + $this->createTable('road_surface', [
  16 + 'road_surface_id' => $this->primaryKey()->comment('Індекс'),
  17 + 'road_id' => $this->integer()->comment('Дорога'),
  18 + 'region_id' => $this->integer()->comment('Область'),
  19 + 'road_direction_id' => $this->integer()->comment('Напрямок смуги руху'),
  20 + 'begin' => $this->float()->comment('Місцезнаходження, км+ початок'),
  21 + 'end' => $this->float()->comment('Місцезнаходження, км+ кінець'),
  22 + 'surface_type_id' => $this->integer()->comment('Тип покриття'),
  23 + 'surface_treatment_id' => $this->integer()->comment('Тип поверхневої обробки'),
  24 + 'state_common_id' => $this->integer()->comment('Стан покриття'),
  25 + ]);
  26 + $this->createTable('surface_treatment', [
  27 + 'surface_treatment_id' => $this->primaryKey(),
  28 + 'name' => $this->string(),
  29 + ]);
  30 + $this->batchInsert('surface_treatment', [ 'name' ], [
  31 + [ 'нема' ],
  32 + ]);
  33 + $this->addForeignKey('road_surface_road_direction', 'road_surface', 'road_direction_id', 'road_direction', 'road_direction_id', 'CASCADE', 'CASCADE');
  34 + $this->addForeignKey('road_surface_region', 'road_surface', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE');
  35 + $this->addForeignKey('road_surface_road', 'road_surface', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE');
  36 + $this->addForeignKey('road_surface_surface_type', 'road_surface', 'surface_type_id', 'surface_type', 'surface_type_id', 'CASCADE', 'CASCADE');
  37 + $this->addForeignKey('road_surface_state_common', 'road_surface', 'state_common_id', 'state_common', 'state_common_id', 'CASCADE', 'CASCADE');
  38 + $this->addForeignKey('road_surface_surface_treatment', 'road_surface', 'surface_treatment_id', 'surface_treatment', 'surface_treatment_id', 'CASCADE', 'CASCADE');
  39 + }
  40 +
  41 + /**
  42 + * @inheritdoc
  43 + */
  44 + public function down()
  45 + {
  46 + $this->dropForeignKey('road_surface_road_direction', 'road_surface');
  47 + $this->dropForeignKey('road_surface_region', 'road_surface');
  48 + $this->dropForeignKey('road_surface_road', 'road_surface');
  49 + $this->dropForeignKey('road_surface_surface_type', 'road_surface');
  50 + $this->dropForeignKey('road_surface_state_common', 'road_surface');
  51 + $this->dropForeignKey('road_surface_surface_treatment', 'road_surface');
  52 + $this->dropTable('road_surface');
  53 + $this->dropTable('surface_treatment');
  54 + }
  55 +}
... ...
console/migrations/m160712_144805_create_service_object.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\db\Migration;
  4 +
  5 + /**
  6 + * Handles the creation for table `service_object`.
  7 + */
  8 + class m160712_144805_create_service_object extends Migration
  9 + {
  10 +
  11 + /**
  12 + * @inheritdoc
  13 + */
  14 + public function up()
  15 + {
  16 + $this->createTable('service_object', [
  17 + 'service_object_id' => $this->primaryKey()
  18 + ->comment('Індекс'),
  19 + 'road_id' => $this->integer()
  20 + ->comment('Дорога'),
  21 + 'region_id' => $this->integer()
  22 + ->comment('Область'),
  23 + 'service_object_type_id' => $this->integer()
  24 + ->comment('Вид споруди чи об\'єкту'),
  25 + 'settlement_id' => $this->integer()
  26 + ->comment('Назва підприємства та населеного пункту'),
  27 + 'department_affiliation_id' => $this->integer()
  28 + ->comment('Відоча приналежність'),
  29 + 'location_right' => $this->float()
  30 + ->comment('Місцезнаходження, км+ справа'),
  31 + 'location_left' => $this->float()
  32 + ->comment('Місцезнаходження, км+ зліва'),
  33 + 'location_axis' => $this->float()
  34 + ->comment('Місцезнаходження, км+ по осі'),
  35 + 'distance' => $this->float()
  36 + ->comment('Відстань до об\'єкту від вісі дор., м'),
  37 + 'capacity' => $this->float()
  38 + ->comment('Потужність'),
  39 + 'arrangement_elements' => $this->text()
  40 + ->comment('Елементи облаштування'),
  41 + ]);
  42 + $this->createTable('service_object_type', [
  43 + 'service_object_type_id' => $this->primaryKey(),
  44 + 'name' => $this->string(),
  45 + ]);
  46 + $this->createTable('department_affiliation', [
  47 + 'department_affiliation_id' => $this->primaryKey(),
  48 + 'name' => $this->string(),
  49 + ]);
  50 + $this->batchInsert('service_object_type', [ 'name' ], [
  51 + [ 'кафе' ],
  52 + [ 'автозаправочна станція (АЗС)' ],
  53 + [ 'мотель' ],
  54 + ]);
  55 + $this->batchInsert('department_affiliation', [ 'name' ], [
  56 + [ 'Приватне підприємство' ],
  57 + ]);
  58 + $this->addForeignKey('service_object_road', 'service_object', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE');
  59 + $this->addForeignKey('service_object_region', 'service_object', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE');
  60 + $this->addForeignKey('service_object_settlement', 'service_object', 'settlement_id', 'settlement', 'settlement_id', 'CASCADE', 'CASCADE');
  61 + $this->addForeignKey('service_object_department_affiliation', 'service_object', 'department_affiliation_id', 'department_affiliation', 'department_affiliation_id', 'CASCADE', 'CASCADE');
  62 + $this->addForeignKey('service_object_service_object_type', 'service_object', 'service_object_type_id', 'service_object_type', 'service_object_type_id', 'CASCADE', 'CASCADE');
  63 + }
  64 +
  65 + /**
  66 + * @inheritdoc
  67 + */
  68 + public function down()
  69 + {
  70 + $this->dropForeignKey('service_object_road', 'service_object');
  71 + $this->dropForeignKey('service_object_region', 'service_object');
  72 + $this->dropForeignKey('service_object_settlement', 'service_object');
  73 + $this->dropForeignKey('service_object_department_affiliation', 'service_object');
  74 + $this->dropForeignKey('service_object_service_object_type', 'service_object');
  75 + $this->dropTable('service_object');
  76 + $this->dropTable('service_object_type');
  77 + $this->dropTable('department_affiliation');
  78 + }
  79 + }
... ...
console/migrations/m160712_144806_create_bus_stop.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\db\Migration;
  4 +
  5 + /**
  6 + * Handles the creation for table `service_object`.
  7 + */
  8 + class m160712_144806_create_bus_stop extends Migration
  9 + {
  10 +
  11 + /**
  12 + * @inheritdoc
  13 + */
  14 + public function up()
  15 + {
  16 + $this->createTable('bus_stop', [
  17 + 'bus_stop_id' => $this->primaryKey()
  18 + ->comment('Індекс'),
  19 + 'road_id' => $this->integer()
  20 + ->comment('Дорога'),
  21 + 'region_id' => $this->integer()
  22 + ->comment('Область'),
  23 + 'settlement_id' => $this->integer()
  24 + ->comment('Назва населеного пункту'),
  25 + 'location_right' => $this->float()
  26 + ->comment('Місцезнаходження, км+ справа'),
  27 + 'location_left' => $this->float()
  28 + ->comment('Місцезнаходження, км+ зліва'),
  29 + 'surface_type_id' => $this->integer()
  30 + ->comment('Тип покриття'),
  31 + 'area_stop_availability' => $this->integer()
  32 + ->comment('Наявність елементів зупин. майдан'),
  33 + 'area_land_availability' => $this->integer()
  34 + ->comment('Наявність елементів посад. майдан'),
  35 + 'pocket_availability' => $this->integer()
  36 + ->comment('Наявність елементів заїзна кишеня'),
  37 + 'toilet_availability' => $this->integer()
  38 + ->comment('Наявність елементів туалет'),
  39 + 'year_build' => $this->integer()
  40 + ->comment('Рік будівництва'),
  41 + 'year_repair' => $this->integer()
  42 + ->comment('Рік ремонту'),
  43 + 'state_common_id' => $this->integer()
  44 + ->comment('Технічний стан'),
  45 + ]);
  46 + $this->addForeignKey('bus_stop_road', 'bus_stop', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE');
  47 + $this->addForeignKey('bus_stop_region', 'bus_stop', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE');
  48 + $this->addForeignKey('bus_stop_settlement', 'bus_stop', 'settlement_id', 'settlement', 'settlement_id', 'CASCADE', 'CASCADE');
  49 + $this->addForeignKey('bus_stop_surface_type', 'bus_stop', 'surface_type_id', 'surface_type', 'surface_type_id', 'CASCADE', 'CASCADE');
  50 + $this->addForeignKey('bus_stop_state_common', 'bus_stop', 'state_common_id', 'state_common', 'state_common_id', 'CASCADE', 'CASCADE');
  51 + }
  52 +
  53 + /**
  54 + * @inheritdoc
  55 + */
  56 + public function down()
  57 + {
  58 + $this->dropForeignKey('bus_stop_road', 'bus_stop');
  59 + $this->dropForeignKey('bus_stop_region', 'bus_stop');
  60 + $this->dropForeignKey('bus_stop_settlement', 'bus_stop');
  61 + $this->dropForeignKey('bus_stop_surface_type', 'bus_stop');
  62 + $this->dropForeignKey('bus_stop_state_common', 'bus_stop');
  63 + $this->dropTable('bus_stop');
  64 + }
  65 + }
... ...
frontend/controllers/BusStopController.php 0 → 100644
  1 +<?php
  2 +
  3 + namespace frontend\controllers;
  4 +
  5 + use common\models\Region;
  6 + use common\models\Road;
  7 + use common\models\Settlement;
  8 + use common\models\StateCommon;
  9 + use common\models\SurfaceType;
  10 + use Yii;
  11 + use common\models\BusStop;
  12 + use common\models\BusStopSearch;
  13 + use yii\web\Controller;
  14 + use yii\web\NotFoundHttpException;
  15 + use yii\filters\VerbFilter;
  16 +
  17 + /**
  18 + * BusStopController implements the CRUD actions for BusStop model.
  19 + */
  20 + class BusStopController extends Controller
  21 + {
  22 +
  23 + /**
  24 + * @inheritdoc
  25 + */
  26 + public function behaviors()
  27 + {
  28 + return [
  29 + 'verbs' => [
  30 + 'class' => VerbFilter::className(),
  31 + 'actions' => [
  32 + 'delete' => [ 'POST' ],
  33 + ],
  34 + ],
  35 + ];
  36 + }
  37 +
  38 + /**
  39 + * Lists all BusStop models.
  40 + * @return mixed
  41 + */
  42 + public function actionIndex()
  43 + {
  44 + $searchModel = new BusStopSearch();
  45 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  46 +
  47 + return $this->render('index', [
  48 + 'searchModel' => $searchModel,
  49 + 'dataProvider' => $dataProvider,
  50 + ]);
  51 + }
  52 +
  53 + /**
  54 + * Displays a single BusStop model.
  55 + *
  56 + * @param integer $id
  57 + *
  58 + * @return mixed
  59 + */
  60 + public function actionView($id)
  61 + {
  62 + return $this->render('view', [
  63 + 'model' => $this->findModel($id),
  64 + ]);
  65 + }
  66 +
  67 + /**
  68 + * Creates a new BusStop model.
  69 + * If creation is successful, the browser will be redirected to the 'view' page.
  70 + * @return mixed
  71 + */
  72 + public function actionCreate()
  73 + {
  74 + $model = new BusStop();
  75 +
  76 + $roads = Road::find()
  77 + ->select([
  78 + 'name',
  79 + 'road_id',
  80 + ])
  81 + ->asArray()
  82 + ->indexBy('road_id')
  83 + ->column();
  84 +
  85 + $regions = Region::find()
  86 + ->select([
  87 + 'name',
  88 + 'region_id',
  89 + ])
  90 + ->asArray()
  91 + ->indexBy('region_id')
  92 + ->column();
  93 +
  94 + $settlements = Settlement::find()
  95 + ->select([
  96 + 'name',
  97 + 'settlement_id',
  98 + ])
  99 + ->asArray()
  100 + ->indexBy('settlement_id')
  101 + ->column();
  102 +
  103 + $surface_types = SurfaceType::find()
  104 + ->select([
  105 + 'name',
  106 + 'surface_type_id',
  107 + ])
  108 + ->asArray()
  109 + ->indexBy('surface_type_id')
  110 + ->column();
  111 +
  112 + $state_commons = StateCommon::find()
  113 + ->select([
  114 + 'value',
  115 + 'state_common_id',
  116 + ])
  117 + ->asArray()
  118 + ->indexBy('state_common_id')
  119 + ->column();
  120 +
  121 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  122 + return $this->redirect([
  123 + 'view',
  124 + 'id' => $model->bus_stop_id,
  125 + ]);
  126 + } else {
  127 + return $this->render('create', [
  128 + 'model' => $model,
  129 + 'roads' => $roads,
  130 + 'regions' => $regions,
  131 + 'settlements' => $settlements,
  132 + 'surface_types' => $surface_types,
  133 + 'state_commons' => $state_commons,
  134 + ]);
  135 + }
  136 + }
  137 +
  138 + /**
  139 + * Updates an existing BusStop model.
  140 + * If update is successful, the browser will be redirected to the 'view' page.
  141 + *
  142 + * @param integer $id
  143 + *
  144 + * @return mixed
  145 + */
  146 + public function actionUpdate($id)
  147 + {
  148 + $model = $this->findModel($id);
  149 +
  150 + $roads = Road::find()
  151 + ->select([
  152 + 'name',
  153 + 'road_id',
  154 + ])
  155 + ->asArray()
  156 + ->indexBy('road_id')
  157 + ->column();
  158 +
  159 + $regions = Region::find()
  160 + ->select([
  161 + 'name',
  162 + 'region_id',
  163 + ])
  164 + ->asArray()
  165 + ->indexBy('region_id')
  166 + ->column();
  167 +
  168 + $settlements = Settlement::find()
  169 + ->select([
  170 + 'name',
  171 + 'settlement_id',
  172 + ])
  173 + ->asArray()
  174 + ->indexBy('settlement_id')
  175 + ->column();
  176 +
  177 + $surface_types = SurfaceType::find()
  178 + ->select([
  179 + 'name',
  180 + 'surface_type_id',
  181 + ])
  182 + ->asArray()
  183 + ->indexBy('surface_type_id')
  184 + ->column();
  185 +
  186 + $state_commons = StateCommon::find()
  187 + ->select([
  188 + 'value',
  189 + 'state_common_id',
  190 + ])
  191 + ->asArray()
  192 + ->indexBy('state_common_id')
  193 + ->column();
  194 +
  195 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  196 + return $this->redirect([
  197 + 'view',
  198 + 'id' => $model->bus_stop_id,
  199 + ]);
  200 + } else {
  201 + return $this->render('update', [
  202 + 'model' => $model,
  203 + 'roads' => $roads,
  204 + 'regions' => $regions,
  205 + 'settlements' => $settlements,
  206 + 'surface_types' => $surface_types,
  207 + 'state_commons' => $state_commons,
  208 + ]);
  209 + }
  210 + }
  211 +
  212 + /**
  213 + * Deletes an existing BusStop model.
  214 + * If deletion is successful, the browser will be redirected to the 'index' page.
  215 + *
  216 + * @param integer $id
  217 + *
  218 + * @return mixed
  219 + */
  220 + public function actionDelete($id)
  221 + {
  222 + $this->findModel($id)
  223 + ->delete();
  224 +
  225 + return $this->redirect([ 'index' ]);
  226 + }
  227 +
  228 + /**
  229 + * Finds the BusStop model based on its primary key value.
  230 + * If the model is not found, a 404 HTTP exception will be thrown.
  231 + *
  232 + * @param integer $id
  233 + *
  234 + * @return BusStop the loaded model
  235 + * @throws NotFoundHttpException if the model cannot be found
  236 + */
  237 + protected function findModel($id)
  238 + {
  239 + if(( $model = BusStop::findOne($id) ) !== NULL) {
  240 + return $model;
  241 + } else {
  242 + throw new NotFoundHttpException('The requested page does not exist.');
  243 + }
  244 + }
  245 + }
... ...
frontend/controllers/RoadController.php
1 1 <?php
2 2 namespace frontend\controllers;
3 3  
  4 + use common\models\BusStop;
4 5 use common\models\CrossSection;
5 6 use common\models\FlowIntensity;
6 7 use common\models\Region;
7 8 use common\models\Road;
8 9 use common\models\RoadCategory;
  10 + use common\models\RoadSurface;
9 11 use common\models\RoadToCategory;
10 12 use common\models\RoadType;
11 13 use common\models\RoadWidth;
  14 + use common\models\ServiceObject;
12 15 use common\models\SettlementAddressLink;
13 16 use yii\data\ActiveDataProvider;
14 17 use yii\filters\VerbFilter;
... ... @@ -184,6 +187,42 @@
184 187 ->where([ 'region_id' => $region_ids ])
185 188 ->all();
186 189 }
  190 + $road_surface_regions = [ ];
  191 + $region_ids = [ ];
  192 + $region_ids = RoadSurface::find()
  193 + ->distinct()
  194 + ->select('region_id')
  195 + ->where([ 'road_id' => $id ])
  196 + ->column();
  197 + if(!empty( $region_ids )) {
  198 + $road_surface_regions = Region::find()
  199 + ->where([ 'region_id' => $region_ids ])
  200 + ->all();
  201 + }
  202 + $service_object_regions = [ ];
  203 + $region_ids = [ ];
  204 + $region_ids = ServiceObject::find()
  205 + ->distinct()
  206 + ->select('region_id')
  207 + ->where([ 'road_id' => $id ])
  208 + ->column();
  209 + if(!empty( $region_ids )) {
  210 + $service_object_regions = Region::find()
  211 + ->where([ 'region_id' => $region_ids ])
  212 + ->all();
  213 + }
  214 + $bus_stop_regions = [ ];
  215 + $region_ids = [ ];
  216 + $region_ids = BusStop::find()
  217 + ->distinct()
  218 + ->select('region_id')
  219 + ->where([ 'road_id' => $id ])
  220 + ->column();
  221 + if(!empty( $region_ids )) {
  222 + $bus_stop_regions = Region::find()
  223 + ->where([ 'region_id' => $region_ids ])
  224 + ->all();
  225 + }
187 226 $road_to_categories = [ ];
188 227 $region_ids = [ ];
189 228 $region_ids = RoadToCategory::find()
... ... @@ -215,6 +254,9 @@
215 254 'cross_section_regions' => $cross_section_regions,
216 255 'road_to_categories' => $road_to_categories,
217 256 'road_width' => $road_width,
  257 + 'road_surface_regions' => $road_surface_regions,
  258 + 'service_object_regions' => $service_object_regions,
  259 + 'bus_stop_regions' => $bus_stop_regions,
218 260 ]);
219 261 }
220 262  
... ... @@ -317,7 +359,7 @@
317 359 ]);
318 360 }
319 361  
320   - public function actionCrossSection($id, $region_id)
  362 + public function actionCrossSection(int $id, int $region_id)
321 363 {
322 364 $road = Road::findOne($id);
323 365 if(empty( $road )) {
... ... @@ -341,4 +383,79 @@
341 383 'dataProvider' => $dataProvider,
342 384 ]);
343 385 }
  386 +
  387 + public function actionRoadSurface(int $id, int $region_id)
  388 + {
  389 + $road = Road::findOne($id);
  390 + if(empty( $road )) {
  391 + throw new NotFoundHttpException('Road not found');
  392 + }
  393 + $region = Region::findOne($region_id);
  394 + if(empty( $region )) {
  395 + throw new NotFoundHttpException('Region not found');
  396 + }
  397 + $dataProvider = new ActiveDataProvider([
  398 + 'query' => RoadSurface::find()
  399 + ->where([
  400 + 'road_id' => $id,
  401 + 'region_id' => $region_id,
  402 + ]),
  403 + 'pagination' => false,
  404 + ]);
  405 + return $this->render('road-surface', [
  406 + 'road' => $road,
  407 + 'region' => $region,
  408 + 'dataProvider' => $dataProvider,
  409 + ]);
  410 + }
  411 +
  412 + public function actionServiceObject(int $id, int $region_id)
  413 + {
  414 + $road = Road::findOne($id);
  415 + if(empty( $road )) {
  416 + throw new NotFoundHttpException('Road not found');
  417 + }
  418 + $region = Region::findOne($region_id);
  419 + if(empty( $region )) {
  420 + throw new NotFoundHttpException('Region not found');
  421 + }
  422 + $dataProvider = new ActiveDataProvider([
  423 + 'query' => ServiceObject::find()
  424 + ->where([
  425 + 'road_id' => $id,
  426 + 'region_id' => $region_id,
  427 + ]),
  428 + 'pagination' => false,
  429 + ]);
  430 + return $this->render('service-object', [
  431 + 'road' => $road,
  432 + 'region' => $region,
  433 + 'dataProvider' => $dataProvider,
  434 + ]);
  435 + }
  436 +
  437 + public function actionBusStop(int $id, int $region_id)
  438 + {
  439 + $road = Road::findOne($id);
  440 + if(empty( $road )) {
  441 + throw new NotFoundHttpException('Road not found');
  442 + }
  443 + $region = Region::findOne($region_id);
  444 + if(empty( $region )) {
  445 + throw new NotFoundHttpException('Region not found');
  446 + }
  447 + $dataProvider = new ActiveDataProvider([
  448 + 'query' => BusStop::find()
  449 + ->where([
  450 + 'road_id' => $id,
  451 + 'region_id' => $region_id,
  452 + ]),
  453 + 'pagination' => false,
  454 + ]);
  455 + return $this->render('bus-stop', [
  456 + 'road' => $road,
  457 + 'region' => $region,
  458 + 'dataProvider' => $dataProvider,
  459 + ]);
  460 + }
344 461 }
... ...
frontend/controllers/RoadSurfaceController.php 0 → 100644
  1 +<?php
  2 +
  3 + namespace frontend\controllers;
  4 +
  5 + use common\models\Region;
  6 + use common\models\Road;
  7 + use common\models\RoadDirection;
  8 + use common\models\StateCommon;
  9 + use common\models\SurfaceTreatment;
  10 + use common\models\SurfaceType;
  11 + use Yii;
  12 + use common\models\RoadSurface;
  13 + use common\models\RoadSurfaceSearch;
  14 + use yii\web\Controller;
  15 + use yii\web\NotFoundHttpException;
  16 + use yii\filters\VerbFilter;
  17 +
  18 + /**
  19 + * RoadSurfaceController implements the CRUD actions for RoadSurface model.
  20 + */
  21 + class RoadSurfaceController extends Controller
  22 + {
  23 +
  24 + /**
  25 + * @inheritdoc
  26 + */
  27 + public function behaviors()
  28 + {
  29 + return [
  30 + 'verbs' => [
  31 + 'class' => VerbFilter::className(),
  32 + 'actions' => [
  33 + 'delete' => [ 'POST' ],
  34 + ],
  35 + ],
  36 + ];
  37 + }
  38 +
  39 + /**
  40 + * Lists all RoadSurface models.
  41 + * @return mixed
  42 + */
  43 + public function actionIndex()
  44 + {
  45 + $searchModel = new RoadSurfaceSearch();
  46 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  47 +
  48 + return $this->render('index', [
  49 + 'searchModel' => $searchModel,
  50 + 'dataProvider' => $dataProvider,
  51 + ]);
  52 + }
  53 +
  54 + /**
  55 + * Displays a single RoadSurface model.
  56 + *
  57 + * @param integer $id
  58 + *
  59 + * @return mixed
  60 + */
  61 + public function actionView($id)
  62 + {
  63 + return $this->render('view', [
  64 + 'model' => $this->findModel($id),
  65 + ]);
  66 + }
  67 +
  68 + /**
  69 + * Creates a new RoadSurface model.
  70 + * If creation is successful, the browser will be redirected to the 'view' page.
  71 + * @return mixed
  72 + */
  73 + public function actionCreate()
  74 + {
  75 + $model = new RoadSurface();
  76 +
  77 + $roads = Road::find()
  78 + ->select([
  79 + 'name',
  80 + 'road_id',
  81 + ])
  82 + ->asArray()
  83 + ->indexBy('road_id')
  84 + ->column();
  85 +
  86 + $regions = Region::find()
  87 + ->select([
  88 + 'name',
  89 + 'region_id',
  90 + ])
  91 + ->asArray()
  92 + ->indexBy('region_id')
  93 + ->column();
  94 +
  95 + $road_directions = RoadDirection::find()
  96 + ->select([
  97 + 'direction_name',
  98 + 'road_direction_id',
  99 + ])
  100 + ->asArray()
  101 + ->indexBy('road_direction_id')
  102 + ->column();
  103 +
  104 + $surface_types = SurfaceType::find()
  105 + ->select([
  106 + 'name',
  107 + 'surface_type_id',
  108 + ])
  109 + ->asArray()
  110 + ->indexBy('surface_type_id')
  111 + ->column();
  112 +
  113 + $surface_treatments = SurfaceTreatment::find()
  114 + ->select([
  115 + 'name',
  116 + 'surface_treatment_id',
  117 + ])
  118 + ->asArray()
  119 + ->indexBy('surface_treatment_id')
  120 + ->column();
  121 +
  122 + $state_commons = StateCommon::find()
  123 + ->select([
  124 + 'value',
  125 + 'state_common_id',
  126 + ])
  127 + ->asArray()
  128 + ->indexBy('state_common_id')
  129 + ->column();
  130 +
  131 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  132 + return $this->redirect([
  133 + 'view',
  134 + 'id' => $model->road_surface_id,
  135 + ]);
  136 + } else {
  137 + return $this->render('create', [
  138 + 'model' => $model,
  139 + 'roads' => $roads,
  140 + 'regions' => $regions,
  141 + 'road_directions' => $road_directions,
  142 + 'surface_types' => $surface_types,
  143 + 'surface_treatments' => $surface_treatments,
  144 + 'state_commons' => $state_commons,
  145 + ]);
  146 + }
  147 + }
  148 +
  149 + /**
  150 + * Updates an existing RoadSurface model.
  151 + * If update is successful, the browser will be redirected to the 'view' page.
  152 + *
  153 + * @param integer $id
  154 + *
  155 + * @return mixed
  156 + */
  157 + public function actionUpdate($id)
  158 + {
  159 + $model = $this->findModel($id);
  160 +
  161 + $roads = Road::find()
  162 + ->select([
  163 + 'name',
  164 + 'road_id',
  165 + ])
  166 + ->asArray()
  167 + ->indexBy('road_id')
  168 + ->column();
  169 +
  170 + $regions = Region::find()
  171 + ->select([
  172 + 'name',
  173 + 'region_id',
  174 + ])
  175 + ->asArray()
  176 + ->indexBy('region_id')
  177 + ->column();
  178 +
  179 + $road_directions = RoadDirection::find()
  180 + ->select([
  181 + 'direction_name',
  182 + 'road_direction_id',
  183 + ])
  184 + ->asArray()
  185 + ->indexBy('road_direction_id')
  186 + ->column();
  187 +
  188 + $surface_types = SurfaceType::find()
  189 + ->select([
  190 + 'name',
  191 + 'surface_type_id',
  192 + ])
  193 + ->asArray()
  194 + ->indexBy('surface_type_id')
  195 + ->column();
  196 +
  197 + $surface_treatments = SurfaceTreatment::find()
  198 + ->select([
  199 + 'name',
  200 + 'surface_treatment_id',
  201 + ])
  202 + ->asArray()
  203 + ->indexBy('surface_treatment_id')
  204 + ->column();
  205 +
  206 + $state_commons = StateCommon::find()
  207 + ->select([
  208 + 'value',
  209 + 'state_common_id',
  210 + ])
  211 + ->asArray()
  212 + ->indexBy('state_common_id')
  213 + ->column();
  214 +
  215 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  216 + return $this->redirect([
  217 + 'view',
  218 + 'id' => $model->road_surface_id,
  219 + ]);
  220 + } else {
  221 + return $this->render('update', [
  222 + 'model' => $model,
  223 + 'roads' => $roads,
  224 + 'regions' => $regions,
  225 + 'road_directions' => $road_directions,
  226 + 'surface_types' => $surface_types,
  227 + 'surface_treatments' => $surface_treatments,
  228 + 'state_commons' => $state_commons,
  229 + ]);
  230 + }
  231 + }
  232 +
  233 + /**
  234 + * Deletes an existing RoadSurface model.
  235 + * If deletion is successful, the browser will be redirected to the 'index' page.
  236 + *
  237 + * @param integer $id
  238 + *
  239 + * @return mixed
  240 + */
  241 + public function actionDelete($id)
  242 + {
  243 + $this->findModel($id)
  244 + ->delete();
  245 +
  246 + return $this->redirect([ 'index' ]);
  247 + }
  248 +
  249 + /**
  250 + * Finds the RoadSurface model based on its primary key value.
  251 + * If the model is not found, a 404 HTTP exception will be thrown.
  252 + *
  253 + * @param integer $id
  254 + *
  255 + * @return RoadSurface the loaded model
  256 + * @throws NotFoundHttpException if the model cannot be found
  257 + */
  258 + protected function findModel($id)
  259 + {
  260 + if(( $model = RoadSurface::findOne($id) ) !== NULL) {
  261 + return $model;
  262 + } else {
  263 + throw new NotFoundHttpException('The requested page does not exist.');
  264 + }
  265 + }
  266 + }
... ...
frontend/controllers/ServiceObjectController.php 0 → 100644
  1 +<?php
  2 +
  3 + namespace frontend\controllers;
  4 +
  5 + use common\models\DepartmentAffiliation;
  6 + use common\models\Region;
  7 + use common\models\Road;
  8 + use common\models\ServiceObjectType;
  9 + use common\models\Settlement;
  10 + use Yii;
  11 + use common\models\ServiceObject;
  12 + use common\models\ServiceObjectSearch;
  13 + use yii\web\Controller;
  14 + use yii\web\NotFoundHttpException;
  15 + use yii\filters\VerbFilter;
  16 +
  17 + /**
  18 + * ServiceObjectController implements the CRUD actions for ServiceObject model.
  19 + */
  20 + class ServiceObjectController extends Controller
  21 + {
  22 +
  23 + /**
  24 + * @inheritdoc
  25 + */
  26 + public function behaviors()
  27 + {
  28 + return [
  29 + 'verbs' => [
  30 + 'class' => VerbFilter::className(),
  31 + 'actions' => [
  32 + 'delete' => [ 'POST' ],
  33 + ],
  34 + ],
  35 + ];
  36 + }
  37 +
  38 + /**
  39 + * Lists all ServiceObject models.
  40 + * @return mixed
  41 + */
  42 + public function actionIndex()
  43 + {
  44 + $searchModel = new ServiceObjectSearch();
  45 + $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
  46 +
  47 + return $this->render('index', [
  48 + 'searchModel' => $searchModel,
  49 + 'dataProvider' => $dataProvider,
  50 + ]);
  51 + }
  52 +
  53 + /**
  54 + * Displays a single ServiceObject model.
  55 + *
  56 + * @param integer $id
  57 + *
  58 + * @return mixed
  59 + */
  60 + public function actionView($id)
  61 + {
  62 + return $this->render('view', [
  63 + 'model' => $this->findModel($id),
  64 + ]);
  65 + }
  66 +
  67 + /**
  68 + * Creates a new ServiceObject model.
  69 + * If creation is successful, the browser will be redirected to the 'view' page.
  70 + * @return mixed
  71 + */
  72 + public function actionCreate()
  73 + {
  74 + $model = new ServiceObject();
  75 +
  76 + $roads = Road::find()
  77 + ->select([
  78 + 'name',
  79 + 'road_id',
  80 + ])
  81 + ->asArray()
  82 + ->indexBy('road_id')
  83 + ->column();
  84 +
  85 + $regions = Region::find()
  86 + ->select([
  87 + 'name',
  88 + 'region_id',
  89 + ])
  90 + ->asArray()
  91 + ->indexBy('region_id')
  92 + ->column();
  93 +
  94 + $service_object_types = ServiceObjectType::find()
  95 + ->select([
  96 + 'name',
  97 + 'service_object_type_id',
  98 + ])
  99 + ->asArray()
  100 + ->indexBy('service_object_type_id')
  101 + ->column();
  102 +
  103 + $settlements = Settlement::find()
  104 + ->select([
  105 + 'name',
  106 + 'settlement_id',
  107 + ])
  108 + ->asArray()
  109 + ->indexBy('settlement_id')
  110 + ->column();
  111 +
  112 + $department_affiliations = DepartmentAffiliation::find()
  113 + ->select([
  114 + 'name',
  115 + 'department_affiliation_id',
  116 + ])
  117 + ->asArray()
  118 + ->indexBy('department_affiliation_id')
  119 + ->column();
  120 +
  121 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  122 + return $this->redirect([
  123 + 'view',
  124 + 'id' => $model->service_object_id,
  125 + ]);
  126 + } else {
  127 + return $this->render('create', [
  128 + 'model' => $model,
  129 + 'roads' => $roads,
  130 + 'regions' => $regions,
  131 + 'service_object_types' => $service_object_types,
  132 + 'settlements' => $settlements,
  133 + 'department_affiliations' => $department_affiliations,
  134 + ]);
  135 + }
  136 + }
  137 +
  138 + /**
  139 + * Updates an existing ServiceObject model.
  140 + * If update is successful, the browser will be redirected to the 'view' page.
  141 + *
  142 + * @param integer $id
  143 + *
  144 + * @return mixed
  145 + */
  146 + public function actionUpdate($id)
  147 + {
  148 + $model = $this->findModel($id);
  149 +
  150 + $roads = Road::find()
  151 + ->select([
  152 + 'name',
  153 + 'road_id',
  154 + ])
  155 + ->asArray()
  156 + ->indexBy('road_id')
  157 + ->column();
  158 +
  159 + $regions = Region::find()
  160 + ->select([
  161 + 'name',
  162 + 'region_id',
  163 + ])
  164 + ->asArray()
  165 + ->indexBy('region_id')
  166 + ->column();
  167 +
  168 + $service_object_types = ServiceObjectType::find()
  169 + ->select([
  170 + 'name',
  171 + 'service_object_type_id',
  172 + ])
  173 + ->asArray()
  174 + ->indexBy('service_object_type_id')
  175 + ->column();
  176 +
  177 + $settlements = Settlement::find()
  178 + ->select([
  179 + 'name',
  180 + 'settlement_id',
  181 + ])
  182 + ->asArray()
  183 + ->indexBy('settlement_id')
  184 + ->column();
  185 +
  186 + $department_affiliations = DepartmentAffiliation::find()
  187 + ->select([
  188 + 'name',
  189 + 'department_affiliation_id',
  190 + ])
  191 + ->asArray()
  192 + ->indexBy('department_affiliation_id')
  193 + ->column();
  194 +
  195 + if($model->load(Yii::$app->request->post()) && $model->save()) {
  196 + return $this->redirect([
  197 + 'view',
  198 + 'id' => $model->service_object_id,
  199 + ]);
  200 + } else {
  201 + return $this->render('update', [
  202 + 'model' => $model,
  203 + 'roads' => $roads,
  204 + 'regions' => $regions,
  205 + 'service_object_types' => $service_object_types,
  206 + 'settlements' => $settlements,
  207 + 'department_affiliations' => $department_affiliations,
  208 + ]);
  209 + }
  210 + }
  211 +
  212 + /**
  213 + * Deletes an existing ServiceObject model.
  214 + * If deletion is successful, the browser will be redirected to the 'index' page.
  215 + *
  216 + * @param integer $id
  217 + *
  218 + * @return mixed
  219 + */
  220 + public function actionDelete($id)
  221 + {
  222 + $this->findModel($id)
  223 + ->delete();
  224 +
  225 + return $this->redirect([ 'index' ]);
  226 + }
  227 +
  228 + /**
  229 + * Finds the ServiceObject model based on its primary key value.
  230 + * If the model is not found, a 404 HTTP exception will be thrown.
  231 + *
  232 + * @param integer $id
  233 + *
  234 + * @return ServiceObject the loaded model
  235 + * @throws NotFoundHttpException if the model cannot be found
  236 + */
  237 + protected function findModel($id)
  238 + {
  239 + if(( $model = ServiceObject::findOne($id) ) !== NULL) {
  240 + return $model;
  241 + } else {
  242 + throw new NotFoundHttpException('The requested page does not exist.');
  243 + }
  244 + }
  245 + }
... ...
frontend/views/bus-stop/_form.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 + use yii\widgets\ActiveForm;
  5 +
  6 + /**
  7 + * @var yii\web\View $this
  8 + * @var array $roads
  9 + * @var array $regions
  10 + * @var array $settlements
  11 + * @var array $surface_types
  12 + * @var array $state_commons
  13 + * @var common\models\BusStop $model
  14 + * @var yii\widgets\ActiveForm $form
  15 + */
  16 +?>
  17 +
  18 +<div class="bus-stop-form">
  19 +
  20 + <?php $form = ActiveForm::begin(); ?>
  21 +
  22 + <?= $form->field($model, 'road_id')
  23 + ->dropDownList($roads) ?>
  24 +
  25 + <?= $form->field($model, 'region_id')
  26 + ->dropDownList($regions) ?>
  27 +
  28 + <?= $form->field($model, 'settlement_id')
  29 + ->dropDownList($settlements) ?>
  30 +
  31 + <?= $form->field($model, 'location_right')
  32 + ->textInput() ?>
  33 +
  34 + <?= $form->field($model, 'location_left')
  35 + ->textInput() ?>
  36 +
  37 + <?= $form->field($model, 'surface_type_id')
  38 + ->dropDownList($surface_types) ?>
  39 +
  40 + <?= $form->field($model, 'area_stop_availability')
  41 + ->dropDownList([0 => 'Нет', 1 => 'Да']) ?>
  42 +
  43 + <?= $form->field($model, 'area_land_availability')
  44 + ->dropDownList([0 => 'Нет', 1 => 'Да']) ?>
  45 +
  46 + <?= $form->field($model, 'pocket_availability')
  47 + ->dropDownList([0 => 'Нет', 1 => 'Да']) ?>
  48 +
  49 + <?= $form->field($model, 'toilet_availability')
  50 + ->dropDownList([0 => 'Нет', 1 => 'Да']) ?>
  51 +
  52 + <?= $form->field($model, 'year_build')
  53 + ->textInput() ?>
  54 +
  55 + <?= $form->field($model, 'year_repair')
  56 + ->textInput() ?>
  57 +
  58 + <?= $form->field($model, 'state_common_id')
  59 + ->dropDownList($state_commons) ?>
  60 +
  61 + <div class="form-group">
  62 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>
  63 + </div>
  64 +
  65 + <?php ActiveForm::end(); ?>
  66 +
  67 +</div>
... ...
frontend/views/bus-stop/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BusStopSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="bus-stop-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'bus_stop_id') ?>
  19 +
  20 + <?= $form->field($model, 'road_id') ?>
  21 +
  22 + <?= $form->field($model, 'region_id') ?>
  23 +
  24 + <?= $form->field($model, 'settlement_id') ?>
  25 +
  26 + <?= $form->field($model, 'location_right') ?>
  27 +
  28 + <?php // echo $form->field($model, 'location_left') ?>
  29 +
  30 + <?php // echo $form->field($model, 'surface_type_id') ?>
  31 +
  32 + <?php // echo $form->field($model, 'area_stop_availability') ?>
  33 +
  34 + <?php // echo $form->field($model, 'area_land_availability') ?>
  35 +
  36 + <?php // echo $form->field($model, 'pocket_availability') ?>
  37 +
  38 + <?php // echo $form->field($model, 'toilet_availability') ?>
  39 +
  40 + <?php // echo $form->field($model, 'year_build') ?>
  41 +
  42 + <?php // echo $form->field($model, 'year_repair') ?>
  43 +
  44 + <?php // echo $form->field($model, 'state_common_id') ?>
  45 +
  46 + <div class="form-group">
  47 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  48 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  49 + </div>
  50 +
  51 + <?php ActiveForm::end(); ?>
  52 +
  53 +</div>
... ...
frontend/views/bus-stop/create.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var array $roads
  8 + * @var array $regions
  9 + * @var array $settlements
  10 + * @var array $surface_types
  11 + * @var array $state_commons
  12 + * @var common\models\BusStop $model
  13 + */
  14 +
  15 + $this->title = 'Create Bus Stop';
  16 + $this->params[ 'breadcrumbs' ][] = [
  17 + 'label' => 'Bus Stops',
  18 + 'url' => [ 'index' ],
  19 + ];
  20 + $this->params[ 'breadcrumbs' ][] = $this->title;
  21 +?>
  22 +<div class="bus-stop-create">
  23 +
  24 + <h1><?= Html::encode($this->title) ?></h1>
  25 +
  26 + <?= $this->render('_form', [
  27 + 'model' => $model,
  28 + 'roads' => $roads,
  29 + 'regions' => $regions,
  30 + 'settlements' => $settlements,
  31 + 'surface_types' => $surface_types,
  32 + 'state_commons' => $state_commons,
  33 + ]) ?>
  34 +
  35 +</div>
... ...
frontend/views/bus-stop/index.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\grid\GridView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $searchModel common\models\BusStopSearch */
  8 +/* @var $dataProvider yii\data\ActiveDataProvider */
  9 +
  10 +$this->title = 'Bus Stops';
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bus-stop-index">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  17 +
  18 + <p>
  19 + <?= Html::a('Create Bus Stop', ['create'], ['class' => 'btn btn-success']) ?>
  20 + </p>
  21 + <?= GridView::widget([
  22 + 'dataProvider' => $dataProvider,
  23 + 'filterModel' => $searchModel,
  24 + 'columns' => [
  25 + ['class' => 'yii\grid\SerialColumn'],
  26 +
  27 + 'bus_stop_id',
  28 + 'road_id',
  29 + 'region_id',
  30 + 'settlement_id',
  31 + 'location_right',
  32 + // 'location_left',
  33 + // 'surface_type_id',
  34 + // 'area_stop_availability',
  35 + // 'area_land_availability',
  36 + // 'pocket_availability',
  37 + // 'toilet_availability',
  38 + // 'year_build',
  39 + // 'year_repair',
  40 + // 'state_common_id',
  41 +
  42 + ['class' => 'yii\grid\ActionColumn'],
  43 + ],
  44 + ]); ?>
  45 +</div>
... ...
frontend/views/bus-stop/update.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var array $roads
  8 + * @var array $regions
  9 + * @var array $settlements
  10 + * @var array $surface_types
  11 + * @var array $state_commons
  12 + * @var common\models\BusStop $model
  13 + */
  14 +
  15 + $this->title = 'Update Bus Stop: ' . $model->bus_stop_id;
  16 + $this->params[ 'breadcrumbs' ][] = [
  17 + 'label' => 'Bus Stops',
  18 + 'url' => [ 'index' ],
  19 + ];
  20 + $this->params[ 'breadcrumbs' ][] = [
  21 + 'label' => $model->bus_stop_id,
  22 + 'url' => [
  23 + 'view',
  24 + 'id' => $model->bus_stop_id,
  25 + ],
  26 + ];
  27 + $this->params[ 'breadcrumbs' ][] = 'Update';
  28 +?>
  29 +<div class="bus-stop-update">
  30 +
  31 + <h1><?= Html::encode($this->title) ?></h1>
  32 +
  33 + <?= $this->render('_form', [
  34 + 'model' => $model,
  35 + 'roads' => $roads,
  36 + 'regions' => $regions,
  37 + 'settlements' => $settlements,
  38 + 'surface_types' => $surface_types,
  39 + 'state_commons' => $state_commons,
  40 + ]) ?>
  41 +
  42 +</div>
... ...
frontend/views/bus-stop/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\BusStop */
  8 +
  9 +$this->title = $model->bus_stop_id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Bus Stops', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="bus-stop-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->bus_stop_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->bus_stop_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'bus_stop_id',
  32 + 'road_id',
  33 + 'region_id',
  34 + 'settlement_id',
  35 + 'location_right',
  36 + 'location_left',
  37 + 'surface_type_id',
  38 + 'area_stop_availability',
  39 + 'area_land_availability',
  40 + 'pocket_availability',
  41 + 'toilet_availability',
  42 + 'year_build',
  43 + 'year_repair',
  44 + 'state_common_id',
  45 + ],
  46 + ]) ?>
  47 +
  48 +</div>
... ...
frontend/views/cross-section/index.php
1 1 <?php
2 2  
3   -use yii\helpers\Html;
  3 + use common\models\CrossSection;
  4 + use yii\helpers\Html;
4 5 use yii\grid\GridView;
5 6  
6 7 /* @var $this yii\web\View */
... ... @@ -23,24 +24,27 @@ $this-&gt;params[&#39;breadcrumbs&#39;][] = $this-&gt;title;
23 24 'filterModel' => $searchModel,
24 25 'columns' => [
25 26 ['class' => 'yii\grid\SerialColumn'],
26   -
27   - 'cross_section_id',
28   - 'region_id',
29   - 'road_id',
  27 + [
  28 + 'attribute' => 'region_id',
  29 + 'value' => function($model) {
  30 + /**
  31 + * @var CrossSection $model
  32 + */
  33 + return $model->region->name;
  34 + }
  35 + ],
  36 + [
  37 + 'attribute' => 'road_id',
  38 + 'value' => function($model) {
  39 + /**
  40 + * @var CrossSection $model
  41 + */
  42 + return $model->road->name;
  43 + }
  44 + ],
30 45 'location_left',
31 46 'location_right',
32   - // 'direction',
33   - // 'surface_type_id',
34   - // 'length_section',
35   - // 'length_surface',
36   - // 'distance_edge',
37   - // 'width',
38   - // 'angle',
39   - // 'tube_availability',
40   - // 'safety_availability',
41   - // 'year_build',
42   - // 'year_repair',
43   - // 'state_common_id',
  47 + 'direction',
44 48  
45 49 ['class' => 'yii\grid\ActionColumn'],
46 50 ],
... ...
frontend/views/road-surface/_form.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 + use yii\widgets\ActiveForm;
  5 +
  6 + /**
  7 + * @var yii\web\View $this
  8 + * @var common\models\RoadSurface $model
  9 + * @var array $roads
  10 + * @var array $regions
  11 + * @var array $road_directions
  12 + * @var array $surface_types
  13 + * @var array $surface_treatments
  14 + * @var array $state_commons
  15 + * @var yii\widgets\ActiveForm $form
  16 + */
  17 +?>
  18 +
  19 +<div class="road-surface-form">
  20 +
  21 + <?php $form = ActiveForm::begin(); ?>
  22 +
  23 + <?= $form->field($model, 'road_id')
  24 + ->dropDownList($roads) ?>
  25 +
  26 + <?= $form->field($model, 'region_id')
  27 + ->dropDownList($regions) ?>
  28 +
  29 + <?= $form->field($model, 'road_direction_id')
  30 + ->dropDownList($road_directions) ?>
  31 +
  32 + <?= $form->field($model, 'begin')
  33 + ->textInput() ?>
  34 +
  35 + <?= $form->field($model, 'end')
  36 + ->textInput() ?>
  37 +
  38 + <?= $form->field($model, 'surface_type_id')
  39 + ->dropDownList($surface_types) ?>
  40 +
  41 + <?= $form->field($model, 'surface_treatment_id')
  42 + ->dropDownList($surface_treatments) ?>
  43 +
  44 + <?= $form->field($model, 'state_common_id')
  45 + ->dropDownList($state_commons) ?>
  46 +
  47 + <div class="form-group">
  48 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>
  49 + </div>
  50 +
  51 + <?php ActiveForm::end(); ?>
  52 +
  53 +</div>
... ...
frontend/views/road-surface/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\RoadSurfaceSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="road-surface-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'road_surface_id') ?>
  19 +
  20 + <?= $form->field($model, 'road_id') ?>
  21 +
  22 + <?= $form->field($model, 'region_id') ?>
  23 +
  24 + <?= $form->field($model, 'road_direction_id') ?>
  25 +
  26 + <?= $form->field($model, 'begin') ?>
  27 +
  28 + <?php // echo $form->field($model, 'end') ?>
  29 +
  30 + <?php // echo $form->field($model, 'surface_type_id') ?>
  31 +
  32 + <?php // echo $form->field($model, 'surface_treatment_id') ?>
  33 +
  34 + <?php // echo $form->field($model, 'state_common_id') ?>
  35 +
  36 + <div class="form-group">
  37 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  38 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  39 + </div>
  40 +
  41 + <?php ActiveForm::end(); ?>
  42 +
  43 +</div>
... ...
frontend/views/road-surface/create.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var common\models\RoadSurface $model
  8 + * @var array $roads
  9 + * @var array $regions
  10 + * @var array $road_directions
  11 + * @var array $surface_types
  12 + * @var array $surface_treatments
  13 + * @var array $state_commons
  14 + */
  15 +
  16 + $this->title = 'Create Road Surface';
  17 + $this->params[ 'breadcrumbs' ][] = [
  18 + 'label' => 'Road Surfaces',
  19 + 'url' => [ 'index' ],
  20 + ];
  21 + $this->params[ 'breadcrumbs' ][] = $this->title;
  22 +?>
  23 +<div class="road-surface-create">
  24 +
  25 + <h1><?= Html::encode($this->title) ?></h1>
  26 +
  27 + <?= $this->render('_form', [
  28 + 'model' => $model,
  29 + 'roads' => $roads,
  30 + 'regions' => $regions,
  31 + 'road_directions' => $road_directions,
  32 + 'surface_types' => $surface_types,
  33 + 'surface_treatments' => $surface_treatments,
  34 + 'state_commons' => $state_commons,
  35 + ]) ?>
  36 +
  37 +</div>
... ...
frontend/views/road-surface/index.php 0 → 100644
  1 +<?php
  2 +
  3 + use common\models\RoadSurface;
  4 + use yii\helpers\Html;
  5 +use yii\grid\GridView;
  6 +
  7 +/* @var $this yii\web\View */
  8 +/* @var $searchModel common\models\RoadSurfaceSearch */
  9 +/* @var $dataProvider yii\data\ActiveDataProvider */
  10 +
  11 +$this->title = 'Road Surfaces';
  12 +$this->params['breadcrumbs'][] = $this->title;
  13 +?>
  14 +<div class="road-surface-index">
  15 +
  16 + <h1><?= Html::encode($this->title) ?></h1>
  17 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  18 +
  19 + <p>
  20 + <?= Html::a('Create Road Surface', ['create'], ['class' => 'btn btn-success']) ?>
  21 + </p>
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => null,
  25 + 'columns' => [
  26 + ['class' => 'yii\grid\SerialColumn'],
  27 + [
  28 + 'attribute' => 'road_id',
  29 + 'value' => function($model) {
  30 + /**
  31 + * @var RoadSurface $model
  32 + */
  33 + return $model->road->name;
  34 + }
  35 + ],
  36 + [
  37 + 'attribute' => 'region_id',
  38 + 'value' => function($model) {
  39 + /**
  40 + * @var RoadSurface $model
  41 + */
  42 + return $model->region->name;
  43 + }
  44 + ],
  45 + [
  46 + 'attribute' => 'road_direction_id',
  47 + 'value' => function($model) {
  48 + /**
  49 + * @var RoadSurface $model
  50 + */
  51 + return $model->roadDirection->direction_name;
  52 + }
  53 + ],
  54 + [
  55 + 'attribute' => 'begin',
  56 + 'value' => function($model) {
  57 + /**
  58 + * @var RoadSurface $model
  59 + */
  60 + return $model->getBeginString();
  61 + }
  62 + ],
  63 + [
  64 + 'attribute' => 'end',
  65 + 'value' => function($model) {
  66 + /**
  67 + * @var RoadSurface $model
  68 + */
  69 + return $model->getEndString();
  70 + }
  71 + ],
  72 +
  73 + ['class' => 'yii\grid\ActionColumn'],
  74 + ],
  75 + ]); ?>
  76 +</div>
... ...
frontend/views/road-surface/update.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var common\models\RoadSurface $model
  8 + * @var array $roads
  9 + * @var array $regions
  10 + * @var array $road_directions
  11 + * @var array $surface_types
  12 + * @var array $surface_treatments
  13 + * @var array $state_commons
  14 + */
  15 +
  16 +$this->title = 'Update Road Surface: ' . $model->road_surface_id;
  17 +$this->params['breadcrumbs'][] = ['label' => 'Road Surfaces', 'url' => ['index']];
  18 +$this->params['breadcrumbs'][] = ['label' => $model->road_surface_id, 'url' => ['view', 'id' => $model->road_surface_id]];
  19 +$this->params['breadcrumbs'][] = 'Update';
  20 +?>
  21 +<div class="road-surface-update">
  22 +
  23 + <h1><?= Html::encode($this->title) ?></h1>
  24 +
  25 + <?= $this->render('_form', [
  26 + 'model' => $model,
  27 + 'roads' => $roads,
  28 + 'regions' => $regions,
  29 + 'road_directions' => $road_directions,
  30 + 'surface_types' => $surface_types,
  31 + 'surface_treatments' => $surface_treatments,
  32 + 'state_commons' => $state_commons,
  33 + ]) ?>
  34 +
  35 +</div>
... ...
frontend/views/road-surface/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\RoadSurface */
  8 +
  9 +$this->title = $model->road_surface_id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Road Surfaces', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="road-surface-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->road_surface_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->road_surface_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'road_surface_id',
  32 + 'road_id',
  33 + 'region_id',
  34 + 'road_direction_id',
  35 + 'begin',
  36 + 'end',
  37 + 'surface_type_id',
  38 + 'surface_treatment_id',
  39 + 'state_common_id',
  40 + ],
  41 + ]) ?>
  42 +
  43 +</div>
... ...
frontend/views/road/bus-stop.php 0 → 100755
  1 +<?php
  2 +
  3 + /**
  4 + * @var Road $road
  5 + * @var Region $region
  6 + * @var ActiveDataProvider $dataProvider
  7 + */
  8 +
  9 + use common\models\BusStop;
  10 + use common\models\Region;
  11 + use common\models\Road;
  12 + use common\models\RoadSurface;
  13 + use yii\data\ActiveDataProvider;
  14 + use yii\grid\GridView;
  15 +
  16 + $this->title = $road->name;
  17 + $this->params[ 'breadcrumbs' ][] = [
  18 + 'label' => 'Дороги',
  19 + 'url' => [ 'index' ],
  20 + ];
  21 + $this->params[ 'breadcrumbs' ][] = [
  22 + 'label' => $this->title,
  23 + 'url' => [
  24 + 'view',
  25 + 'id' => $road->road_id,
  26 + ],
  27 + ];
  28 + $this->params[ 'breadcrumbs' ][] = 'Відомість наявності та технічного стану автобусних зупинок - ' . ucfirst($region->name). ' область';
  29 +?>
  30 +<div class="site-index">
  31 + <div class="col-xs-6 text-center">
  32 + Міністрество транспорту України <br>
  33 + Державна служба автомобільних доріг <br>
  34 + України
  35 + </div>
  36 + <div class="col-xs-6 text-center">
  37 + Служба автомобільних доріг у <?php echo $region->name; ?> області
  38 + </div>
  39 + <div class="clearfix"></div>
  40 + <div class="col-xs-12 text-center">
  41 + <p class="h3">Відомість</p>
  42 + <p>наявності та технічного стану</p>
  43 + <p><b>автобусних зупинок</b></p>
  44 + <p>на автомобільній дорозі</p>
  45 + <p><ins><?php echo $road->name; ?></ins></p>
  46 + <p><ins><?php echo $road->roadType->definition;?></ins> значення станом на <ins><?php echo date('d F Y');?> р.</ins></p>
  47 + </div>
  48 + <div class="col-xs-12 text-center">
  49 + <?php
  50 + echo GridView::widget([
  51 + 'dataProvider' => $dataProvider,
  52 + 'layout' => "{items}",
  53 + 'columns' => [
  54 + [
  55 + 'attribute' => 'location_right',
  56 + 'value' => function($model) {
  57 + /**
  58 + * @var BusStop $model
  59 + */
  60 + return $model->getRightString();
  61 + }
  62 + ],
  63 + [
  64 + 'attribute' => 'location_left',
  65 + 'value' => function($model) {
  66 + /**
  67 + * @var BusStop $model
  68 + */
  69 + return $model->getLeftString();
  70 + }
  71 + ],
  72 + [
  73 + 'attribute' => 'settlement_id',
  74 + 'value' => function($model) {
  75 + /**
  76 + * @var BusStop $model
  77 + */
  78 + return $model->settlement->name;
  79 + }
  80 + ],
  81 + [
  82 + 'attribute' => 'surface_type_id',
  83 + 'value' => function($model) {
  84 + /**
  85 + * @var BusStop $model
  86 + */
  87 + return $model->surfaceType->name;
  88 + }
  89 + ],
  90 + 'area_stop_availability',
  91 + 'area_land_availability',
  92 + 'pocket_availability',
  93 + 'toilet_availability',
  94 + 'year_build',
  95 + 'year_repair',
  96 + [
  97 + 'attribute' => 'state_common_id',
  98 + 'value' => function($model) {
  99 + /**
  100 + * @var BusStop $model
  101 + */
  102 + return $model->stateCommon->value;
  103 + }
  104 + ],
  105 + ],
  106 + ]);
  107 + ?>
  108 + </div>
  109 +</div>
... ...
frontend/views/road/cross-section.php
... ... @@ -86,7 +86,15 @@
86 86 'safety_availability:boolean',
87 87 'year_build',
88 88 'year_repair',
89   - 'state_common_id',
  89 + [
  90 + 'attribute' => 'state_common_id',
  91 + 'value' => function($model) {
  92 + /**
  93 + * @var CrossSection $model
  94 + */
  95 + return $model->stateCommon->value;
  96 + }
  97 + ],
90 98 ],
91 99 ]);
92 100 ?>
... ...
frontend/views/road/road-surface.php 0 → 100755
  1 +<?php
  2 +
  3 + /**
  4 + * @var Road $road
  5 + * @var Region $region
  6 + * @var ActiveDataProvider $dataProvider
  7 + */
  8 +
  9 + use common\models\Region;
  10 + use common\models\Road;
  11 + use common\models\RoadSurface;
  12 + use yii\data\ActiveDataProvider;
  13 + use yii\grid\GridView;
  14 +
  15 + $this->title = $road->name;
  16 + $this->params[ 'breadcrumbs' ][] = [
  17 + 'label' => 'Дороги',
  18 + 'url' => [ 'index' ],
  19 + ];
  20 + $this->params[ 'breadcrumbs' ][] = [
  21 + 'label' => $this->title,
  22 + 'url' => [
  23 + 'view',
  24 + 'id' => $road->road_id,
  25 + ],
  26 + ];
  27 + $this->params[ 'breadcrumbs' ][] = 'Відомість наявності та технічного стану покриття автодоріг - ' . ucfirst($region->name). ' область';
  28 +?>
  29 +<div class="site-index">
  30 + <div class="col-xs-6 text-center">
  31 + Міністрество транспорту України <br>
  32 + Державна служба автомобільних доріг <br>
  33 + України
  34 + </div>
  35 + <div class="col-xs-6 text-center">
  36 + Служба автомобільних доріг у <?php echo $region->name; ?> області
  37 + </div>
  38 + <div class="clearfix"></div>
  39 + <div class="col-xs-12 text-center">
  40 + <p class="h3">Відомість</p>
  41 + <p>наявності та технічного стану покриття</p>
  42 + <p><b>покриття автодоріг</b></p>
  43 + <p>на автомобільній дорозі</p>
  44 + <p><ins><?php echo $road->name; ?></ins></p>
  45 + <p><ins><?php echo $road->roadType->definition;?></ins> значення станом на <ins><?php echo date('d F Y');?> р.</ins></p>
  46 + </div>
  47 + <div class="col-xs-12 text-center">
  48 + <?php
  49 + echo GridView::widget([
  50 + 'dataProvider' => $dataProvider,
  51 + 'layout' => "{items}",
  52 + 'columns' => [
  53 + [
  54 + 'attribute' => 'road_direction_id',
  55 + 'value' => function($model) {
  56 + /**
  57 + * @var RoadSurface $model
  58 + */
  59 + return $model->roadDirection->direction_name;
  60 + }
  61 + ],
  62 + [
  63 + 'attribute' => 'begin',
  64 + 'value' => function($model) {
  65 + /**
  66 + * @var RoadSurface $model
  67 + */
  68 + return $model->getBeginString();
  69 + }
  70 + ],
  71 + [
  72 + 'attribute' => 'end',
  73 + 'value' => function($model) {
  74 + /**
  75 + * @var RoadSurface $model
  76 + */
  77 + return $model->getEndString();
  78 + }
  79 + ],
  80 + [
  81 + 'attribute' => 'surface_type_id',
  82 + 'value' => function($model) {
  83 + /**
  84 + * @var RoadSurface $model
  85 + */
  86 + return $model->surfaceType->name;
  87 + }
  88 + ],
  89 + [
  90 + 'attribute' => 'surface_treatment_id',
  91 + 'value' => function($model) {
  92 + /**
  93 + * @var RoadSurface $model
  94 + */
  95 + return $model->surfaceTreatment->name;
  96 + }
  97 + ],
  98 + [
  99 + 'attribute' => 'state_common_id',
  100 + 'value' => function($model) {
  101 + /**
  102 + * @var RoadSurface $model
  103 + */
  104 + return $model->stateCommon->value;
  105 + }
  106 + ],
  107 + ],
  108 + ]);
  109 + ?>
  110 + </div>
  111 +</div>
... ...
frontend/views/road/service-object.php 0 → 100755
  1 +<?php
  2 +
  3 + /**
  4 + * @var Road $road
  5 + * @var Region $region
  6 + * @var ActiveDataProvider $dataProvider
  7 + */
  8 +
  9 + use common\models\Region;
  10 + use common\models\Road;
  11 + use common\models\ServiceObject;
  12 + use common\models\SettlementAddressLink;
  13 + use yii\bootstrap\Html;
  14 + use yii\data\ActiveDataProvider;
  15 + use yii\grid\GridView;
  16 + use yii\widgets\DetailView;
  17 +
  18 + $this->title = $road->name;
  19 + $this->params[ 'breadcrumbs' ][] = [
  20 + 'label' => 'Дороги',
  21 + 'url' => [ 'index' ],
  22 + ];
  23 + $this->params[ 'breadcrumbs' ][] = [
  24 + 'label' => $this->title,
  25 + 'url' => [
  26 + 'view',
  27 + 'id' => $road->road_id,
  28 + ],
  29 + ];
  30 + $this->params[ 'breadcrumbs' ][] = 'Відомість наявності споруд автослужб, об\'єктів сервісу - ' . ucfirst($region->name) . ' область';
  31 +?>
  32 +<div class="site-index">
  33 + <div class="col-xs-6 text-center">
  34 + Міністрество транспорту України <br>
  35 + Державна служба автомобільних доріг <br>
  36 + України
  37 + </div>
  38 + <div class="col-xs-6 text-center">
  39 + Служба автомобільних доріг у <?php echo $region->name; ?> області
  40 + </div>
  41 + <div class="clearfix"></div>
  42 + <div class="col-xs-12 text-center">
  43 + <p class="h3">Відомість</p>
  44 + <p>наявносіті</p>
  45 + <p><b>споруд автослужб, об'єктів сервісу</b></p>
  46 + <p>на автомобільній дорозі</p>
  47 + <p>
  48 + <ins><?php echo $road->name; ?></ins>
  49 + </p>
  50 + <p>
  51 + <ins><?php echo $road->roadType->definition; ?></ins>
  52 + значення станом на
  53 + <ins><?php echo date('d F Y'); ?> р.</ins>
  54 + </p>
  55 + </div>
  56 + <div class="col-xs-12 text-center">
  57 + <?php
  58 + echo GridView::widget([
  59 + 'dataProvider' => $dataProvider,
  60 + 'layout' => "{items}",
  61 + 'columns' => [
  62 + [
  63 + 'attribute' => 'location_right',
  64 + 'value' => function($model) {
  65 + /**
  66 + * @var ServiceObject $model
  67 + */
  68 + return $model->getRightString();
  69 + },
  70 + ],
  71 + [
  72 + 'attribute' => 'location_axis',
  73 + 'value' => function($model) {
  74 + /**
  75 + * @var ServiceObject $model
  76 + */
  77 + return $model->getAxisString();
  78 + },
  79 + ],
  80 + [
  81 + 'attribute' => 'location_left',
  82 + 'value' => function($model) {
  83 + /**
  84 + * @var ServiceObject $model
  85 + */
  86 + return $model->getLeftString();
  87 + },
  88 + ],
  89 + [
  90 + 'attribute' => 'service_object_type_id',
  91 + 'value' => function($model) {
  92 + /**
  93 + * @var ServiceObject $model
  94 + */
  95 + return $model->serviceObjectType->name;
  96 + },
  97 + ],
  98 + [
  99 + 'attribute' => 'settlement_id',
  100 + 'value' => function($model) {
  101 + /**
  102 + * @var ServiceObject $model
  103 + */
  104 + if(!empty($model->settlement->name)) {
  105 + return $model->settlement->name;
  106 + } else {
  107 + return false;
  108 + }
  109 + },
  110 + ],
  111 + 'distance',
  112 + 'capacity',
  113 + [
  114 + 'attribute' => 'department_affiliation_id',
  115 + 'value' => function($model) {
  116 + /**
  117 + * @var ServiceObject $model
  118 + */
  119 + return $model->departmentAffiliation->name;
  120 + },
  121 + ],
  122 + 'arrangement_elements',
  123 + ],
  124 + ]);
  125 + ?>
  126 + </div>
  127 +</div>
... ...
frontend/views/road/view.php
... ... @@ -5,6 +5,9 @@
5 5 * @var Region[] $settlement_regions
6 6 * @var Region[] $flow_intensity_regions
7 7 * @var Region[] $cross_section_regions
  8 + * @var Region[] $road_surface_regions
  9 + * @var Region[] $service_object_regions
  10 + * @var Region[] $bus_stop_regions
8 11 * @var Region[] $road_to_categories
9 12 * @var Region[] $road_width
10 13 */
... ... @@ -128,6 +131,84 @@
128 131 </div>
129 132 <div class="panel panel-default">
130 133 <div class="panel-heading">
  134 + <a href="#road_surfaces" data-toggle="collapse" aria-expanded="false" aria-controls="road_surfaces">Наявність та технічний стан покриття автодоріг</a>
  135 + </div>
  136 + <div class="panel-body collapse" id="road_surfaces">
  137 + <?php
  138 + if(!empty( $road_surface_regions )) {
  139 + ?>
  140 + <div class="list-group">
  141 + <?php
  142 + foreach($road_surface_regions as $region) {
  143 + echo Html::a($region->name . ' область', [
  144 + 'road-surface',
  145 + 'id' => $road->road_id,
  146 + 'region_id' => $region->region_id,
  147 + ]);
  148 + }
  149 + ?>
  150 + </div>
  151 + <?php
  152 + } else {
  153 + echo Html::tag('p', 'Відомості не знайдені.');
  154 + }
  155 + ?>
  156 + </div>
  157 + </div>
  158 + <div class="panel panel-default">
  159 + <div class="panel-heading">
  160 + <a href="#service_objects" data-toggle="collapse" aria-expanded="false" aria-controls="service_objects">Наявність споруд автослужб, об'єктів сервісу</a>
  161 + </div>
  162 + <div class="panel-body collapse" id="service_objects">
  163 + <?php
  164 + if(!empty( $service_object_regions )) {
  165 + ?>
  166 + <div class="list-group">
  167 + <?php
  168 + foreach($service_object_regions as $region) {
  169 + echo Html::a($region->name . ' область', [
  170 + 'service-object',
  171 + 'id' => $road->road_id,
  172 + 'region_id' => $region->region_id,
  173 + ]);
  174 + }
  175 + ?>
  176 + </div>
  177 + <?php
  178 + } else {
  179 + echo Html::tag('p', 'Відомості не знайдені.');
  180 + }
  181 + ?>
  182 + </div>
  183 + </div>
  184 + <div class="panel panel-default">
  185 + <div class="panel-heading">
  186 + <a href="#bus_stops" data-toggle="collapse" aria-expanded="false" aria-controls="bus_stops">Наявності та технічного стану автобусних зупинок</a>
  187 + </div>
  188 + <div class="panel-body collapse" id="bus_stops">
  189 + <?php
  190 + if(!empty( $bus_stop_regions )) {
  191 + ?>
  192 + <div class="list-group">
  193 + <?php
  194 + foreach($bus_stop_regions as $region) {
  195 + echo Html::a($region->name . ' область', [
  196 + 'bus-stop',
  197 + 'id' => $road->road_id,
  198 + 'region_id' => $region->region_id,
  199 + ]);
  200 + }
  201 + ?>
  202 + </div>
  203 + <?php
  204 + } else {
  205 + echo Html::tag('p', 'Відомості не знайдені.');
  206 + }
  207 + ?>
  208 + </div>
  209 + </div>
  210 + <div class="panel panel-default">
  211 + <div class="panel-heading">
131 212 <a href="#road_to_categories" data-toggle="collapse" aria-expanded="false" aria-controls="road_to_categories">Категорії доріг</a>
132 213 </div>
133 214 <div class="panel-body collapse" id="road_to_categories">
... ...
frontend/views/service-object/_form.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 + use yii\widgets\ActiveForm;
  5 +
  6 + /**
  7 + * @var yii\web\View $this
  8 + * @var common\models\ServiceObject $model
  9 + * @var array $roads
  10 + * @var array $regions
  11 + * @var array $service_object_types
  12 + * @var array $settlements
  13 + * @var array $department_affiliations
  14 + * @var yii\widgets\ActiveForm $form
  15 + */
  16 +?>
  17 +
  18 +<div class="service-object-form">
  19 +
  20 + <?php $form = ActiveForm::begin(); ?>
  21 +
  22 + <?= $form->field($model, 'road_id')
  23 + ->dropDownList($roads) ?>
  24 +
  25 + <?= $form->field($model, 'region_id')
  26 + ->dropDownList($regions) ?>
  27 +
  28 + <?= $form->field($model, 'service_object_type_id')
  29 + ->dropDownList($service_object_types) ?>
  30 +
  31 + <?= $form->field($model, 'settlement_id')
  32 + ->dropDownList($settlements, ['prompt' => 'Нет']) ?>
  33 +
  34 + <?= $form->field($model, 'department_affiliation_id')
  35 + ->dropDownList($department_affiliations) ?>
  36 +
  37 + <?= $form->field($model, 'location_right')
  38 + ->textInput() ?>
  39 +
  40 + <?= $form->field($model, 'location_left')
  41 + ->textInput() ?>
  42 +
  43 + <?= $form->field($model, 'location_axis')
  44 + ->textInput() ?>
  45 +
  46 + <?= $form->field($model, 'distance')
  47 + ->textInput() ?>
  48 +
  49 + <?= $form->field($model, 'capacity')
  50 + ->textInput() ?>
  51 +
  52 + <?= $form->field($model, 'arrangement_elements')
  53 + ->textarea([ 'rows' => 6 ]) ?>
  54 +
  55 + <div class="form-group">
  56 + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', [ 'class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary' ]) ?>
  57 + </div>
  58 +
  59 + <?php ActiveForm::end(); ?>
  60 +
  61 +</div>
... ...
frontend/views/service-object/_search.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\ActiveForm;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\ServiceObjectSearch */
  8 +/* @var $form yii\widgets\ActiveForm */
  9 +?>
  10 +
  11 +<div class="service-object-search">
  12 +
  13 + <?php $form = ActiveForm::begin([
  14 + 'action' => ['index'],
  15 + 'method' => 'get',
  16 + ]); ?>
  17 +
  18 + <?= $form->field($model, 'service_object_id') ?>
  19 +
  20 + <?= $form->field($model, 'road_id') ?>
  21 +
  22 + <?= $form->field($model, 'region_id') ?>
  23 +
  24 + <?= $form->field($model, 'service_object_type_id') ?>
  25 +
  26 + <?= $form->field($model, 'settlement_id') ?>
  27 +
  28 + <?php // echo $form->field($model, 'department_affiliation_id') ?>
  29 +
  30 + <?php // echo $form->field($model, 'location_right') ?>
  31 +
  32 + <?php // echo $form->field($model, 'location_left') ?>
  33 +
  34 + <?php // echo $form->field($model, 'location_axis') ?>
  35 +
  36 + <?php // echo $form->field($model, 'distance') ?>
  37 +
  38 + <?php // echo $form->field($model, 'capacity') ?>
  39 +
  40 + <?php // echo $form->field($model, 'arrangement_elements') ?>
  41 +
  42 + <div class="form-group">
  43 + <?= Html::submitButton('Search', ['class' => 'btn btn-primary']) ?>
  44 + <?= Html::resetButton('Reset', ['class' => 'btn btn-default']) ?>
  45 + </div>
  46 +
  47 + <?php ActiveForm::end(); ?>
  48 +
  49 +</div>
... ...
frontend/views/service-object/create.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var common\models\ServiceObject $model
  8 + * @var array $roads
  9 + * @var array $regions
  10 + * @var array $service_object_types
  11 + * @var array $settlements
  12 + * @var array $department_affiliations
  13 + */
  14 +
  15 + $this->title = 'Create Service Object';
  16 + $this->params[ 'breadcrumbs' ][] = [
  17 + 'label' => 'Service Objects',
  18 + 'url' => [ 'index' ],
  19 + ];
  20 + $this->params[ 'breadcrumbs' ][] = $this->title;
  21 +?>
  22 +<div class="service-object-create">
  23 +
  24 + <h1><?= Html::encode($this->title) ?></h1>
  25 +
  26 + <?= $this->render('_form', [
  27 + 'model' => $model,
  28 + 'roads' => $roads,
  29 + 'regions' => $regions,
  30 + 'service_object_types' => $service_object_types,
  31 + 'settlements' => $settlements,
  32 + 'department_affiliations' => $department_affiliations,
  33 + ]) ?>
  34 +
  35 +</div>
... ...
frontend/views/service-object/index.php 0 → 100644
  1 +<?php
  2 +
  3 + use common\models\ServiceObject;
  4 + use yii\helpers\Html;
  5 + use yii\grid\GridView;
  6 +
  7 + /* @var $this yii\web\View */
  8 + /* @var $searchModel common\models\ServiceObjectSearch */
  9 + /* @var $dataProvider yii\data\ActiveDataProvider */
  10 +
  11 + $this->title = 'Service Objects';
  12 + $this->params[ 'breadcrumbs' ][] = $this->title;
  13 +?>
  14 +<div class="service-object-index">
  15 +
  16 + <h1><?= Html::encode($this->title) ?></h1>
  17 + <?php // echo $this->render('_search', ['model' => $searchModel]); ?>
  18 +
  19 + <p>
  20 + <?= Html::a('Create Service Object', [ 'create' ], [ 'class' => 'btn btn-success' ]) ?>
  21 + </p>
  22 + <?= GridView::widget([
  23 + 'dataProvider' => $dataProvider,
  24 + 'filterModel' => $searchModel,
  25 + 'columns' => [
  26 + [ 'class' => 'yii\grid\SerialColumn' ],
  27 + [
  28 + 'attribute' => 'location_right',
  29 + 'value' => function($model) {
  30 + /**
  31 + * @var ServiceObject $model
  32 + */
  33 + return $model->getRightString();
  34 + },
  35 + ],
  36 + [
  37 + 'attribute' => 'location_left',
  38 + 'value' => function($model) {
  39 + /**
  40 + * @var ServiceObject $model
  41 + */
  42 + return $model->getLeftString();
  43 + },
  44 + ],
  45 + [
  46 + 'attribute' => 'location_axis',
  47 + 'value' => function($model) {
  48 + /**
  49 + * @var ServiceObject $model
  50 + */
  51 + return $model->getAxisString();
  52 + },
  53 + ],
  54 + [
  55 + 'attribute' => 'road_id',
  56 + 'value' => function($model) {
  57 + /**
  58 + * @var ServiceObject $model
  59 + */
  60 + return $model->road->name;
  61 + },
  62 + ],
  63 + [
  64 + 'attribute' => 'region_id',
  65 + 'value' => function($model) {
  66 + /**
  67 + * @var ServiceObject $model
  68 + */
  69 + return $model->region->name;
  70 + },
  71 + ],
  72 + [
  73 + 'attribute' => 'service_object_type_id',
  74 + 'value' => function($model) {
  75 + /**
  76 + * @var ServiceObject $model
  77 + */
  78 + return $model->serviceObjectType->name;
  79 + },
  80 + ],
  81 + [ 'class' => 'yii\grid\ActionColumn' ],
  82 + ],
  83 + ]); ?>
  84 +</div>
... ...
frontend/views/service-object/update.php 0 → 100644
  1 +<?php
  2 +
  3 + use yii\helpers\Html;
  4 +
  5 + /**
  6 + * @var yii\web\View $this
  7 + * @var common\models\ServiceObject $model
  8 + * @var array $roads
  9 + * @var array $regions
  10 + * @var array $service_object_types
  11 + * @var array $settlements
  12 + * @var array $department_affiliations
  13 + */
  14 +
  15 + $this->title = 'Update Service Object: ' . $model->service_object_id;
  16 + $this->params[ 'breadcrumbs' ][] = [
  17 + 'label' => 'Service Objects',
  18 + 'url' => [ 'index' ],
  19 + ];
  20 + $this->params[ 'breadcrumbs' ][] = [
  21 + 'label' => $model->service_object_id,
  22 + 'url' => [
  23 + 'view',
  24 + 'id' => $model->service_object_id,
  25 + ],
  26 + ];
  27 + $this->params[ 'breadcrumbs' ][] = 'Update';
  28 +?>
  29 +<div class="service-object-update">
  30 +
  31 + <h1><?= Html::encode($this->title) ?></h1>
  32 +
  33 + <?= $this->render('_form', [
  34 + 'model' => $model,
  35 + 'roads' => $roads,
  36 + 'regions' => $regions,
  37 + 'service_object_types' => $service_object_types,
  38 + 'settlements' => $settlements,
  39 + 'department_affiliations' => $department_affiliations,
  40 + ]) ?>
  41 +
  42 +</div>
... ...
frontend/views/service-object/view.php 0 → 100644
  1 +<?php
  2 +
  3 +use yii\helpers\Html;
  4 +use yii\widgets\DetailView;
  5 +
  6 +/* @var $this yii\web\View */
  7 +/* @var $model common\models\ServiceObject */
  8 +
  9 +$this->title = $model->service_object_id;
  10 +$this->params['breadcrumbs'][] = ['label' => 'Service Objects', 'url' => ['index']];
  11 +$this->params['breadcrumbs'][] = $this->title;
  12 +?>
  13 +<div class="service-object-view">
  14 +
  15 + <h1><?= Html::encode($this->title) ?></h1>
  16 +
  17 + <p>
  18 + <?= Html::a('Update', ['update', 'id' => $model->service_object_id], ['class' => 'btn btn-primary']) ?>
  19 + <?= Html::a('Delete', ['delete', 'id' => $model->service_object_id], [
  20 + 'class' => 'btn btn-danger',
  21 + 'data' => [
  22 + 'confirm' => 'Are you sure you want to delete this item?',
  23 + 'method' => 'post',
  24 + ],
  25 + ]) ?>
  26 + </p>
  27 +
  28 + <?= DetailView::widget([
  29 + 'model' => $model,
  30 + 'attributes' => [
  31 + 'service_object_id',
  32 + 'road_id',
  33 + 'region_id',
  34 + 'service_object_type_id',
  35 + 'settlement_id',
  36 + 'department_affiliation_id',
  37 + 'location_right',
  38 + 'location_left',
  39 + 'location_axis',
  40 + 'distance',
  41 + 'capacity',
  42 + 'arrangement_elements:ntext',
  43 + ],
  44 + ]) ?>
  45 +
  46 +</div>
... ...