= $model->title; ?>
++ = \Yii::$app->formatter->asDate($model->created_at); ?> + +
+= $model->body_preview; ?>
++ = Html::a( + 'Продолжить чтение', + [ + '', 'alias' => $model->alias + ], + [ + 'class' => 'btn btn-template-main', + ] + ) ?> +
+diff --git a/frontend/controllers/EventController.php b/frontend/controllers/EventController.php
new file mode 100755
index 0000000..344fe26
--- /dev/null
+++ b/frontend/controllers/EventController.php
@@ -0,0 +1,164 @@
+with(
+ [
+ 'language',
+ ]
+ )
+ ->orderBy([ 'sort' => SORT_ASC ])
+ ->all();
+
+
+ $dataProvider = new ActiveDataProvider(
+ [
+ 'query' => Event::find()
+ ->orderBy(
+ [
+ 'created_at' => SORT_DESC,
+ ]
+ )
+ ->joinWith('language')
+ ->where([ 'event.status' => true ])
+ ->andFilterWhere(
+ [
+ 'ilike',
+ 'event_lang.title',
+ $q,
+ ]
+ )
+ ->distinct(),
+ 'pagination' => [
+ 'pageSize' => 3,
+ ],
+ ]
+ );
+
+ return $this->render(
+ 'index',
+ [
+ 'tags' => $tags,
+ 'dataProvider' => $dataProvider,
+ ]
+ );
+ }
+
+ public function actionView($id)
+ {
+ $model = $this->findModel($id);
+
+ $tags = Tag::find()
+ ->with([ 'language' ])
+ ->orderBy([ 'sort' => SORT_ASC ])
+ ->all();
+
+ return $this->render(
+ 'view',
+ [
+ 'tags' => $tags,
+ 'model' => $model,
+ ]
+ );
+ }
+
+
+ public function actionTag($id)
+ {
+ $tags = Tag::find()
+ ->with(
+ [
+ 'language',
+ ]
+ )
+ ->orderBy([ 'sort' => SORT_ASC ])
+ ->all();
+
+ $model = Tag::find()
+ ->where(
+ [
+ 'id' => $id,
+ ]
+ )
+ ->with(
+ [
+ 'articles',
+ ]
+ )
+ ->one();
+
+ $dataProvider = new ActiveDataProvider(
+ [
+ 'query' => $model->getEvents()
+ ->with(
+ [
+ 'language',
+ ]
+ )
+ ->where(['event.status' => true])
+ ->orderBy(
+ [
+ 'created_at' => SORT_DESC,
+ ]
+ ),
+ 'pagination' => [
+ 'pageSize' => 3,
+ ],
+ ]
+ );
+
+ return $this->render(
+ 'tag',
+ [
+ 'tags' => $tags,
+ 'dataProvider' => $dataProvider,
+ 'model' => $model,
+ ]
+ );
+ }
+
+ /**
+ * @param $id
+ *
+ * @return Event
+ * @throws \yii\web\NotFoundHttpException
+ */
+ protected function findModel($id)
+ {
+ /**
+ * @var Event | null $model
+ */
+ $model = Event::find()
+ ->where([ 'id' => $id ])
+ ->with(
+ [
+ 'language',
+ 'tags.language',
+ ]
+ )
+ ->andWhere([ 'status' => true ])
+ ->one();
+
+ if (empty($model)) {
+ throw new NotFoundHttpException(\Yii::t('app', 'Article not found'));
+ } else {
+ return $model;
+ }
+ }
+ }
\ No newline at end of file
diff --git a/frontend/views/event/_event.php b/frontend/views/event/_event.php
new file mode 100755
index 0000000..e811949
--- /dev/null
+++ b/frontend/views/event/_event.php
@@ -0,0 +1,79 @@
+
+
+
+ = \Yii::$app->formatter->asDate($model->created_at); ?>
+
+ = $model->body_preview; ?>
+ = Html::a(
+ 'Продолжить чтение',
+ [
+ '', 'alias' => $model->alias
+ ],
+ [
+ 'class' => 'btn btn-template-main',
+ ]
+ ) ?>
+ = $model->title; ?>
+
= \Yii::$app->formatter->asDate( + $model->created_at + ); ?>
+ +
+
+
September 23, 2011 в 12:00
+Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. + Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
+Ответить +
+
+
+
23 сентября 2012 в 12:00
+Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. + Aenean ultricies mi vitae est. Mauris placerat eleifend leo.
+Ответить +
+Личный подбор маршрута. Планирование поездки. Бронь билетов. Страховка.
+=$slide->description?>
- +
Leave comment
+ + + +