diff --git a/controllers/CaptureLogsController.php b/controllers/CaptureLogsController.php new file mode 100644 index 00000000..eab57f64 --- /dev/null +++ b/controllers/CaptureLogsController.php @@ -0,0 +1,54 @@ +user->isGuest) { + return $this->redirect(['/site/login']); + } + } + + /** + * {@inheritdoc} + */ + public function behaviors() { + return [ + 'verbs' => [ + 'class' => VerbFilter::className(), + 'actions' => [ + 'delete' => ['POST'], + ], + ], + ]; + } + + /** + * Lists all Script models. + * @return mixed + */ + public function actionIndex() { + $this->view->title = "Ảnh mẫu"; + $searchModel = new CaptureLogsSearch(); + $dataProvider = $searchModel->search(Yii::$app->request->queryParams); + + return $this->render('index', [ + 'searchModel' => $searchModel, + 'dataProvider' => $dataProvider, + ]); + } + + +} diff --git a/helpers/CaptureLogsGrid.php b/helpers/CaptureLogsGrid.php new file mode 100644 index 00000000..e54bb138 --- /dev/null +++ b/helpers/CaptureLogsGrid.php @@ -0,0 +1,32 @@ +app->app_name; + }; + } + + public static function getLayout() { + return "{items}
{summary}
{pager}
"; + } + + public static function actionTemplate() { + return "{update} {delete}"; + } + +} diff --git a/models/CaptureLogs.php b/models/CaptureLogs.php new file mode 100644 index 00000000..5a1aee14 --- /dev/null +++ b/models/CaptureLogs.php @@ -0,0 +1,50 @@ + 'ID', + 'Time' => 'Time', + 'Image' => 'Image', + 'Status' => 'Status', + 'Remark' => 'Remark', + ]; + } +} diff --git a/models/CaptureLogsSearch.php b/models/CaptureLogsSearch.php new file mode 100644 index 00000000..8c331ca7 --- /dev/null +++ b/models/CaptureLogsSearch.php @@ -0,0 +1,72 @@ + $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, + 'Time' => $this->Time, + 'Status' => $this->Status, + ]); + + $query->andFilterWhere(['like', 'Image', $this->Image]) + ->andFilterWhere(['like', 'Remark', $this->Remark]); + + return $dataProvider; + } +} diff --git a/views/capture-logs/index.tpl b/views/capture-logs/index.tpl new file mode 100644 index 00000000..d9ceca39 --- /dev/null +++ b/views/capture-logs/index.tpl @@ -0,0 +1,22 @@ +{extends file=$smarty.current_dir|cat:'/../extends.tpl'} +{use class="yii\helpers\Url"} +{use class="yii\grid\GridView"} +{block name='content'} + + {GridView::widget([ + 'dataProvider' => $dataProvider, + 'filterModel' => $searchModel, + 'layout'=> \app\helpers\CaptureLogsGrid::getLayout(), + 'tableOptions' => [ + 'class' => 'table table-striped table-bordered', + 'style' => 'background:#fff;min-width:700px;' + ], + 'columns' => [ + ['class' => 'yii\grid\SerialColumn'], + 'Time', + 'Image', + 'Status', + 'Remark' + ] + ])} +{/block} \ No newline at end of file