From cb6805b8fc4ece81923a0bf70c976b3d929905fb Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Tue, 12 Apr 2016 10:11:17 +0300 Subject: [PATCH] 12.04.16 finish event, service --- backend/controllers/EventController.php | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/controllers/PageController.php | 136 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/controllers/SeoController.php | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/controllers/ServiceController.php | 124 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/event/_form.php | 74 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/event/_search.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/event/create.php | 21 +++++++++++++++++++++ backend/views/event/index.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ backend/views/event/update.php | 23 +++++++++++++++++++++++ backend/views/event/view.php | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/layouts/main-sidebar.php | 4 ++++ backend/views/page/_form.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ backend/views/page/_search.php | 43 +++++++++++++++++++++++++++++++++++++++++++ backend/views/page/create.php | 21 +++++++++++++++++++++ backend/views/page/index.php | 41 +++++++++++++++++++++++++++++++++++++++++ backend/views/page/update.php | 21 +++++++++++++++++++++ backend/views/page/view.php | 42 ++++++++++++++++++++++++++++++++++++++++++ backend/views/service/_form.php | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ backend/views/service/_search.php | 45 +++++++++++++++++++++++++++++++++++++++++++++ backend/views/service/create.php | 21 +++++++++++++++++++++ backend/views/service/index.php | 44 ++++++++++++++++++++++++++++++++++++++++++++ backend/views/service/update.php | 23 +++++++++++++++++++++++ backend/views/service/view.php | 47 +++++++++++++++++++++++++++++++++++++++++++++++ common/behaviors/Slug.php | 14 +++++++++----- common/models/Event.php | 102 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/EventSearch.php | 83 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Page.php | 79 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/PageSearch.php | 72 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Seo.php | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/SeoSearch.php | 73 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Service.php | 81 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/ServiceSearch.php | 78 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ common/models/Slider.php | 2 +- console/migrations/m160406_221846_create_page.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ console/migrations/m160407_185510_create_event.php | 38 ++++++++++++++++++++++++++++++++++++++ console/migrations/m160411_211053_create_service.php | 37 +++++++++++++++++++++++++++++++++++++ console/migrations/m160411_215739_create_seo.php | 33 +++++++++++++++++++++++++++++++++ frontend/config/main.php | 3 +++ frontend/controllers/EventController.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ frontend/controllers/PageController.php | 20 ++++++++++++++++++++ frontend/controllers/ServiceController.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ frontend/helpers/TextHelper.php | 24 ++++++++++++++++++++++++ frontend/page/show.php | 4 ++++ frontend/views/event/_objects.php | 38 ++++++++++++++++++++++++++++++++++++++ frontend/views/event/index.php | 13 +++++++++++++ frontend/views/event/view.php | 23 +++++++++++++++++++++++ frontend/views/layouts/main.php | 10 +++++----- frontend/views/layouts/main_menu.php | 13 ++++++++++--- frontend/views/page/show.php | 7 +++++++ frontend/views/service/_objects.php | 35 +++++++++++++++++++++++++++++++++++ frontend/views/service/index.php | 13 +++++++++++++ frontend/views/service/view.php | 20 ++++++++++++++++++++ frontend/web/css/style.css | 32 ++++++++++++++++++++++++++++++++ frontend/web/images/ico-2.jpg | Bin 0 -> 1896 bytes frontend/widgets/Seo.php | 33 +++++++++++++++++++++++++++++++++ 55 files changed, 2397 insertions(+), 14 deletions(-) create mode 100644 backend/controllers/EventController.php create mode 100644 backend/controllers/PageController.php create mode 100644 backend/controllers/SeoController.php create mode 100644 backend/controllers/ServiceController.php create mode 100644 backend/views/event/_form.php create mode 100644 backend/views/event/_search.php create mode 100644 backend/views/event/create.php create mode 100644 backend/views/event/index.php create mode 100644 backend/views/event/update.php create mode 100644 backend/views/event/view.php create mode 100644 backend/views/page/_form.php create mode 100644 backend/views/page/_search.php create mode 100644 backend/views/page/create.php create mode 100644 backend/views/page/index.php create mode 100644 backend/views/page/update.php create mode 100644 backend/views/page/view.php create mode 100644 backend/views/service/_form.php create mode 100644 backend/views/service/_search.php create mode 100644 backend/views/service/create.php create mode 100644 backend/views/service/index.php create mode 100644 backend/views/service/update.php create mode 100644 backend/views/service/view.php create mode 100644 common/models/Event.php create mode 100644 common/models/EventSearch.php create mode 100644 common/models/Page.php create mode 100644 common/models/PageSearch.php create mode 100644 common/models/Seo.php create mode 100644 common/models/SeoSearch.php create mode 100644 common/models/Service.php create mode 100644 common/models/ServiceSearch.php create mode 100644 console/migrations/m160406_221846_create_page.php create mode 100644 console/migrations/m160407_185510_create_event.php create mode 100644 console/migrations/m160411_211053_create_service.php create mode 100644 console/migrations/m160411_215739_create_seo.php create mode 100644 frontend/controllers/EventController.php create mode 100644 frontend/controllers/PageController.php create mode 100644 frontend/controllers/ServiceController.php create mode 100644 frontend/helpers/TextHelper.php create mode 100644 frontend/page/show.php create mode 100644 frontend/views/event/_objects.php create mode 100644 frontend/views/event/index.php create mode 100644 frontend/views/event/view.php create mode 100644 frontend/views/page/show.php create mode 100644 frontend/views/service/_objects.php create mode 100644 frontend/views/service/index.php create mode 100644 frontend/views/service/view.php create mode 100644 frontend/web/images/ico-2.jpg create mode 100644 frontend/widgets/Seo.php diff --git a/backend/controllers/EventController.php b/backend/controllers/EventController.php new file mode 100644 index 0000000..5c1b366 --- /dev/null +++ b/backend/controllers/EventController.php @@ -0,0 +1,124 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Event models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new EventSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Event model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Event model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Event(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->event_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Event 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); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->event_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Event 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 Event model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Event the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Event::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/PageController.php b/backend/controllers/PageController.php new file mode 100644 index 0000000..778dbfe --- /dev/null +++ b/backend/controllers/PageController.php @@ -0,0 +1,136 @@ + [ + 'class' => AccessControl::className(), + 'rules' => [ + [ + 'actions' => ['login', 'error'], + 'allow' => true, + ], + [ + 'actions' => ['logout', 'index','create','update','view','delete','test-img' ], + 'allow' => true, + 'roles' => ['@'], + ], + ], + ], + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'logout' => ['post'], + ], + ], + ]; + } + + /** + * Lists all Page models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new PageSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Page model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Page model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Page(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Page 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); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Page 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 Page model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Page the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Page::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/SeoController.php b/backend/controllers/SeoController.php new file mode 100644 index 0000000..13a21a0 --- /dev/null +++ b/backend/controllers/SeoController.php @@ -0,0 +1,124 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Seo models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new SeoSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Seo model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Seo model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Seo(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->seo_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Seo 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); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->seo_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Seo 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 Seo model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Seo the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Seo::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/controllers/ServiceController.php b/backend/controllers/ServiceController.php new file mode 100644 index 0000000..8f20add --- /dev/null +++ b/backend/controllers/ServiceController.php @@ -0,0 +1,124 @@ + [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Service models. + * @return mixed + */ + public function actionIndex() + { + $searchModel = new ServiceSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + /** + * Displays a single Service model. + * @param integer $id + * @return mixed + */ + public function actionView($id) + { + return $this->render('view', [ + 'model' => $this->findModel($id), + ]); + } + + /** + * Creates a new Service model. + * If creation is successful, the browser will be redirected to the 'view' page. + * @return mixed + */ + public function actionCreate() + { + $model = new Service(); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->service_id]); + } else { + return $this->render('create', [ + 'model' => $model, + ]); + } + } + + /** + * Updates an existing Service 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); + + if ($model->load(Yii::$app->request->post()) && $model->save()) { + return $this->redirect(['view', 'id' => $model->service_id]); + } else { + return $this->render('update', [ + 'model' => $model, + ]); + } + } + + /** + * Deletes an existing Service 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 Service model based on its primary key value. + * If the model is not found, a 404 HTTP exception will be thrown. + * @param integer $id + * @return Service the loaded model + * @throws NotFoundHttpException if the model cannot be found + */ + protected function findModel($id) + { + if (($model = Service::findOne($id)) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } +} diff --git a/backend/views/event/_form.php b/backend/views/event/_form.php new file mode 100644 index 0000000..15c6cfa --- /dev/null +++ b/backend/views/event/_form.php @@ -0,0 +1,74 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'alias')->textInput(['maxlength' => true]) ?> + + field($model, 'body')->widget(CKEditor::className(), + [ + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать + 'inline' => false, //по умолчанию false]), + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') + ] + ) + ]) ?> + + + field($model, 'end_at') + ->widget(DatePicker::className(), [ + 'dateFormat' => 'yyyy-MM-dd', + 'clientOptions' => [ 'minDate' => 1 ], + ]) ?> + + + $model, + 'field'=>'image', + 'size' => [ + [ + 'width'=>200, + 'height'=>200, + ], + [ + 'width'=>940, + 'height'=>480, + ] + ], + 'multi'=>false, + 'gallery' => $model->image, + 'name' => 'Загрузить изображение' + ]); + ?> + + field($model, 'meta_title')->textInput(['maxlength' => true]) ?> + + field($model, 'description')->textInput(['maxlength' => true]) ?> + + field($model, 'h1')->textInput(['maxlength' => true]) ?> + + field($model, 'seo_text')->textarea(['rows' => 6]) ?> + + + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/event/_search.php b/backend/views/event/_search.php new file mode 100644 index 0000000..4185226 --- /dev/null +++ b/backend/views/event/_search.php @@ -0,0 +1,49 @@ + + + diff --git a/backend/views/event/create.php b/backend/views/event/create.php new file mode 100644 index 0000000..cfc38fa --- /dev/null +++ b/backend/views/event/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create Event'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/event/index.php b/backend/views/event/index.php new file mode 100644 index 0000000..7f0e340 --- /dev/null +++ b/backend/views/event/index.php @@ -0,0 +1,45 @@ +title = Yii::t('app', 'Events'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

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

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'event_id', + 'name', + 'alias', + [ + 'format' => 'image', + 'attribute'=>'image', + ], + // 'meta_title', + // 'description', + // 'h1', + // 'seo_text:ntext', + // 'created_at', + // 'updated_at', + // 'end_at', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
diff --git a/backend/views/event/update.php b/backend/views/event/update.php new file mode 100644 index 0000000..d8f4f48 --- /dev/null +++ b/backend/views/event/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Event', +]) . $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->event_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/event/view.php b/backend/views/event/view.php new file mode 100644 index 0000000..a3d8067 --- /dev/null +++ b/backend/views/event/view.php @@ -0,0 +1,49 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ + $model, + 'attributes' => [ + 'event_id', + 'name', + 'alias', + 'body:ntext', + [ + 'format' => 'image', + 'attribute'=>'image', + ], + 'meta_title', + 'description', + 'h1', + 'seo_text:ntext', + 'created_at', + 'updated_at', + 'end_at', + ], + ]) ?> + +
diff --git a/backend/views/layouts/main-sidebar.php b/backend/views/layouts/main-sidebar.php index a144b40..bd70450 100755 --- a/backend/views/layouts/main-sidebar.php +++ b/backend/views/layouts/main-sidebar.php @@ -51,6 +51,10 @@ use yii\widgets\Menu; ['label' => 'Зависимости', 'url' => ['/relation/manage']] ] ], + ['label' => 'Статические страницы', 'url' => ['/page/index']], + ['label' => 'Акции', 'url' => ['/event/index']], + ['label' => 'Услуги', 'url' => ['/service/index']], + ['label' => 'SEO', 'url' => ['/seo/index']], // ['label' => 'Rubrication', 'url' => ['/rubrication/tax-group']], // ['label' => 'Relation', 'url' => ['/relation/manage']], ], diff --git a/backend/views/page/_form.php b/backend/views/page/_form.php new file mode 100644 index 0000000..64850bd --- /dev/null +++ b/backend/views/page/_form.php @@ -0,0 +1,47 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => 255]) ?> + + field($model, 'alias')->textInput(['maxlength' => 250]) ?> + + field($model, 'title')->textInput(['maxlength' => 250]) ?> + + field($model, 'body')->widget(CKEditor::className(), + [ + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать + 'inline' => false, //по умолчанию false]), + 'allowedContent' => true, + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') + ] + ) + ]) ?> + + field($model, 'meta_title')->textInput(['maxlength' => 250]) ?> + + field($model, 'description')->textInput(['maxlength' => 250]) ?> + + field($model, 'h1')->textInput(['maxlength' => 255]) ?> + + field($model, 'seo_text')->textarea(['rows' => 6]) ?> + +
+ isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/page/_search.php b/backend/views/page/_search.php new file mode 100644 index 0000000..5105f20 --- /dev/null +++ b/backend/views/page/_search.php @@ -0,0 +1,43 @@ + + + diff --git a/backend/views/page/create.php b/backend/views/page/create.php new file mode 100644 index 0000000..fe610ab --- /dev/null +++ b/backend/views/page/create.php @@ -0,0 +1,21 @@ +title = 'Create Page'; +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/page/index.php b/backend/views/page/index.php new file mode 100644 index 0000000..285c578 --- /dev/null +++ b/backend/views/page/index.php @@ -0,0 +1,41 @@ +title = 'Статические страницы'; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

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

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

+ + $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'id', + 'name', + 'alias', + 'title', + // 'meta_title', + // 'description', + // 'h1', + // 'seo_text:ntext', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> + +
diff --git a/backend/views/page/update.php b/backend/views/page/update.php new file mode 100644 index 0000000..c3c9762 --- /dev/null +++ b/backend/views/page/update.php @@ -0,0 +1,21 @@ +title = 'Update Page: ' . ' ' . $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; +$this->params['breadcrumbs'][] = 'Обновление'; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/page/view.php b/backend/views/page/view.php new file mode 100644 index 0000000..18546f9 --- /dev/null +++ b/backend/views/page/view.php @@ -0,0 +1,42 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

+ $model->id], ['class' => 'btn btn-primary']) ?> + $model->id], [ + 'class' => 'btn btn-danger', + 'data' => [ + 'confirm' => 'Вы уверены что хотите удалить этот элемент?', + 'method' => 'post', + ], + ]) ?> +

+ + $model, + 'attributes' => [ + 'id', + 'name', + 'alias', + 'title', + 'meta_title', + 'description', + 'h1', + 'seo_text:ntext', + ], + ]) ?> + +
diff --git a/backend/views/service/_form.php b/backend/views/service/_form.php new file mode 100644 index 0000000..62cebc3 --- /dev/null +++ b/backend/views/service/_form.php @@ -0,0 +1,66 @@ + + +
+ + + + field($model, 'name')->textInput(['maxlength' => true]) ?> + + field($model, 'alias')->textInput(['maxlength' => true]) ?> + + field($model, 'body')->widget(CKEditor::className(), + [ + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ + 'preset' => 'full', //разработанны стандартные настройки basic, standard, full данную возможность не обязательно использовать + 'inline' => false, //по умолчанию false]), + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') + ] + ) + ]) ?> + + + $model, + 'field'=>'image', + 'size' => [ + [ + 'width'=>200, + 'height'=>200, + ], + [ + 'width'=>940, + 'height'=>480, + ] + ], + 'multi'=>false, + 'gallery' => $model->image, + 'name' => 'Загрузить изображение' + ]); + ?> + + field($model, 'meta_title')->textInput(['maxlength' => true]) ?> + + field($model, 'description')->textInput(['maxlength' => true]) ?> + + field($model, 'h1')->textInput(['maxlength' => true]) ?> + + field($model, 'seo_text')->textarea(['rows' => 6]) ?> + + +
+ isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> +
+ + + +
diff --git a/backend/views/service/_search.php b/backend/views/service/_search.php new file mode 100644 index 0000000..5e3577a --- /dev/null +++ b/backend/views/service/_search.php @@ -0,0 +1,45 @@ + + + diff --git a/backend/views/service/create.php b/backend/views/service/create.php new file mode 100644 index 0000000..7fe8e91 --- /dev/null +++ b/backend/views/service/create.php @@ -0,0 +1,21 @@ +title = Yii::t('app', 'Create Service'); +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/service/index.php b/backend/views/service/index.php new file mode 100644 index 0000000..55e639e --- /dev/null +++ b/backend/views/service/index.php @@ -0,0 +1,44 @@ +title = Yii::t('app', 'Services'); +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

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

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

+ $dataProvider, + 'filterModel' => $searchModel, + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + + 'service_id', + 'name', + 'alias', + [ + 'format' => 'image', + 'attribute'=>'image', + ], + // 'meta_title', + // 'description', + // 'h1', + // 'seo_text:ntext', + // 'created_at', + // 'updated_at', + + ['class' => 'yii\grid\ActionColumn'], + ], + ]); ?> +
diff --git a/backend/views/service/update.php b/backend/views/service/update.php new file mode 100644 index 0000000..1e3abb4 --- /dev/null +++ b/backend/views/service/update.php @@ -0,0 +1,23 @@ +title = Yii::t('app', 'Update {modelClass}: ', [ + 'modelClass' => 'Service', +]) . $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->service_id]]; +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); +?> +
+ +

title) ?>

+ + render('_form', [ + 'model' => $model, + ]) ?> + +
diff --git a/backend/views/service/view.php b/backend/views/service/view.php new file mode 100644 index 0000000..e1af593 --- /dev/null +++ b/backend/views/service/view.php @@ -0,0 +1,47 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; +?> +
+ +

title) ?>

+ +

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

+ + $model, + 'attributes' => [ + 'service_id', + 'name', + 'alias', + [ + 'format' => 'image', + 'attribute'=>'image', + ], + 'meta_title', + 'description', + 'h1', + 'seo_text:ntext', + 'created_at', + 'updated_at', + ], + ]) ?> + +
diff --git a/common/behaviors/Slug.php b/common/behaviors/Slug.php index 9f13615..969a6be 100755 --- a/common/behaviors/Slug.php +++ b/common/behaviors/Slug.php @@ -15,17 +15,21 @@ class Slug extends Behavior public function events() { return [ - ActiveRecord::EVENT_BEFORE_VALIDATE => 'getSlug' + ActiveRecord::EVENT_BEFORE_INSERT=> 'getSlug', + ActiveRecord::EVENT_BEFORE_UPDATE=> 'getSlug' ]; } public function getSlug( $event ) { - if ( empty( $this->owner->{$this->out_attribute} ) ) { - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); - } else { - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} ); + if(!empty($this->owner->{$this->in_attribute})){ + if ( empty( $this->owner->{$this->out_attribute} ) ) { + $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); + } else { + $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} ); + } } + } private function generateSlug( $slug ) diff --git a/common/models/Event.php b/common/models/Event.php new file mode 100644 index 0000000..a65e8bd --- /dev/null +++ b/common/models/Event.php @@ -0,0 +1,102 @@ + [ + 'class' => 'common\behaviors\Slug', + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true + ], + [ + 'class' => 'common\behaviors\ShowImage', + ], + ]; + } + + + public function beforeSave($insert) + { + if (parent::beforeSave($insert)) { + $this->end_at = strtotime($this->end_at); + return true; + } else { + return false; + } + } + + public function afterFind(){ + $this->end_at = date("Y-m-d", $this->end_at); + } + + + /** + * @inheritdoc + */ + public function rules() + { + return [ + [['body', 'seo_text'], 'string'], + [['created_at', 'updated_at' ], 'integer'], + [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at'], 'string', 'max' => 255], + [['name','body'], 'required'], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'event_id' => Yii::t('app', 'Event ID'), + 'name' => Yii::t('app', 'Name'), + 'alias' => Yii::t('app', 'Alias'), + 'body' => Yii::t('app', 'Body'), + 'image' => Yii::t('app', 'Image'), + 'meta_title' => Yii::t('app', 'Meta Title'), + 'description' => Yii::t('app', 'Description'), + 'h1' => Yii::t('app', 'H1'), + 'seo_text' => Yii::t('app', 'Seo Text'), + 'created_at' => Yii::t('app', 'Created At'), + 'updated_at' => Yii::t('app', 'Updated At'), + 'end_at' => Yii::t('app', 'End At'), + ]; + } +} diff --git a/common/models/EventSearch.php b/common/models/EventSearch.php new file mode 100644 index 0000000..1965c36 --- /dev/null +++ b/common/models/EventSearch.php @@ -0,0 +1,83 @@ + $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([ + 'event_id' => $this->event_id, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + 'end_at' => $this->end_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'alias', $this->alias]) + ->andFilterWhere(['like', 'body', $this->body]) + ->andFilterWhere(['like', 'image', $this->image]) + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'h1', $this->h1]) + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); + + return $dataProvider; + } +} diff --git a/common/models/Page.php b/common/models/Page.php new file mode 100644 index 0000000..0644205 --- /dev/null +++ b/common/models/Page.php @@ -0,0 +1,79 @@ + 255], + [['alias', 'title', 'meta_title', 'description'], 'string', 'max' => 250] + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'id' => 'ID', + 'name' => 'Название', + 'alias' => 'alias', + 'title' => 'Title', + 'body' => 'Body', + 'meta_title' => 'Meta Title', + 'description' => 'Description', + 'h1' => 'H1', + 'seo_text' => 'Seo Text', + ]; + } + + public function behaviors() + { + return [ + 'slug' => [ + 'class' => 'common\behaviors\Slug', + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true + ] + ]; + } + + public function getPageTranslit($page){ + return self::find() + ->where(['alias' => $page]) + ->one(); + + } +} diff --git a/common/models/PageSearch.php b/common/models/PageSearch.php new file mode 100644 index 0000000..ea5b3d2 --- /dev/null +++ b/common/models/PageSearch.php @@ -0,0 +1,72 @@ + $query, + ]); + + $this->load($params); + + if (!$this->validate()) { + // uncomment the following line if you do not want to any records when validation fails + // $query->where('0=1'); + return $dataProvider; + } + + $query->andFilterWhere([ + 'id' => $this->id, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'alias', $this->alias]) + ->andFilterWhere(['like', 'title', $this->title]) + ->andFilterWhere(['like', 'body', $this->body]) + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'h1', $this->h1]) + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); + + return $dataProvider; + } +} diff --git a/common/models/Seo.php b/common/models/Seo.php new file mode 100644 index 0000000..968ca81 --- /dev/null +++ b/common/models/Seo.php @@ -0,0 +1,53 @@ + 255], + ]; + } + + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'seo_id' => Yii::t('app', 'Seo ID'), + 'url' => Yii::t('app', 'Url'), + 'title' => Yii::t('app', 'Title'), + 'description' => Yii::t('app', 'Description'), + 'h1' => Yii::t('app', 'H1'), + 'seo_text' => Yii::t('app', 'Seo Text'), + ]; + } +} diff --git a/common/models/SeoSearch.php b/common/models/SeoSearch.php new file mode 100644 index 0000000..7dd4e82 --- /dev/null +++ b/common/models/SeoSearch.php @@ -0,0 +1,73 @@ + $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([ + 'seo_id' => $this->seo_id, + ]); + + $query->andFilterWhere(['like', 'url', $this->url]) + ->andFilterWhere(['like', 'title', $this->title]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'h1', $this->h1]) + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); + + return $dataProvider; + } +} diff --git a/common/models/Service.php b/common/models/Service.php new file mode 100644 index 0000000..e368e03 --- /dev/null +++ b/common/models/Service.php @@ -0,0 +1,81 @@ + 255], + ]; + } + /** + * @inheritdoc + */ + public function behaviors() + { + return [ + TimestampBehavior::className(), + 'slug' => [ + 'class' => 'common\behaviors\Slug', + 'in_attribute' => 'name', + 'out_attribute' => 'alias', + 'translit' => true + ], + [ + 'class' => 'common\behaviors\ShowImage', + ], + ]; + } + /** + * @inheritdoc + */ + public function attributeLabels() + { + return [ + 'service_id' => Yii::t('app', 'Service ID'), + 'name' => Yii::t('app', 'Name'), + 'alias' => Yii::t('app', 'Alias'), + 'body' => Yii::t('app', 'Body'), + 'image' => Yii::t('app', 'Image'), + 'meta_title' => Yii::t('app', 'Meta Title'), + 'description' => Yii::t('app', 'Description'), + 'h1' => Yii::t('app', 'H1'), + 'seo_text' => Yii::t('app', 'Seo Text'), + 'created_at' => Yii::t('app', 'Created At'), + 'updated_at' => Yii::t('app', 'Updated At'), + ]; + } +} diff --git a/common/models/ServiceSearch.php b/common/models/ServiceSearch.php new file mode 100644 index 0000000..20842ad --- /dev/null +++ b/common/models/ServiceSearch.php @@ -0,0 +1,78 @@ + $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([ + 'service_id' => $this->service_id, + 'created_at' => $this->created_at, + 'updated_at' => $this->updated_at, + ]); + + $query->andFilterWhere(['like', 'name', $this->name]) + ->andFilterWhere(['like', 'alias', $this->alias]) + ->andFilterWhere(['like', 'body', $this->body]) + ->andFilterWhere(['like', 'image', $this->image]) + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) + ->andFilterWhere(['like', 'description', $this->description]) + ->andFilterWhere(['like', 'h1', $this->h1]) + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); + + return $dataProvider; + } +} diff --git a/common/models/Slider.php b/common/models/Slider.php index e3e8b54..61186fd 100755 --- a/common/models/Slider.php +++ b/common/models/Slider.php @@ -63,6 +63,6 @@ class Slider extends \yii\db\ActiveRecord */ public function getSliderImage() { - return $this->hasMany(SliderImage::className(), ['slider_id' => 'slider_id']); + return $this->hasMany(SliderImage::className(), ['slider_id' => 'slider_id'])->where([SliderImage::tableName().'.status'=>1]); } } diff --git a/console/migrations/m160406_221846_create_page.php b/console/migrations/m160406_221846_create_page.php new file mode 100644 index 0000000..1c836ce --- /dev/null +++ b/console/migrations/m160406_221846_create_page.php @@ -0,0 +1,48 @@ +createTable('page', [ + 'id' => $this->primaryKey(), + 'name'=> $this->string(), + 'alias'=> $this->string(), + 'title' => $this->string(), + 'body'=> $this->text(), + 'meta_title'=> $this->string(), + 'description' => $this->string(), + 'h1'=> $this->string(), + 'seo_text'=> $this->text(), + + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('page'); + } +} diff --git a/console/migrations/m160407_185510_create_event.php b/console/migrations/m160407_185510_create_event.php new file mode 100644 index 0000000..6f751db --- /dev/null +++ b/console/migrations/m160407_185510_create_event.php @@ -0,0 +1,38 @@ +createTable('event', [ + 'event_id' => $this->primaryKey(), + 'name'=> $this->string(), + 'alias'=> $this->string(), + 'body'=> $this->text(), + 'image' => $this->string(), + 'meta_title'=> $this->string(), + 'description' => $this->string(), + 'h1'=> $this->string(), + 'seo_text'=> $this->text(), + 'created_at' => $this->integer(), + 'updated_at' => $this->integer(), + 'end_at' => $this->integer(), + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('event'); + } +} diff --git a/console/migrations/m160411_211053_create_service.php b/console/migrations/m160411_211053_create_service.php new file mode 100644 index 0000000..d1c752f --- /dev/null +++ b/console/migrations/m160411_211053_create_service.php @@ -0,0 +1,37 @@ +createTable('service', [ + 'service_id' => $this->primaryKey(), + 'name'=> $this->string()->notNull(), + 'alias'=> $this->string(), + 'body'=> $this->text()->notNull(), + 'image' => $this->string(), + 'meta_title'=> $this->string(), + 'description' => $this->string(), + 'h1'=> $this->string(), + 'seo_text'=> $this->text(), + 'created_at' => $this->integer(), + 'updated_at' => $this->integer(), + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('service'); + } +} diff --git a/console/migrations/m160411_215739_create_seo.php b/console/migrations/m160411_215739_create_seo.php new file mode 100644 index 0000000..f21c0a0 --- /dev/null +++ b/console/migrations/m160411_215739_create_seo.php @@ -0,0 +1,33 @@ +createTable('seo', [ + 'seo_id' => $this->primaryKey(), + 'url'=> $this->string()->notNull(), + 'title'=> $this->string(), + 'description' => $this->string(), + 'h1'=> $this->string(), + 'seo_text'=> $this->text(), + + ]); + } + + /** + * @inheritdoc + */ + public function down() + { + $this->dropTable('seo'); + } +} diff --git a/frontend/config/main.php b/frontend/config/main.php index 8509b79..3b80cdf 100755 --- a/frontend/config/main.php +++ b/frontend/config/main.php @@ -55,6 +55,9 @@ return [ 'brand' => 'catalog/brand', ] ], + 'page/'=>'page/show', + 'event/view/'=>'event/view', + 'service/view/'=>'service/view', //// 'catalog' => 'catalog/category', // 'catalog/' => 'catalog/category', // 'catalog//' => 'catalog/category', diff --git a/frontend/controllers/EventController.php b/frontend/controllers/EventController.php new file mode 100644 index 0000000..34e09b1 --- /dev/null +++ b/frontend/controllers/EventController.php @@ -0,0 +1,48 @@ + Event::find() ]); + + return $this->render('index', [ + 'dataProvider' => $dataProvider, + ]); + } + + + + public function actionView($alias) + { + + return $this->render('view', [ + 'model' => $this->findModel($alias), + ]); + } + + + protected function findModel($alias) + { + if (($model = Event::findOne(["alias"=>$alias])) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + +} \ No newline at end of file diff --git a/frontend/controllers/PageController.php b/frontend/controllers/PageController.php new file mode 100644 index 0000000..a65088a --- /dev/null +++ b/frontend/controllers/PageController.php @@ -0,0 +1,20 @@ +getPageTranslit($translit)) + throw new \Exception(404,'The requested page does not exist.'); + return $this->render('show',['page'=>$page]); + } +} \ No newline at end of file diff --git a/frontend/controllers/ServiceController.php b/frontend/controllers/ServiceController.php new file mode 100644 index 0000000..1b50bf2 --- /dev/null +++ b/frontend/controllers/ServiceController.php @@ -0,0 +1,48 @@ + Service::find() ]); + + return $this->render('index', [ + 'dataProvider' => $dataProvider, + ]); + } + + + + public function actionView($alias) + { + + return $this->render('view', [ + 'model' => $this->findModel($alias), + ]); + } + + + protected function findModel($alias) + { + if (($model = Service::findOne(["alias"=>$alias])) !== null) { + return $model; + } else { + throw new NotFoundHttpException('The requested page does not exist.'); + } + } + + +} \ No newline at end of file diff --git a/frontend/helpers/TextHelper.php b/frontend/helpers/TextHelper.php new file mode 100644 index 0000000..2b1f308 --- /dev/null +++ b/frontend/helpers/TextHelper.php @@ -0,0 +1,24 @@ +

') + { + if ($asHtml) { + return static::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset); + } + + if (mb_strlen($string, $encoding ?: Yii::$app->charset) > $length) { + return strip_tags(trim(mb_substr($string, 0, $length, $encoding ?: Yii::$app->charset)) . $suffix, $html); + } else { + return strip_tags($string, $html); + } + + + } +} diff --git a/frontend/page/show.php b/frontend/page/show.php new file mode 100644 index 0000000..609feb6 --- /dev/null +++ b/frontend/page/show.php @@ -0,0 +1,4 @@ +title = $page->title; +$this->params['breadcrumbs'][] = $this->title; +echo $page->body; \ No newline at end of file diff --git a/frontend/views/event/_objects.php b/frontend/views/event/_objects.php new file mode 100644 index 0000000..3ebbc54 --- /dev/null +++ b/frontend/views/event/_objects.php @@ -0,0 +1,38 @@ + +
+
+ +
+
+ minImg($model->image, '200','200')),Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?> +
+
+ +
+ + +
name,Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?>
+
+ Срок действия по: end_at?> +
+
+

+ body, 200, '...') ?> +

+
+ + + + + + + +
Заказать консультацию
+
+
+
\ No newline at end of file diff --git a/frontend/views/event/index.php b/frontend/views/event/index.php new file mode 100644 index 0000000..c91f03a --- /dev/null +++ b/frontend/views/event/index.php @@ -0,0 +1,13 @@ +params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']]; +?> + $dataProvider, + 'itemView'=>'_objects', + 'summary'=>'', + 'layout' => "
{items}
+
{pager}
" + ] ); +?> diff --git a/frontend/views/event/view.php b/frontend/views/event/view.php new file mode 100644 index 0000000..37e0207 --- /dev/null +++ b/frontend/views/event/view.php @@ -0,0 +1,23 @@ +title = $model->name; +$this->params['breadcrumbs'][] = ['label' => 'Акции', 'url' => ['index']]; +$this->params['breadcrumbs'][] = $this->title; + +?> +
+

name?>

+ minImg($model->image, '940','480')) ?> +
+ Срок действия по: end_at?> +
+
+ body?> +
+
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php index 9f53ae1..e4cd596 100755 --- a/frontend/views/layouts/main.php +++ b/frontend/views/layouts/main.php @@ -18,7 +18,7 @@ AppAsset::register($this); - Clean Template + <?= Html::encode($this->title)?> head() ?> @@ -33,8 +33,8 @@ AppAsset::register($this);
@@ -101,7 +101,7 @@ AppAsset::register($this);
О нас
@@ -109,7 +109,7 @@ AppAsset::register($this);
Покупателям
diff --git a/frontend/views/layouts/main_menu.php b/frontend/views/layouts/main_menu.php index 833982e..ce59475 100755 --- a/frontend/views/layouts/main_menu.php +++ b/frontend/views/layouts/main_menu.php @@ -1,3 +1,8 @@ +