From 3d730a7c2ac77bee309c32e49a21d4999e165e51 Mon Sep 17 00:00:00 2001 From: yarik Date: Tue, 12 Jul 2016 15:50:49 +0300 Subject: [PATCH] Yarik --- common/models/CrossSection.php | 176 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/CrossSectionSearch.php | 85 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/StateCommon.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/SurfaceType.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160712_104942_create_road_to_category.php | 39 +++++++++++++++++++++++++++++++++++++++ console/migrations/m160712_110146_create_cross_section.php | 87 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/CrossSectionController.php | 224 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/RoadController.php | 41 +++++++++++++++++++++++++++++++++++++++++ frontend/views/cross-section/_form.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/cross-section/_search.php | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/cross-section/create.php | 33 +++++++++++++++++++++++++++++++++ frontend/views/cross-section/index.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/cross-section/update.php | 31 +++++++++++++++++++++++++++++++ frontend/views/cross-section/view.php | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/road/cross-section.php | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ frontend/views/road/view.php | 33 +++++++++++++++++++++++++++++++++ 16 files changed, 1166 insertions(+), 0 deletions(-) create mode 100644 common/models/CrossSection.php create mode 100644 common/models/CrossSectionSearch.php create mode 100644 common/models/StateCommon.php create mode 100644 common/models/SurfaceType.php create mode 100644 console/migrations/m160712_104942_create_road_to_category.php create mode 100644 console/migrations/m160712_110146_create_cross_section.php create mode 100644 frontend/controllers/CrossSectionController.php create mode 100644 frontend/views/cross-section/_form.php create mode 100644 frontend/views/cross-section/_search.php create mode 100644 frontend/views/cross-section/create.php create mode 100644 frontend/views/cross-section/index.php create mode 100644 frontend/views/cross-section/update.php create mode 100644 frontend/views/cross-section/view.php create mode 100755 frontend/views/road/cross-section.php diff --git a/common/models/CrossSection.php b/common/models/CrossSection.php new file mode 100644 index 0000000..0eb2f73 --- /dev/null +++ b/common/models/CrossSection.php @@ -0,0 +1,176 @@ + 255, + ], + [ + [ 'region_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Region::className(), + 'targetAttribute' => [ 'region_id' => 'region_id' ], + ], + [ + [ 'road_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => Road::className(), + 'targetAttribute' => [ 'road_id' => 'road_id' ], + ], + [ + [ 'state_common_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => StateCommon::className(), + 'targetAttribute' => [ 'state_common_id' => 'state_common_id' ], + ], + [ + [ 'surface_type_id' ], + 'exist', + 'skipOnError' => true, + 'targetClass' => SurfaceType::className(), + 'targetAttribute' => [ 'surface_type_id' => 'surface_type_id' ], + ], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'cross_section_id' => 'Індекс', + 'region_id' => 'Область', + 'road_id' => 'Дорога', + 'location_left' => 'Місцеположення, км+ зліва', + 'location_right' => 'Місцеположення, км+ справа', + 'direction' => 'Напрямок з\'їзду', + 'surface_type_id' => 'Тип покриття', + 'length_section' => 'Фактична довжина, м з\'їзду', + 'length_surface' => 'Фактична довжина, м покриття', + 'distance_edge' => 'Відстань від крайки проїзної частики, м', + 'width' => 'Ширина, м', + 'angle' => 'Кут примикання', + 'tube_availability' => 'Наявність облаштування, труба', + 'safety_availability' => 'Наявність облаштування, острівок безпеки', + 'year_build' => 'Рік спорудження', + 'year_repair' => 'Рік ремонту', + 'state_common_id' => 'Технічний стан', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRegion() + { + return $this->hasOne(Region::className(), [ 'region_id' => 'region_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getRoad() + { + return $this->hasOne(Road::className(), [ 'road_id' => 'road_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getStateCommon() + { + return $this->hasOne(StateCommon::className(), [ 'state_common_id' => 'state_common_id' ]); + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getSurfaceType() + { + return $this->hasOne(SurfaceType::className(), [ 'surface_type_id' => 'surface_type_id' ]); + } + + public function getRightString() + { + return floor($this->location_right) . '+' . ( str_pad(round(( $this->location_right - floor($this->location_right) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + + public function getLeftString() + { + return floor($this->location_left) . '+' . ( str_pad(round(( $this->location_left - floor($this->location_left) ) * 1000), 3, '0', STR_PAD_LEFT) ); + } + } diff --git a/common/models/CrossSectionSearch.php b/common/models/CrossSectionSearch.php new file mode 100644 index 0000000..821bed5 --- /dev/null +++ b/common/models/CrossSectionSearch.php @@ -0,0 +1,85 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to return any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + // grid filtering conditions + $query->andFilterWhere([ + 'cross_section_id' => $this->cross_section_id, + 'region_id' => $this->region_id, + 'road_id' => $this->road_id, + 'location_left' => $this->location_left, + 'location_right' => $this->location_right, + 'surface_type_id' => $this->surface_type_id, + 'length_section' => $this->length_section, + 'length_surface' => $this->length_surface, + 'distance_edge' => $this->distance_edge, + 'width' => $this->width, + 'angle' => $this->angle, + 'tube_availability' => $this->tube_availability, + 'safety_availability' => $this->safety_availability, + 'year_build' => $this->year_build, + 'year_repair' => $this->year_repair, + 'state_common_id' => $this->state_common_id, + ]); + + $query->andFilterWhere(['like', 'direction', $this->direction]); + + return $dataProvider; + } +} diff --git a/common/models/StateCommon.php b/common/models/StateCommon.php new file mode 100644 index 0000000..a60cc86 --- /dev/null +++ b/common/models/StateCommon.php @@ -0,0 +1,53 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'state_common_id' => 'Ідентифікатор', + 'value' => 'Значення', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getCrossSections() + { + return $this->hasMany(CrossSection::className(), ['state_common_id' => 'state_common_id']); + } +} diff --git a/common/models/SurfaceType.php b/common/models/SurfaceType.php new file mode 100644 index 0000000..48cc5c0 --- /dev/null +++ b/common/models/SurfaceType.php @@ -0,0 +1,53 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'surface_type_id' => 'Surface Type ID', + 'name' => 'Name', + ]; + } + + /** + * @return \yii\db\ActiveQuery + */ + public function getCrossSections() + { + return $this->hasMany(CrossSection::className(), ['surface_type_id' => 'surface_type_id']); + } +} diff --git a/console/migrations/m160712_104942_create_road_to_category.php b/console/migrations/m160712_104942_create_road_to_category.php new file mode 100644 index 0000000..9819615 --- /dev/null +++ b/console/migrations/m160712_104942_create_road_to_category.php @@ -0,0 +1,39 @@ +createTable('road_to_category', [ + 'road_to_category_id' => $this->primaryKey()->comment('Індекс'), + 'region_id' => $this->integer()->comment('Область'), + 'road_id' => $this->integer()->comment('Дорога'), + 'begin' => $this->float()->comment('Місцезнаходження, км+ початок'), + 'end' => $this->float()->comment('Місцезнаходження, км+ кінець'), + 'distance' => $this->float()->comment('Протяжність, км'), + 'road_category_id' => $this->integer()->comment('Категорія'), + ]); + $this->addForeignKey('road_to_category_region', 'road_to_category', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('road_to_category_road', 'road_to_category', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('road_to_category_road_category', 'road_to_category', 'road_category_id', 'road_category', 'road_category_id', 'CASCADE', 'CASCADE'); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropForeignKey('road_to_category_region', 'road_to_category'); + $this->dropForeignKey('road_to_category_road', 'road_to_category'); + $this->dropForeignKey('road_to_category_road_category', 'road_to_category'); + $this->dropTable('road_to_category'); + } +} diff --git a/console/migrations/m160712_110146_create_cross_section.php b/console/migrations/m160712_110146_create_cross_section.php new file mode 100644 index 0000000..2770fa0 --- /dev/null +++ b/console/migrations/m160712_110146_create_cross_section.php @@ -0,0 +1,87 @@ +createTable('cross_section', [ + 'cross_section_id' => $this->primaryKey() + ->comment('Індекс'), + 'region_id' => $this->integer() + ->comment('Область'), + 'road_id' => $this->integer() + ->comment('Дорога'), + 'location_left' => $this->float() + ->comment('Місцеположення, км+ справа'), + 'location_right' => $this->float() + ->comment('Місцеположення, км+ зліва'), + 'direction' => $this->string() + ->comment('Напрямок з\'їзду'), + 'surface_type_id' => $this->integer() + ->comment('Тип покриття'), + 'length_section' => $this->float() + ->comment('Фактична довжина, м з\'їзду'), + 'length_surface' => $this->float() + ->comment('Фактична довжина, м покриття'), + 'distance_edge' => $this->float() + ->comment('Відстань від крайки проїзної частики, м'), + 'width' => $this->float() + ->comment('Ширина, м'), + 'angle' => $this->float() + ->comment('Кут примикання'), + 'tube_availability' => $this->integer() + ->comment('Наявність облаштування, труба'), + 'safety_availability' => $this->integer() + ->comment('Наявність облаштування, острівок безпеки'), + 'year_build' => $this->integer() + ->comment('Рік спорудження'), + 'year_repair' => $this->integer() + ->comment('Рік ремонту'), + 'state_common_id' => $this->integer() + ->comment('Технічний стан'), + ]); + $this->createTable('surface_type', [ + 'surface_type_id' => $this->primaryKey(), + 'name' => $this->string(), + ]); + $this->createTable('state_common', [ + 'state_common_id' => $this->primaryKey()->comment('Ідентифікатор'), + 'value' => $this->string()->comment('Значення'), + ]); + $this->addCommentOnTable('state_common', 'Стан простого об’єкту'); + $this->batchInsert('state_common', [ 'value' ], [ + [ 'добрий' ], + [ 'задовільний' ], + [ 'незадовільний' ], + [ 'непрацездатний' ], + [ 'аварійний' ], + ]); + $this->addForeignKey('cross_section_region', 'cross_section', 'region_id', 'region', 'region_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('cross_section_road', 'cross_section', 'road_id', 'road', 'road_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('cross_section_surface_type', 'cross_section', 'surface_type_id', 'surface_type', 'surface_type_id', 'CASCADE', 'CASCADE'); + $this->addForeignKey('cross_section_state_common', 'cross_section', 'state_common_id', 'state_common', 'state_common_id', 'CASCADE', 'CASCADE'); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropForeignKey('cross_section_region', 'cross_section'); + $this->dropForeignKey('cross_section_road', 'cross_section'); + $this->dropForeignKey('cross_section_surface_type', 'cross_section'); + $this->dropForeignKey('cross_section_state_common', 'cross_section'); + $this->dropTable('cross_section'); + $this->dropTable('surface_type'); + $this->dropTable('state_common'); + } + } diff --git a/frontend/controllers/CrossSectionController.php b/frontend/controllers/CrossSectionController.php new file mode 100644 index 0000000..6cb949f --- /dev/null +++ b/frontend/controllers/CrossSectionController.php @@ -0,0 +1,224 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => [ 'POST' ], + ], + ], + ]; + } + + /** + * Lists all CrossSection models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new CrossSectionSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single CrossSection model. + * + * @param integer $id + * + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new CrossSection model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new CrossSection(); + + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + + $surface_types = SurfaceType::find() + ->select([ + 'name', + 'surface_type_id', + ]) + ->asArray() + ->indexBy('surface_type_id') + ->column(); + + $state_commons = StateCommon::find() + ->select([ + 'value', + 'state_common_id', + ]) + ->asArray() + ->indexBy('state_common_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->cross_section_id, + ]); + } else { + return $this->render('create', [ + 'model' => $model, + 'regions' => $regions, + 'roads' => $roads, + 'surface_types' => $surface_types, + 'state_commons' => $state_commons, + ]); + } + } + + /** + * Updates an existing CrossSection model. + * If update is successful, the browser will be redirected to the 'view' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionUpdate($id) + { + $model = $this->findModel($id); + + $regions = Region::find() + ->select([ + 'name', + 'region_id', + ]) + ->asArray() + ->indexBy('region_id') + ->column(); + + $roads = Road::find() + ->select([ + 'name', + 'road_id', + ]) + ->asArray() + ->indexBy('road_id') + ->column(); + + $surface_types = SurfaceType::find() + ->select([ + 'name', + 'surface_type_id', + ]) + ->asArray() + ->indexBy('surface_type_id') + ->column(); + + $state_commons = StateCommon::find() + ->select([ + 'value', + 'state_common_id', + ]) + ->asArray() + ->indexBy('state_common_id') + ->column(); + + if($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect([ + 'view', + 'id' => $model->cross_section_id, + ]); + } else { + return $this->render('update', [ + 'model' => $model, + 'regions' => $regions, + 'roads' => $roads, + 'surface_types' => $surface_types, + 'state_commons' => $state_commons, + ]); + } + } + + /** + * Deletes an existing CrossSection model. + * If deletion is successful, the browser will be redirected to the 'index' page. + * + * @param integer $id + * + * @return mixed + */ + public function actionDelete($id) + { + $this->findModel($id) + ->delete(); + + return $this->redirect([ 'index' ]); + } + + /** + * Finds the CrossSection model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * + * @param integer $id + * + * @return CrossSection the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if(( $model = CrossSection::findOne($id) ) !== NULL) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + } diff --git a/frontend/controllers/RoadController.php b/frontend/controllers/RoadController.php index cb8b7b4..9c2bf33 100755 --- a/frontend/controllers/RoadController.php +++ b/frontend/controllers/RoadController.php @@ -1,6 +1,7 @@ where([ 'region_id' => $region_ids ]) ->all(); } + // До сюда заменяешь название своей моделью $flow_intensity_regions = [ ]; $region_ids = [ ]; $region_ids = FlowIntensity::find() @@ -166,10 +169,23 @@ ->where([ 'region_id' => $region_ids ]) ->all(); } + $cross_section_regions = [ ]; + $region_ids = [ ]; + $region_ids = CrossSection::find() + ->distinct() + ->select('region_id') + ->where([ 'road_id' => $id ]) + ->column(); + if(!empty( $region_ids )) { + $cross_section_regions = Region::find() + ->where([ 'region_id' => $region_ids ]) + ->all(); + } return $this->render('view', [ 'road' => $road, 'settlement_regions' => $settlement_regions, 'flow_intensity_regions' => $flow_intensity_regions, + 'cross_section_regions' => $cross_section_regions, ]); } @@ -222,4 +238,29 @@ 'dataProvider' => $dataProvider, ]); } + + public function actionCrossSection($id, $region_id) + { + $road = Road::findOne($id); + if(empty( $road )) { + throw new NotFoundHttpException('Road not found'); + } + $region = Region::findOne($region_id); + if(empty( $region )) { + throw new NotFoundHttpException('Region not found'); + } + $dataProvider = new ActiveDataProvider([ + 'query' => CrossSection::find() + ->where([ + 'road_id' => $id, + 'region_id' => $region_id, + ]), + 'pagination' => false, + ]); + return $this->render('cross-section', [ + 'road' => $road, + 'region' => $region, + 'dataProvider' => $dataProvider, + ]); + } } diff --git a/frontend/views/cross-section/_form.php b/frontend/views/cross-section/_form.php new file mode 100644 index 0000000..738b6e6 --- /dev/null +++ b/frontend/views/cross-section/_form.php @@ -0,0 +1,59 @@ + + +
+ + + + field($model, 'region_id')->dropDownList($regions) ?> + + field($model, 'road_id')->dropDownList($roads) ?> + + field($model, 'location_left')->textInput() ?> + + field($model, 'location_right')->textInput() ?> + + field($model, 'direction')->textInput(['maxlength' => true]) ?> + + field($model, 'surface_type_id')->dropDownList($surface_types) ?> + + field($model, 'length_section')->textInput() ?> + + field($model, 'length_surface')->textInput() ?> + + field($model, 'distance_edge')->textInput() ?> + + field($model, 'width')->textInput() ?> + + field($model, 'angle')->textInput() ?> + + field($model, 'tube_availability')->dropDownList([0 => 'немає', 1 => 'є']) ?> + + field($model, 'safety_availability')->dropDownList([0 => 'немає', 1 => 'є']) ?> + + field($model, 'year_build')->textInput() ?> + + field($model, 'year_repair')->textInput() ?> + + field($model, 'state_common_id')->dropDownList($state_commons) ?> + +
+ isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/frontend/views/cross-section/_search.php b/frontend/views/cross-section/_search.php new file mode 100644 index 0000000..3a4c5ff --- /dev/null +++ b/frontend/views/cross-section/_search.php @@ -0,0 +1,59 @@ + + + diff --git a/frontend/views/cross-section/create.php b/frontend/views/cross-section/create.php new file mode 100644 index 0000000..ed13568 --- /dev/null +++ b/frontend/views/cross-section/create.php @@ -0,0 +1,33 @@ +title = 'Create Cross Section'; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Cross Sections', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'regions' => $regions, + 'roads' => $roads, + 'surface_types' => $surface_types, + 'state_commons' => $state_commons, + ]) ?> + +
diff --git a/frontend/views/cross-section/index.php b/frontend/views/cross-section/index.php new file mode 100644 index 0000000..91efa7f --- /dev/null +++ b/frontend/views/cross-section/index.php @@ -0,0 +1,48 @@ +title = 'Наявність та технічний стан з\'їздів'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ render('_search', ['model' => $searchModel]); ?> + +

+ 'btn btn-success']) ?> +

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'cross_section_id', + 'region_id', + 'road_id', + 'location_left', + 'location_right', + // 'direction', + // 'surface_type_id', + // 'length_section', + // 'length_surface', + // 'distance_edge', + // 'width', + // 'angle', + // 'tube_availability', + // 'safety_availability', + // 'year_build', + // 'year_repair', + // 'state_common_id', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
diff --git a/frontend/views/cross-section/update.php b/frontend/views/cross-section/update.php new file mode 100644 index 0000000..0c897d3 --- /dev/null +++ b/frontend/views/cross-section/update.php @@ -0,0 +1,31 @@ +title = 'Update Cross Section: ' . $model->cross_section_id; +$this->params['breadcrumbs'][] = ['label' => 'Cross Sections', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->cross_section_id, 'url' => ['view', 'id' => $model->cross_section_id]]; +$this->params['breadcrumbs'][] = 'Update'; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + 'regions' => $regions, + 'roads' => $roads, + 'surface_types' => $surface_types, + 'state_commons' => $state_commons, + ]) ?> + +
diff --git a/frontend/views/cross-section/view.php b/frontend/views/cross-section/view.php new file mode 100644 index 0000000..4854b68 --- /dev/null +++ b/frontend/views/cross-section/view.php @@ -0,0 +1,51 @@ +title = $model->cross_section_id; +$this->params['breadcrumbs'][] = ['label' => 'Cross Sections', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->cross_section_id], ['class' => 'btn btn-primary']) ?> + $model->cross_section_id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Are you sure you want to delete this item?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'cross_section_id', + 'region_id', + 'road_id', + 'location_left', + 'location_right', + 'direction', + 'surface_type_id', + 'length_section', + 'length_surface', + 'distance_edge', + 'width', + 'angle', + 'tube_availability', + 'safety_availability', + 'year_build', + 'year_repair', + 'state_common_id', + ], + ]) ?> + +
diff --git a/frontend/views/road/cross-section.php b/frontend/views/road/cross-section.php new file mode 100755 index 0000000..c60f6c1 --- /dev/null +++ b/frontend/views/road/cross-section.php @@ -0,0 +1,94 @@ +title = $road->name; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => 'Дороги', + 'url' => [ 'index' ], + ]; + $this->params[ 'breadcrumbs' ][] = [ + 'label' => $this->title, + 'url' => [ + 'view', + 'id' => $road->road_id, + ], + ]; + $this->params[ 'breadcrumbs' ][] = 'Відомість інтенсивності руху та склад транспортного потоку - ' . ucfirst($region->name). ' область'; +?> +
+
+ Міністрество транспорту України
+ Державна служба автомобільних доріг
+ України +
+
+ Служба автомобільних доріг у name; ?> області +
+
+
+

Відомість

+

інтенсивності руху та склад транспортного потоку

+

на автомобільній дорозі

+

name; ?>

+

roadType->definition;?> значення станом на р.

+
+
+ $dataProvider, + 'layout' => "{items}", + 'columns' => [ + [ + 'attribute' => 'location_right', + 'value' => function($model) { + /** + * @var CrossSection $model + */ + return $model->getRightString(); + } + ], + [ + 'attribute' => 'location_left', + 'value' => function($model) { + /** + * @var CrossSection $model + */ + return $model->getLeftString(); + } + ], + 'direction', + [ + 'attribute' => 'surface_type_id', + 'value' => function($model) { + /** + * @var CrossSection $model + */ + return $model->surfaceType->name; + } + ], + 'length_section', + 'length_surface', + 'distance_edge', + 'width', + 'angle', + 'tube_availability:boolean', + 'safety_availability:boolean', + 'year_build', + 'year_repair', + 'state_common_id', + ], + ]); + ?> +
+
diff --git a/frontend/views/road/view.php b/frontend/views/road/view.php index 6de75d4..af557fa 100755 --- a/frontend/views/road/view.php +++ b/frontend/views/road/view.php @@ -4,6 +4,7 @@ * @var Road $road * @var Region[] $settlement_regions * @var Region[] $flow_intensity_regions + * @var Region[] $cross_section_regions */ use common\models\Region; @@ -39,6 +40,9 @@

Відомості:

+ + +
+ +
+ +
+ name . ' область', [ + 'cross-section', + 'id' => $road->road_id, + 'region_id' => $region->region_id, + ]); + } + ?> +
+ +
+
-- libgit2 0.21.4