update gui get image
This commit is contained in:
parent
566c065303
commit
73b44eb2af
54
controllers/CaptureLogsController.php
Normal file
54
controllers/CaptureLogsController.php
Normal file
|
@ -0,0 +1,54 @@
|
|||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
use Yii;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\CaptureLogsSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\helpers\Url;
|
||||
|
||||
/**
|
||||
* ScriptController implements the CRUD actions for Script model.
|
||||
*/
|
||||
class CaptureLogsController extends Controller {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if (Yii::$app->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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
}
|
32
helpers/CaptureLogsGrid.php
Normal file
32
helpers/CaptureLogsGrid.php
Normal file
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
use app\models\common;
|
||||
|
||||
class CaptureLogsGrid {
|
||||
|
||||
static $path = "";
|
||||
|
||||
public static function path() {
|
||||
return self::$path;
|
||||
}
|
||||
|
||||
public static function engineNameFunc() {
|
||||
return function ($data) {
|
||||
return $data->app->app_name;
|
||||
};
|
||||
}
|
||||
|
||||
public static function getLayout() {
|
||||
return "{items}<div class='row'><div class='col-md-4'>{summary}</div><div class='col-md-8 text-right'>{pager}</div></div>";
|
||||
}
|
||||
|
||||
public static function actionTemplate() {
|
||||
return "{update} {delete}";
|
||||
}
|
||||
|
||||
}
|
50
models/CaptureLogs.php
Normal file
50
models/CaptureLogs.php
Normal file
|
@ -0,0 +1,50 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "capture_logs".
|
||||
*
|
||||
* @property int $ID
|
||||
* @property int $Time
|
||||
* @property string $Image
|
||||
* @property int $Status
|
||||
* @property string $Remark
|
||||
*/
|
||||
class CaptureLogs extends \yii\db\ActiveRecord
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName()
|
||||
{
|
||||
return 'capture_logs';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['Time', 'Status'], 'integer'],
|
||||
[['Image', 'Remark'], 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels()
|
||||
{
|
||||
return [
|
||||
'ID' => 'ID',
|
||||
'Time' => 'Time',
|
||||
'Image' => 'Image',
|
||||
'Status' => 'Status',
|
||||
'Remark' => 'Remark',
|
||||
];
|
||||
}
|
||||
}
|
72
models/CaptureLogsSearch.php
Normal file
72
models/CaptureLogsSearch.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use app\models\CaptureLogs;
|
||||
|
||||
/**
|
||||
* CaptureLogsSearch represents the model behind the search form of `app\models\CaptureLogs`.
|
||||
*/
|
||||
class CaptureLogsSearch extends CaptureLogs
|
||||
{
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
[['ID', 'Time', 'Status'], 'integer'],
|
||||
[['Image', 'Remark'], 'safe'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function scenarios()
|
||||
{
|
||||
// bypass scenarios() implementation in the parent class
|
||||
return Model::scenarios();
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates data provider instance with search query applied
|
||||
*
|
||||
* @param array $params
|
||||
*
|
||||
* @return ActiveDataProvider
|
||||
*/
|
||||
public function search($params)
|
||||
{
|
||||
$query = CaptureLogs::find();
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $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;
|
||||
}
|
||||
}
|
22
views/capture-logs/index.tpl
Normal file
22
views/capture-logs/index.tpl
Normal file
|
@ -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}
|
Loading…
Reference in New Issue
Block a user