Commit cb6805b8fc4ece81923a0bf70c976b3d929905fb
1 parent
7669648a
12.04.16 finish event, service
Showing
55 changed files
with
2397 additions
and
14 deletions
Show diff stats
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Event; | ||
7 | +use common\models\EventSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * EventController implements the CRUD actions for Event model. | ||
14 | + */ | ||
15 | +class EventController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'verbs' => [ | ||
24 | + 'class' => VerbFilter::className(), | ||
25 | + 'actions' => [ | ||
26 | + 'delete' => ['POST'], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ]; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Lists all Event models. | ||
34 | + * @return mixed | ||
35 | + */ | ||
36 | + public function actionIndex() | ||
37 | + { | ||
38 | + $searchModel = new EventSearch(); | ||
39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
40 | + | ||
41 | + return $this->render('index', [ | ||
42 | + 'searchModel' => $searchModel, | ||
43 | + 'dataProvider' => $dataProvider, | ||
44 | + ]); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Displays a single Event model. | ||
49 | + * @param integer $id | ||
50 | + * @return mixed | ||
51 | + */ | ||
52 | + public function actionView($id) | ||
53 | + { | ||
54 | + return $this->render('view', [ | ||
55 | + 'model' => $this->findModel($id), | ||
56 | + ]); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Creates a new Event model. | ||
61 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
62 | + * @return mixed | ||
63 | + */ | ||
64 | + public function actionCreate() | ||
65 | + { | ||
66 | + $model = new Event(); | ||
67 | + | ||
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
69 | + return $this->redirect(['view', 'id' => $model->event_id]); | ||
70 | + } else { | ||
71 | + return $this->render('create', [ | ||
72 | + 'model' => $model, | ||
73 | + ]); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Updates an existing Event model. | ||
79 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
80 | + * @param integer $id | ||
81 | + * @return mixed | ||
82 | + */ | ||
83 | + public function actionUpdate($id) | ||
84 | + { | ||
85 | + $model = $this->findModel($id); | ||
86 | + | ||
87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
88 | + return $this->redirect(['view', 'id' => $model->event_id]); | ||
89 | + } else { | ||
90 | + return $this->render('update', [ | ||
91 | + 'model' => $model, | ||
92 | + ]); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Deletes an existing Event model. | ||
98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
99 | + * @param integer $id | ||
100 | + * @return mixed | ||
101 | + */ | ||
102 | + public function actionDelete($id) | ||
103 | + { | ||
104 | + $this->findModel($id)->delete(); | ||
105 | + | ||
106 | + return $this->redirect(['index']); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Finds the Event model based on its primary key value. | ||
111 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
112 | + * @param integer $id | ||
113 | + * @return Event the loaded model | ||
114 | + * @throws NotFoundHttpException if the model cannot be found | ||
115 | + */ | ||
116 | + protected function findModel($id) | ||
117 | + { | ||
118 | + if (($model = Event::findOne($id)) !== null) { | ||
119 | + return $model; | ||
120 | + } else { | ||
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
122 | + } | ||
123 | + } | ||
124 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\filters\AccessControl; | ||
7 | +use common\models\Page; | ||
8 | +use common\models\PageSearch; | ||
9 | +use yii\web\Controller; | ||
10 | +use yii\web\NotFoundHttpException; | ||
11 | +use yii\filters\VerbFilter; | ||
12 | + | ||
13 | +/** | ||
14 | + * PageController implements the CRUD actions for Page model. | ||
15 | + */ | ||
16 | +class PageController extends Controller | ||
17 | +{ | ||
18 | + public function behaviors() | ||
19 | + { | ||
20 | + return [ | ||
21 | + 'access' => [ | ||
22 | + 'class' => AccessControl::className(), | ||
23 | + 'rules' => [ | ||
24 | + [ | ||
25 | + 'actions' => ['login', 'error'], | ||
26 | + 'allow' => true, | ||
27 | + ], | ||
28 | + [ | ||
29 | + 'actions' => ['logout', 'index','create','update','view','delete','test-img' ], | ||
30 | + 'allow' => true, | ||
31 | + 'roles' => ['@'], | ||
32 | + ], | ||
33 | + ], | ||
34 | + ], | ||
35 | + 'verbs' => [ | ||
36 | + 'class' => VerbFilter::className(), | ||
37 | + 'actions' => [ | ||
38 | + 'logout' => ['post'], | ||
39 | + ], | ||
40 | + ], | ||
41 | + ]; | ||
42 | + } | ||
43 | + | ||
44 | + /** | ||
45 | + * Lists all Page models. | ||
46 | + * @return mixed | ||
47 | + */ | ||
48 | + public function actionIndex() | ||
49 | + { | ||
50 | + $searchModel = new PageSearch(); | ||
51 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
52 | + | ||
53 | + return $this->render('index', [ | ||
54 | + 'searchModel' => $searchModel, | ||
55 | + 'dataProvider' => $dataProvider, | ||
56 | + ]); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Displays a single Page model. | ||
61 | + * @param integer $id | ||
62 | + * @return mixed | ||
63 | + */ | ||
64 | + public function actionView($id) | ||
65 | + { | ||
66 | + return $this->render('view', [ | ||
67 | + 'model' => $this->findModel($id), | ||
68 | + ]); | ||
69 | + } | ||
70 | + | ||
71 | + /** | ||
72 | + * Creates a new Page model. | ||
73 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
74 | + * @return mixed | ||
75 | + */ | ||
76 | + public function actionCreate() | ||
77 | + { | ||
78 | + $model = new Page(); | ||
79 | + | ||
80 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
81 | + return $this->redirect(['view', 'id' => $model->id]); | ||
82 | + } else { | ||
83 | + return $this->render('create', [ | ||
84 | + 'model' => $model, | ||
85 | + ]); | ||
86 | + } | ||
87 | + } | ||
88 | + | ||
89 | + /** | ||
90 | + * Updates an existing Page model. | ||
91 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
92 | + * @param integer $id | ||
93 | + * @return mixed | ||
94 | + */ | ||
95 | + public function actionUpdate($id) | ||
96 | + { | ||
97 | + $model = $this->findModel($id); | ||
98 | + | ||
99 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
100 | + return $this->redirect(['view', 'id' => $model->id]); | ||
101 | + } else { | ||
102 | + return $this->render('update', [ | ||
103 | + 'model' => $model, | ||
104 | + ]); | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + /** | ||
109 | + * Deletes an existing Page model. | ||
110 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
111 | + * @param integer $id | ||
112 | + * @return mixed | ||
113 | + */ | ||
114 | + public function actionDelete($id) | ||
115 | + { | ||
116 | + $this->findModel($id)->delete(); | ||
117 | + | ||
118 | + return $this->redirect(['index']); | ||
119 | + } | ||
120 | + | ||
121 | + /** | ||
122 | + * Finds the Page model based on its primary key value. | ||
123 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
124 | + * @param integer $id | ||
125 | + * @return Page the loaded model | ||
126 | + * @throws NotFoundHttpException if the model cannot be found | ||
127 | + */ | ||
128 | + protected function findModel($id) | ||
129 | + { | ||
130 | + if (($model = Page::findOne($id)) !== null) { | ||
131 | + return $model; | ||
132 | + } else { | ||
133 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
134 | + } | ||
135 | + } | ||
136 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Seo; | ||
7 | +use common\models\SeoSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * SeoController implements the CRUD actions for Seo model. | ||
14 | + */ | ||
15 | +class SeoController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'verbs' => [ | ||
24 | + 'class' => VerbFilter::className(), | ||
25 | + 'actions' => [ | ||
26 | + 'delete' => ['POST'], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ]; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Lists all Seo models. | ||
34 | + * @return mixed | ||
35 | + */ | ||
36 | + public function actionIndex() | ||
37 | + { | ||
38 | + $searchModel = new SeoSearch(); | ||
39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
40 | + | ||
41 | + return $this->render('index', [ | ||
42 | + 'searchModel' => $searchModel, | ||
43 | + 'dataProvider' => $dataProvider, | ||
44 | + ]); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Displays a single Seo model. | ||
49 | + * @param integer $id | ||
50 | + * @return mixed | ||
51 | + */ | ||
52 | + public function actionView($id) | ||
53 | + { | ||
54 | + return $this->render('view', [ | ||
55 | + 'model' => $this->findModel($id), | ||
56 | + ]); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Creates a new Seo model. | ||
61 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
62 | + * @return mixed | ||
63 | + */ | ||
64 | + public function actionCreate() | ||
65 | + { | ||
66 | + $model = new Seo(); | ||
67 | + | ||
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
69 | + return $this->redirect(['view', 'id' => $model->seo_id]); | ||
70 | + } else { | ||
71 | + return $this->render('create', [ | ||
72 | + 'model' => $model, | ||
73 | + ]); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Updates an existing Seo model. | ||
79 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
80 | + * @param integer $id | ||
81 | + * @return mixed | ||
82 | + */ | ||
83 | + public function actionUpdate($id) | ||
84 | + { | ||
85 | + $model = $this->findModel($id); | ||
86 | + | ||
87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
88 | + return $this->redirect(['view', 'id' => $model->seo_id]); | ||
89 | + } else { | ||
90 | + return $this->render('update', [ | ||
91 | + 'model' => $model, | ||
92 | + ]); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Deletes an existing Seo model. | ||
98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
99 | + * @param integer $id | ||
100 | + * @return mixed | ||
101 | + */ | ||
102 | + public function actionDelete($id) | ||
103 | + { | ||
104 | + $this->findModel($id)->delete(); | ||
105 | + | ||
106 | + return $this->redirect(['index']); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Finds the Seo model based on its primary key value. | ||
111 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
112 | + * @param integer $id | ||
113 | + * @return Seo the loaded model | ||
114 | + * @throws NotFoundHttpException if the model cannot be found | ||
115 | + */ | ||
116 | + protected function findModel($id) | ||
117 | + { | ||
118 | + if (($model = Seo::findOne($id)) !== null) { | ||
119 | + return $model; | ||
120 | + } else { | ||
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
122 | + } | ||
123 | + } | ||
124 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace backend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Service; | ||
7 | +use common\models\ServiceSearch; | ||
8 | +use yii\web\Controller; | ||
9 | +use yii\web\NotFoundHttpException; | ||
10 | +use yii\filters\VerbFilter; | ||
11 | + | ||
12 | +/** | ||
13 | + * ServiceController implements the CRUD actions for Service model. | ||
14 | + */ | ||
15 | +class ServiceController extends Controller | ||
16 | +{ | ||
17 | + /** | ||
18 | + * @inheritdoc | ||
19 | + */ | ||
20 | + public function behaviors() | ||
21 | + { | ||
22 | + return [ | ||
23 | + 'verbs' => [ | ||
24 | + 'class' => VerbFilter::className(), | ||
25 | + 'actions' => [ | ||
26 | + 'delete' => ['POST'], | ||
27 | + ], | ||
28 | + ], | ||
29 | + ]; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * Lists all Service models. | ||
34 | + * @return mixed | ||
35 | + */ | ||
36 | + public function actionIndex() | ||
37 | + { | ||
38 | + $searchModel = new ServiceSearch(); | ||
39 | + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); | ||
40 | + | ||
41 | + return $this->render('index', [ | ||
42 | + 'searchModel' => $searchModel, | ||
43 | + 'dataProvider' => $dataProvider, | ||
44 | + ]); | ||
45 | + } | ||
46 | + | ||
47 | + /** | ||
48 | + * Displays a single Service model. | ||
49 | + * @param integer $id | ||
50 | + * @return mixed | ||
51 | + */ | ||
52 | + public function actionView($id) | ||
53 | + { | ||
54 | + return $this->render('view', [ | ||
55 | + 'model' => $this->findModel($id), | ||
56 | + ]); | ||
57 | + } | ||
58 | + | ||
59 | + /** | ||
60 | + * Creates a new Service model. | ||
61 | + * If creation is successful, the browser will be redirected to the 'view' page. | ||
62 | + * @return mixed | ||
63 | + */ | ||
64 | + public function actionCreate() | ||
65 | + { | ||
66 | + $model = new Service(); | ||
67 | + | ||
68 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
69 | + return $this->redirect(['view', 'id' => $model->service_id]); | ||
70 | + } else { | ||
71 | + return $this->render('create', [ | ||
72 | + 'model' => $model, | ||
73 | + ]); | ||
74 | + } | ||
75 | + } | ||
76 | + | ||
77 | + /** | ||
78 | + * Updates an existing Service model. | ||
79 | + * If update is successful, the browser will be redirected to the 'view' page. | ||
80 | + * @param integer $id | ||
81 | + * @return mixed | ||
82 | + */ | ||
83 | + public function actionUpdate($id) | ||
84 | + { | ||
85 | + $model = $this->findModel($id); | ||
86 | + | ||
87 | + if ($model->load(Yii::$app->request->post()) && $model->save()) { | ||
88 | + return $this->redirect(['view', 'id' => $model->service_id]); | ||
89 | + } else { | ||
90 | + return $this->render('update', [ | ||
91 | + 'model' => $model, | ||
92 | + ]); | ||
93 | + } | ||
94 | + } | ||
95 | + | ||
96 | + /** | ||
97 | + * Deletes an existing Service model. | ||
98 | + * If deletion is successful, the browser will be redirected to the 'index' page. | ||
99 | + * @param integer $id | ||
100 | + * @return mixed | ||
101 | + */ | ||
102 | + public function actionDelete($id) | ||
103 | + { | ||
104 | + $this->findModel($id)->delete(); | ||
105 | + | ||
106 | + return $this->redirect(['index']); | ||
107 | + } | ||
108 | + | ||
109 | + /** | ||
110 | + * Finds the Service model based on its primary key value. | ||
111 | + * If the model is not found, a 404 HTTP exception will be thrown. | ||
112 | + * @param integer $id | ||
113 | + * @return Service the loaded model | ||
114 | + * @throws NotFoundHttpException if the model cannot be found | ||
115 | + */ | ||
116 | + protected function findModel($id) | ||
117 | + { | ||
118 | + if (($model = Service::findOne($id)) !== null) { | ||
119 | + return $model; | ||
120 | + } else { | ||
121 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
122 | + } | ||
123 | + } | ||
124 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use yii\jui\DatePicker; | ||
4 | +use yii\helpers\Html; | ||
5 | +use yii\widgets\ActiveForm; | ||
6 | +use mihaildev\ckeditor\CKEditor; | ||
7 | +use mihaildev\elfinder\ElFinder; | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $model common\models\Event */ | ||
10 | +/* @var $form yii\widgets\ActiveForm */ | ||
11 | +?> | ||
12 | + | ||
13 | +<div class="event-form"> | ||
14 | + | ||
15 | + <?php $form = ActiveForm::begin(); ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | ||
22 | + [ | ||
23 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | ||
24 | + 'preset' => 'full', //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | ||
25 | + 'inline' => false, //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | ||
26 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | ||
27 | + ] | ||
28 | + ) | ||
29 | + ]) ?> | ||
30 | + | ||
31 | + | ||
32 | + <?= $form->field($model, 'end_at') | ||
33 | + ->widget(DatePicker::className(), [ | ||
34 | + 'dateFormat' => 'yyyy-MM-dd', | ||
35 | + 'clientOptions' => [ 'minDate' => 1 ], | ||
36 | + ]) ?> | ||
37 | + | ||
38 | + | ||
39 | + <?= \common\modules\file\widgets\ImageUploader::widget([ | ||
40 | + 'model'=> $model, | ||
41 | + 'field'=>'image', | ||
42 | + 'size' => [ | ||
43 | + [ | ||
44 | + 'width'=>200, | ||
45 | + 'height'=>200, | ||
46 | + ], | ||
47 | + [ | ||
48 | + 'width'=>940, | ||
49 | + 'height'=>480, | ||
50 | + ] | ||
51 | + ], | ||
52 | + 'multi'=>false, | ||
53 | + 'gallery' => $model->image, | ||
54 | + 'name' => 'ะะฐะณััะทะธัั ะธะทะพะฑัะฐะถะตะฝะธะต' | ||
55 | + ]); | ||
56 | + ?> | ||
57 | + | ||
58 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | ||
59 | + | ||
60 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | ||
61 | + | ||
62 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | ||
63 | + | ||
64 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + <div class="form-group"> | ||
69 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
70 | + </div> | ||
71 | + | ||
72 | + <?php ActiveForm::end(); ?> | ||
73 | + | ||
74 | +</div> |
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\EventSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="event-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'event_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'name') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'alias') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'body') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'image') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'meta_title') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'description') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'h1') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'seo_text') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'created_at') ?> | ||
37 | + | ||
38 | + <?php // echo $form->field($model, 'updated_at') ?> | ||
39 | + | ||
40 | + <?php // echo $form->field($model, 'end_at') ?> | ||
41 | + | ||
42 | + <div class="form-group"> | ||
43 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
44 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
45 | + </div> | ||
46 | + | ||
47 | + <?php ActiveForm::end(); ?> | ||
48 | + | ||
49 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Event */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Event'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="event-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
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\EventSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Events'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="event-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a(Yii::t('app', 'Create Event'), ['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 | + 'event_id', | ||
28 | + 'name', | ||
29 | + 'alias', | ||
30 | + [ | ||
31 | + 'format' => 'image', | ||
32 | + 'attribute'=>'image', | ||
33 | + ], | ||
34 | + // 'meta_title', | ||
35 | + // 'description', | ||
36 | + // 'h1', | ||
37 | + // 'seo_text:ntext', | ||
38 | + // 'created_at', | ||
39 | + // 'updated_at', | ||
40 | + // 'end_at', | ||
41 | + | ||
42 | + ['class' => 'yii\grid\ActionColumn'], | ||
43 | + ], | ||
44 | + ]); ?> | ||
45 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model common\models\Event */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Event', | ||
10 | +]) . $model->name; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->event_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="event-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
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\Event */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Events'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="event-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->event_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->event_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', '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 | + 'event_id', | ||
32 | + 'name', | ||
33 | + 'alias', | ||
34 | + 'body:ntext', | ||
35 | + [ | ||
36 | + 'format' => 'image', | ||
37 | + 'attribute'=>'image', | ||
38 | + ], | ||
39 | + 'meta_title', | ||
40 | + 'description', | ||
41 | + 'h1', | ||
42 | + 'seo_text:ntext', | ||
43 | + 'created_at', | ||
44 | + 'updated_at', | ||
45 | + 'end_at', | ||
46 | + ], | ||
47 | + ]) ?> | ||
48 | + | ||
49 | +</div> |
backend/views/layouts/main-sidebar.php
@@ -51,6 +51,10 @@ use yii\widgets\Menu; | @@ -51,6 +51,10 @@ use yii\widgets\Menu; | ||
51 | ['label' => 'ะะฐะฒะธัะธะผะพััะธ', 'url' => ['/relation/manage']] | 51 | ['label' => 'ะะฐะฒะธัะธะผะพััะธ', 'url' => ['/relation/manage']] |
52 | ] | 52 | ] |
53 | ], | 53 | ], |
54 | + ['label' => 'ะกัะฐัะธัะตัะบะธะต ัััะฐะฝะธัั', 'url' => ['/page/index']], | ||
55 | + ['label' => 'ะะบัะธะธ', 'url' => ['/event/index']], | ||
56 | + ['label' => 'ะฃัะปัะณะธ', 'url' => ['/service/index']], | ||
57 | + ['label' => 'SEO', 'url' => ['/seo/index']], | ||
54 | // ['label' => 'Rubrication', 'url' => ['/rubrication/tax-group']], | 58 | // ['label' => 'Rubrication', 'url' => ['/rubrication/tax-group']], |
55 | // ['label' => 'Relation', 'url' => ['/relation/manage']], | 59 | // ['label' => 'Relation', 'url' => ['/relation/manage']], |
56 | ], | 60 | ], |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | +use mihaildev\ckeditor\CKEditor; | ||
6 | +use mihaildev\elfinder\ElFinder; | ||
7 | +/* @var $this yii\web\View */ | ||
8 | +/* @var $model backend\models\Page */ | ||
9 | +/* @var $form yii\widgets\ActiveForm */ | ||
10 | +?> | ||
11 | + | ||
12 | +<div class="page-form"> | ||
13 | + | ||
14 | + <?php $form = ActiveForm::begin(); ?> | ||
15 | + | ||
16 | + <?= $form->field($model, 'name')->textInput(['maxlength' => 255]) ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => 250]) ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'title')->textInput(['maxlength' => 250]) ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | ||
23 | + [ | ||
24 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | ||
25 | + 'preset' => 'full', //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | ||
26 | + 'inline' => false, //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | ||
27 | + 'allowedContent' => true, | ||
28 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | ||
29 | + ] | ||
30 | + ) | ||
31 | + ]) ?> | ||
32 | + | ||
33 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => 250]) ?> | ||
34 | + | ||
35 | + <?= $form->field($model, 'description')->textInput(['maxlength' => 250]) ?> | ||
36 | + | ||
37 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => 255]) ?> | ||
38 | + | ||
39 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | ||
40 | + | ||
41 | + <div class="form-group"> | ||
42 | + <?= Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
43 | + </div> | ||
44 | + | ||
45 | + <?php ActiveForm::end(); ?> | ||
46 | + | ||
47 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\PageSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="page-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'name') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'alias') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'title') ?> | ||
25 | + | ||
26 | + <?= $form->field($model, 'body') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'meta_title') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'description') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'h1') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'seo_text') ?> | ||
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> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Page */ | ||
8 | + | ||
9 | +$this->title = 'Create Page'; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="page-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\grid\GridView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $searchModel backend\models\PageSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = 'ะกัะฐัะธัะตัะบะธะต ัััะฐะฝะธัั'; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="page-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a('ะกะพะทะดะฐัั', ['create'], ['class' => 'btn btn-success']) ?> | ||
20 | + </p> | ||
21 | + | ||
22 | + <?= GridView::widget([ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + 'filterModel' => $searchModel, | ||
25 | + 'columns' => [ | ||
26 | + ['class' => 'yii\grid\SerialColumn'], | ||
27 | + | ||
28 | + 'id', | ||
29 | + 'name', | ||
30 | + 'alias', | ||
31 | + 'title', | ||
32 | + // 'meta_title', | ||
33 | + // 'description', | ||
34 | + // 'h1', | ||
35 | + // 'seo_text:ntext', | ||
36 | + | ||
37 | + ['class' => 'yii\grid\ActionColumn'], | ||
38 | + ], | ||
39 | + ]); ?> | ||
40 | + | ||
41 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model backend\models\Page */ | ||
7 | + | ||
8 | +$this->title = 'Update Page: ' . ' ' . $model->name; | ||
9 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]]; | ||
11 | +$this->params['breadcrumbs'][] = 'ะะฑะฝะพะฒะปะตะฝะธะต'; | ||
12 | +?> | ||
13 | +<div class="page-update"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\DetailView; | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model backend\models\Page */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => 'Pages', 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="page-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a('ะะฑะฝะพะฒะธัั', ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?=Html::a('ะฃะดะฐะปะธัั', ['delete', 'id' => $model->id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => 'ะั ัะฒะตัะตะฝั ััะพ ั ะพัะธัะต ัะดะฐะปะธัั ััะพั ัะปะตะผะตะฝั?', | ||
23 | + 'method' => 'post', | ||
24 | + ], | ||
25 | + ]) ?> | ||
26 | + </p> | ||
27 | + | ||
28 | + <?= DetailView::widget([ | ||
29 | + 'model' => $model, | ||
30 | + 'attributes' => [ | ||
31 | + 'id', | ||
32 | + 'name', | ||
33 | + 'alias', | ||
34 | + 'title', | ||
35 | + 'meta_title', | ||
36 | + 'description', | ||
37 | + 'h1', | ||
38 | + 'seo_text:ntext', | ||
39 | + ], | ||
40 | + ]) ?> | ||
41 | + | ||
42 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | +use yii\widgets\ActiveForm; | ||
5 | +use mihaildev\ckeditor\CKEditor; | ||
6 | +use mihaildev\elfinder\ElFinder; | ||
7 | +use yii\jui\DatePicker; | ||
8 | +/* @var $this yii\web\View */ | ||
9 | +/* @var $model common\models\Service */ | ||
10 | +/* @var $form yii\widgets\ActiveForm */ | ||
11 | +?> | ||
12 | + | ||
13 | +<div class="service-form"> | ||
14 | + | ||
15 | + <?php $form = ActiveForm::begin(); ?> | ||
16 | + | ||
17 | + <?= $form->field($model, 'name')->textInput(['maxlength' => true]) ?> | ||
18 | + | ||
19 | + <?= $form->field($model, 'alias')->textInput(['maxlength' => true]) ?> | ||
20 | + | ||
21 | + <?= $form->field($model, 'body')->widget(CKEditor::className(), | ||
22 | + [ | ||
23 | + 'editorOptions' => ElFinder::ckeditorOptions('elfinder',[ | ||
24 | + 'preset' => 'full', //ัะฐะทัะฐะฑะพัะฐะฝะฝั ััะฐะฝะดะฐััะฝัะต ะฝะฐัััะพะนะบะธ basic, standard, full ะดะฐะฝะฝัั ะฒะพะทะผะพะถะฝะพััั ะฝะต ะพะฑัะทะฐัะตะปัะฝะพ ะธัะฟะพะปัะทะพะฒะฐัั | ||
25 | + 'inline' => false, //ะฟะพ ัะผะพะปัะฐะฝะธั false]), | ||
26 | + 'filebrowserUploadUrl'=>Yii::$app->getUrlManager()->createUrl('file/uploader/images-upload') | ||
27 | + ] | ||
28 | + ) | ||
29 | + ]) ?> | ||
30 | + | ||
31 | + | ||
32 | + <?= \common\modules\file\widgets\ImageUploader::widget([ | ||
33 | + 'model'=> $model, | ||
34 | + 'field'=>'image', | ||
35 | + 'size' => [ | ||
36 | + [ | ||
37 | + 'width'=>200, | ||
38 | + 'height'=>200, | ||
39 | + ], | ||
40 | + [ | ||
41 | + 'width'=>940, | ||
42 | + 'height'=>480, | ||
43 | + ] | ||
44 | + ], | ||
45 | + 'multi'=>false, | ||
46 | + 'gallery' => $model->image, | ||
47 | + 'name' => 'ะะฐะณััะทะธัั ะธะทะพะฑัะฐะถะตะฝะธะต' | ||
48 | + ]); | ||
49 | + ?> | ||
50 | + | ||
51 | + <?= $form->field($model, 'meta_title')->textInput(['maxlength' => true]) ?> | ||
52 | + | ||
53 | + <?= $form->field($model, 'description')->textInput(['maxlength' => true]) ?> | ||
54 | + | ||
55 | + <?= $form->field($model, 'h1')->textInput(['maxlength' => true]) ?> | ||
56 | + | ||
57 | + <?= $form->field($model, 'seo_text')->textarea(['rows' => 6]) ?> | ||
58 | + | ||
59 | + | ||
60 | + <div class="form-group"> | ||
61 | + <?= Html::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Update'), ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']) ?> | ||
62 | + </div> | ||
63 | + | ||
64 | + <?php ActiveForm::end(); ?> | ||
65 | + | ||
66 | +</div> |
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\ServiceSearch */ | ||
8 | +/* @var $form yii\widgets\ActiveForm */ | ||
9 | +?> | ||
10 | + | ||
11 | +<div class="service-search"> | ||
12 | + | ||
13 | + <?php $form = ActiveForm::begin([ | ||
14 | + 'action' => ['index'], | ||
15 | + 'method' => 'get', | ||
16 | + ]); ?> | ||
17 | + | ||
18 | + <?= $form->field($model, 'service_id') ?> | ||
19 | + | ||
20 | + <?= $form->field($model, 'name') ?> | ||
21 | + | ||
22 | + <?= $form->field($model, 'alias') ?> | ||
23 | + | ||
24 | + <?= $form->field($model, 'image') ?> | ||
25 | + | ||
26 | + <?php // echo $form->field($model, 'meta_title') ?> | ||
27 | + | ||
28 | + <?php // echo $form->field($model, 'description') ?> | ||
29 | + | ||
30 | + <?php // echo $form->field($model, 'h1') ?> | ||
31 | + | ||
32 | + <?php // echo $form->field($model, 'seo_text') ?> | ||
33 | + | ||
34 | + <?php // echo $form->field($model, 'created_at') ?> | ||
35 | + | ||
36 | + <?php // echo $form->field($model, 'updated_at') ?> | ||
37 | + | ||
38 | + <div class="form-group"> | ||
39 | + <?= Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?> | ||
40 | + <?= Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?> | ||
41 | + </div> | ||
42 | + | ||
43 | + <?php ActiveForm::end(); ?> | ||
44 | + | ||
45 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | + | ||
6 | +/* @var $this yii\web\View */ | ||
7 | +/* @var $model common\models\Service */ | ||
8 | + | ||
9 | +$this->title = Yii::t('app', 'Create Service'); | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="service-create"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <?= $this->render('_form', [ | ||
18 | + 'model' => $model, | ||
19 | + ]) ?> | ||
20 | + | ||
21 | +</div> |
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\ServiceSearch */ | ||
8 | +/* @var $dataProvider yii\data\ActiveDataProvider */ | ||
9 | + | ||
10 | +$this->title = Yii::t('app', 'Services'); | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="service-index"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + <?php // echo $this->render('_search', ['model' => $searchModel]); ?> | ||
17 | + | ||
18 | + <p> | ||
19 | + <?= Html::a(Yii::t('app', 'Create Service'), ['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 | + 'service_id', | ||
28 | + 'name', | ||
29 | + 'alias', | ||
30 | + [ | ||
31 | + 'format' => 'image', | ||
32 | + 'attribute'=>'image', | ||
33 | + ], | ||
34 | + // 'meta_title', | ||
35 | + // 'description', | ||
36 | + // 'h1', | ||
37 | + // 'seo_text:ntext', | ||
38 | + // 'created_at', | ||
39 | + // 'updated_at', | ||
40 | + | ||
41 | + ['class' => 'yii\grid\ActionColumn'], | ||
42 | + ], | ||
43 | + ]); ?> | ||
44 | +</div> |
1 | +<?php | ||
2 | + | ||
3 | +use yii\helpers\Html; | ||
4 | + | ||
5 | +/* @var $this yii\web\View */ | ||
6 | +/* @var $model common\models\Service */ | ||
7 | + | ||
8 | +$this->title = Yii::t('app', 'Update {modelClass}: ', [ | ||
9 | + 'modelClass' => 'Service', | ||
10 | +]) . $model->name; | ||
11 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | ||
12 | +$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->service_id]]; | ||
13 | +$this->params['breadcrumbs'][] = Yii::t('app', 'Update'); | ||
14 | +?> | ||
15 | +<div class="service-update"> | ||
16 | + | ||
17 | + <h1><?= Html::encode($this->title) ?></h1> | ||
18 | + | ||
19 | + <?= $this->render('_form', [ | ||
20 | + 'model' => $model, | ||
21 | + ]) ?> | ||
22 | + | ||
23 | +</div> |
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\Service */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Services'), 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | +?> | ||
13 | +<div class="service-view"> | ||
14 | + | ||
15 | + <h1><?= Html::encode($this->title) ?></h1> | ||
16 | + | ||
17 | + <p> | ||
18 | + <?= Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->service_id], ['class' => 'btn btn-primary']) ?> | ||
19 | + <?= Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->service_id], [ | ||
20 | + 'class' => 'btn btn-danger', | ||
21 | + 'data' => [ | ||
22 | + 'confirm' => Yii::t('app', '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_id', | ||
32 | + 'name', | ||
33 | + 'alias', | ||
34 | + [ | ||
35 | + 'format' => 'image', | ||
36 | + 'attribute'=>'image', | ||
37 | + ], | ||
38 | + 'meta_title', | ||
39 | + 'description', | ||
40 | + 'h1', | ||
41 | + 'seo_text:ntext', | ||
42 | + 'created_at', | ||
43 | + 'updated_at', | ||
44 | + ], | ||
45 | + ]) ?> | ||
46 | + | ||
47 | +</div> |
common/behaviors/Slug.php
@@ -15,17 +15,21 @@ class Slug extends Behavior | @@ -15,17 +15,21 @@ class Slug extends Behavior | ||
15 | public function events() | 15 | public function events() |
16 | { | 16 | { |
17 | return [ | 17 | return [ |
18 | - ActiveRecord::EVENT_BEFORE_VALIDATE => 'getSlug' | 18 | + ActiveRecord::EVENT_BEFORE_INSERT=> 'getSlug', |
19 | + ActiveRecord::EVENT_BEFORE_UPDATE=> 'getSlug' | ||
19 | ]; | 20 | ]; |
20 | } | 21 | } |
21 | 22 | ||
22 | public function getSlug( $event ) | 23 | public function getSlug( $event ) |
23 | { | 24 | { |
24 | - if ( empty( $this->owner->{$this->out_attribute} ) ) { | ||
25 | - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); | ||
26 | - } else { | ||
27 | - $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} ); | 25 | + if(!empty($this->owner->{$this->in_attribute})){ |
26 | + if ( empty( $this->owner->{$this->out_attribute} ) ) { | ||
27 | + $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->in_attribute} ); | ||
28 | + } else { | ||
29 | + $this->owner->{$this->out_attribute} = $this->generateSlug( $this->owner->{$this->out_attribute} ); | ||
30 | + } | ||
28 | } | 31 | } |
32 | + | ||
29 | } | 33 | } |
30 | 34 | ||
31 | private function generateSlug( $slug ) | 35 | private function generateSlug( $slug ) |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\behaviors\TimestampBehavior; | ||
7 | +/** | ||
8 | + * This is the model class for table "event". | ||
9 | + * | ||
10 | + * @property integer $event_id | ||
11 | + * @property string $name | ||
12 | + * @property string $alias | ||
13 | + * @property string $body | ||
14 | + * @property string $image | ||
15 | + * @property string $meta_title | ||
16 | + * @property string $description | ||
17 | + * @property string $h1 | ||
18 | + * @property string $seo_text | ||
19 | + * @property integer $created_at | ||
20 | + * @property integer $updated_at | ||
21 | + * @property integer $end_at | ||
22 | + */ | ||
23 | +class Event extends \yii\db\ActiveRecord | ||
24 | +{ | ||
25 | + | ||
26 | + /** | ||
27 | + * @inheritdoc | ||
28 | + */ | ||
29 | + public static function tableName() | ||
30 | + { | ||
31 | + return 'event'; | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * @inheritdoc | ||
36 | + */ | ||
37 | + public function behaviors() | ||
38 | + { | ||
39 | + return [ | ||
40 | + TimestampBehavior::className(), | ||
41 | + 'slug' => [ | ||
42 | + 'class' => 'common\behaviors\Slug', | ||
43 | + 'in_attribute' => 'name', | ||
44 | + 'out_attribute' => 'alias', | ||
45 | + 'translit' => true | ||
46 | + ], | ||
47 | + [ | ||
48 | + 'class' => 'common\behaviors\ShowImage', | ||
49 | + ], | ||
50 | + ]; | ||
51 | + } | ||
52 | + | ||
53 | + | ||
54 | + public function beforeSave($insert) | ||
55 | + { | ||
56 | + if (parent::beforeSave($insert)) { | ||
57 | + $this->end_at = strtotime($this->end_at); | ||
58 | + return true; | ||
59 | + } else { | ||
60 | + return false; | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | + public function afterFind(){ | ||
65 | + $this->end_at = date("Y-m-d", $this->end_at); | ||
66 | + } | ||
67 | + | ||
68 | + | ||
69 | + /** | ||
70 | + * @inheritdoc | ||
71 | + */ | ||
72 | + public function rules() | ||
73 | + { | ||
74 | + return [ | ||
75 | + [['body', 'seo_text'], 'string'], | ||
76 | + [['created_at', 'updated_at' ], 'integer'], | ||
77 | + [['name', 'alias', 'image', 'meta_title', 'description', 'h1','end_at'], 'string', 'max' => 255], | ||
78 | + [['name','body'], 'required'], | ||
79 | + ]; | ||
80 | + } | ||
81 | + | ||
82 | + /** | ||
83 | + * @inheritdoc | ||
84 | + */ | ||
85 | + public function attributeLabels() | ||
86 | + { | ||
87 | + return [ | ||
88 | + 'event_id' => Yii::t('app', 'Event ID'), | ||
89 | + 'name' => Yii::t('app', 'Name'), | ||
90 | + 'alias' => Yii::t('app', 'Alias'), | ||
91 | + 'body' => Yii::t('app', 'Body'), | ||
92 | + 'image' => Yii::t('app', 'Image'), | ||
93 | + 'meta_title' => Yii::t('app', 'Meta Title'), | ||
94 | + 'description' => Yii::t('app', 'Description'), | ||
95 | + 'h1' => Yii::t('app', 'H1'), | ||
96 | + 'seo_text' => Yii::t('app', 'Seo Text'), | ||
97 | + 'created_at' => Yii::t('app', 'Created At'), | ||
98 | + 'updated_at' => Yii::t('app', 'Updated At'), | ||
99 | + 'end_at' => Yii::t('app', 'End At'), | ||
100 | + ]; | ||
101 | + } | ||
102 | +} |
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\Event; | ||
9 | + | ||
10 | +/** | ||
11 | + * EventSearch represents the model behind the search form about `common\models\Event`. | ||
12 | + */ | ||
13 | +class EventSearch extends Event | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['event_id', 'created_at', 'updated_at', 'end_at'], 'integer'], | ||
22 | + [['name', 'alias', 'body', 'image', 'meta_title', 'description', 'h1', 'seo_text'], 'safe'], | ||
23 | + ]; | ||
24 | + } | ||
25 | + | ||
26 | + | ||
27 | + | ||
28 | + /** | ||
29 | + * @inheritdoc | ||
30 | + */ | ||
31 | + public function scenarios() | ||
32 | + { | ||
33 | + // bypass scenarios() implementation in the parent class | ||
34 | + return Model::scenarios(); | ||
35 | + } | ||
36 | + | ||
37 | + /** | ||
38 | + * Creates data provider instance with search query applied | ||
39 | + * | ||
40 | + * @param array $params | ||
41 | + * | ||
42 | + * @return ActiveDataProvider | ||
43 | + */ | ||
44 | + public function search($params) | ||
45 | + { | ||
46 | + | ||
47 | + | ||
48 | + $query = Event::find(); | ||
49 | + | ||
50 | + // add conditions that should always apply here | ||
51 | + | ||
52 | + $dataProvider = new ActiveDataProvider([ | ||
53 | + 'query' => $query, | ||
54 | + ]); | ||
55 | + | ||
56 | + $this->load($params); | ||
57 | + | ||
58 | + if (!$this->validate()) { | ||
59 | + // uncomment the following line if you do not want to return any records when validation fails | ||
60 | + // $query->where('0=1'); | ||
61 | + return $dataProvider; | ||
62 | + } | ||
63 | + | ||
64 | + // grid filtering conditions | ||
65 | + $query->andFilterWhere([ | ||
66 | + 'event_id' => $this->event_id, | ||
67 | + 'created_at' => $this->created_at, | ||
68 | + 'updated_at' => $this->updated_at, | ||
69 | + 'end_at' => $this->end_at, | ||
70 | + ]); | ||
71 | + | ||
72 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
73 | + ->andFilterWhere(['like', 'alias', $this->alias]) | ||
74 | + ->andFilterWhere(['like', 'body', $this->body]) | ||
75 | + ->andFilterWhere(['like', 'image', $this->image]) | ||
76 | + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | ||
77 | + ->andFilterWhere(['like', 'description', $this->description]) | ||
78 | + ->andFilterWhere(['like', 'h1', $this->h1]) | ||
79 | + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | ||
80 | + | ||
81 | + return $dataProvider; | ||
82 | + } | ||
83 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "{{%page}}". | ||
9 | + * | ||
10 | + * @property integer $id | ||
11 | + * @property string $name | ||
12 | + * @property string $translit | ||
13 | + * @property string $title | ||
14 | + * @property string $body | ||
15 | + * @property string $meta_title | ||
16 | + * @property string $description | ||
17 | + * @property string $h1 | ||
18 | + * @property string $seo_text | ||
19 | + */ | ||
20 | +class Page extends \yii\db\ActiveRecord | ||
21 | +{ | ||
22 | + /** | ||
23 | + * @inheritdoc | ||
24 | + */ | ||
25 | + public static function tableName() | ||
26 | + { | ||
27 | + return '{{page}}'; | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * @inheritdoc | ||
32 | + */ | ||
33 | + public function rules() | ||
34 | + { | ||
35 | + return [ | ||
36 | + [['name', 'body'], 'required'], | ||
37 | + [['body', 'seo_text'], 'string'], | ||
38 | + [['name', 'h1'], 'string', 'max' => 255], | ||
39 | + [['alias', 'title', 'meta_title', 'description'], 'string', 'max' => 250] | ||
40 | + ]; | ||
41 | + } | ||
42 | + | ||
43 | + /** | ||
44 | + * @inheritdoc | ||
45 | + */ | ||
46 | + public function attributeLabels() | ||
47 | + { | ||
48 | + return [ | ||
49 | + 'id' => 'ID', | ||
50 | + 'name' => 'ะะฐะทะฒะฐะฝะธะต', | ||
51 | + 'alias' => 'alias', | ||
52 | + 'title' => 'Title', | ||
53 | + 'body' => 'Body', | ||
54 | + 'meta_title' => 'Meta Title', | ||
55 | + 'description' => 'Description', | ||
56 | + 'h1' => 'H1', | ||
57 | + 'seo_text' => 'Seo Text', | ||
58 | + ]; | ||
59 | + } | ||
60 | + | ||
61 | + public function behaviors() | ||
62 | + { | ||
63 | + return [ | ||
64 | + 'slug' => [ | ||
65 | + 'class' => 'common\behaviors\Slug', | ||
66 | + 'in_attribute' => 'name', | ||
67 | + 'out_attribute' => 'alias', | ||
68 | + 'translit' => true | ||
69 | + ] | ||
70 | + ]; | ||
71 | + } | ||
72 | + | ||
73 | + public function getPageTranslit($page){ | ||
74 | + return self::find() | ||
75 | + ->where(['alias' => $page]) | ||
76 | + ->one(); | ||
77 | + | ||
78 | + } | ||
79 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\base\Model; | ||
7 | +use yii\data\ActiveDataProvider; | ||
8 | + | ||
9 | +/** | ||
10 | + * PageSearch represents the model behind the search form about `backend\models\Page`. | ||
11 | + */ | ||
12 | +class PageSearch extends Page | ||
13 | +{ | ||
14 | + /** | ||
15 | + * @inheritdoc | ||
16 | + */ | ||
17 | + public function rules() | ||
18 | + { | ||
19 | + return [ | ||
20 | + [['id'], 'integer'], | ||
21 | + [['name', 'alias', 'title', 'body', 'meta_title', 'description', 'h1', 'seo_text'], 'safe'], | ||
22 | + ]; | ||
23 | + } | ||
24 | + | ||
25 | + /** | ||
26 | + * @inheritdoc | ||
27 | + */ | ||
28 | + public function scenarios() | ||
29 | + { | ||
30 | + // bypass scenarios() implementation in the parent class | ||
31 | + return Model::scenarios(); | ||
32 | + } | ||
33 | + | ||
34 | + /** | ||
35 | + * Creates data provider instance with search query applied | ||
36 | + * | ||
37 | + * @param array $params | ||
38 | + * | ||
39 | + * @return ActiveDataProvider | ||
40 | + */ | ||
41 | + public function search($params) | ||
42 | + { | ||
43 | + $query = Page::find(); | ||
44 | + | ||
45 | + $dataProvider = new ActiveDataProvider([ | ||
46 | + 'query' => $query, | ||
47 | + ]); | ||
48 | + | ||
49 | + $this->load($params); | ||
50 | + | ||
51 | + if (!$this->validate()) { | ||
52 | + // uncomment the following line if you do not want to any records when validation fails | ||
53 | + // $query->where('0=1'); | ||
54 | + return $dataProvider; | ||
55 | + } | ||
56 | + | ||
57 | + $query->andFilterWhere([ | ||
58 | + 'id' => $this->id, | ||
59 | + ]); | ||
60 | + | ||
61 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
62 | + ->andFilterWhere(['like', 'alias', $this->alias]) | ||
63 | + ->andFilterWhere(['like', 'title', $this->title]) | ||
64 | + ->andFilterWhere(['like', 'body', $this->body]) | ||
65 | + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | ||
66 | + ->andFilterWhere(['like', 'description', $this->description]) | ||
67 | + ->andFilterWhere(['like', 'h1', $this->h1]) | ||
68 | + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | ||
69 | + | ||
70 | + return $dataProvider; | ||
71 | + } | ||
72 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | + | ||
7 | +/** | ||
8 | + * This is the model class for table "seo". | ||
9 | + * | ||
10 | + * @property integer $seo_id | ||
11 | + * @property string $url | ||
12 | + * @property string $title | ||
13 | + * @property string $description | ||
14 | + * @property string $h1 | ||
15 | + * @property string $seo_text | ||
16 | + */ | ||
17 | +class Seo extends \yii\db\ActiveRecord | ||
18 | +{ | ||
19 | + /** | ||
20 | + * @inheritdoc | ||
21 | + */ | ||
22 | + public static function tableName() | ||
23 | + { | ||
24 | + return 'seo'; | ||
25 | + } | ||
26 | + | ||
27 | + /** | ||
28 | + * @inheritdoc | ||
29 | + */ | ||
30 | + public function rules() | ||
31 | + { | ||
32 | + return [ | ||
33 | + [['url'], 'required'], | ||
34 | + [['seo_text'], 'string'], | ||
35 | + [['url', 'title', 'description', 'h1'], 'string', 'max' => 255], | ||
36 | + ]; | ||
37 | + } | ||
38 | + | ||
39 | + /** | ||
40 | + * @inheritdoc | ||
41 | + */ | ||
42 | + public function attributeLabels() | ||
43 | + { | ||
44 | + return [ | ||
45 | + 'seo_id' => Yii::t('app', 'Seo ID'), | ||
46 | + 'url' => Yii::t('app', 'Url'), | ||
47 | + 'title' => Yii::t('app', 'Title'), | ||
48 | + 'description' => Yii::t('app', 'Description'), | ||
49 | + 'h1' => Yii::t('app', 'H1'), | ||
50 | + 'seo_text' => Yii::t('app', 'Seo Text'), | ||
51 | + ]; | ||
52 | + } | ||
53 | +} |
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\Seo; | ||
9 | + | ||
10 | +/** | ||
11 | + * SeoSearch represents the model behind the search form about `common\models\Seo`. | ||
12 | + */ | ||
13 | +class SeoSearch extends Seo | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['seo_id'], 'integer'], | ||
22 | + [['url', 'title', 'description', 'h1', 'seo_text'], 'safe'], | ||
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 = Seo::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 | + 'seo_id' => $this->seo_id, | ||
63 | + ]); | ||
64 | + | ||
65 | + $query->andFilterWhere(['like', 'url', $this->url]) | ||
66 | + ->andFilterWhere(['like', 'title', $this->title]) | ||
67 | + ->andFilterWhere(['like', 'description', $this->description]) | ||
68 | + ->andFilterWhere(['like', 'h1', $this->h1]) | ||
69 | + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | ||
70 | + | ||
71 | + return $dataProvider; | ||
72 | + } | ||
73 | +} |
1 | +<?php | ||
2 | + | ||
3 | +namespace common\models; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use yii\behaviors\TimestampBehavior; | ||
7 | +/** | ||
8 | + * This is the model class for table "service". | ||
9 | + * | ||
10 | + * @property integer $service_id | ||
11 | + * @property string $name | ||
12 | + * @property string $alias | ||
13 | + * @property string $body | ||
14 | + * @property string $image | ||
15 | + * @property string $meta_title | ||
16 | + * @property string $description | ||
17 | + * @property string $h1 | ||
18 | + * @property string $seo_text | ||
19 | + * @property integer $created_at | ||
20 | + * @property integer $updated_at | ||
21 | + */ | ||
22 | +class Service extends \yii\db\ActiveRecord | ||
23 | +{ | ||
24 | + /** | ||
25 | + * @inheritdoc | ||
26 | + */ | ||
27 | + public static function tableName() | ||
28 | + { | ||
29 | + return 'service'; | ||
30 | + } | ||
31 | + | ||
32 | + /** | ||
33 | + * @inheritdoc | ||
34 | + */ | ||
35 | + public function rules() | ||
36 | + { | ||
37 | + return [ | ||
38 | + [['name', 'body'], 'required'], | ||
39 | + [['body', 'seo_text'], 'string'], | ||
40 | + [['created_at', 'updated_at'], 'integer'], | ||
41 | + [['name', 'alias', 'image', 'meta_title', 'description', 'h1'], 'string', 'max' => 255], | ||
42 | + ]; | ||
43 | + } | ||
44 | + /** | ||
45 | + * @inheritdoc | ||
46 | + */ | ||
47 | + public function behaviors() | ||
48 | + { | ||
49 | + return [ | ||
50 | + TimestampBehavior::className(), | ||
51 | + 'slug' => [ | ||
52 | + 'class' => 'common\behaviors\Slug', | ||
53 | + 'in_attribute' => 'name', | ||
54 | + 'out_attribute' => 'alias', | ||
55 | + 'translit' => true | ||
56 | + ], | ||
57 | + [ | ||
58 | + 'class' => 'common\behaviors\ShowImage', | ||
59 | + ], | ||
60 | + ]; | ||
61 | + } | ||
62 | + /** | ||
63 | + * @inheritdoc | ||
64 | + */ | ||
65 | + public function attributeLabels() | ||
66 | + { | ||
67 | + return [ | ||
68 | + 'service_id' => Yii::t('app', 'Service ID'), | ||
69 | + 'name' => Yii::t('app', 'Name'), | ||
70 | + 'alias' => Yii::t('app', 'Alias'), | ||
71 | + 'body' => Yii::t('app', 'Body'), | ||
72 | + 'image' => Yii::t('app', 'Image'), | ||
73 | + 'meta_title' => Yii::t('app', 'Meta Title'), | ||
74 | + 'description' => Yii::t('app', 'Description'), | ||
75 | + 'h1' => Yii::t('app', 'H1'), | ||
76 | + 'seo_text' => Yii::t('app', 'Seo Text'), | ||
77 | + 'created_at' => Yii::t('app', 'Created At'), | ||
78 | + 'updated_at' => Yii::t('app', 'Updated At'), | ||
79 | + ]; | ||
80 | + } | ||
81 | +} |
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\Service; | ||
9 | + | ||
10 | +/** | ||
11 | + * ServiceSearch represents the model behind the search form about `common\models\Service`. | ||
12 | + */ | ||
13 | +class ServiceSearch extends Service | ||
14 | +{ | ||
15 | + /** | ||
16 | + * @inheritdoc | ||
17 | + */ | ||
18 | + public function rules() | ||
19 | + { | ||
20 | + return [ | ||
21 | + [['service_id', 'created_at', 'updated_at'], 'integer'], | ||
22 | + [['name', 'alias', 'body', 'image', 'meta_title', 'description', 'h1', 'seo_text'], 'safe'], | ||
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 = Service::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 | + 'service_id' => $this->service_id, | ||
63 | + 'created_at' => $this->created_at, | ||
64 | + 'updated_at' => $this->updated_at, | ||
65 | + ]); | ||
66 | + | ||
67 | + $query->andFilterWhere(['like', 'name', $this->name]) | ||
68 | + ->andFilterWhere(['like', 'alias', $this->alias]) | ||
69 | + ->andFilterWhere(['like', 'body', $this->body]) | ||
70 | + ->andFilterWhere(['like', 'image', $this->image]) | ||
71 | + ->andFilterWhere(['like', 'meta_title', $this->meta_title]) | ||
72 | + ->andFilterWhere(['like', 'description', $this->description]) | ||
73 | + ->andFilterWhere(['like', 'h1', $this->h1]) | ||
74 | + ->andFilterWhere(['like', 'seo_text', $this->seo_text]); | ||
75 | + | ||
76 | + return $dataProvider; | ||
77 | + } | ||
78 | +} |
common/models/Slider.php
@@ -63,6 +63,6 @@ class Slider extends \yii\db\ActiveRecord | @@ -63,6 +63,6 @@ class Slider extends \yii\db\ActiveRecord | ||
63 | */ | 63 | */ |
64 | public function getSliderImage() | 64 | public function getSliderImage() |
65 | { | 65 | { |
66 | - return $this->hasMany(SliderImage::className(), ['slider_id' => 'slider_id']); | 66 | + return $this->hasMany(SliderImage::className(), ['slider_id' => 'slider_id'])->where([SliderImage::tableName().'.status'=>1]); |
67 | } | 67 | } |
68 | } | 68 | } |
console/migrations/m160406_221846_create_page.php
0 โ 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles the creation for table `page`. | ||
7 | + */ | ||
8 | +/** | ||
9 | + * | ||
10 | + * @property integer $id | ||
11 | + * @property string $name | ||
12 | + * @property string $translit | ||
13 | + * @property string $title | ||
14 | + * @property string $body | ||
15 | + * @property string $meta_title | ||
16 | + * @property string $description | ||
17 | + * @property string $h1 | ||
18 | + * @property string $seo_text | ||
19 | + */ | ||
20 | +class m160406_221846_create_page extends Migration | ||
21 | +{ | ||
22 | + /** | ||
23 | + * @inheritdoc | ||
24 | + */ | ||
25 | + public function up() | ||
26 | + { | ||
27 | + $this->createTable('page', [ | ||
28 | + 'id' => $this->primaryKey(), | ||
29 | + 'name'=> $this->string(), | ||
30 | + 'alias'=> $this->string(), | ||
31 | + 'title' => $this->string(), | ||
32 | + 'body'=> $this->text(), | ||
33 | + 'meta_title'=> $this->string(), | ||
34 | + 'description' => $this->string(), | ||
35 | + 'h1'=> $this->string(), | ||
36 | + 'seo_text'=> $this->text(), | ||
37 | + | ||
38 | + ]); | ||
39 | + } | ||
40 | + | ||
41 | + /** | ||
42 | + * @inheritdoc | ||
43 | + */ | ||
44 | + public function down() | ||
45 | + { | ||
46 | + $this->dropTable('page'); | ||
47 | + } | ||
48 | +} |
console/migrations/m160407_185510_create_event.php
0 โ 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles the creation for table `event`. | ||
7 | + */ | ||
8 | +class m160407_185510_create_event extends Migration | ||
9 | +{ | ||
10 | + /** | ||
11 | + * @inheritdoc | ||
12 | + */ | ||
13 | + public function up() | ||
14 | + { | ||
15 | + $this->createTable('event', [ | ||
16 | + 'event_id' => $this->primaryKey(), | ||
17 | + 'name'=> $this->string(), | ||
18 | + 'alias'=> $this->string(), | ||
19 | + 'body'=> $this->text(), | ||
20 | + 'image' => $this->string(), | ||
21 | + 'meta_title'=> $this->string(), | ||
22 | + 'description' => $this->string(), | ||
23 | + 'h1'=> $this->string(), | ||
24 | + 'seo_text'=> $this->text(), | ||
25 | + 'created_at' => $this->integer(), | ||
26 | + 'updated_at' => $this->integer(), | ||
27 | + 'end_at' => $this->integer(), | ||
28 | + ]); | ||
29 | + } | ||
30 | + | ||
31 | + /** | ||
32 | + * @inheritdoc | ||
33 | + */ | ||
34 | + public function down() | ||
35 | + { | ||
36 | + $this->dropTable('event'); | ||
37 | + } | ||
38 | +} |
console/migrations/m160411_211053_create_service.php
0 โ 100644
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles the creation for table `service`. | ||
7 | + */ | ||
8 | +class m160411_211053_create_service extends Migration | ||
9 | +{ | ||
10 | + /** | ||
11 | + * @inheritdoc | ||
12 | + */ | ||
13 | + public function up() | ||
14 | + { | ||
15 | + $this->createTable('service', [ | ||
16 | + 'service_id' => $this->primaryKey(), | ||
17 | + 'name'=> $this->string()->notNull(), | ||
18 | + 'alias'=> $this->string(), | ||
19 | + 'body'=> $this->text()->notNull(), | ||
20 | + 'image' => $this->string(), | ||
21 | + 'meta_title'=> $this->string(), | ||
22 | + 'description' => $this->string(), | ||
23 | + 'h1'=> $this->string(), | ||
24 | + 'seo_text'=> $this->text(), | ||
25 | + 'created_at' => $this->integer(), | ||
26 | + 'updated_at' => $this->integer(), | ||
27 | + ]); | ||
28 | + } | ||
29 | + | ||
30 | + /** | ||
31 | + * @inheritdoc | ||
32 | + */ | ||
33 | + public function down() | ||
34 | + { | ||
35 | + $this->dropTable('service'); | ||
36 | + } | ||
37 | +} |
1 | +<?php | ||
2 | + | ||
3 | +use yii\db\Migration; | ||
4 | + | ||
5 | +/** | ||
6 | + * Handles the creation for table `seo`. | ||
7 | + */ | ||
8 | +class m160411_215739_create_seo extends Migration | ||
9 | +{ | ||
10 | + /** | ||
11 | + * @inheritdoc | ||
12 | + */ | ||
13 | + public function up() | ||
14 | + { | ||
15 | + $this->createTable('seo', [ | ||
16 | + 'seo_id' => $this->primaryKey(), | ||
17 | + 'url'=> $this->string()->notNull(), | ||
18 | + 'title'=> $this->string(), | ||
19 | + 'description' => $this->string(), | ||
20 | + 'h1'=> $this->string(), | ||
21 | + 'seo_text'=> $this->text(), | ||
22 | + | ||
23 | + ]); | ||
24 | + } | ||
25 | + | ||
26 | + /** | ||
27 | + * @inheritdoc | ||
28 | + */ | ||
29 | + public function down() | ||
30 | + { | ||
31 | + $this->dropTable('seo'); | ||
32 | + } | ||
33 | +} |
frontend/config/main.php
@@ -55,6 +55,9 @@ return [ | @@ -55,6 +55,9 @@ return [ | ||
55 | 'brand' => 'catalog/brand', | 55 | 'brand' => 'catalog/brand', |
56 | ] | 56 | ] |
57 | ], | 57 | ], |
58 | + 'page/<translit:[A-Za-z0-9_-]++>'=>'page/show', | ||
59 | + 'event/view/<alias:[A-Za-z0-9_-]+>'=>'event/view', | ||
60 | + 'service/view/<alias:[A-Za-z0-9_-]+>'=>'service/view', | ||
58 | //// 'catalog' => 'catalog/category', | 61 | //// 'catalog' => 'catalog/category', |
59 | // 'catalog/<alias:[A-Za-z0-9_-]+>' => 'catalog/category', | 62 | // 'catalog/<alias:[A-Za-z0-9_-]+>' => 'catalog/category', |
60 | // 'catalog/<alias:[A-Za-z0-9_-]+>/<filter>' => 'catalog/category', | 63 | // 'catalog/<alias:[A-Za-z0-9_-]+>/<filter>' => 'catalog/category', |
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Event; | ||
7 | +use yii\web\Controller; | ||
8 | +use yii\web\NotFoundHttpException; | ||
9 | +use yii\data\ActiveDataProvider; | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | +class EventController extends Controller | ||
14 | +{ | ||
15 | + | ||
16 | + public function actionIndex() | ||
17 | + { | ||
18 | + | ||
19 | + $dataProvider = new ActiveDataProvider([ | ||
20 | + 'query' => Event::find() ]); | ||
21 | + | ||
22 | + return $this->render('index', [ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + ]); | ||
25 | + } | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + public function actionView($alias) | ||
30 | + { | ||
31 | + | ||
32 | + return $this->render('view', [ | ||
33 | + 'model' => $this->findModel($alias), | ||
34 | + ]); | ||
35 | + } | ||
36 | + | ||
37 | + | ||
38 | + protected function findModel($alias) | ||
39 | + { | ||
40 | + if (($model = Event::findOne(["alias"=>$alias])) !== null) { | ||
41 | + return $model; | ||
42 | + } else { | ||
43 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | +} | ||
0 | \ No newline at end of file | 49 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\controllers; | ||
4 | + | ||
5 | +use Yii; | ||
6 | +use common\models\Page; | ||
7 | +use yii\web\Controller; | ||
8 | + | ||
9 | + | ||
10 | +class PageController extends Controller | ||
11 | +{ | ||
12 | + | ||
13 | + public function actionShow($translit) | ||
14 | + { | ||
15 | + $model = new Page; | ||
16 | + if(!$page = $model->getPageTranslit($translit)) | ||
17 | + throw new \Exception(404,'The requested page does not exist.'); | ||
18 | + return $this->render('show',['page'=>$page]); | ||
19 | + } | ||
20 | +} | ||
0 | \ No newline at end of file | 21 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\controllers; | ||
4 | + | ||
5 | +use common\models\Service; | ||
6 | +use Yii; | ||
7 | +use yii\web\Controller; | ||
8 | +use yii\web\NotFoundHttpException; | ||
9 | +use yii\data\ActiveDataProvider; | ||
10 | + | ||
11 | + | ||
12 | + | ||
13 | +class ServiceController extends Controller | ||
14 | +{ | ||
15 | + | ||
16 | + public function actionIndex() | ||
17 | + { | ||
18 | + | ||
19 | + $dataProvider = new ActiveDataProvider([ | ||
20 | + 'query' => Service::find() ]); | ||
21 | + | ||
22 | + return $this->render('index', [ | ||
23 | + 'dataProvider' => $dataProvider, | ||
24 | + ]); | ||
25 | + } | ||
26 | + | ||
27 | + | ||
28 | + | ||
29 | + public function actionView($alias) | ||
30 | + { | ||
31 | + | ||
32 | + return $this->render('view', [ | ||
33 | + 'model' => $this->findModel($alias), | ||
34 | + ]); | ||
35 | + } | ||
36 | + | ||
37 | + | ||
38 | + protected function findModel($alias) | ||
39 | + { | ||
40 | + if (($model = Service::findOne(["alias"=>$alias])) !== null) { | ||
41 | + return $model; | ||
42 | + } else { | ||
43 | + throw new NotFoundHttpException('The requested page does not exist.'); | ||
44 | + } | ||
45 | + } | ||
46 | + | ||
47 | + | ||
48 | +} | ||
0 | \ No newline at end of file | 49 | \ No newline at end of file |
1 | +<?php | ||
2 | + | ||
3 | +namespace frontend\helpers; | ||
4 | +use Yii; | ||
5 | +use yii\helpers\BaseStringHelper; | ||
6 | + | ||
7 | + | ||
8 | +class TextHelper extends BaseStringHelper | ||
9 | +{ | ||
10 | + public static function truncateHtmlText($string, $length, $suffix = '...', $encoding = null, $asHtml = false, $html = '<p></p>') | ||
11 | + { | ||
12 | + if ($asHtml) { | ||
13 | + return static::truncateHtml($string, $length, $suffix, $encoding ?: Yii::$app->charset); | ||
14 | + } | ||
15 | + | ||
16 | + if (mb_strlen($string, $encoding ?: Yii::$app->charset) > $length) { | ||
17 | + return strip_tags(trim(mb_substr($string, 0, $length, $encoding ?: Yii::$app->charset)) . $suffix, $html); | ||
18 | + } else { | ||
19 | + return strip_tags($string, $html); | ||
20 | + } | ||
21 | + | ||
22 | + | ||
23 | + } | ||
24 | +} |
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use frontend\helpers\TextHelper; | ||
4 | +use yii\helpers\Url; | ||
5 | + | ||
6 | +?> | ||
7 | +<div class="portfolio-portfolio"> | ||
8 | + <div class="portfolio-portfolio-overflow"> | ||
9 | + | ||
10 | + <div class="portfolio-portfolio-img-wrap"> | ||
11 | + <div class="portfolio-portfolio-img"> | ||
12 | + <?= Html::a(Html::img($model->minImg($model->image, '200','200')),Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="portfolio-portfolio-text-wrap"> | ||
17 | + | ||
18 | + | ||
19 | + <div class="portfolio-category-name"><?= Html::a($model->name,Url::toRoute(['event/view', 'alias' =>$model->alias ])) ?></div> | ||
20 | + <div class="date_end"> | ||
21 | + ะกัะพะบ ะดะตะนััะฒะธั ะฟะพ: <?= $model->end_at?> | ||
22 | + </div> | ||
23 | + <div class="portfolio-text-name"> | ||
24 | + <p> | ||
25 | + <span><?= TextHelper::truncateHtmlText($model->body, 200, '...') ?></span> | ||
26 | + </p> | ||
27 | + </div> | ||
28 | + <table class="tov-tb-3" cellspacing="0" cellpadding="0" border="0"> | ||
29 | + <tbody> | ||
30 | + <tr> | ||
31 | + <td height="25"><img src="/images/ico-2.jpg" alt=""></td> | ||
32 | + <td height="25"></td><td><a data-toggle="modal" href="#registrationFormModal" style="margin-left: 11px; font-size: 13px; font-family: arial; color: #6b7b9d; border-bottom: 1px dotted;">ะะฐะบะฐะทะฐัั ะบะพะฝััะปััะฐัะธั</a></td> | ||
33 | + </tr> | ||
34 | + </tbody> | ||
35 | + </table> | ||
36 | + </div> | ||
37 | + </div> | ||
38 | +</div> | ||
0 | \ No newline at end of file | 39 | \ No newline at end of file |
1 | +<?php | ||
2 | +use yii\widgets\ListView; | ||
3 | +$this->params['breadcrumbs'][] = ['label' => 'ะะบัะธะธ', 'url' => ['index']]; | ||
4 | +?> | ||
5 | +<?php | ||
6 | + echo ListView::widget( [ | ||
7 | + 'dataProvider' => $dataProvider, | ||
8 | + 'itemView'=>'_objects', | ||
9 | + 'summary'=>'', | ||
10 | + 'layout' => "<div class='portfolio-block-left'>{items}</div> | ||
11 | + <div class='pager-block' id='pager-block-single'>{pager}</div>" | ||
12 | + ] ); | ||
13 | +?> |
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\Stone */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => 'ะะบัะธะธ', 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | + | ||
13 | +?> | ||
14 | +<div class="events-one-item"> | ||
15 | + <h1><?= $model->name?></h1> | ||
16 | + <?= Html::img($model->minImg($model->image, '940','480')) ?> | ||
17 | + <div class="date_end"> | ||
18 | + ะกัะพะบ ะดะตะนััะฒะธั ะฟะพ: <?= $model->end_at?> | ||
19 | + </div> | ||
20 | + <div class="content-last-block-text-wrap"> | ||
21 | + <?= $model->body?> | ||
22 | + </div> | ||
23 | +</div> |
frontend/views/layouts/main.php
@@ -18,7 +18,7 @@ AppAsset::register($this); | @@ -18,7 +18,7 @@ AppAsset::register($this); | ||
18 | <html lang="en"> | 18 | <html lang="en"> |
19 | <head> | 19 | <head> |
20 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | 20 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
21 | - <title>Clean Template</title> | 21 | + <title><?= Html::encode($this->title)?></title> |
22 | <?php $this->head() ?> | 22 | <?php $this->head() ?> |
23 | <link href='https://fonts.googleapis.com/css?family=Ubuntu:400,300italic,300,400italic,500,500italic,700italic,700' rel='stylesheet' type='text/css'> | 23 | <link href='https://fonts.googleapis.com/css?family=Ubuntu:400,300italic,300,400italic,500,500italic,700italic,700' rel='stylesheet' type='text/css'> |
24 | 24 | ||
@@ -33,8 +33,8 @@ AppAsset::register($this); | @@ -33,8 +33,8 @@ AppAsset::register($this); | ||
33 | <div class="left_lineup"> | 33 | <div class="left_lineup"> |
34 | <ul> | 34 | <ul> |
35 | <li><a href="#">ะะฟะปะฐัะฐ</a></li> | 35 | <li><a href="#">ะะฟะปะฐัะฐ</a></li> |
36 | - <li><a href="#">ะะพััะฐะฒะบะฐ</a></li> | ||
37 | - <li><a href="#">ะะพะฝัะฐะบัั</a></li> | 36 | + <li><?=Html::a('ะะพััะฐะฒะบะฐ',Url::toRoute(['page/show', 'translit'=>'dostavka'])); ?></li> |
37 | + <li><?=Html::a('ะะพะฝัะฐะบัั',Url::toRoute(['page/show', 'translit'=>'kontakty'])); ?></li> | ||
38 | </ul> | 38 | </ul> |
39 | </div> | 39 | </div> |
40 | <div class="right_lineup"> | 40 | <div class="right_lineup"> |
@@ -101,7 +101,7 @@ AppAsset::register($this); | @@ -101,7 +101,7 @@ AppAsset::register($this); | ||
101 | <div class="title grey">ะ ะฝะฐั</div> | 101 | <div class="title grey">ะ ะฝะฐั</div> |
102 | <ul style="padding-left: 2px;"> | 102 | <ul style="padding-left: 2px;"> |
103 | <li><a href="#">ะ ะบะพะผะฟะฐะฝะธะธ</a></li> | 103 | <li><a href="#">ะ ะบะพะผะฟะฐะฝะธะธ</a></li> |
104 | - <li><a href="#">ะะพะฝัะฐะบัั</a></li> | 104 | + <li><?=Html::a('ะะพะฝัะฐะบัั',Url::toRoute(['page/show', 'translit'=>'kontakty'])); ?></li> |
105 | <li><a href="#">ะัะพะธะทะฒะพะดะธัะตะปะธ</a></li> | 105 | <li><a href="#">ะัะพะธะทะฒะพะดะธัะตะปะธ</a></li> |
106 | <li><a href="#">ะะพััะฐะฒัะธะบะฐะผ</a></li> | 106 | <li><a href="#">ะะพััะฐะฒัะธะบะฐะผ</a></li> |
107 | </ul> | 107 | </ul> |
@@ -109,7 +109,7 @@ AppAsset::register($this); | @@ -109,7 +109,7 @@ AppAsset::register($this); | ||
109 | <div class="content" style="width: 232px;left: 240px;"> | 109 | <div class="content" style="width: 232px;left: 240px;"> |
110 | <div class="title grey">ะะพะบัะฟะฐัะตะปัะผ</div> | 110 | <div class="title grey">ะะพะบัะฟะฐัะตะปัะผ</div> |
111 | <ul style="margin-left: 2px;"> | 111 | <ul style="margin-left: 2px;"> |
112 | - <li><a href="#">ะะพััะฐะฒะบะฐ</a></li> | 112 | + <li><?=Html::a('ะะพััะฐะฒะบะฐ',Url::toRoute(['page/show', 'translit'=>'dostavka'])); ?></li> |
113 | <li><a href="#">ะะฟะปะฐัะฐ</a></li> | 113 | <li><a href="#">ะะฟะปะฐัะฐ</a></li> |
114 | <li><a href="#">ะัะพะณัะฐะผะผะฐ ะปะพัะปัะฝะพััะธ</a></li> | 114 | <li><a href="#">ะัะพะณัะฐะผะผะฐ ะปะพัะปัะฝะพััะธ</a></li> |
115 | </ul> | 115 | </ul> |
frontend/views/layouts/main_menu.php
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use yii\helpers\Url; | ||
4 | + | ||
5 | +?> | ||
1 | <div class="menu_up"> | 6 | <div class="menu_up"> |
2 | <div class="menu_up_center"> | 7 | <div class="menu_up_center"> |
3 | <div class="home_button"> | 8 | <div class="home_button"> |
@@ -6,7 +11,9 @@ | @@ -6,7 +11,9 @@ | ||
6 | <div class="menu_item"> | 11 | <div class="menu_item"> |
7 | <a href="#" class="m_item1">ะ ะฝะฐั</a> | 12 | <a href="#" class="m_item1">ะ ะฝะฐั</a> |
8 | </div> | 13 | </div> |
9 | - <?= \common\modules\product\widgets\catalogSubmenuWidget::widget([ | 14 | + <?= |
15 | + | ||
16 | + \common\modules\product\widgets\catalogSubmenuWidget::widget([ | ||
10 | 'root_id' => 45, | 17 | 'root_id' => 45, |
11 | 'rootClass' => 'm_item2' | 18 | 'rootClass' => 'm_item2' |
12 | ]) ?> | 19 | ]) ?> |
@@ -14,7 +21,7 @@ | @@ -14,7 +21,7 @@ | ||
14 | 'root_id' => 58, | 21 | 'root_id' => 58, |
15 | 'rootClass' => 'm_item3' | 22 | 'rootClass' => 'm_item3' |
16 | ]) ?> | 23 | ]) ?> |
17 | - <div class="menu_item"><a href="#" class="m_item4">ะฃัะปัะณะธ</a></div> | ||
18 | - <div class="menu_item"><a href="#" class="m_item5">ะะบัะธะธ</a></div> | 24 | + <div class="menu_item"><?=Html::a('ะฃัะปัะณะธ',Url::toRoute(['service/index']),['class'=>'m_item4']); ?></div> |
25 | + <div class="menu_item"><?=Html::a('ะะบัะธะธ',Url::toRoute(['event/index']),['class'=>'m_item5']); ?></div> | ||
19 | </div> | 26 | </div> |
20 | </div> | 27 | </div> |
21 | \ No newline at end of file | 28 | \ No newline at end of file |
1 | +<?php | ||
2 | +use yii\helpers\Html; | ||
3 | +use frontend\helpers\TextHelper; | ||
4 | +use yii\helpers\Url; | ||
5 | + | ||
6 | +?> | ||
7 | +<div class="portfolio-portfolio"> | ||
8 | + <div class="portfolio-portfolio-overflow"> | ||
9 | + | ||
10 | + <div class="portfolio-portfolio-img-wrap"> | ||
11 | + <div class="portfolio-portfolio-img"> | ||
12 | + <?= Html::a(Html::img($model->minImg($model->image, '200','200')),Url::toRoute(['service/view', 'alias' =>$model->alias ])) ?> | ||
13 | + </div> | ||
14 | + </div> | ||
15 | + | ||
16 | + <div class="portfolio-portfolio-text-wrap"> | ||
17 | + | ||
18 | + | ||
19 | + <div class="portfolio-category-name"><?= Html::a($model->name,Url::toRoute(['service/view', 'alias' =>$model->alias ])) ?></div> | ||
20 | + <div class="portfolio-text-name"> | ||
21 | + <p> | ||
22 | + <span><?= TextHelper::truncateHtmlText($model->body, 200, '...') ?></span> | ||
23 | + </p> | ||
24 | + </div> | ||
25 | + <table class="tov-tb-3" cellspacing="0" cellpadding="0" border="0"> | ||
26 | + <tbody> | ||
27 | + <tr> | ||
28 | + <td height="25"><img src="/images/ico-2.jpg" alt=""></td> | ||
29 | + <td height="25"></td><td><a data-toggle="modal" href="#registrationFormModal" style="margin-left: 11px; font-size: 13px; font-family: arial; color: #6b7b9d; border-bottom: 1px dotted;">ะะฐะบะฐะทะฐัั ะบะพะฝััะปััะฐัะธั</a></td> | ||
30 | + </tr> | ||
31 | + </tbody> | ||
32 | + </table> | ||
33 | + </div> | ||
34 | + </div> | ||
35 | +</div> | ||
0 | \ No newline at end of file | 36 | \ No newline at end of file |
1 | +<?php | ||
2 | +use yii\widgets\ListView; | ||
3 | +$this->params['breadcrumbs'][] = ['label' => 'ะฃัะปัะณะธ', 'url' => ['index']]; | ||
4 | +?> | ||
5 | +<?php | ||
6 | + echo ListView::widget( [ | ||
7 | + 'dataProvider' => $dataProvider, | ||
8 | + 'itemView'=>'_objects', | ||
9 | + 'summary'=>'', | ||
10 | + 'layout' => "<div class='portfolio-block-left'>{items}</div> | ||
11 | + <div class='pager-block' id='pager-block-single'>{pager}</div>" | ||
12 | + ] ); | ||
13 | +?> |
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\Stone */ | ||
8 | + | ||
9 | +$this->title = $model->name; | ||
10 | +$this->params['breadcrumbs'][] = ['label' => 'ะฃัะปัะณะธ', 'url' => ['index']]; | ||
11 | +$this->params['breadcrumbs'][] = $this->title; | ||
12 | + | ||
13 | +?> | ||
14 | +<div class="events-one-item"> | ||
15 | + <h1><?= $model->name?></h1> | ||
16 | + <?= Html::img($model->minImg($model->image, '940','480')) ?> | ||
17 | + <div class="content-last-block-text-wrap"> | ||
18 | + <?= $model->body?> | ||
19 | + </div> | ||
20 | +</div> |
frontend/web/css/style.css
@@ -1104,4 +1104,36 @@ input.error_pass{ | @@ -1104,4 +1104,36 @@ input.error_pass{ | ||
1104 | -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; | 1104 | -webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s; |
1105 | -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; | 1105 | -o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; |
1106 | transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; | 1106 | transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s; |
1107 | +} | ||
1108 | + | ||
1109 | +.portfolio-portfolio { | ||
1110 | + width: 940px; | ||
1111 | + height:230px; | ||
1112 | + border-bottom: 1px solid #c8ced5; | ||
1113 | + padding-top: 15px; | ||
1114 | + box-sizing: border-box; | ||
1115 | + position: relative; | ||
1116 | +} | ||
1117 | + | ||
1118 | +.portfolio-portfolio-img-wrap { | ||
1119 | + width: 200px; | ||
1120 | + height: 200px; | ||
1121 | + margin-right: 15px; | ||
1122 | + float: left; | ||
1123 | +} | ||
1124 | + | ||
1125 | + | ||
1126 | +.portfolio-portfolio-text-wrap { | ||
1127 | + width: 925px; | ||
1128 | +} | ||
1129 | + | ||
1130 | +.date_end { | ||
1131 | + display: block; | ||
1132 | + padding: 10px 0; | ||
1133 | + font-size: 12px; | ||
1134 | + | ||
1135 | +} | ||
1136 | + | ||
1137 | +.portfolio-text-name{ | ||
1138 | + padding: 20px 0; | ||
1107 | } | 1139 | } |
1108 | \ No newline at end of file | 1140 | \ No newline at end of file |
1.85 KB
1 | +<?php | ||
2 | +namespace frontend\components; | ||
3 | +use common\models\SeoSearch; | ||
4 | +use yii\base\Widget; | ||
5 | + | ||
6 | +class Seo extends Widget | ||
7 | +{ | ||
8 | + private $url; | ||
9 | + public $row; | ||
10 | + | ||
11 | + public function init(){ | ||
12 | + $this->url = $_SERVER['REQUEST_URI']; | ||
13 | + parent::init(); | ||
14 | + | ||
15 | + } | ||
16 | + | ||
17 | + | ||
18 | + public function run() | ||
19 | + { | ||
20 | + $widgetData = $this->findModel(); | ||
21 | + | ||
22 | + return $widgetData->{$this->row}; | ||
23 | + } | ||
24 | + | ||
25 | + protected function findModel() | ||
26 | + { | ||
27 | + if (($model = \common\models\Seo::findOne(['url'=>$this->url])) !== null) { | ||
28 | + return $model; | ||
29 | + } else { | ||
30 | + return new SeoSearch(); | ||
31 | + } | ||
32 | + } | ||
33 | +} | ||
0 | \ No newline at end of file | 34 | \ No newline at end of file |