diff --git a/backend/config/main.php b/backend/config/main.php
index d7c47be..7e2b799 100755
--- a/backend/config/main.php
+++ b/backend/config/main.php
@@ -27,7 +27,7 @@
'page-category' => 'artbox\core\controllers\PageCategoryController',
'alias' => 'artbox\core\controllers\AliasController',
'seo' => 'artbox\core\controllers\SeoController',
- 'feedback' => 'artbox\core\controllers\FeedbackController',
+// 'feedback' => 'artbox\core\controllers\FeedbackController',
'blog-article' => 'artbox\weblog\controllers\ArticleController',
'blog-category' => 'artbox\weblog\controllers\CategoryController',
'blog-tag' => 'artbox\weblog\controllers\TagController',
diff --git a/backend/controllers/FeedbackController.php b/backend/controllers/FeedbackController.php
new file mode 100644
index 0000000..790eeba
--- /dev/null
+++ b/backend/controllers/FeedbackController.php
@@ -0,0 +1,172 @@
+ [
+ 'class' => VerbFilter::className(),
+ 'actions' => [
+ 'delete' => ['POST'],
+ ],
+ ],
+ ];
+ }
+
+ /**
+ * Lists all Feedback models.
+ * @return mixed
+ */
+ public function actionIndex()
+ {
+ $searchModel = new FeedbackSearch();
+ $dataProvider = new ActiveDataProvider(
+ [
+ 'query' => Feedback::find()->orderBy(['created_at' => SORT_DESC]),
+ ]
+ );
+
+ return $this->render('index', [
+ 'searchModel' => $searchModel,
+ 'dataProvider' => $dataProvider,
+ ]);
+ }
+
+ /**
+ * Displays a single Feedback model.
+ * @param integer $id
+ * @return mixed
+ */
+ public function actionView($id)
+ {
+ $model = $this->findModel($id);
+
+ $model->status = true;
+ $model->save(false, [ 'status' ]);
+
+ return $this->render('view', [
+ 'model' => $model,
+ ]);
+ }
+
+ /**
+ * Creates a new Feedback model.
+ * If creation is successful, the browser will be redirected to the 'view' page.
+ * @return mixed
+ */
+ public function actionCreate()
+ {
+ $model = new Feedback();
+
+ 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 Feedback 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);
+
+ $model->status = true;
+ $model->save(false, [ 'status' ]);
+
+ 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 Feedback 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 Feedback model based on its primary key value.
+ * If the model is not found, a 404 HTTP exception will be thrown.
+ * @param integer $id
+ * @return Feedback the loaded model
+ * @throws NotFoundHttpException if the model cannot be found
+ */
+ protected function findModel($id)
+ {
+ if (($model = Feedback::findOne($id)) !== null) {
+ return $model;
+ } else {
+ throw new NotFoundHttpException('The requested page does not exist.');
+ }
+ }
+
+ public function actionViewed($id)
+ {
+ if (Yii::$app->request->isPost) {
+ $model = $this->findModel($id);
+
+ Yii::$app->response->format = Response::FORMAT_JSON;
+
+ $model->status = true;
+ if ($model->save(false, [ 'status' ])) {
+
+ $widget = FeedbackWidget::widget();
+
+ return [
+ 'text' => Html::tag(
+ 'span',
+ '',
+ [
+ 'class' => 'glyphicon glyphicon-ok',
+ ]
+ ),
+ 'message' => [
+ 'title' => Yii::t('core', 'Notification') . ':',
+ 'text' => Yii::t('core', 'Status changed'),
+ ],
+ 'widget' => $widget,
+ ];
+ }
+ }
+ return [];
+ }
+
+}
diff --git a/backend/controllers/PersoneController.php b/backend/controllers/PersoneController.php
old mode 100644
new mode 100755
index 57e7302..57e7302
--- a/backend/controllers/PersoneController.php
+++ b/backend/controllers/PersoneController.php
diff --git a/backend/views/feedback/_form.php b/backend/views/feedback/_form.php
new file mode 100644
index 0000000..d4871ae
--- /dev/null
+++ b/backend/views/feedback/_form.php
@@ -0,0 +1,37 @@
+
+
+
diff --git a/backend/views/feedback/_search.php b/backend/views/feedback/_search.php
new file mode 100644
index 0000000..2f3b77a
--- /dev/null
+++ b/backend/views/feedback/_search.php
@@ -0,0 +1,49 @@
+
+
+
+
+ ['index'],
+ 'method' => 'get',
+ ]); ?>
+
+ = $form->field($model, 'id') ?>
+
+ = $form->field($model, 'name') ?>
+
+ = $form->field($model, 'email') ?>
+
+ = $form->field($model, 'phone') ?>
+
+ = $form->field($model, 'message') ?>
+
+ field($model, 'created_at') ?>
+
+ field($model, 'ip') ?>
+
+ field($model, 'url') ?>
+
+ field($model, 'status')->checkbox() ?>
+
+ field($model, 'date') ?>
+
+ field($model, 'service') ?>
+
+ field($model, 'time') ?>
+
+
+ = Html::submitButton(Yii::t('app', 'Search'), ['class' => 'btn btn-primary']) ?>
+ = Html::resetButton(Yii::t('app', 'Reset'), ['class' => 'btn btn-default']) ?>
+
+
+
+
+
diff --git a/backend/views/feedback/create.php b/backend/views/feedback/create.php
new file mode 100644
index 0000000..ee50797
--- /dev/null
+++ b/backend/views/feedback/create.php
@@ -0,0 +1,21 @@
+title = Yii::t('app', 'Create Feedback');
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Feedbacks'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/feedback/index.php b/backend/views/feedback/index.php
new file mode 100644
index 0000000..2f36486
--- /dev/null
+++ b/backend/views/feedback/index.php
@@ -0,0 +1,83 @@
+title = Yii::t('app', 'Feedbacks');
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+ render('_search', ['model' => $searchModel]); ?>
+
+
+ = Html::a(Yii::t('app', 'Create Feedback'), ['create'], ['class' => 'btn btn-success']) ?>
+
+ = GridView::widget([
+ 'dataProvider' => $dataProvider,
+ 'rowOptions' => function (Feedback $model) {
+ if ($model->status) {
+ return [];
+ } else {
+ return [
+ 'class' => 'success',
+ ];
+ }
+ },
+ 'filterModel' => $searchModel,
+ 'columns' => [
+ ['class' => 'yii\grid\SerialColumn'],
+
+ 'id',
+ 'name',
+ 'email:email',
+ 'phone',
+ // 'message:ntext',
+ // 'created_at',
+ // 'ip',
+ // 'url:url',
+ // 'status:boolean',
+ 'date',
+ 'service',
+ 'time',
+
+ [
+ 'class' => 'yii\grid\ActionColumn',
+ 'buttons' => [
+ 'viewed' => function (string $url, Feedback $model) {
+ if ($model->status) {
+ return Html::tag(
+ 'span',
+ '',
+ [
+ 'class' => 'glyphicon glyphicon-ok',
+ ]
+ );
+ } else {
+ return Html::a(
+ Html::tag(
+ 'span',
+ '',
+ [
+ 'class' => 'glyphicon glyphicon-flag',
+ ]
+ ),
+ $url,
+ [
+ 'class' => 'viewed-toggle',
+ ]
+ );
+ }
+ },
+ ],
+ 'template' => '{viewed} {view} {update} {delete}',
+ ],
+ ],
+ ]); ?>
+
diff --git a/backend/views/feedback/update.php b/backend/views/feedback/update.php
new file mode 100644
index 0000000..192e611
--- /dev/null
+++ b/backend/views/feedback/update.php
@@ -0,0 +1,23 @@
+title = Yii::t('app', 'Update {modelClass}: ', [
+ 'modelClass' => 'Feedback',
+]) . $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Feedbacks'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = ['label' => $model->name, 'url' => ['view', 'id' => $model->id]];
+$this->params['breadcrumbs'][] = Yii::t('app', 'Update');
+?>
+
+
+
= Html::encode($this->title) ?>
+
+ = $this->render('_form', [
+ 'model' => $model,
+ ]) ?>
+
+
diff --git a/backend/views/feedback/view.php b/backend/views/feedback/view.php
new file mode 100644
index 0000000..67ee76c
--- /dev/null
+++ b/backend/views/feedback/view.php
@@ -0,0 +1,52 @@
+title = $model->name;
+$this->params['breadcrumbs'][] = ['label' => Yii::t('app', 'Feedbacks'), 'url' => ['index']];
+$this->params['breadcrumbs'][] = $this->title;
+?>
+
+
+
= Html::encode($this->title) ?>
+
+
+ = Html::a(Yii::t('app', 'Update'), ['update', 'id' => $model->id], ['class' => 'btn btn-primary']) ?>
+ = Html::a(Yii::t('app', 'Delete'), ['delete', 'id' => $model->id], [
+ 'class' => 'btn btn-danger',
+ 'data' => [
+ 'confirm' => Yii::t('app', 'Are you sure you want to delete this item?'),
+ 'method' => 'post',
+ ],
+ ]) ?>
+
+
+ = DetailView::widget([
+ 'model' => $model,
+ 'attributes' => [
+ 'id',
+ 'name',
+ 'email:email',
+ 'phone',
+ 'message:ntext',
+ [
+ 'attribute' => 'created_at',
+ 'format' => [
+ 'datetime',
+ 'php:d.m.Y H:i',
+ ],
+ ],
+ 'ip',
+ 'url:url',
+ 'status:boolean',
+ 'date',
+ 'service',
+ 'time',
+ ],
+ ]) ?>
+
+
diff --git a/backend/views/persone/_form.php b/backend/views/persone/_form.php
old mode 100644
new mode 100755
index 9f440b3..9f440b3
--- a/backend/views/persone/_form.php
+++ b/backend/views/persone/_form.php
diff --git a/backend/views/persone/_search.php b/backend/views/persone/_search.php
old mode 100644
new mode 100755
index e89b966..e89b966
--- a/backend/views/persone/_search.php
+++ b/backend/views/persone/_search.php
diff --git a/backend/views/persone/create.php b/backend/views/persone/create.php
old mode 100644
new mode 100755
index 446b3aa..446b3aa
--- a/backend/views/persone/create.php
+++ b/backend/views/persone/create.php
diff --git a/backend/views/persone/index.php b/backend/views/persone/index.php
old mode 100644
new mode 100755
index 3e1dff3..3e1dff3
--- a/backend/views/persone/index.php
+++ b/backend/views/persone/index.php
diff --git a/backend/views/persone/update.php b/backend/views/persone/update.php
old mode 100644
new mode 100755
index f5d9bde..f5d9bde
--- a/backend/views/persone/update.php
+++ b/backend/views/persone/update.php
diff --git a/backend/views/persone/view.php b/backend/views/persone/view.php
old mode 100644
new mode 100755
index 1a30b40..1a30b40
--- a/backend/views/persone/view.php
+++ b/backend/views/persone/view.php
diff --git a/common/models/Feedback.php b/common/models/Feedback.php
new file mode 100755
index 0000000..2aaf747
--- /dev/null
+++ b/common/models/Feedback.php
@@ -0,0 +1,119 @@
+ [
+ 'name',
+ 'phone',
+ 'date',
+ 'time',
+ 'service',
+ ],
+
+ self::SCENARIO_WRITE_US => [
+ 'name',
+ 'email',
+ 'phone',
+ 'message',
+ ],
+ ]
+ );
+
+ return $scenarios;
+ }
+
+ public function rules()
+ {
+ return [
+ [
+ [
+ 'name',
+ 'phone',
+ 'date',
+ ],
+ 'required',
+ 'on' => self::SCENARIO_APPOINTMENT,
+ ],
+ [
+ [
+ 'name',
+ 'email',
+ 'phone',
+ ],
+ 'required',
+ 'on' => self::SCENARIO_WRITE_US,
+ ],
+ [
+ [ 'email' ],
+ 'email',
+ ],
+ [
+ [
+ 'name',
+ 'date',
+ 'service',
+ 'time',
+ ],
+ 'string',
+ 'max' => 55,
+ ],
+ [
+ [ 'phone' ],
+ 'match',
+ 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
+ ],
+ [
+ [ 'message' ],
+ 'string',
+ ],
+ [
+ [ 'status', ],
+ 'boolean',
+ ],
+ ];
+ }
+
+ /**
+ * @inheritdoc
+ */
+ public function attributeLabels()
+ {
+ return [
+ 'id' => Yii::t('core', 'id'),
+ 'name' => Yii::t('core', 'name'),
+ 'phone' => Yii::t('core', 'phone'),
+ 'created_at' => Yii::t('core', 'created_at'),
+ 'ip' => Yii::t('core', 'ip'),
+ 'url' => Yii::t('core', 'url'),
+ 'status' => Yii::t('core', 'status'),
+ 'message' => Yii::t('core', 'message'),
+ 'email' => Yii::t('core', 'email'),
+ 'service' => Yii::t('core', 'service'),
+ 'date' => Yii::t('core', 'date'),
+ 'time' => Yii::t('core', 'time'),
+ ];
+ }
+
+ }
\ No newline at end of file
diff --git a/common/models/FeedbackSearch.php b/common/models/FeedbackSearch.php
new file mode 100644
index 0000000..0267d4e
--- /dev/null
+++ b/common/models/FeedbackSearch.php
@@ -0,0 +1,80 @@
+ $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([
+ 'id' => $this->id,
+ 'created_at' => $this->created_at,
+ 'status' => $this->status,
+ ]);
+
+ $query->andFilterWhere(['like', 'name', $this->name])
+ ->andFilterWhere(['like', 'email', $this->email])
+ ->andFilterWhere(['like', 'phone', $this->phone])
+ ->andFilterWhere(['like', 'message', $this->message])
+ ->andFilterWhere(['like', 'ip', $this->ip])
+ ->andFilterWhere(['like', 'url', $this->url])
+ ->andFilterWhere(['like', 'date', $this->date])
+ ->andFilterWhere(['like', 'service', $this->service])
+ ->andFilterWhere(['like', 'time', $this->time]);
+
+ return $dataProvider;
+ }
+}
diff --git a/frontend/controllers/SiteController.php b/frontend/controllers/SiteController.php
index 72944f9..fec5945 100755
--- a/frontend/controllers/SiteController.php
+++ b/frontend/controllers/SiteController.php
@@ -1,7 +1,7 @@
[
- 'name',
- 'phone',
- 'date',
- 'time',
- 'service',
- ],
-
- self::SCENARIO_WRITE_US => [
- 'name',
- 'email',
- 'phone',
- 'message',
- ],
- ]
- );
-
- return $scenarios;
- }
-
- public function rules()
- {
- return [
- [
- [
- 'name',
- 'phone',
- 'date',
- ],
- 'required',
- 'on' => self::SCENARIO_APPOINTMENT,
- ],
- [
- [
- 'name',
- 'email',
- 'phone',
- ],
- 'required',
- 'on' => self::SCENARIO_WRITE_US,
- ],
- [
- [ 'email' ],
- 'email',
- ],
- [
- [
- 'name',
- 'date',
- 'service',
- 'time',
- ],
- 'string',
- 'max' => 55,
- ],
- [
- [ 'phone' ],
- 'match',
- 'pattern' => '/^\+38\(\d{3}\)\d{3}-\d{2}-\d{2}$/',
- ],
- [
- [ 'message' ],
- 'string',
- ],
- [
- [ 'status', ],
- 'boolean',
- ],
- ];
- }
-
- /**
- * @inheritdoc
- */
- public function attributeLabels()
- {
- return [
- 'id' => Yii::t('core', 'id'),
- 'name' => Yii::t('core', 'name'),
- 'phone' => Yii::t('core', 'phone'),
- 'created_at' => Yii::t('core', 'created_at'),
- 'ip' => Yii::t('core', 'ip'),
- 'url' => Yii::t('core', 'url'),
- 'status' => Yii::t('core', 'status'),
- 'message' => Yii::t('core', 'message'),
- 'email' => Yii::t('core', 'email'),
- 'service' => Yii::t('core', 'service'),
- 'date' => Yii::t('core', 'date'),
- ];
- }
-
- }
\ No newline at end of file
diff --git a/frontend/views/layouts/main.php b/frontend/views/layouts/main.php
index 658eb57..53d0174 100755
--- a/frontend/views/layouts/main.php
+++ b/frontend/views/layouts/main.php
@@ -10,7 +10,7 @@
use artbox\core\components\SeoComponent;
use artbox\core\helpers\ImageHelper;
- use frontend\models\Feedback;
+ use common\models\Feedback;
use artbox\core\models\PageCategory;
use artbox\core\models\User;
use common\models\Settings;
--
libgit2 0.21.4