Compare commits
139 Commits
master
...
litepro_de
Author | SHA1 | Date | |
---|---|---|---|
9960469007 | |||
6ae14302fd | |||
d8fe80034e | |||
7c8014ca87 | |||
8918a58746 | |||
5a3074ff4a | |||
8ec330d21d | |||
0dce5700b5 | |||
d4cc9654d8 | |||
a26cf27d08 | |||
c29719d73e | |||
e4e080266a | |||
82a5b0d0ad | |||
21cc5f2050 | |||
ea202ccc3f | |||
58a5522642 | |||
476f01098f | |||
5450124be9 | |||
8954a2fc25 | |||
c8e0bb7795 | |||
d6d7dc3719 | |||
982db2b6c8 | |||
1817771d88 | |||
33e439de8f | |||
ac0588b711 | |||
3ecfd63b68 | |||
aba8a19d75 | |||
9aa5b3b03a | |||
c22ce35c48 | |||
7545b93ee7 | |||
11ecb518ef | |||
4a08ad05df | |||
45c9a9f4f1 | |||
64d9ad0b88 | |||
8758bb3692 | |||
26d240b3ad | |||
bd43865bb2 | |||
74d8ab31bf | |||
2b3e30ad0e | |||
ce6bcfabba | |||
3fd18b0d95 | |||
e26819f1fb | |||
7d83a98e21 | |||
8dc6ca8104 | |||
7181c32bbf | |||
c3d93f64c6 | |||
e4829d7f78 | |||
61e82f68ca | |||
66357b25d5 | |||
a27bf65303 | |||
f9f32878cd | |||
22f6d0c158 | |||
f41cb233c5 | |||
14467d53b5 | |||
b207d54462 | |||
6c4190372e | |||
0b50249cdf | |||
eb88996797 | |||
7057e5b35c | |||
5598e1f3ad | |||
1e3f0bef13 | |||
821cf9463d | |||
08266f3a5f | |||
9ceb3567c9 | |||
2c722a1ee9 | |||
70d60ff51e | |||
c02733be18 | |||
924d23dad0 | |||
b006af4e1f | |||
1b1162f3c2 | |||
bf93f6c9d0 | |||
aaa6de6f9c | |||
e45e08f372 | |||
c353c25abf | |||
92541936d1 | |||
6d87d47d68 | |||
3f22f89654 | |||
32939a05cb | |||
5cefdb8031 | |||
74135e96de | |||
8cb9cd30bc | |||
cc41875ad2 | |||
5472f6ef77 | |||
aa811a40dd | |||
3b247f9f25 | |||
3611390586 | |||
09604d1cb8 | |||
d296533184 | |||
cb6c8fba32 | |||
c9d0c24218 | |||
ddcf67ba9c | |||
dc75b88bd8 | |||
86afa3a430 | |||
18ffc9c6f4 | |||
22f3a3f650 | |||
b26814bb97 | |||
492651570e | |||
999df32e09 | |||
9cca411720 | |||
45be07f772 | |||
ef59255c52 | |||
d0f17afc39 | |||
fc0f2ccc0f | |||
40df99acd9 | |||
3f289ddc9d | |||
bba20c9c17 | |||
df644d539d | |||
5bb7d519fc | |||
ef08b20d16 | |||
27e58bf5e1 | |||
4d6f1cbed8 | |||
04d467a73c | |||
0095c2c133 | |||
6cbe36d04f | |||
9bdfb205f6 | |||
fc347376d3 | |||
8530a33542 | |||
237f658e16 | |||
5d5de05f85 | |||
e27b8de414 | |||
483e0fa349 | |||
94215e4e80 | |||
fbc48fca53 | |||
7ff0f1b976 | |||
75073b956d | |||
24e3347d43 | |||
ee3c869d71 | |||
3a34cc43c8 | |||
ed4b8a0144 | |||
4cb2f77598 | |||
f694e9fe71 | |||
811ed32e04 | |||
3ef04dfb5a | |||
0c9bbd3314 | |||
df39cdf602 | |||
4187fc7239 | |||
6030ccd0a5 | |||
efb4113001 | |||
73b44eb2af |
23
assets/CaptureLogsAsset.php
Normal file
23
assets/CaptureLogsAsset.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace app\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
class CaptureLogsAsset extends AssetBundle {
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
];
|
||||
public $js = [
|
||||
'js/capture-logs.js'
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'app\assets\AppAsset',
|
||||
'yii\jui\JuiAsset',
|
||||
'yii\bootstrap\BootstrapAsset',
|
||||
];
|
||||
|
||||
}
|
23
assets/ControlLogsAsset.php
Normal file
23
assets/ControlLogsAsset.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace app\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
class ControlLogsAsset extends AssetBundle {
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
];
|
||||
public $js = [
|
||||
'js/control-logs.js'
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'app\assets\AppAsset',
|
||||
'yii\jui\JuiAsset',
|
||||
'yii\bootstrap\BootstrapAsset',
|
||||
];
|
||||
|
||||
}
|
23
assets/FaceComparisonAsset.php
Normal file
23
assets/FaceComparisonAsset.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace app\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
class FaceComparisonAsset extends AssetBundle {
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
];
|
||||
public $js = [
|
||||
'js/face-comparison.js'
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'app\assets\AppAsset',
|
||||
'yii\jui\JuiAsset',
|
||||
'yii\bootstrap\BootstrapAsset',
|
||||
];
|
||||
|
||||
}
|
23
assets/ListManagementAsset.php
Normal file
23
assets/ListManagementAsset.php
Normal file
|
@ -0,0 +1,23 @@
|
|||
<?php
|
||||
|
||||
namespace app\assets;
|
||||
|
||||
use yii\web\AssetBundle;
|
||||
|
||||
class ListManagementAsset extends AssetBundle {
|
||||
|
||||
public $basePath = '@webroot';
|
||||
public $baseUrl = '@web';
|
||||
public $css = [
|
||||
];
|
||||
public $js = [
|
||||
'js/list-management.js'
|
||||
];
|
||||
public $depends = [
|
||||
'yii\web\YiiAsset',
|
||||
'app\assets\AppAsset',
|
||||
'yii\jui\JuiAsset',
|
||||
'yii\bootstrap\BootstrapAsset',
|
||||
];
|
||||
|
||||
}
|
|
@ -10,6 +10,9 @@ namespace app\commands;
|
|||
|
||||
use yii\console\Controller;
|
||||
use yii\console\ExitCode;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\ListManagement;
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This command echoes the first argument that you have entered.
|
||||
|
@ -28,32 +31,34 @@ class SyncController extends Controller {
|
|||
*/
|
||||
public function actionIndex() {
|
||||
if ($this->is_connected()) {
|
||||
$sync = \app\models\SyncUrl::find()->one();
|
||||
if ($sync) {
|
||||
$logs = \app\models\FaceLogs::find()->all();
|
||||
foreach ($logs as $key => $value) {
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"camera_id" => $value->camera_id,
|
||||
"confidence" => $value->confidence,
|
||||
"enable_door" => $value->enable_door,
|
||||
"encoded_person_image" => $value->encoded_person_image,
|
||||
"frametime" => $value->frametime,
|
||||
"id" => $value->face_id,
|
||||
"image" => $value->image,
|
||||
"name" => $value->name,
|
||||
"person_id" => $value->person_id,
|
||||
"status" => $value->status,
|
||||
"stt" => $value->stt,
|
||||
"timezone" => $value->timezone
|
||||
]),
|
||||
]
|
||||
];
|
||||
file_get_contents($sync->data, false, stream_context_create($options));
|
||||
$value->delete();
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 209;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
$ls = CaptureLogs::find()->andWhere(['<>', 'staff_id', 0])->andWhere(['sync_status' => null])->all();
|
||||
foreach ($ls as $key => $value) {
|
||||
$staffInfo = ListManagement::findOne($value->staff_id);
|
||||
$res = json_decode(file_get_contents("https://" . $ip . "/api/box/oem_face_recognition", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)),
|
||||
'camera_id' => strval($id_camera),
|
||||
'frametime' => date("Y-m-d H:i:s", $value->time + 60 * 60 * 7),
|
||||
'idCard' => $staffInfo ? strval($staffInfo->code) : "0",
|
||||
"person_id" => "123",
|
||||
"timezone" => "+7"
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res['status'] == 10000) {
|
||||
$value->sync_status = 1;
|
||||
$value->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,4 +2,11 @@
|
|||
|
||||
return [
|
||||
'adminEmail' => 'admin@example.com',
|
||||
"type" => "BiFace", // BiFace, BiTable
|
||||
"maxLogs" => 50000,
|
||||
"maxPicture" => 9999,
|
||||
"version" => "1.0.7",
|
||||
"autoSyncLog" => false,
|
||||
"timeoutRequestServer" => 4,
|
||||
"test" => 6
|
||||
];
|
||||
|
|
|
@ -5,6 +5,11 @@ namespace app\controllers;
|
|||
use Yii;
|
||||
use yii\web\Controller;
|
||||
use yii\filters\VerbFilter;
|
||||
use yii\helpers\FileHelper;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\ListManagement;
|
||||
use app\models\common;
|
||||
use app\models\Schedule;
|
||||
|
||||
/**
|
||||
* CardController implements the CRUD actions for Card model.
|
||||
|
@ -51,4 +56,847 @@ class ApiController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
public function actionGetLogs() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->bodyParams;
|
||||
$time = date_format(date_create_from_format('Y-m-d H:i:s', $post['time']), 'U');
|
||||
$key = common::generateRandomString();
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
$fileName = "face_" . $key . "_" . $time . ".png";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
file_put_contents($targetPath . "/" . $fileName, base64_decode($post['image']));
|
||||
|
||||
$totalsLogs = CaptureLogs::find()->count();
|
||||
if ($totalsLogs >= \Yii::$app->params['maxLogs']) {
|
||||
$lastLogs = CaptureLogs::find()->orderBy(["id" => SORT_ASC])->limit(1)->one();
|
||||
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $lastLogs->image);
|
||||
$lastLogs->delete();
|
||||
}
|
||||
$lastLogs = CaptureLogs::find()->andWhere(["staff_id" => $post['id']])->orderBy(["time" => SORT_DESC])->limit(1)->one();
|
||||
if ($lastLogs && ($time - $lastLogs->time) < 1) {
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "] duplicate face " . $post["id"], FILE_APPEND);
|
||||
return ["status" => "success"];
|
||||
}
|
||||
|
||||
$model = new CaptureLogs();
|
||||
$logs = $model->create([
|
||||
"Staff" => $post["id"],
|
||||
"Time" => $time,
|
||||
"Image" => $fileName,
|
||||
"Confidence" => json_encode($post["confidence"])
|
||||
]);
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$parseUrl = parse_url($ip);
|
||||
$host = $parseUrl['host'];
|
||||
$port = isset($parseUrl['port']) ? $parseUrl['port'] : 80;
|
||||
if ($this->is_connected($host, $port) && $logs) {
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 0;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
$logsInfo = CaptureLogs::findOne($logs);
|
||||
$staffInfo = ListManagement::findOne($post['id']);
|
||||
$tk = "";
|
||||
$token = \app\models\SyncUrl::findOne(['key_config' => 'token']);
|
||||
if ($token)
|
||||
$tk = $token->data;
|
||||
$data = [];
|
||||
$data[] = strval($id_camera); //camera_id
|
||||
$data[] = date("Y-m-d H:i:s", $time); //frametime
|
||||
$data[] = $staffInfo ? strval($staffInfo->code) : "0"; //idCard
|
||||
$data[] = $staffInfo ? $staffInfo->staff_id : ""; //idObject
|
||||
$data[] = "123"; //person_id
|
||||
$data[] = "+7"; //timezone
|
||||
$text = implode("|", $data);
|
||||
$res = json_decode(@file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([
|
||||
'http' => [
|
||||
'timeout' => Yii::$app->params['timeoutRequestServer'],
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName)),
|
||||
'data' => common::rsaEncode($text),
|
||||
'confidence' => isset($post["confidence"]["percent1"]) ? $post["confidence"]["percent1"] : 0
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res && $res['status'] == 10000) {
|
||||
$logsInfo->sync_status = 1;
|
||||
$logsInfo->save();
|
||||
} else {
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "] /api/box/face_recognition_auth_v2 timeout " . $ip, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
return ["status" => "success"];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionGetAllFeatures($offset = 0, $limit = 10) {
|
||||
$listManagement = ListManagement::find()->limit($limit)->offset($offset)->all();
|
||||
$allFeatures = [];
|
||||
foreach ($listManagement as $key => $value) {
|
||||
$features = json_decode($value->image, true);
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
// $allFeatures[] = [
|
||||
// "id" => $value->id,
|
||||
// "name" => $this->convert_vi_to_en($value->name),
|
||||
// "features" => $f
|
||||
// ];
|
||||
$feature1 = $feature2 = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$feature1[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$feature2[] = $v['features512'];
|
||||
}
|
||||
$allFeatures[] = [
|
||||
"id" => $value->id,
|
||||
"object_id" => $value->staff_id,
|
||||
"name" => $this->convert_vi_to_en($value->name),
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
];
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return $allFeatures;
|
||||
}
|
||||
|
||||
public function actionData() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
return ListManagement::find()->orderBy(['last_modified' => SORT_DESC])->all();
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFullData() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$lists = ListManagement::find()->andWhere(["IN", "code", Yii::$app->request->post()])->orderBy(['last_modified' => SORT_DESC])->all();
|
||||
$res = [];
|
||||
foreach ($lists as $key => $value) {
|
||||
$f = [];
|
||||
$features = json_decode($value->image, true);
|
||||
foreach ($features as $k => $v) {
|
||||
$f[] = ["url" => base64_encode(file_get_contents(Yii::getAlias('@webroot') . "/data/uploads/face/" . $v['url'])), "features" => $v['features']];
|
||||
}
|
||||
$res[] = [
|
||||
"id" => $value->id,
|
||||
"code" => $value->code,
|
||||
"type" => $value->type,
|
||||
"name" => $value->name,
|
||||
"gender" => $value->gender,
|
||||
"birthday" => $value->birthday,
|
||||
"telephone" => $value->telephone,
|
||||
"department" => $value->address,
|
||||
"time" => $value->time,
|
||||
"images" => $f
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionGetAllImage() {
|
||||
Yii::$app->response->format = "json";
|
||||
$lists = ListManagement::find()->orderBy(['id' => SORT_DESC])->all();
|
||||
$res = [];
|
||||
foreach ($lists as $key => $value) {
|
||||
$f = [];
|
||||
$features = json_decode($value->image, true);
|
||||
foreach ($features as $k => $v) {
|
||||
$f[] = Yii::$app->request->hostInfo . "/data/uploads/face/" . $v['url'];
|
||||
}
|
||||
$res[] = [
|
||||
"id" => $value->id,
|
||||
"code" => $value->code,
|
||||
"type" => $value->type,
|
||||
"name" => $value->name,
|
||||
"gender" => $value->gender,
|
||||
"birthday" => $value->birthday,
|
||||
"telephone" => $value->telephone,
|
||||
"address" => $value->address,
|
||||
"time" => $value->time,
|
||||
"image" => $f
|
||||
];
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function actionResetData() {
|
||||
// return file_get_contents("https://bischool.beetai.com/view/image/5f7c1b22dfe5aaf427a6dfa1");
|
||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||
}
|
||||
|
||||
public function convert_vi_to_en($str) {
|
||||
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", "a", $str);
|
||||
$str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", "e", $str);
|
||||
$str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", "i", $str);
|
||||
$str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", "o", $str);
|
||||
$str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", "u", $str);
|
||||
$str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", "y", $str);
|
||||
$str = preg_replace("/(đ)/", "d", $str);
|
||||
$str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", "A", $str);
|
||||
$str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", "E", $str);
|
||||
$str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", "I", $str);
|
||||
$str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", "O", $str);
|
||||
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", "U", $str);
|
||||
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", "Y", $str);
|
||||
$str = preg_replace("/(Đ)/", "D", $str);
|
||||
//$str = str_replace(" ", "-", str_replace("&*#39;","",$str));
|
||||
return $str;
|
||||
}
|
||||
|
||||
public function getCurrentTime() {
|
||||
$time = microtime();
|
||||
$time = explode(' ', $time);
|
||||
return $time[1] + $time[0];
|
||||
}
|
||||
|
||||
public function actionAutoGenFeature() {
|
||||
Yii::$app->response->format = "json";
|
||||
if (!$this->check512())
|
||||
return ["status" => false];
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
if (!$updating) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "updating",
|
||||
'data' => "false"
|
||||
]);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
}
|
||||
$currentCache = json_decode(@file_get_contents("http://localhost:2305/current-cache"), true);
|
||||
if ($updating->data === "true") {
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$updating->data = "false";
|
||||
$updating->save();
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
|
||||
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
} else {
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "updating";
|
||||
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
}
|
||||
}
|
||||
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$txt = "\n" . date("H:i:s d/m/Y") . " " . "success";
|
||||
// file_put_contents(date('Ymd') . "_logs.txt", $txt, FILE_APPEND);
|
||||
return ["status" => false];
|
||||
}
|
||||
|
||||
$updating->data = "true";
|
||||
$updating->save();
|
||||
|
||||
$processTime = [];
|
||||
set_time_limit(0);
|
||||
$lists = ListManagement::find()->all();
|
||||
foreach ($lists as $key => $value) {
|
||||
$extract = false;
|
||||
$images = json_decode($value->image, true);
|
||||
$newImgs = [];
|
||||
$temp = [];
|
||||
foreach ($images as $k => $v) {
|
||||
if (!isset($v['features512']) || (isset($v['features512']) && count($v['features512']) == 0)) {
|
||||
$start = $this->getCurrentTime();
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url'], "type" => "raw"]
|
||||
],
|
||||
"type" => "512"
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false];
|
||||
$features = json_decode($features['data'], true);
|
||||
$finish = $this->getCurrentTime();
|
||||
$temp[] = round(($finish - $start), 4);
|
||||
$v['features512'] = $features['results'][0]['feature512'];
|
||||
$extract = true;
|
||||
}
|
||||
$newImgs[] = $v;
|
||||
}
|
||||
if ($extract) {
|
||||
$processTime['extract'] = $temp;
|
||||
$start = $this->getCurrentTime();
|
||||
$value->image = json_encode($newImgs);
|
||||
$value->save();
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime["updateDB"] = round(($finish - $start), 4);
|
||||
$txt = "\n" . json_encode($processTime);
|
||||
// file_put_contents(date('Ymd') . ".txt", $txt, FILE_APPEND);
|
||||
}
|
||||
}
|
||||
|
||||
@file_get_contents("http://localhost:2305/update-feature");
|
||||
$updating->data = "false";
|
||||
$updating->save();
|
||||
return ["status" => true];
|
||||
}
|
||||
|
||||
public function actionSync() {
|
||||
Yii::$app->response->format = "json";
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$parseUrl = parse_url($ip);
|
||||
$host = $parseUrl['host'];
|
||||
$port = isset($parseUrl['port']) ? $parseUrl['port'] : 80;
|
||||
if ($this->is_connected($host, $port)) {
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 0;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
$ls = CaptureLogs::find()->andWhere(['sync_status' => null])->all();
|
||||
$tk = "";
|
||||
$token = \app\models\SyncUrl::findOne(['key_config' => 'token']);
|
||||
if ($token)
|
||||
$tk = $token->data;
|
||||
foreach ($ls as $key => $value) {
|
||||
if (file_exists("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)) {
|
||||
$staffInfo = ListManagement::findOne($value->staff_id);
|
||||
$confidence = json_decode($value->confidence, true);
|
||||
$data = [];
|
||||
$data[] = strval($id_camera); //camera_id
|
||||
$data[] = date("Y-m-d H:i:s", $value->time); //frametime
|
||||
$data[] = $staffInfo ? strval($staffInfo->code) : "0"; //idCard
|
||||
$data[] = $staffInfo ? $staffInfo->staff_id : ""; //idObject
|
||||
$data[] = "123"; //person_id
|
||||
$data[] = "+7"; //timezone
|
||||
$text = implode("|", $data);
|
||||
$res = json_decode(@file_get_contents($ip . "/api/box/face_recognition_auth_v2?token=" . $tk, false, stream_context_create([
|
||||
'http' => [
|
||||
'timeout' => Yii::$app->params['timeoutRequestServer'],
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'image' => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value->image)),
|
||||
'data' => common::rsaEncode($text),
|
||||
'confidence' => isset($confidence['percent1']) ? floatval($confidence['percent1']) : 0
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res && $res['status'] == 10000) {
|
||||
$value->sync_status = 1;
|
||||
$value->save();
|
||||
} else {
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "][SYNC] face_recognition_auth_v2 timeout " . $ip, FILE_APPEND);
|
||||
}
|
||||
} else {
|
||||
$value->delete();
|
||||
}
|
||||
}
|
||||
}
|
||||
return ["status" => true];
|
||||
}
|
||||
|
||||
function is_connected($host, $port) {
|
||||
$connected = @fsockopen($host, $port);
|
||||
//website, port (try 80 or 443)
|
||||
if ($connected) {
|
||||
$is_conn = true; //action when connected
|
||||
fclose($connected);
|
||||
// file_put_contents("log_connect_server.txt", "\n" . date("H:i:s d/m/Y") . " connected " . $host . ":" . $port, FILE_APPEND);
|
||||
} else {
|
||||
$is_conn = false; //action in connection failure
|
||||
file_put_contents("log_connect_server.txt", "\n[" . date("H:i:s d/m/Y") . "] disconnected " . $host . ":" . $port, FILE_APPEND);
|
||||
}
|
||||
return $is_conn;
|
||||
}
|
||||
|
||||
public function actionGetNumberPerson() {
|
||||
return ListManagement::find()->count();
|
||||
}
|
||||
|
||||
public function actionGetTotalFeature() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = "json";
|
||||
$start = $this->getCurrentTime();
|
||||
$statistics = ListManagement::statisticFeatures();
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime = round(($finish - $start), 4);
|
||||
return [
|
||||
"statistics" => $statistics,
|
||||
"processTime" => $processTime
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCurrentCache() {
|
||||
return @file_get_contents("http://localhost:2305/current-cache");
|
||||
}
|
||||
|
||||
public function actionSaveToken() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->bodyParams;
|
||||
$token = \app\models\SyncUrl::findOne(['key_config' => 'token']);
|
||||
if ($token) {
|
||||
$token->data = $post['token'];
|
||||
$token->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "token",
|
||||
'data' => $post['token']
|
||||
]);
|
||||
}
|
||||
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
|
||||
if ($version) {
|
||||
$version->data = $post['version'];
|
||||
$version->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "version",
|
||||
'data' => $post['version']
|
||||
]);
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function check512() {
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return false;
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0)
|
||||
return false;
|
||||
|
||||
$checkConfig = json_decode(file_get_contents("http://localhost:4004/ReadConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path']
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
|
||||
if (!$checkConfig['status'])
|
||||
return false;
|
||||
|
||||
$config_json = "";
|
||||
if ($checkConfig['status']) {
|
||||
$config_json = json_decode($checkConfig['data'], true);
|
||||
$check512 = $config_json['feature']['type2']['enable'];
|
||||
if ($check512 !== "0")
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function actionTest() {
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$parseUrl = parse_url($ip);
|
||||
$host = $parseUrl['host'];
|
||||
$port = isset($parseUrl['port']) ? $parseUrl['port'] : 80;
|
||||
$this->is_connected($host, $port);
|
||||
}
|
||||
|
||||
public function actionReGenFeature() {
|
||||
@file_get_contents("http://localhost:2305/update-feature");
|
||||
\app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
if (!$updating) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "updating",
|
||||
'data' => "false"
|
||||
]);
|
||||
} else {
|
||||
if ($this->check512()) {
|
||||
$currentCache = json_decode(file_get_contents("http://localhost:2305/current-cache"), true);
|
||||
if ($currentCache['n_128'] == $currentCache['n_512']) {
|
||||
$updating->data = "true";
|
||||
} else {
|
||||
$updating->data = "false";
|
||||
}
|
||||
} else
|
||||
$updating->data = "false";
|
||||
$updating->save();
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return ["data" => "reset updating flag"];
|
||||
}
|
||||
|
||||
public function actionCheckLogs() {
|
||||
set_time_limit(5000);
|
||||
Yii::$app->response->format = "json";
|
||||
$logProcessStatus = \app\models\SyncUrl::findOne(['key_config' => 'log_process_status']);
|
||||
if (!$logProcessStatus) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create(['key_config' => 'log_process_status', 'data' => json_encode(["status" => true, "time" => time()])]);
|
||||
$logProcessStatus = \app\models\SyncUrl::findOne(['key_config' => 'log_process_status']);
|
||||
} else {
|
||||
$processStatus = json_decode($logProcessStatus->data, true);
|
||||
if ($processStatus['status']) {
|
||||
if (time() - $processStatus['time'] < 60 * 3) {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "CHECK LOGS PROCESSING\n", FILE_APPEND);
|
||||
return ["data" => "check logs processing"];
|
||||
}
|
||||
} else {
|
||||
$logProcessStatus->data = json_encode(["status" => true, "time" => time()]);
|
||||
$logProcessStatus->save();
|
||||
}
|
||||
}
|
||||
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
if (!$device_id)
|
||||
return ["data" => "check logs fail"];
|
||||
|
||||
$id_camera = intval($device_id->data);
|
||||
|
||||
$datas = json_decode(file_get_contents($ip . "/api/model/get_log_model", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"idCamera" => $id_camera
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "START CHECK LOGS\n", FILE_APPEND);
|
||||
if ($datas['status'] == 10000) {
|
||||
$logs = $datas['data'];
|
||||
$infomation = [];
|
||||
$fault_information = [];
|
||||
$count = 0;
|
||||
foreach ($logs as $key => $value) {
|
||||
$count++;
|
||||
$start = $this->getCurrentTime();
|
||||
$result = true;
|
||||
if ($value['action'] == "insert_image")
|
||||
$result = $this->insertImage($value['images'][0], $value['id'], $value['files_name'][0]);
|
||||
|
||||
if ($value['action'] == "remove_image")
|
||||
$result = $this->removeImage($value['id'], $value['files_name'][0]);
|
||||
|
||||
if ($value['action'] == "insert_info")
|
||||
$result = $this->insertInfo($value);
|
||||
|
||||
if ($value['action'] == "remove_info")
|
||||
$result = $this->removeInfo($value);
|
||||
|
||||
if ($value['action'] == "insert_door_open")
|
||||
$result = $this->insertSchedule($value);
|
||||
|
||||
if ($value['action'] == "remove_door_open")
|
||||
$result = $this->removeSchedule($value);
|
||||
|
||||
if ($value['action'] == "reset_all") {
|
||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
||||
}
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime = round(($finish - $start), 4);
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", $count . "\t" . $value['action'] . "\t" . $value['files_name'][0] . "\t" . ($result ? "true" : "false") . "\t" . $processTime . "\t" . $value['name'] . "\n", FILE_APPEND);
|
||||
|
||||
if (in_array($value['action'], ['insert_image', 'remove_image', 'insert_info', 'remove_info', 'reset_all', 'insert_door_open', 'remove_door_open'])) {
|
||||
if ($result)
|
||||
$infomation[] = [
|
||||
"obj_Log" => $value['obj_Log'],
|
||||
"action" => $value['action'],
|
||||
"idCamera" => $id_camera
|
||||
];
|
||||
else
|
||||
$fault_information[] = [
|
||||
"obj_Log" => $value['obj_Log'],
|
||||
"action" => $value['action'],
|
||||
"idCamera" => $id_camera
|
||||
];
|
||||
}
|
||||
}
|
||||
if (count($infomation) > 0 || count($fault_information) > 0) {
|
||||
file_get_contents($ip . "/api/model/set_log_model", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"infomation" => $infomation,
|
||||
"fault_information" => $fault_information
|
||||
])
|
||||
]
|
||||
]));
|
||||
@file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
||||
}
|
||||
}
|
||||
$logProcessStatus->data = json_encode(["status" => false, "time" => time()]);
|
||||
$logProcessStatus->save();
|
||||
return ["data" => "check logs"];
|
||||
}
|
||||
|
||||
public function insertImage($image, $staff_id, $files_name) {
|
||||
$model = ListManagement::findOne(['staff_id' => $staff_id]);
|
||||
if (!$model)
|
||||
return false;
|
||||
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$ft = [];
|
||||
$currentArr = [];
|
||||
$currentImg = json_decode($model->image, true);
|
||||
if ($currentImg) {
|
||||
foreach ($currentImg as $key => $value) {
|
||||
if (isset($value['serverKey']))
|
||||
$currentArr[] = $value['serverKey'];
|
||||
}
|
||||
$ft = $currentImg;
|
||||
}
|
||||
if (!in_array($files_name, $currentArr)) {
|
||||
$fileName = "face_" . $staff_id . "_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$img = false;
|
||||
try {
|
||||
$img = file_get_contents(str_replace("&", "&", $image));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
if ($img && $img !== "null") {
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
if (!$this->resizeImg($img, $fileTarget)) {
|
||||
file_put_contents($fileTarget, $img);
|
||||
}
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
],
|
||||
"type" => "128"
|
||||
]);
|
||||
if (!$features['status']) {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "[ERROR] extract feature " . json_encode($features) . "\n", FILE_APPEND);
|
||||
return false;
|
||||
}
|
||||
$features = json_decode($features['data'], true);
|
||||
$ft[] = [
|
||||
"serverKey" => $files_name,
|
||||
"url" => $fileName,
|
||||
"urlOld" => $fileName,
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => []
|
||||
];
|
||||
$model->image = json_encode($ft);
|
||||
$model->last_modified = time();
|
||||
return $model->save();
|
||||
} else {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "[ERROR] image error" . $image . "\n", FILE_APPEND);
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (Yii::$app->params['autoSyncLog'])
|
||||
file_put_contents("logs.txt", "[ERROR] file exists" . $files_name . "\n", FILE_APPEND);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public function removeImage($staff_id, $files_name) {
|
||||
$model = ListManagement::findOne(['staff_id' => $staff_id]);
|
||||
if (!$model)
|
||||
return false;
|
||||
$images = json_decode($model->image, true);
|
||||
$ft = [];
|
||||
foreach ($images as $key => $value) {
|
||||
if (isset($value['serverKey']) && $value['serverKey'] !== $files_name)
|
||||
$ft[] = $value;
|
||||
else
|
||||
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);
|
||||
}
|
||||
$model->image = json_encode($ft);
|
||||
$model->last_modified = time();
|
||||
return $model->save();
|
||||
}
|
||||
|
||||
public function insertInfo($data) {
|
||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
||||
if ($model) {
|
||||
$model->name = $data['name'];
|
||||
$model->abbreviated_name = $data['abbreviated_name'];
|
||||
$model->code = $data['code'];
|
||||
$model->address = $data['department'];
|
||||
$model->last_modified = time();
|
||||
$model->save();
|
||||
} else {
|
||||
$model = new ListManagement();
|
||||
$model->create([
|
||||
'staff_id' => $data['id'],
|
||||
'code' => $data['code'],
|
||||
'type' => 'wl',
|
||||
'name' => $data['name'],
|
||||
'image' => json_encode([]),
|
||||
'gender' => "Male",
|
||||
'birthday' => "",
|
||||
'telephone' => "",
|
||||
'address' => $data['department'],
|
||||
'abbreviated_name' => $data['abbreviated_name'],
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function removeInfo($data) {
|
||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
||||
if ($model) {
|
||||
$images = json_decode($model->image, true);
|
||||
foreach ($images as $k => $v) {
|
||||
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
|
||||
}
|
||||
$model->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function resizeImg($img, $fileTarget) {
|
||||
$im = imagecreatefromstring($img);
|
||||
$width = imagesx($im);
|
||||
$height = imagesy($im);
|
||||
$newwidth = 224;
|
||||
$newheight = 224;
|
||||
if ($width > $newwidth && $height > $newheight) {
|
||||
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
imagejpeg($thumb, $fileTarget);
|
||||
imagedestroy($thumb);
|
||||
imagedestroy($im);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function insertSchedule($data) {
|
||||
$model = new Schedule();
|
||||
$info = ListManagement::findOne(['staff_id' => $data['id']]);
|
||||
$schedule = Schedule::findOne(['staff_id' => $info->id, 'id_door_calendar' => $data['id_door_calendar']]);
|
||||
if ($schedule) {
|
||||
$schedule->from_time = $data['time_in'];
|
||||
$schedule->to_time = $data['time_out'];
|
||||
$schedule->from_date = $this->formatDateSchedule($data['day_in']);
|
||||
$schedule->to_date = $this->formatDateSchedule($data['day_out']);
|
||||
$schedule->date_of_week = $this->formatDayOfWeekSchedule($data['day_of_week']);
|
||||
return $schedule->save();
|
||||
} else {
|
||||
return $model->create([
|
||||
'staff_id' => $info->id,
|
||||
'from_time' => $data['time_in'],
|
||||
'to_time' => $data['time_out'],
|
||||
'from_date' => $this->formatDateSchedule($data['day_in']),
|
||||
'to_date' => $this->formatDateSchedule($data['day_out']),
|
||||
'date_of_week' => $this->formatDayOfWeekSchedule($data['day_of_week']),
|
||||
'id_door_calendar' => $data['id_door_calendar']
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function removeSchedule($data) {
|
||||
$info = ListManagement::findOne(['staff_id' => $data['id']]);
|
||||
if ($info) {
|
||||
$schedule = \app\models\Schedule::findOne([
|
||||
'id_door_calendar' => $data['id_door_calendar'],
|
||||
'staff_id' => $info->id
|
||||
]);
|
||||
if ($schedule)
|
||||
$schedule->delete();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public function formatDateSchedule($date) {
|
||||
$temp = explode(" ", $date);
|
||||
$parse = explode("-", $temp[0]);
|
||||
return $parse[2] . "/" . $parse[1] . "/" . $parse[0];
|
||||
}
|
||||
|
||||
public function formatDayOfWeekSchedule($dayOfWeek) {
|
||||
$days = [];
|
||||
$temp = explode("|", $dayOfWeek);
|
||||
foreach ($temp as $key => $value) {
|
||||
if ($value != "")
|
||||
$days[] = intval($value) + 2;
|
||||
}
|
||||
return implode(",", $days);
|
||||
}
|
||||
|
||||
public function actionCheckOpenDoor() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->bodyParams;
|
||||
$info = ListManagement::findOne(["staff_id" => $post["object_id"]]);
|
||||
$timeGet = date_format(date_create_from_format('Y-m-d H:i:s', $post['timeget']), 'U');
|
||||
$openDoor = 0;
|
||||
if ($info) {
|
||||
$schedules = Schedule::find()->andWhere(["staff_id" => $info->id])->all();
|
||||
foreach ($schedules as $key => $value) {
|
||||
$fromDate = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . $value->from_date), 'U');
|
||||
$toDate = date_format(date_create_from_format('H:i:s d/m/Y', "23:59:59 " . $value->to_date), 'U');
|
||||
if ($timeGet > $fromDate && $timeGet < $toDate) {
|
||||
$dateOfWeek = explode(",", $value->date_of_week);
|
||||
$weekDay = intval(date("w", $timeGet)) + 1;
|
||||
if ($weekDay == 1)
|
||||
$weekDay = 8;
|
||||
if (in_array($weekDay, $dateOfWeek)) {
|
||||
$fromTime = date_format(date_create_from_format('H:i:s d/m/Y', $value->from_time . ":00 " . date("d/m/Y", $timeGet)), 'U');
|
||||
$toTime = date_format(date_create_from_format('H:i:s d/m/Y', $value->to_time . ":59 " . date("d/m/Y", $timeGet)), 'U');
|
||||
if ($timeGet > $fromTime && $timeGet < $toTime)
|
||||
$openDoor = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"status" => 10000,
|
||||
"data" => [
|
||||
"open_door" => $openDoor
|
||||
]
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCheckTimeEngine() {
|
||||
Yii::$app->response->format = "json";
|
||||
$config_engine = ["start_at" => "00:00", "end_at" => "23:59"];
|
||||
$engine_time_config = \app\models\SyncUrl::findOne(['key_config' => 'engine_time_config']);
|
||||
if ($engine_time_config)
|
||||
$config_engine = json_decode($engine_time_config->data, true);
|
||||
|
||||
$start_at = date_format(date_create_from_format('H:i:s d/m/Y', $config_engine['start_at'] . ":00 " . date("d/m/Y")), 'U');
|
||||
$end_at = date_format(date_create_from_format('H:i:s d/m/Y', $config_engine['end_at'] . ":59 " . date("d/m/Y")), 'U');
|
||||
$now = time();
|
||||
if ($now < $start_at || $now > $end_at)
|
||||
return ["status" => false];
|
||||
|
||||
return ["status" => true];
|
||||
}
|
||||
|
||||
}
|
||||
|
|
155
controllers/CaptureLogsController.php
Normal file
155
controllers/CaptureLogsController.php
Normal file
|
@ -0,0 +1,155 @@
|
|||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
use Yii;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\CaptureLogsSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use app\models\ListManagement;
|
||||
|
||||
/**
|
||||
* CaptureLogsController implements the CRUD actions for CaptureLogs model.
|
||||
*/
|
||||
class CaptureLogsController extends Controller {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
|
||||
public function behaviors() {
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function actionIndex($from = "", $to = "", $all = false) {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', "00:00 " . date("d/m/Y")), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', "23:59 " . date("d/m/Y")), 'U');
|
||||
if ($from !== "" && $to !== "") {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', $from), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', $to), 'U');
|
||||
}
|
||||
|
||||
$this->view->title = Yii::t("app", "LICH_SU_HE_THONG");
|
||||
$searchModel = new CaptureLogsSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
if (!$all)
|
||||
$dataProvider->query->andWhere(["capture_logs.staff_id" => 0]);
|
||||
$dataProvider->query->andWhere(["BETWEEN", "capture_logs.time", $f, $t]);
|
||||
|
||||
// $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
// 'http' => [
|
||||
// 'header' => "Content-Type: application/json",
|
||||
// 'method' => "POST"
|
||||
// ]
|
||||
// ])), true);
|
||||
// $data = json_decode($tempConfig['data'], true);
|
||||
// $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one();
|
||||
// if (!is_object($last))
|
||||
// $last = (object) ['id' => 0];
|
||||
// $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'statusArray' => CaptureLogs::$statusArray,
|
||||
'f' => $f,
|
||||
't' => $t,
|
||||
// 'idAuto' => $idAuto,
|
||||
"staffArray" => ListManagement::staffArray(),
|
||||
"typeArray" => ListManagement::typeArray(),
|
||||
"genderArray" => ListManagement::genderArray(),
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionView($id) {
|
||||
return $this->render('view', [
|
||||
'model' => $this->findModel($id),
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionCreate() {
|
||||
$model = new CaptureLogs();
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionUpdate($id) {
|
||||
$model = $this->findModel($id);
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id]);
|
||||
}
|
||||
|
||||
return $this->render('update', [
|
||||
'model' => $model,
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionDelete($id) {
|
||||
$this->findModel($id)->delete();
|
||||
|
||||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
protected function findModel($id) {
|
||||
if (($model = CaptureLogs::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
|
||||
}
|
||||
|
||||
public function actionFaceComparison() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
Yii::$app->response->format = "json";
|
||||
$results = json_decode(file_get_contents("http://192.168.1.43:2305/compare", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"type" => "base64",
|
||||
"img0" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face1'])),
|
||||
"img1" => base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web" . $post['face2']))
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
return [
|
||||
"type1" => number_format($results['type1']['percent'] * 100, 2),
|
||||
"type2" => number_format($results['type2']['percent'] * 100, 2)
|
||||
];
|
||||
} else {
|
||||
$this->view->title = Yii::t("app", "SO_SANH_MAT");
|
||||
return $this->render('face-comparison', [
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUploadFace() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$model = new \app\models\UploadForm();
|
||||
$url = $model->UploadGlobal("image" . $post['imageIndex'], ["PNG", "JPG", "JPEG", "GIF"], "comparison");
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -14,9 +14,9 @@ class ConfigController extends Controller {
|
|||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if (Yii::$app->user->isGuest) {
|
||||
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -34,7 +34,7 @@ class ConfigController extends Controller {
|
|||
}
|
||||
|
||||
public $config_json = [
|
||||
"lang" => "vi",
|
||||
"lang" => "vi",
|
||||
"camera" => [
|
||||
"auto_check" => 1,
|
||||
"num_cam" => 2,
|
||||
|
@ -157,12 +157,12 @@ class ConfigController extends Controller {
|
|||
]
|
||||
];
|
||||
|
||||
/**
|
||||
* Lists all Script models.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionIndex() {
|
||||
$this->view->title = "Cấu hình thiết bị";
|
||||
$this->view->title = Yii::t("app", "CAU_HINH_MAY_CHU");
|
||||
if (Yii::$app->params['type'] != "BiFace")
|
||||
return $this->redirect(['cau-hinh-ip']);
|
||||
if (Yii::$app->user->identity->username != "admin")
|
||||
return $this->redirect(['cau-hinh-nhan-dien']);
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
|
@ -178,7 +178,8 @@ class ConfigController extends Controller {
|
|||
}
|
||||
return $this->render('index', [
|
||||
"servermqtt" => $servermqtt === "" ? $ip . ":1883" : $servermqtt,
|
||||
"url" => isset($temp[2]) ? $temp[2] : $ip . ":5001"
|
||||
"url" => isset($temp[2]) ? $temp[2] : $ip . ":5001",
|
||||
"menu" => $this->renderPartial("menu", ["tab" => "server_config"])
|
||||
]);
|
||||
}
|
||||
|
||||
|
@ -207,9 +208,12 @@ class ConfigController extends Controller {
|
|||
$cfgData = $post['config'];
|
||||
$config_json = [];
|
||||
foreach ($cfgData as $key => $value) {
|
||||
if (is_numeric($value['data'])) {
|
||||
$value['data'] = floatval($value['data']);
|
||||
}
|
||||
// if (is_numeric($value['data'])) {
|
||||
// $value['data'] = floatval($value['data']);
|
||||
// }
|
||||
$value['data'] = trim(strip_tags($value['data']));
|
||||
$value['data'] = str_replace(' ', '', $value['data']);
|
||||
$value['data'] = preg_replace('/\s+/', ' ', $value['data']);
|
||||
|
||||
$pr = explode("|", $value['parent']);
|
||||
if (count($pr) == 1) {
|
||||
|
@ -259,7 +263,9 @@ class ConfigController extends Controller {
|
|||
]));
|
||||
return true;
|
||||
} else {
|
||||
$this->view->title = "Cấu hình nhận diện";
|
||||
$this->view->title = Yii::t("app", "CAU_HINH_NHAN_DIEN");
|
||||
if (Yii::$app->params['type'] != "BiFace")
|
||||
return $this->redirect(['cau-hinh-ip']);
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
|
@ -291,43 +297,97 @@ class ConfigController extends Controller {
|
|||
$config_json = json_decode($checkConfig['data'], true);
|
||||
|
||||
return $this->render('config', [
|
||||
"config_json" => \app\widgets\ConfigTree::widget(['configLists' => $config_json, 'isRoot' => true, 'parent_id' => 'node', 'parent_key' => ''])
|
||||
"config_json" => \app\widgets\ConfigTree::widget(['configLists' => $config_json, 'isRoot' => true, 'parent_id' => 'node', 'parent_key' => '']),
|
||||
"menu" => $this->renderPartial("menu", ["tab" => "engine_config"])
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionReset() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if ($tempConfig['status']) {
|
||||
if ($tempConfig['data'] !== "") {
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0) {
|
||||
$path = "";
|
||||
Yii::$app->response->format = "json";
|
||||
if (Yii::$app->request->post()) {
|
||||
if (Yii::$app->request->post("deleteDB") === "true") {
|
||||
\Yii::$app->db->createCommand()->truncateTable('capture_logs')->execute();
|
||||
\Yii::$app->db->createCommand()->truncateTable('list_management')->execute();
|
||||
array_map('unlink', glob("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/*.*"));
|
||||
try {
|
||||
file_get_contents("http://localhost:2305/update-feature");
|
||||
} catch (\Exception $exc) {
|
||||
|
||||
}
|
||||
\app\models\SyncUrl::deleteAll(['key_config' => 'log_process_status']);
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 0;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
try {
|
||||
$res = json_decode(file_get_contents($ip . "/api/model/reset_log_model", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"idCamera" => $id_camera,
|
||||
"isCloud" => 0
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res['status'] != 10000)
|
||||
return [
|
||||
"status" => false,
|
||||
"btnText" => Yii::t("app", "THU_LAI")
|
||||
];
|
||||
} catch (Exception $ex) {
|
||||
return [
|
||||
"status" => false,
|
||||
"btnText" => Yii::t("app", "THU_LAI")
|
||||
];
|
||||
}
|
||||
}
|
||||
if (Yii::$app->request->post("resetDevice") === "true") {
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if ($tempConfig['status']) {
|
||||
if ($tempConfig['data'] !== "") {
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0) {
|
||||
$path = "";
|
||||
} else {
|
||||
$path = $engineConfig['data']['engines'][0]['path'];
|
||||
}
|
||||
} else {
|
||||
$path = $engineConfig['data']['engines'][0]['path'];
|
||||
$path = "";
|
||||
}
|
||||
} else {
|
||||
$path = "";
|
||||
}
|
||||
} else {
|
||||
$path = "";
|
||||
file_get_contents("http://localhost:4004/Reset", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $path
|
||||
])
|
||||
]
|
||||
]));
|
||||
}
|
||||
file_get_contents("http://localhost:4004/Reset", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $path
|
||||
])
|
||||
]
|
||||
]));
|
||||
return Url::to(['/config']);
|
||||
\app\models\SyncUrl::deleteAll(['IN', 'key_config', ['server_api', 'device_id']]);
|
||||
return [
|
||||
"status" => true,
|
||||
"url" => Url::to(['/config/cau-hinh-thiet-bi'])
|
||||
];
|
||||
} else {
|
||||
return [
|
||||
"title" => Yii::t("app", "RESET_THIET_BI"),
|
||||
"form" => $this->renderPartial("reset")
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -344,7 +404,7 @@ class ConfigController extends Controller {
|
|||
return ['status' => false, 'text' => 'error'];
|
||||
|
||||
if ($tempConfig['data'] === "")
|
||||
return ['status' => false, 'text' => 'Cấu hình ip chưa đúng!'];
|
||||
return ['status' => false, 'text' => Yii::t("app", "CAU_HINH_IP_CHUA_DUNG")];
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0)
|
||||
|
@ -363,9 +423,341 @@ class ConfigController extends Controller {
|
|||
if (!$checkConfig['status']) {
|
||||
return ['status' => false, 'text' => ''];
|
||||
} else {
|
||||
return ['status' => true, 'url' => Url::to(['cau-hinh-nhan-dien'])];
|
||||
@file_get_contents("http://localhost:4004/SetupMedia");
|
||||
return ['status' => true, 'url' => Url::to(['cau-hinh-thiet-bi'])];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCauHinhThietBi() {
|
||||
$this->view->title = Yii::t("app", "CAU_HINH_THIET_BI");
|
||||
if (Yii::$app->params['type'] != "BiFace")
|
||||
return $this->redirect(['cau-hinh-ip']);
|
||||
if (Yii::$app->user->identity->username != "admin")
|
||||
return $this->redirect(['cau-hinh-nhan-dien']);
|
||||
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return $this->redirect(['/config']);
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
|
||||
$server_api = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
if (!$server_api) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => 'server_api',
|
||||
'data' => $engineConfig['data']['engines'][0]['url']
|
||||
]);
|
||||
}
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
if (!$device_id) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => 'device_id',
|
||||
'data' => strval($engineConfig['data']['engines'][0]['id'])
|
||||
]);
|
||||
}
|
||||
return $this->render('device', [
|
||||
"server_api" => \app\models\SyncUrl::findOne(['key_config' => 'server_api']),
|
||||
"device_id" => \app\models\SyncUrl::findOne(['key_config' => 'device_id']),
|
||||
"menu" => $this->renderPartial("menu", ["tab" => "device_config"])
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionSaveConfig() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$server_api = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
if ($server_api) {
|
||||
$server_api->data = $post['server_api'];
|
||||
$server_api->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => 'server_api',
|
||||
'data' => $post['server_api']
|
||||
]);
|
||||
}
|
||||
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
if ($device_id) {
|
||||
$device_id->data = $post['device_id'];
|
||||
$device_id->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => 'device_id',
|
||||
'data' => $post['device_id']
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public $subnet = [
|
||||
"0.0.0.0" => "/0",
|
||||
"128.0.0.0" => "/1",
|
||||
"192.0.0.0" => "/2",
|
||||
"224.0.0.0" => "/3",
|
||||
"240.0.0.0" => "/4",
|
||||
"248.0.0.0" => "/5",
|
||||
"252.0.0.0" => "/6",
|
||||
"254.0.0.0" => "/7",
|
||||
"255.0.0.0" => "/8",
|
||||
"255.128.0.0" => "/9",
|
||||
"255.192.0.0" => "/10",
|
||||
"255.224.0.0" => "/11",
|
||||
"255.240.0.0" => "/12",
|
||||
"255.248.0.0" => "/13",
|
||||
"255.252.0.0" => "/14",
|
||||
"255.254.0.0" => "/15",
|
||||
"255.255.0.0" => "/16",
|
||||
"255.255.128.0" => "/17",
|
||||
"255.255.192.0" => "/18",
|
||||
"255.255.224.0" => "/19",
|
||||
"255.255.240.0" => "/20",
|
||||
"255.255.248.0" => "/21",
|
||||
"255.255.252.0" => "/22",
|
||||
"255.255.254.0" => "/23",
|
||||
"255.255.255.0" => "/24",
|
||||
"255.255.255.128" => "/25",
|
||||
"255.255.255.192" => "/26",
|
||||
"255.255.255.224" => "/27",
|
||||
"255.255.255.240" => "/28",
|
||||
"255.255.255.248" => "/29",
|
||||
"255.255.255.252" => "/30",
|
||||
"255.255.255.254" => "/31",
|
||||
"255.255.255.255" => "/32"
|
||||
];
|
||||
|
||||
public function actionCauHinhIp() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$post = Yii::$app->request->post();
|
||||
if (!$post['dhcp'] && !isset($this->subnet[$post['subnet_mask']]))
|
||||
return ["status" => false];
|
||||
$post['subnet_mask'] = isset($this->subnet[$post['subnet_mask']]) ? $this->subnet[$post['subnet_mask']] : "";
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($post),
|
||||
]
|
||||
];
|
||||
json_decode(@file_get_contents("http://localhost:4004/SetIP", false, stream_context_create($options)), true);
|
||||
return ["status" => true, "url" => "http://" . $post['device_ip']];
|
||||
} else {
|
||||
$this->view->title = Yii::t("app", "CAU_HINH_IP");
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
];
|
||||
$network = json_decode(@file_get_contents("http://localhost:4004/Network", false, stream_context_create($options)), true);
|
||||
return $this->render('ip', [
|
||||
"menu" => $this->renderPartial("menu", ["tab" => "ip_config"]),
|
||||
"network" => $network
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSystemInfo() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = "json";
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
];
|
||||
@file_get_contents("http://localhost:4004/Reboot", false, stream_context_create($options));
|
||||
return ["status" => true];
|
||||
} else {
|
||||
$this->view->title = Yii::t("app", "THONG_TIN_HE_THONG");
|
||||
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
|
||||
$info = $version ? $version->data : "Pro 4.27.13 (Jul 19 2021 11:49)";
|
||||
$temp = explode("(", $info);
|
||||
$ver = trim($temp[0]);
|
||||
$build_time = str_replace(")", "", $temp[1]);
|
||||
return $this->render('system-info', [
|
||||
"version" => $ver,
|
||||
"build_time" => $build_time
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
public function getConfigJson() {
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
])), true);
|
||||
if (!$tempConfig['status'])
|
||||
return $this->redirect(['/config']);
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
if (count($engineConfig['data']['engines']) == 0)
|
||||
return $this->redirect(['/config']);
|
||||
|
||||
$checkConfig = json_decode(file_get_contents("http://localhost:4004/ReadConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path']
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
|
||||
if (!$checkConfig['status'])
|
||||
return $this->redirect(['/config']);
|
||||
|
||||
$config_json = $this->config_json;
|
||||
if ($checkConfig['status'])
|
||||
$config_json = json_decode($checkConfig['data'], true);
|
||||
return $config_json;
|
||||
}
|
||||
|
||||
public function actionDieuKhienThietBi() {
|
||||
$this->view->title = Yii::t("app", "DIEU_KHIEN_THIET_BI");
|
||||
$config_json = $this->getConfigJson();
|
||||
|
||||
$config_engine = ["start_at" => "00:00", "end_at" => "23:59"];
|
||||
$engine_time_config = \app\models\SyncUrl::findOne(['key_config' => 'engine_time_config']);
|
||||
if ($engine_time_config)
|
||||
$config_engine = json_decode($engine_time_config->data, true);
|
||||
return $this->render('dieu-khien-thiet-bi', [
|
||||
"background" => $config_json['background'],
|
||||
"config_engine" => $config_engine,
|
||||
"config_light" => isset($config_json['open_door']['light']) ? $config_json['open_door']['light'] : false,
|
||||
"engineStatus" => json_decode(@file_get_contents("http://localhost:4004/EngineStatus"), true),
|
||||
"menu" => $this->renderPartial("menu", ["tab" => "device_controller"])
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionControlEngine($status) {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode(["action" => $status]),
|
||||
]
|
||||
];
|
||||
json_decode(@file_get_contents("http://localhost:4004/ControlEngine", false, stream_context_create($options)), true);
|
||||
return $status;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSaveTimeLightConfig() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$config_json = $this->getConfigJson();
|
||||
$config_json['open_door']['light'] = [
|
||||
"enable" => $post['enable'],
|
||||
"start_at" => $post['start_at'],
|
||||
"end_at" => $post['end_at']
|
||||
];
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
];
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create($options)), true);
|
||||
|
||||
if (!$tempConfig['status'])
|
||||
return false;
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
$engineConfig['data']['engines'][0]['isConfig'] = "1";
|
||||
|
||||
file_get_contents("http://localhost:4004/SaveEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path'],
|
||||
'config' => $engineConfig,
|
||||
'configEngine' => json_encode($config_json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
|
||||
])
|
||||
]
|
||||
]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSaveTimeEngineConfig() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$engine_time_config = \app\models\SyncUrl::findOne(['key_config' => 'engine_time_config']);
|
||||
$config_engine = ["start_at" => $post['start_at'], "end_at" => $post['end_at']];
|
||||
if ($engine_time_config) {
|
||||
$engine_time_config->data = json_encode($config_engine);
|
||||
$engine_time_config->save();
|
||||
} else {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => 'engine_time_config',
|
||||
'data' => json_encode($config_engine)
|
||||
]);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionBackground() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$model = new \app\models\UploadForm();
|
||||
$path = "bg";
|
||||
$url = $model->UploadGlobal("image", ["PNG", "JPG", "JPEG", "GIF"], $path);
|
||||
|
||||
$config_json = $this->getConfigJson();
|
||||
$config_json['background'] = "/uploads" . $url;
|
||||
$options = [
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST"
|
||||
]
|
||||
];
|
||||
$tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create($options)), true);
|
||||
|
||||
if (!$tempConfig['status'])
|
||||
return false;
|
||||
|
||||
$engineConfig = json_decode($tempConfig['data'], true);
|
||||
$engineConfig['data']['engines'][0]['isConfig'] = "1";
|
||||
|
||||
file_get_contents("http://localhost:4004/SaveEngineConfig", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
'path' => $engineConfig['data']['engines'][0]['path'],
|
||||
'config' => $engineConfig,
|
||||
'configEngine' => json_encode($config_json, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE)
|
||||
])
|
||||
]
|
||||
]));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSound() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$model = new \app\models\UploadForm();
|
||||
$path = "audio";
|
||||
$model->UploadSound("sound", ["WAV"], $path);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
152
controllers/ControlLogsController.php
Normal file
152
controllers/ControlLogsController.php
Normal file
|
@ -0,0 +1,152 @@
|
|||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
use Yii;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\CaptureLogsSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use app\models\ListManagement;
|
||||
use yii\helpers\FileHelper;
|
||||
use app\models\common;
|
||||
|
||||
/**
|
||||
* CaptureLogsController implements the CRUD actions for CaptureLogs model.
|
||||
*/
|
||||
class ControlLogsController extends Controller {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
|
||||
public function behaviors() {
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all", $id = "") {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', "00:00 " . date("d/m/Y")), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', "23:59 " . date("d/m/Y")), 'U');
|
||||
if ($from !== "" && $to !== "") {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', $from), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', $to), 'U');
|
||||
}
|
||||
|
||||
$this->view->title = Yii::t("app", "DANH_SACH_NHAN_DIEN");
|
||||
$searchModel = new CaptureLogsSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
$dataProvider->query->andWhere(["<>", "capture_logs.staff_id", 0]);
|
||||
$dataProvider->query->andWhere(["BETWEEN", "capture_logs.time", $f, $t]);
|
||||
if ($id !== "")
|
||||
$dataProvider->query->andWhere(["LIKE", "list_management.code", $id]);
|
||||
if ($name !== "")
|
||||
$dataProvider->query->andWhere(["LIKE", "list_management.name", $name]);
|
||||
if ($type !== "all")
|
||||
$dataProvider->query->andWhere(["list_management.type" => $type]);
|
||||
if ($gender !== "all")
|
||||
$dataProvider->query->andWhere(["list_management.gender" => $gender]);
|
||||
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'f' => $f,
|
||||
't' => $t,
|
||||
'typeArray' => ListManagement::typeArray(),
|
||||
'genderArray' => ListManagement::genderArray()
|
||||
]);
|
||||
}
|
||||
|
||||
protected function findModel($id) {
|
||||
if (($model = CaptureLogs::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
|
||||
}
|
||||
|
||||
public function actionUseFeature($id) {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = "json";
|
||||
$model = $this->findModel($id);
|
||||
$listManagement = ListManagement::findOne($model->staff_id);
|
||||
if ($listManagement) {
|
||||
$url = $model->image;
|
||||
$images = json_decode($listManagement->image, true);
|
||||
if (count($images) >= \Yii::$app->params['maxPicture'])
|
||||
return ["status" => false, "text" => Yii::t("app", "SO_ANH_MAU_TOI_DA", ["maxPicture" => \Yii::$app->params['maxPicture']])];
|
||||
$add = true;
|
||||
foreach ($images as $key => $value) {
|
||||
if (isset($value['urlOld']) && $value['urlOld'] === $url)
|
||||
$add = false;
|
||||
}
|
||||
if ($add) {
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$fileName = "face_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$img = file_get_contents("http://localhost/data/uploads/face/" . $url);
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
if (!$this->resizeImg($img, $fileTarget))
|
||||
$fileName = $url;
|
||||
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||
$features = json_decode($features['data'], true);
|
||||
$images[] = [
|
||||
"url" => $fileName,
|
||||
"urlOld" => $url,
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
];
|
||||
$listManagement->image = json_encode($images);
|
||||
$listManagement->last_modified = time();
|
||||
$listManagement->save();
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $listManagement->id,
|
||||
"object_id" => $listManagement->staff_id,
|
||||
"name" => common::convert_vi_to_en($listManagement->name),
|
||||
"features" => $listManagement->allFeatures
|
||||
]);
|
||||
return ["status" => true];
|
||||
}
|
||||
return ["status" => false, "text" => Yii::t("app", "ANH_MAU_DA_DUOC_CHON")];
|
||||
}
|
||||
return ["status" => false, "text" => Yii::t("app", "DOI_TUONG_KHONG_TON_TAI")];
|
||||
}
|
||||
}
|
||||
|
||||
public function resizeImg($img, $fileTarget) {
|
||||
$im = imagecreatefromstring($img);
|
||||
$width = imagesx($im);
|
||||
$height = imagesy($im);
|
||||
$newwidth = 224;
|
||||
$newheight = 224;
|
||||
if ($width > $newwidth && $height > $newheight) {
|
||||
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
imagejpeg($thumb, $fileTarget);
|
||||
imagedestroy($thumb);
|
||||
imagedestroy($im);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
|
@ -14,13 +14,6 @@ use yii\helpers\Url;
|
|||
*/
|
||||
class DashboardController extends Controller {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if (Yii::$app->user->isGuest) {
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
|
@ -147,4 +140,22 @@ class DashboardController extends Controller {
|
|||
return $this->redirect(Yii::$app->request->hostInfo . "/BiFace_Server_Lite/web/du-lieu.xlsx");
|
||||
}
|
||||
|
||||
public function actionChangeLanguage($lang) {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
$language = \app\models\common::allLanguage();
|
||||
foreach ($language as $key => $value) {
|
||||
if ($value['name'] === $lang)
|
||||
return Yii::$app->session->set("language", $value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionChangeLanguageLogin($lang) {
|
||||
$language = \app\models\common::allLanguage();
|
||||
foreach ($language as $key => $value) {
|
||||
if ($value['name'] === $lang)
|
||||
return $this->redirect(['/site/login', 'lang' => $lang]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
930
controllers/ListManagementController.php
Normal file
930
controllers/ListManagementController.php
Normal file
|
@ -0,0 +1,930 @@
|
|||
<?php
|
||||
|
||||
namespace app\controllers;
|
||||
|
||||
use Yii;
|
||||
use app\models\ListManagement;
|
||||
use app\models\ListManagementSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use app\models\CaptureLogs;
|
||||
use app\models\common;
|
||||
use yii\helpers\FileHelper;
|
||||
|
||||
/**
|
||||
* ListMamagementController implements the CRUD actions for ListMamagement model.
|
||||
*/
|
||||
class ListManagementController extends Controller {
|
||||
|
||||
public function init() {
|
||||
parent::init();
|
||||
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
|
||||
public function behaviors() {
|
||||
return [
|
||||
'verbs' => [
|
||||
'class' => VerbFilter::className(),
|
||||
'actions' => [
|
||||
'delete' => ['POST'],
|
||||
],
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
public function actionIndex($from = "", $to = "", $name = "", $type = "all", $gender = "all", $id = "") {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', "00:00 " . date("d/m/Y")), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', "23:59 " . date("d/m/Y")), 'U');
|
||||
$this->view->title = Yii::t("app", "QUAN_LY_MAU");
|
||||
$searchModel = new ListManagementSearch();
|
||||
$dataProvider = $searchModel->search(Yii::$app->request->queryParams);
|
||||
if ($from !== "" && $to !== "") {
|
||||
$f = date_format(date_create_from_format('H:i d/m/Y', $from), 'U');
|
||||
$t = date_format(date_create_from_format('H:i d/m/Y', $to), 'U');
|
||||
$dataProvider->query->andWhere(["BETWEEN", "time", $f, $t]);
|
||||
}
|
||||
if ($id !== "")
|
||||
$dataProvider->query->andWhere(["LIKE", "code", $id]);
|
||||
if ($name !== "")
|
||||
$dataProvider->query->andWhere(["LIKE", "name", $name]);
|
||||
if ($type !== "all")
|
||||
$dataProvider->query->andWhere(["type" => $type]);
|
||||
if ($gender !== "all")
|
||||
$dataProvider->query->andWhere(["gender" => $gender]);
|
||||
$dataProvider->query->orderBy(["time" => SORT_DESC]);
|
||||
|
||||
// $tempConfig = json_decode(file_get_contents("http://localhost:4004/ReadEngineConfig", false, stream_context_create([
|
||||
// 'http' => [
|
||||
// 'header' => "Content-Type: application/json",
|
||||
// 'method' => "POST"
|
||||
// ]
|
||||
// ])), true);
|
||||
// $data = json_decode($tempConfig['data'], true);
|
||||
// $last = \app\models\ListManagement::find()->orderBy(['id' => SORT_DESC])->limit(1)->one();
|
||||
// if (!is_object($last))
|
||||
// $last = (object) ['id' => 0];
|
||||
// $idAuto = $data['data']['box_id'] . "_" . ($last->id + 1);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
if (!$updating) {
|
||||
$model = new \app\models\SyncUrl();
|
||||
$model->create([
|
||||
'key_config' => "updating",
|
||||
'data' => "false"
|
||||
]);
|
||||
$updating = \app\models\SyncUrl::findOne(['key_config' => 'updating']);
|
||||
}
|
||||
|
||||
$dataProvider->pagination->pageSize = 20;
|
||||
if (Yii::$app->request->get("per-page"))
|
||||
$dataProvider->pagination->pageSize = Yii::$app->request->get("per-page");
|
||||
return $this->render('index', [
|
||||
'searchModel' => $searchModel,
|
||||
'dataProvider' => $dataProvider,
|
||||
'f' => $f,
|
||||
't' => $t,
|
||||
'typeArray' => ListManagement::typeArray(),
|
||||
'genderArray' => ListManagement::genderArray(),
|
||||
// 'idAuto' => $idAuto,
|
||||
"staffArray" => ListManagement::staffArray(),
|
||||
"updating" => $updating
|
||||
]);
|
||||
}
|
||||
|
||||
public function actionAdd() {
|
||||
$model = new ListManagement();
|
||||
Yii::$app->response->format = "json";
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$check = ListManagement::findOne(['id' => $data['code']]);
|
||||
if ($check)
|
||||
return ["status" => false];
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $data['image'], "type" => "raw"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false];
|
||||
$features = json_decode($features['data'], true);
|
||||
$data['image'] = json_encode([
|
||||
[
|
||||
"url" => $data['image'],
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
]
|
||||
]);
|
||||
$model->create($data);
|
||||
file_get_contents("http://localhost:2305/update-feature");
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionCreate() {
|
||||
$model = new ListManagement();
|
||||
Yii::$app->response->format = "json";
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$listManagement = ListManagement::findOne(['id' => $data['code']]);
|
||||
$url = CaptureLogs::findOne($data['id'])->image;
|
||||
if ($listManagement) {
|
||||
$images = json_decode($listManagement->image, true);
|
||||
if (count($images) >= \Yii::$app->params['maxPicture'])
|
||||
return ["status" => false, "text" => Yii::t("app", "SO_ANH_MAU_TOI_DA", ["maxPicture" => \Yii::$app->params['maxPicture']])];
|
||||
$add = true;
|
||||
foreach ($images as $key => $value) {
|
||||
if (isset($value['urlOld']) && $value['urlOld'] === $url)
|
||||
$add = false;
|
||||
}
|
||||
if ($add) {
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$fileName = "face_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$img = file_get_contents("http://localhost/data/uploads/face/" . $url);
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
if (!$this->resizeImg($img, $fileTarget))
|
||||
$fileName = $url;
|
||||
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||
$features = json_decode($features['data'], true);
|
||||
$images[] = [
|
||||
"url" => $fileName,
|
||||
"urlOld" => $url,
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
];
|
||||
$listManagement->type = $data['type'];
|
||||
$listManagement->name = $data['name'];
|
||||
$listManagement->abbreviated_name = $data['abbreviated_name'];
|
||||
$listManagement->gender = $data['gender'];
|
||||
$listManagement->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
||||
$listManagement->telephone = $data['telephone'];
|
||||
$listManagement->address = $data['address'];
|
||||
$listManagement->image = json_encode($images);
|
||||
$listManagement->last_modified = time();
|
||||
$listManagement->save();
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $listManagement->id,
|
||||
"object_id" => $listManagement->staff_id,
|
||||
"name" => common::convert_vi_to_en($listManagement->name),
|
||||
"features" => $listManagement->allFeatures
|
||||
]);
|
||||
return ["status" => true];
|
||||
}
|
||||
return ["status" => false, "text" => Yii::t("app", "ANH_MAU_DA_DUOC_CHON")];
|
||||
} else {
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$fileName = "face_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$img = file_get_contents("http://localhost/data/uploads/face/" . $url);
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
if (!$this->resizeImg($img, $fileTarget))
|
||||
$fileName = $url;
|
||||
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||
$features = json_decode($features['data'], true);
|
||||
$data['image'] = json_encode([
|
||||
[
|
||||
"url" => $fileName,
|
||||
"urlOld" => $url,
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
]
|
||||
]);
|
||||
$model->create($data);
|
||||
file_get_contents("http://localhost:2305/update-feature");
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFormUpdate() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$ListManagement = $this->findModel($data['id']);
|
||||
$images = json_decode($ListManagement->image, true);
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"type" => $ListManagement->type,
|
||||
"code" => $ListManagement->code,
|
||||
"name" => $ListManagement->name,
|
||||
"abbreviated_name" => $ListManagement->abbreviated_name,
|
||||
"gender" => $ListManagement->gender,
|
||||
"birthday" => date("d/m/Y", $ListManagement->birthday),
|
||||
"telephone" => $ListManagement->telephone,
|
||||
"address" => $ListManagement->address,
|
||||
"image" => count($images) > 0 ? "/data/uploads/face/" . $images[0]['url'] : "/images/user2-160x160.jpg",
|
||||
"canUpload" => count($images) >= Yii::$app->params['maxPicture'] ? false : true
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUpdate() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$model = $this->findModel($data['id']);
|
||||
$check = ListManagement::findOne(['code' => $data['code']]);
|
||||
if ($check && $check->id != $model->id)
|
||||
return false;
|
||||
if ($data['image'] !== "") {
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$fileName = "face_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$img = file_get_contents("http://localhost/data/uploads/face/" . $data['image']);
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
if (!$this->resizeImg($img, $fileTarget))
|
||||
$fileName = $data['image'];
|
||||
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false, "text" => Yii::t("app", "ENGINE_KHONG_HOAT_DONG")];
|
||||
$features = json_decode($features['data'], true);
|
||||
$images = json_decode($model->image, true);
|
||||
$images[] = [
|
||||
"url" => $fileName,
|
||||
"urlOld" => $data['image'],
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
];
|
||||
$model->image = json_encode($images);
|
||||
}
|
||||
$model->code = $data['code'];
|
||||
$model->type = $data['type'];
|
||||
$model->name = $data['name'];
|
||||
$model->abbreviated_name = $data['abbreviated_name'];
|
||||
$model->gender = $data['gender'];
|
||||
$model->birthday = $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U');
|
||||
$model->telephone = $data['telephone'];
|
||||
$model->address = $data['address'];
|
||||
$model->last_modified = time();
|
||||
$model->save();
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionDelete() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$model = $this->findModel($data['id']);
|
||||
$images = json_decode($model->image, true);
|
||||
foreach ($images as $k => $v) {
|
||||
@unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
|
||||
}
|
||||
common::updateFeature([
|
||||
"cmd" => "delete",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => []
|
||||
]);
|
||||
$model->delete();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionDeleteFeature() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$model = $this->findModel($data['id']);
|
||||
$images = json_decode($model->image, true);
|
||||
$features = [];
|
||||
foreach ($images as $key => $value) {
|
||||
if ($value['url'] !== $data['image'])
|
||||
$features[] = $value;
|
||||
else {
|
||||
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']);
|
||||
}
|
||||
}
|
||||
$model->image = json_encode($features);
|
||||
$model->save();
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
protected function findModel($id) {
|
||||
if (($model = ListManagement::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
|
||||
}
|
||||
|
||||
public function actionBatchDelete() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
Yii::$app->response->format = "json";
|
||||
foreach ($data['lists'] as $key => $value) {
|
||||
$staff = ListManagement::findOne($value);
|
||||
if ($staff) {
|
||||
$images = json_decode($staff->image, true);
|
||||
foreach ($images as $k => $v) {
|
||||
unlink("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $v['url']);
|
||||
}
|
||||
if (count($data['lists']) <= 10)
|
||||
common::updateFeature([
|
||||
"cmd" => "delete",
|
||||
"id" => $staff->id,
|
||||
"object_id" => $staff->staff_id,
|
||||
"name" => common::convert_vi_to_en($staff->name),
|
||||
"features" => []
|
||||
]);
|
||||
$staff->delete();
|
||||
}
|
||||
}
|
||||
if (count($data['lists']) > 10)
|
||||
file_get_contents("http://localhost:2305/update-feature");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUpload() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$model = new common();
|
||||
Yii::$app->response->format = "json";
|
||||
$url = $model->UploadFile("AnhNhanVien", ["PNG", "JPG", "JPEG", "GIF"], "temp");
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/" . $url, "type" => "crop"]
|
||||
]
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return ["status" => false];
|
||||
$features = json_decode($features['data'], true);
|
||||
unlink("/var/www/html/BiFace_Server_Lite/web/" . $url);
|
||||
if ($features['results'][0]['crop'] === "") {
|
||||
return ["status" => false];
|
||||
} else {
|
||||
$key = common::generateRandomString();
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
$fileName = "face_" . $key . "_" . time() . ".png";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
file_put_contents($targetPath . "/" . $fileName, base64_decode($features['results'][0]['crop']));
|
||||
return ["status" => true, "url" => $fileName, "dataPath" => "data/uploads/face/"];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function actionFormSync() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$data = Yii::$app->request->post();
|
||||
$results = json_decode(file_get_contents("http://" . $data['ip'] . "/api/data", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode(ListManagement::nameArray())
|
||||
]
|
||||
])), true);
|
||||
$filters = [];
|
||||
foreach ($results as $key => $value) {
|
||||
$filters[$value['code']] = $value['code'] . " - " . $value['name'] . " - " . $value['address'];
|
||||
}
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"title" => $data['ip'],
|
||||
"form" => $this->renderPartial("list", [
|
||||
"results" => $results,
|
||||
"typeArray" => ListManagement::typeArray(),
|
||||
"filters" => $filters,
|
||||
"ip" => $data['ip']
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSyncFromServer() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 0;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
|
||||
$datas = json_decode(file_get_contents($ip . "/api/oem/get_all_image", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"id_camera" => $id_camera,
|
||||
"ids_staff" => [],
|
||||
"objs_staff" => []
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
$filters = [];
|
||||
foreach ($datas['data'] as $key => $value) {
|
||||
$filters[$value['id']] = $value['code'] . " - " . $value['name'] . " - " . $value['department'];
|
||||
}
|
||||
$deviceDatas = ListManagement::getAllID();
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"title" => "<i class='fa fa-download'></i> " . Yii::t("app", "DONG_BO_TU_MAY_CHU"),
|
||||
"form" => $this->renderPartial("list-server", [
|
||||
"datas" => $datas['data'],
|
||||
"filters" => $filters,
|
||||
"personImage" => $deviceDatas["imgCountArr"],
|
||||
"allID" => $deviceDatas["idArr"]
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function getCurrentTime() {
|
||||
$time = microtime();
|
||||
$time = explode(' ', $time);
|
||||
return $time[1] + $time[0];
|
||||
}
|
||||
|
||||
public function extractFeature($images, $files_name, $staff_id, $currentImg = false) {
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
$extractFeature = [];
|
||||
$ft = [];
|
||||
$currentArr = [];
|
||||
if ($currentImg) {
|
||||
foreach ($currentImg as $key => $value) {
|
||||
if (isset($value['serverKey']))
|
||||
$currentArr[] = $value['serverKey'];
|
||||
}
|
||||
$ft = $currentImg;
|
||||
}
|
||||
foreach ($images as $key => $value) {
|
||||
if ($key < Yii::$app->params['maxPicture'] && !in_array($files_name[$key], $currentArr)) {
|
||||
$fileName = "face_" . $staff_id . "_" . common::generateRandomString() . "_" . time() . ".png";
|
||||
$start = $this->getCurrentTime();
|
||||
$img = false;
|
||||
try {
|
||||
$img = file_get_contents(str_replace("&", "&", $value));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
$finish = $this->getCurrentTime();
|
||||
$temp["getIMG"] = round(($finish - $start), 4);
|
||||
if ($img && $img !== "null") {
|
||||
$fileTarget = $targetPath . "/" . $fileName;
|
||||
$start = $this->getCurrentTime();
|
||||
if (!$this->resizeImg($img, $fileTarget)) {
|
||||
file_put_contents($fileTarget, $img);
|
||||
}
|
||||
$finish = $this->getCurrentTime();
|
||||
$temp["saveIMG"] = round(($finish - $start), 4);
|
||||
$start = $this->getCurrentTime();
|
||||
$features = common::requestToEngine("/get-feature", [
|
||||
"image_paths" => [
|
||||
["url" => "/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $fileName, "type" => "raw"]
|
||||
],
|
||||
"type" => "128"
|
||||
]);
|
||||
if (!$features['status'])
|
||||
return false;
|
||||
$features = json_decode($features['data'], true);
|
||||
$finish = $this->getCurrentTime();
|
||||
$temp["extract"] = round(($finish - $start), 4);
|
||||
$ft[] = [
|
||||
"serverKey" => $files_name[$key],
|
||||
"url" => $fileName,
|
||||
"urlOld" => $fileName,
|
||||
"features" => $features['results'][0]['feature'],
|
||||
"features512" => []//isset($features['results'][0]['feature512']) ? $features['results'][0]['feature512'] : []
|
||||
];
|
||||
}
|
||||
$extractFeature[] = $temp;
|
||||
}
|
||||
}
|
||||
return [
|
||||
"time" => $extractFeature,
|
||||
"features" => $ft
|
||||
];
|
||||
}
|
||||
|
||||
public function actionSyncFeature() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$processTime = [];
|
||||
$totalStart = $this->getCurrentTime();
|
||||
$totals = intval(Yii::$app->request->post("totals"));
|
||||
|
||||
$data = Yii::$app->request->post("id"); //$res['data'][0];
|
||||
|
||||
$start = $this->getCurrentTime();
|
||||
$model = ListManagement::findOne(['staff_id' => $data['id']]);
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime["getLM"] = round(($finish - $start), 4);
|
||||
$ft = [];
|
||||
if ($model) {
|
||||
if (isset($data['images'])) {
|
||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id'], json_decode($model->image, true));
|
||||
if (!$extractFeature)
|
||||
return false;
|
||||
$processTime["extractFeature"] = $extractFeature['time'];
|
||||
$ft = $extractFeature['features'];
|
||||
}
|
||||
$model->abbreviated_name = $data['abbreviated_name'];
|
||||
$model->code = $data['code'];
|
||||
$model->name = $data['name'];
|
||||
$model->address = $data['department'];
|
||||
$model->image = json_encode($ft);
|
||||
$model->last_modified = time();
|
||||
$model->save();
|
||||
if ($totals <= 10)
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
} else {
|
||||
if (isset($data['images'])) {
|
||||
$extractFeature = $this->extractFeature($data['images'], $data['files_name'], $data['id']);
|
||||
if (!$extractFeature)
|
||||
return false;
|
||||
$processTime["extractFeature"] = $extractFeature['time'];
|
||||
$ft = $extractFeature['features'];
|
||||
}
|
||||
|
||||
$start = $this->getCurrentTime();
|
||||
$model = new ListManagement();
|
||||
$model->create([
|
||||
'code' => strval($data['code']),
|
||||
'type' => "wl",
|
||||
'name' => $data['name'],
|
||||
'abbreviated_name' => $data['abbreviated_name'],
|
||||
'staff_id' => $data['id'],
|
||||
'image' => json_encode($ft),
|
||||
'gender' => "Male",
|
||||
'birthday' => "",
|
||||
'telephone' => "",
|
||||
'address' => $data['department']
|
||||
]);
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime["insertDB"] = round(($finish - $start), 4);
|
||||
if ($totals <= 10)
|
||||
common::updateFeature([
|
||||
"cmd" => "create",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
}
|
||||
$totalFinish = $this->getCurrentTime();
|
||||
$processTime["total"] = round(($totalFinish - $totalStart), 4);
|
||||
$processTime["id"] = strval($data['code']);
|
||||
return $processTime; //["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSyncFeatureFromDevice() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$data = Yii::$app->request->post();
|
||||
$totals = intval($data['totals']);
|
||||
$results = json_decode(file_get_contents("http://" . $data['ip'] . "/api/full-data", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([$data['id']])
|
||||
]
|
||||
])), true);
|
||||
foreach ($results as $key => $value) {
|
||||
$images = [];
|
||||
$imagesReverse = array_reverse($value['images']);
|
||||
foreach ($imagesReverse as $k => $v) {
|
||||
if ($k < Yii::$app->params['maxPicture']) {
|
||||
$key = common::generateRandomString();
|
||||
$RootFolder = Yii::getAlias('@webroot') . "/data/uploads";
|
||||
$targetPath = $RootFolder . "/face";
|
||||
$fileName = "face_" . $key . "_" . time() . ".png";
|
||||
FileHelper::createDirectory($targetPath, 0777);
|
||||
file_put_contents($targetPath . "/" . $fileName, base64_decode($v['url']));
|
||||
$images[] = [
|
||||
"url" => $fileName,
|
||||
"urlOld" => $fileName,
|
||||
"features" => $v['features'],
|
||||
"features512" => isset($v['features512']) ? $v['features512'] : []
|
||||
];
|
||||
}
|
||||
}
|
||||
$model = ListManagement::findOne(['code' => $value['code']]);
|
||||
if ($model) {
|
||||
$model->type = $value['type'];
|
||||
$model->name = $value['name'];
|
||||
$model->image = json_encode($images);
|
||||
$model->gender = $value['gender'];
|
||||
$model->birthday = $value['birthday'];
|
||||
$model->telephone = $value['telephone'];
|
||||
$model->address = $value['department'];
|
||||
$model->save();
|
||||
if ($totals <= 10)
|
||||
common::updateFeature([
|
||||
"cmd" => "update",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
} else {
|
||||
$model = new ListManagement();
|
||||
$model->create([
|
||||
'code' => $value['code'],
|
||||
'type' => $value['type'],
|
||||
'name' => $value['name'],
|
||||
'image' => json_encode($images),
|
||||
'gender' => $value['gender'],
|
||||
'birthday' => date("d/m/Y", $value['birthday']),
|
||||
'telephone' => $value['telephone'],
|
||||
'address' => $value['department'],
|
||||
'time' => $value['time']
|
||||
]);
|
||||
if ($totals <= 10)
|
||||
common::updateFeature([
|
||||
"cmd" => "create",
|
||||
"id" => $model->id,
|
||||
"object_id" => $model->staff_id,
|
||||
"name" => common::convert_vi_to_en($model->name),
|
||||
"features" => $model->allFeatures
|
||||
]);
|
||||
}
|
||||
}
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionUpdateFeature() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = "json";
|
||||
file_get_contents("http://localhost:2305/update-feature?total=" . ListManagement::find()->count());
|
||||
return ["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionChooseStaff() {
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$staff = ListManagement::findOne(['id' => $post['code']]);
|
||||
Yii::$app->response->format = "json";
|
||||
return [
|
||||
"name" => $staff->name,
|
||||
"gender" => $staff->gender,
|
||||
"birthday" => date("d/m/Y", $staff->birthday),
|
||||
"telephone" => $staff->telephone,
|
||||
"department" => $staff->address,
|
||||
"abbreviated_name" => $staff->abbreviated_name
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSyncToServer() {
|
||||
if (Yii::$app->request->isAjax) {
|
||||
Yii::$app->response->format = "json";
|
||||
$datas = ListManagement::find()->orderBy(["code" => SORT_ASC])->all();
|
||||
$filters = [];
|
||||
foreach ($datas as $key => $value) {
|
||||
$filters[$value->staff_id] = $value->code . " - " . $value->name . " - " . $value->address;
|
||||
}
|
||||
return [
|
||||
"title" => "<i class='fa fa-upload'></i> " . Yii::t("app", "DONG_BO_LEN_MAY_CHU"),
|
||||
"form" => $this->renderPartial("list-to-server", [
|
||||
"datas" => $datas,
|
||||
"filters" => $filters
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionSyncFeatureToServer() {
|
||||
if (Yii::$app->request->post()) {
|
||||
Yii::$app->response->format = "json";
|
||||
$server_ip = \app\models\SyncUrl::findOne(['key_config' => 'server_api']);
|
||||
$ip = "https://dev-dc.beetai.com";
|
||||
if ($server_ip)
|
||||
$ip = $server_ip->data;
|
||||
$device_id = \app\models\SyncUrl::findOne(['key_config' => 'device_id']);
|
||||
$id_camera = 0;
|
||||
if ($device_id)
|
||||
$id_camera = intval($device_id->data);
|
||||
|
||||
$StaffInfo = ListManagement::findOne(["staff_id" => Yii::$app->request->post("id")]);
|
||||
$lsImgs = json_decode($StaffInfo->image, true);
|
||||
$images = [];
|
||||
foreach ($lsImgs as $key => $value) {
|
||||
if (!isset($value['serverKey']) || (isset($value['serverKey']) && $value['serverKey'] == "")) {
|
||||
try {
|
||||
$images[] = base64_encode(file_get_contents("/var/www/html/BiFace_Server_Lite/web/data/uploads/face/" . $value['url']));
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
if (count($images) == 0)
|
||||
return ["status" => true, "text" => Yii::t("app", "DU_LIEU_KHONG_DOI")];
|
||||
|
||||
$items = [
|
||||
"id" => $StaffInfo->staff_id,
|
||||
"name" => $StaffInfo->name,
|
||||
"abbreviated_name" => $StaffInfo->abbreviated_name,
|
||||
"code" => $StaffInfo->code,
|
||||
"department" => $StaffInfo->address,
|
||||
"birthday" => date("Y-m-d", $StaffInfo->birthday),
|
||||
"gender" => $StaffInfo == "Male" ? 1 : 0,
|
||||
"telephone" => $StaffInfo->telephone,
|
||||
"images" => $images
|
||||
];
|
||||
$start = $this->getCurrentTime();
|
||||
try {
|
||||
$res = json_decode(file_get_contents($ip . "/api/oem/data_sync_pro", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode([
|
||||
"id_camera" => $id_camera,
|
||||
"items" => [$items]
|
||||
])
|
||||
]
|
||||
])), true);
|
||||
if ($res['status'] == 10000) {
|
||||
$resData = $res['data'];
|
||||
for ($i = 0; $i < count($lsImgs); $i++) {
|
||||
$lsImgs[$i]['serverKey'] = isset($resData[$i]) ? $resData[$i] : "";
|
||||
}
|
||||
$StaffInfo->image = json_encode($lsImgs);
|
||||
$StaffInfo->save();
|
||||
}
|
||||
} catch (\Exception $e) {
|
||||
|
||||
}
|
||||
$finish = $this->getCurrentTime();
|
||||
$processTime = round(($finish - $start), 4);
|
||||
return $processTime; //$res; //["status" => true];
|
||||
}
|
||||
}
|
||||
|
||||
public function resizeImg($img, $fileTarget) {
|
||||
$im = imagecreatefromstring($img);
|
||||
$width = imagesx($im);
|
||||
$height = imagesy($im);
|
||||
$newwidth = 224;
|
||||
$newheight = 224;
|
||||
if ($width > $newwidth && $height > $newheight) {
|
||||
$thumb = imagecreatetruecolor($newwidth, $newheight);
|
||||
imagecopyresized($thumb, $im, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
|
||||
imagejpeg($thumb, $fileTarget);
|
||||
imagedestroy($thumb);
|
||||
imagedestroy($im);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public function actionTest() {
|
||||
return file_get_contents("http://minio1.beetai.com/biface-school/origin/385/454_20201126101221879048.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=minioadmin%2F20201230%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20201230T081350Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=df7586a01bb128c0585edd87d1024b1ddb33483fd335e81238103fd2467b4772");
|
||||
}
|
||||
|
||||
public function actionSchedule() {
|
||||
Yii::$app->response->format = "json";
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$model = new \app\models\Schedule();
|
||||
$datas = [];
|
||||
foreach ($post['lists'] as $key => $value) {
|
||||
$datas[] = [$value, $post['fromTime'], $post['toTime'], $post['fromDate'], $post['toDate'], implode(",", $post['dateOfWeek'])];
|
||||
}
|
||||
$model->multiCreate($datas);
|
||||
return ["status" => true];
|
||||
} else {
|
||||
return [
|
||||
"title" => Yii::t("app", "GAN_LICH_TRINH"),
|
||||
"form" => $this->renderPartial("schedule", ["type" => "create"])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionEditSchedule($id) {
|
||||
Yii::$app->response->format = "json";
|
||||
$model = \app\models\Schedule::findOne($id);
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
$dateOfWeek = implode(",", $post['dateOfWeek']);
|
||||
if ($post['editAll'] == "true" && isset($post['lists'])) {
|
||||
foreach ($post['lists'] as $key => $value) {
|
||||
$schedule = \app\models\Schedule::findOne([
|
||||
'from_time' => $model->from_time,
|
||||
'to_time' => $model->to_time,
|
||||
'from_date' => $model->from_date,
|
||||
'to_date' => $model->to_date,
|
||||
'date_of_week' => $model->date_of_week,
|
||||
'staff_id' => $value
|
||||
]);
|
||||
if ($schedule) {
|
||||
$schedule->from_time = $post['fromTime'];
|
||||
$schedule->to_time = $post['toTime'];
|
||||
$schedule->from_date = $post['fromDate'];
|
||||
$schedule->to_date = $post['toDate'];
|
||||
$schedule->date_of_week = $dateOfWeek;
|
||||
$schedule->save();
|
||||
} else {
|
||||
$modelSchedule = new \app\models\Schedule();
|
||||
$modelSchedule->create([
|
||||
'staff_id' => $value,
|
||||
'from_time' => $post['fromTime'],
|
||||
'to_time' => $post['toTime'],
|
||||
'from_date' => $post['fromDate'],
|
||||
'to_date' => $post['toDate'],
|
||||
'date_of_week' => $dateOfWeek
|
||||
]);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$model->from_time = $post['fromTime'];
|
||||
$model->to_time = $post['toTime'];
|
||||
$model->from_date = $post['fromDate'];
|
||||
$model->to_date = $post['toDate'];
|
||||
$model->date_of_week = $dateOfWeek;
|
||||
$model->save();
|
||||
}
|
||||
return ["status" => true];
|
||||
} else {
|
||||
return [
|
||||
"title" => Yii::t("app", "SUA_LICH_TRINH"),
|
||||
"form" => $this->renderPartial("schedule", [
|
||||
"type" => "edit",
|
||||
"model" => $model
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
public function actionDeleteSchedule($id) {
|
||||
Yii::$app->response->format = "json";
|
||||
$model = \app\models\Schedule::findOne($id);
|
||||
if (Yii::$app->request->post()) {
|
||||
$post = Yii::$app->request->post();
|
||||
if ($post['editAll'] == "true" && isset($post['lists'])) {
|
||||
foreach ($post['lists'] as $key => $value) {
|
||||
$schedule = \app\models\Schedule::findOne([
|
||||
'from_time' => $model->from_time,
|
||||
'to_time' => $model->to_time,
|
||||
'from_date' => $model->from_date,
|
||||
'to_date' => $model->to_date,
|
||||
'date_of_week' => $model->date_of_week,
|
||||
'staff_id' => $value
|
||||
]);
|
||||
if ($schedule)
|
||||
$schedule->delete();
|
||||
}
|
||||
} else
|
||||
$model->delete();
|
||||
|
||||
return ["status" => true];
|
||||
} else {
|
||||
return [
|
||||
"title" => Yii::t("app", "XOA_LICH_TRINH"),
|
||||
"form" => $this->renderPartial("schedule-delete", [
|
||||
"model" => $model
|
||||
])
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -66,13 +66,20 @@ class SiteController extends Controller {
|
|||
*
|
||||
* @return Response|string
|
||||
*/
|
||||
public function actionLogin() {
|
||||
public function actionLogin($lang = "vi-VI") {
|
||||
if (!Yii::$app->user->isGuest) {
|
||||
return $this->goHome();
|
||||
}
|
||||
Yii::$app->language = $lang;
|
||||
|
||||
$model = new LoginForm();
|
||||
if ($model->load(Yii::$app->request->post()) && $model->login()) {
|
||||
$lang = Yii::$app->request->post('lang');
|
||||
$language = \app\models\common::allLanguage();
|
||||
foreach ($language as $key => $value) {
|
||||
if ($value['name'] === $lang)
|
||||
Yii::$app->session->set("language", $value);
|
||||
}
|
||||
return $this->redirect(["/config"]);
|
||||
}
|
||||
|
||||
|
@ -88,9 +95,10 @@ class SiteController extends Controller {
|
|||
* @return Response
|
||||
*/
|
||||
public function actionLogout() {
|
||||
$lang = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
Yii::$app->user->logout();
|
||||
|
||||
return $this->goHome();
|
||||
return $this->redirect(['/site/login', 'lang' => $lang]); //$this->goHome();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -19,12 +19,12 @@ class UserController extends Controller {
|
|||
|
||||
public function init() {
|
||||
parent::init();
|
||||
if (Yii::$app->user->isGuest) {
|
||||
Yii::$app->language = Yii::$app->session->get("language") ? Yii::$app->session->get("language")["name"] : Yii::$app->language;
|
||||
if (Yii::$app->user->isGuest)
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
if (!Yii::$app->user->can("administrator")) {
|
||||
|
||||
if (!Yii::$app->user->can("administrator"))
|
||||
return $this->redirect(["/dashboard"]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -86,11 +86,6 @@ class UserController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new User model.
|
||||
* If creation is successful, the browser will be redirected to the 'view' page.
|
||||
* @return mixed
|
||||
*/
|
||||
public function actionCreate() {
|
||||
if (!Yii::$app->user->can("administrator")) {
|
||||
Yii::$app->response->format = "json";
|
||||
|
@ -142,13 +137,6 @@ class UserController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates an existing User model.
|
||||
* If update is successful, the browser will be redirected to the 'view' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionUpdate($id) {
|
||||
if (!Yii::$app->user->can("administrator")) {
|
||||
Yii::$app->response->format = "json";
|
||||
|
@ -196,13 +184,6 @@ class UserController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes an existing User model.
|
||||
* If deletion is successful, the browser will be redirected to the 'index' page.
|
||||
* @param integer $id
|
||||
* @return mixed
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
public function actionDelete($id) {
|
||||
if (!Yii::$app->user->can("administrator")) {
|
||||
throw new \yii\web\ForbiddenHttpException(Yii::t("app", "Bạn không có quyền truy cập!"));
|
||||
|
@ -213,19 +194,12 @@ class UserController extends Controller {
|
|||
return $this->redirect(['index']);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the User model based on its primary key value.
|
||||
* If the model is not found, a 404 HTTP exception will be thrown.
|
||||
* @param integer $id
|
||||
* @return User the loaded model
|
||||
* @throws NotFoundHttpException if the model cannot be found
|
||||
*/
|
||||
protected function findModel($id) {
|
||||
if (($model = User::findOne($id)) !== null) {
|
||||
return $model;
|
||||
}
|
||||
|
||||
throw new NotFoundHttpException('The requested page does not exist.');
|
||||
throw new NotFoundHttpException(Yii::t("app", "KHONG_TIM_THAY_THONG_TIN"));
|
||||
}
|
||||
|
||||
public function actionProfiles() {
|
||||
|
@ -234,7 +208,7 @@ class UserController extends Controller {
|
|||
}
|
||||
|
||||
$model = $this->findModel(Yii::$app->user->id);
|
||||
$this->view->title = Yii::t("app", "Thông tin cá nhân");
|
||||
$this->view->title = Yii::t("app", "THONG_TIN_CA_NHAN");
|
||||
$this->view->params['breadcrumbs'][] = $this->view->title;
|
||||
|
||||
return $this->render('profiles', [
|
||||
|
@ -264,7 +238,7 @@ class UserController extends Controller {
|
|||
if (Yii::$app->user->isGuest) {
|
||||
return $this->redirect(['/site/login']);
|
||||
}
|
||||
$this->view->title = Yii::t("app", "Đổi mật khẩu");
|
||||
$this->view->title = Yii::t("app", "DOI_MAT_KHAU");
|
||||
$this->view->params['breadcrumbs'][] = $this->view->title;
|
||||
|
||||
return $this->render('password', [
|
||||
|
|
158
helpers/CaptureLogsGrid.php
Normal file
158
helpers/CaptureLogsGrid.php
Normal file
|
@ -0,0 +1,158 @@
|
|||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
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}";
|
||||
}
|
||||
|
||||
public static function time() {
|
||||
return function($model) {
|
||||
return date("H:i:s d/m/Y", $model->time);
|
||||
};
|
||||
}
|
||||
|
||||
public static function image($process = false) {
|
||||
return function($model) use ($process) {
|
||||
$btn = "";
|
||||
if ($process)
|
||||
$btn = Html::button("<i class='fa fa-reply'></i>", [
|
||||
"class" => "btn btn-info btn-xs",
|
||||
"style" => "position:absolute;top:0;right:0;visibility: hidden;",
|
||||
"data" => [
|
||||
"toggle" => "tooltip",
|
||||
"href" => Url::to(["/control-logs/use-feature", "id" => $model->id])
|
||||
],
|
||||
"title" => "Chuyển làm ảnh mẫu",
|
||||
"onclick" => "_useFeature(this);"
|
||||
]);
|
||||
return "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $model->image, [
|
||||
"class" => "img-thumbnail",
|
||||
"style" => "width: 150px;height:150px;"
|
||||
]) . $btn . "</div>";
|
||||
};
|
||||
}
|
||||
|
||||
public static function status($statusArray) {
|
||||
return function($model) use ($statusArray) {
|
||||
return $statusArray[$model->status];
|
||||
};
|
||||
}
|
||||
|
||||
public static function confidence() {
|
||||
return function($model) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
// $person1_html = $person2_html = "";
|
||||
// $person1 = \app\models\ListManagement::findOne($confidence['id1']);
|
||||
// if ($person1) {
|
||||
// $images = json_decode($person1->image, true);
|
||||
// $person1_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
// "class" => "img-thumbnail",
|
||||
// "style" => "width: 100px;height:100px;"
|
||||
// ]) . "<br>" . $person1->name . " [" . $confidence['percent1'] . "]" . "</div>";
|
||||
// }
|
||||
// if ($confidence['id2'] !== "0" && $confidence['id2'] != $confidence['id1']) {
|
||||
// $person2 = \app\models\ListManagement::findOne($confidence['id2']);
|
||||
// if ($person2) {
|
||||
// $images = json_decode($person2->image, true);
|
||||
// $person2_html = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $images[0]['url'], [
|
||||
// "class" => "img-thumbnail",
|
||||
// "style" => "width: 100px;height:100px;"
|
||||
// ]) . "<br>" . $person2->name . " [" . $confidence['percent2'] . "]" . "</div>";
|
||||
// }
|
||||
// }
|
||||
return $confidence['percent1']; //$person1_html . $person2_html;
|
||||
};
|
||||
}
|
||||
|
||||
public static function confidenceControlLogs() {
|
||||
return function($model) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
return $confidence['percent1'] . ($confidence['percent2'] > 0 ? " [" . $confidence['percent2'] . "]" : "");
|
||||
};
|
||||
}
|
||||
|
||||
public static function rows() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
$confidence = json_decode($model->confidence, true);
|
||||
$person = isset($confidence['id1']) ? \app\models\ListManagement::findOne($confidence['id1']) : false;
|
||||
$images = false;
|
||||
if ($person) {
|
||||
$images = json_decode($person->image, true);
|
||||
}
|
||||
return [
|
||||
"ondblclick" => "_form(this);",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"id" => $model->id,
|
||||
"img" => "/data/uploads/face/" . $model->image,
|
||||
"confidence" => json_encode([
|
||||
"name" => $person ? $person->name : "",
|
||||
"score" => isset($confidence['percent1']) ? $confidence['percent1'] : "",
|
||||
"img" => isset($images[0]) ? "/data/uploads/face/" . $images[0]['url'] : ""
|
||||
])
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
public static function rowsControlLogs() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
return [
|
||||
"ondblclick" => "_form(this);",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"id" => $model->id,
|
||||
"img" => "/data/uploads/face/" . $model->image
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
public static function birthday() {
|
||||
return function($model) {
|
||||
$staff = $model->listManagement;
|
||||
if ($staff)
|
||||
return date("d/m/Y", $staff->birthday);
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
public static function registrationImage() {
|
||||
return function($model) {
|
||||
$staff = $model->listManagement;
|
||||
if ($staff) {
|
||||
$images = json_decode($staff->image, true);
|
||||
if (count($images) > 0)
|
||||
return Html::img("/data/uploads/face/" . $images[count($images) - 1]['url'], [
|
||||
"class" => "img-thumbnail",
|
||||
"style" => "width: 150px;height:150px;"
|
||||
]);
|
||||
}
|
||||
return "";
|
||||
};
|
||||
}
|
||||
|
||||
}
|
128
helpers/ListManagementGrid.php
Normal file
128
helpers/ListManagementGrid.php
Normal file
|
@ -0,0 +1,128 @@
|
|||
<?php
|
||||
|
||||
namespace app\helpers;
|
||||
|
||||
use Yii;
|
||||
use yii\helpers\Html;
|
||||
use yii\helpers\Url;
|
||||
|
||||
class ListManagementGrid {
|
||||
|
||||
static $path = "";
|
||||
|
||||
public static function path() {
|
||||
return self::$path;
|
||||
}
|
||||
|
||||
public static function engineNameFunc() {
|
||||
return function ($data) {
|
||||
return $data->app->app_name;
|
||||
};
|
||||
}
|
||||
|
||||
public static function layout($default = 20, $hiddenText = false) {
|
||||
$pageSize = [10, 20, 50, 100];
|
||||
$options = [];
|
||||
foreach ($pageSize as $key => $value) {
|
||||
$selected = "";
|
||||
if (Yii::$app->request->get("per-page") && Yii::$app->request->get("per-page") == $value)
|
||||
$selected = "selected";
|
||||
if (!Yii::$app->request->get("per-page") && $value == $default)
|
||||
$selected = "selected";
|
||||
$options[] = "<option value='" . $value . "' {$selected}>" . $value . "</options>";
|
||||
}
|
||||
$select = "<select style='width:80px;' onchange='common.changePerPage(this);'>" . implode("", $options) . "</select>";
|
||||
$text = "";
|
||||
if (!$hiddenText)
|
||||
$text = "Hiển thị ";
|
||||
return "{items}<div class='row'><div class='col-md-6'>{summary}</div><div class='col-md-6'><div class='row'><div class='col-md-9 text-right'>{pager}</div><div class='col-md-3'>" . $text . $select . "</div></div></div></div>";
|
||||
}
|
||||
|
||||
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}";
|
||||
}
|
||||
|
||||
public static function time() {
|
||||
return function($model) {
|
||||
return date("H:i:s d/m/Y", $model->time);
|
||||
};
|
||||
}
|
||||
|
||||
public static function birthday() {
|
||||
return function($model) {
|
||||
return date("d/m/Y", $model->birthday);
|
||||
};
|
||||
}
|
||||
|
||||
public static function image() {
|
||||
return function($model) {
|
||||
$images = json_decode($model->image, true);
|
||||
$return = [];
|
||||
foreach ($images as $key => $value) {
|
||||
$removeBtn = Html::button("<i class='fa fa-remove'></i>", [
|
||||
"class" => "btn btn-danger btn-xs",
|
||||
"style" => "position:absolute;top:0;right:0;visibility: hidden;",
|
||||
"onclick" => "_deleteFeature(this);",
|
||||
"data-img" => $value['url'],
|
||||
"data-id" => $model->id,
|
||||
"data-href" => Url::to(["/list-management/delete-feature"])
|
||||
]);
|
||||
$return[] = "<div class='feature-img'>" . Html::img("/data/uploads/face/" . $value['url'], [
|
||||
"class" => "img-thumbnail",
|
||||
"style" => "width: 100px;height:100px;"
|
||||
]) . $removeBtn . "</div>";
|
||||
}
|
||||
return implode(" ", $return);
|
||||
};
|
||||
}
|
||||
|
||||
public static function type($typeArray) {
|
||||
return function($model) use ($typeArray) {
|
||||
return $typeArray[$model->type];
|
||||
};
|
||||
}
|
||||
|
||||
public static function gender($genderArray) {
|
||||
return function($model) use ($genderArray) {
|
||||
return $genderArray[$model->gender];
|
||||
};
|
||||
}
|
||||
|
||||
public static function rows() {
|
||||
return function($model, $index, $widget, $grid) {
|
||||
return [
|
||||
"ondblclick" => "_menu(this);",
|
||||
"style" => "cursor: pointer;",
|
||||
"data" => [
|
||||
"id" => $model->id
|
||||
]
|
||||
];
|
||||
};
|
||||
}
|
||||
|
||||
public static function schedule() {
|
||||
return function($model) {
|
||||
$schedules = $model->schedule;
|
||||
$html = "<ul style='padding-left:10px;'>";
|
||||
foreach ($schedules as $key => $value) {
|
||||
$btnEdit = "<i class='fa fa-edit text-green' onclick='formEditSchedule(this);' data-href='" . Url::to(['/list-management/edit-schedule', 'id' => $value->id]) . "'></i>";
|
||||
$btnDelete = "<i class='fa fa-remove text-red' onclick='formDeleteSchedule(this);' data-href='" . Url::to(['/list-management/delete-schedule', 'id' => $value->id]) . "'></i>";
|
||||
$btn = "<span class='btn-schedule'>" . $btnEdit . " " . $btnDelete . "</span>";
|
||||
$html .= "<li class='schedule-item'>[" . $value->from_time . "-" . $value->to_time . "] " . $value->from_date . " - " . $value->to_date . " [" . $value->date_of_week . "] " . $btn . "</li>";
|
||||
}
|
||||
$html .= "</ul>";
|
||||
return $html;
|
||||
};
|
||||
}
|
||||
|
||||
public static function check() {
|
||||
return function($model) {
|
||||
return "<input type='checkbox' value='' name='' onclick='choose(this);'>";
|
||||
};
|
||||
}
|
||||
|
||||
}
|
180
messages/en/app.php
Normal file
180
messages/en/app.php
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
return [
|
||||
"CAU_HINH" => "Configuration",
|
||||
"CAU_HINH_THIET_BI" => "Device Config",
|
||||
"CAU_HINH_MAY_CHU" => "Server Config",
|
||||
"CAU_HINH_NHAN_DIEN" => "Recognition Config",
|
||||
"CAU_HINH_IP" => "IP Config",
|
||||
"DEVICE_CONFIG" => " ",
|
||||
"SERVER_CONFIG" => " ",
|
||||
"ENGINE_CONFIG" => " ",
|
||||
"IP_CONFIG" => " ",
|
||||
"SERVER_MQTT" => "server_mqtt",
|
||||
"URL" => "url",
|
||||
"LUU_LAI" => "Save",
|
||||
"HAY_NHAP_THONG_TIN" => "Please enter the required information",
|
||||
"BOX_CHUA_DUOC_DANG_KI_TREN_CMS" => "This box is not yet registered on CMS",
|
||||
"DA_LUU_CAU_HINH" => "Configuration saved",
|
||||
"LUU_CAU_HINH_THAT_BAI" => "Unable to save this configuration",
|
||||
"RESET_THIET_BI" => "Reset the device",
|
||||
"XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI" => "Delete the data stored in the device",
|
||||
"RESET_CAU_HINH_THIET_BI" => "Reset to default configuration",
|
||||
"DONG_Y" => "Confirm",
|
||||
"HUY_BO" => "Cancel",
|
||||
"HAY_LUA_CHON_THAO_TAC" => "Please select an operation",
|
||||
"DELETE_DB_CONFIRM" => "Please confirm to delete all the data stored in the device?",
|
||||
"RESET_DB_CONFIRM" => "Please confirm to reset the to default configuration?",
|
||||
"CAU_HINH_IP_CHUA_DUNG" => "IP Configuration is not correct",
|
||||
"SERVER_API" => "Server API",
|
||||
"DEVICE_ID" => "Device ID",
|
||||
"QUAN_LY_MAU" => "Face Sample Management",
|
||||
"LICH_SU_HE_THONG" => "System history",
|
||||
"DANH_SACH_NHAN_DIEN" => "Recognition log",
|
||||
"ONLINE" => "Online",
|
||||
"THONG_TIN_CA_NHAN" => "Personal Information",
|
||||
"DOI_MAT_KHAU" => "Change Password",
|
||||
"DANG_XUAT" => "Log out",
|
||||
"PHIEN_BAN" => "Version",
|
||||
"ID" => "ID",
|
||||
"LOAI" => "Type",
|
||||
"TEN" => "Name",
|
||||
"HINH_ANH_DANG_KI" => "Sample Images",
|
||||
"GIOI_TINH" => "Sex",
|
||||
"NGAY_SINH" => "DOB",
|
||||
"DIEN_THOAI" => "Phone Nnumber",
|
||||
"DON_VI" => "Departement",
|
||||
"THOI_GIAN_DANG_KI" => "Registration time",
|
||||
"TEN_HIEN_THI" => "Display Name",
|
||||
"WHITE_LIST" => "Whitelist",
|
||||
"BLACK_LIST" => "Blacklist",
|
||||
"MALE" => "Male",
|
||||
"FEMALE" => "Female",
|
||||
"TIM_KIEM_DU_LIEU" => "Search the data",
|
||||
"TAT_CA" => "All",
|
||||
"TIM_KIEM" => "Search",
|
||||
"XOA_NHIEU_DU_LIEU" => "Choose multiple data",
|
||||
"CHON_TOAN_BO_TRANG" => "Select all data",
|
||||
"BO_CHON" => "Unselect",
|
||||
"XAC_NHAN_XOA" => "Deletion Confirm",
|
||||
"DONG_BO_VOI_MAY_CHU" => "Data Synchronization",
|
||||
"DONG_BO_TU_MAY_CHU" => "Synchronize data from server",
|
||||
"DONG_BO_LEN_MAY_CHU" => "Synchronize data to server",
|
||||
"DONG_BO_TU_THIET_BI_KHAC" => "Synchronize data from other device",
|
||||
"NHAP_IP_THIET_BI" => "Insert device's ip",
|
||||
"SO_NGUOI_CO_ANH_TREN_TONG" => "Users with face samples/ Total",
|
||||
"DAC_TRUNG_1" => "Face Feature 1",
|
||||
"DAC_TRUNG_2" => "Face Feature 2",
|
||||
"DANG_CAP_NHAT" => "Loading ...",
|
||||
"THAO_TAC" => "Action",
|
||||
"SUA" => "Edit",
|
||||
"XOA" => "Delete",
|
||||
"DANH_SACH" => "List",
|
||||
"LUU" => "Save",
|
||||
"HUY" => "Cancel",
|
||||
"HAY_CHON_DOI_TUONG" => "Please choose objects",
|
||||
"HAY_NHAP_TEN" => "Please insert name",
|
||||
"HAY_NHAP_TEN_HIEN_THI" => "Please insert display name",
|
||||
"CAP_NHAT_DU_LIEU_THANH_CONG" => "The data is updated successfully",
|
||||
"MA_DOI_TUONG_DA_TON_TAI" => "Object code existed",
|
||||
"DELETE_CONFIRM" => "Dele confirm?",
|
||||
"HAY_CHON_DU_LIEU_DE_XOA" => "Please select data to delete",
|
||||
"DA_XOA_DU_LIEU" => "Data is deleted",
|
||||
"CHON_HINH_ANH" => "Please select an image",
|
||||
"HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT" => "Unable to recognize faces in the image",
|
||||
"HAY_TAI_LEN_HINH_ANH" => "Please upload sample pictures",
|
||||
"HAY_NHAP_DIA_CHI_IP_DONG_BO" => "Please enter the ip address of the device you want to synchronize",
|
||||
"SAI_DINH_DANG_IP" => "IP address is not correct",
|
||||
"TIM_KIEM_THEO_ID_HOAC_TEN" => "Search by ID/Name",
|
||||
"KHONG_CO_KET_NOI_TOI_THIET_BI" => "No connection to the device",
|
||||
"KHONG_CO_DU_LIEU_DONG_BO" => "Sychonozation data is blank",
|
||||
"DONG_BO_DU_LIEU_HOAN_THANH" => "Data synchronization is completed",
|
||||
"SO_ANH_MAU_TOI_DA" => "Each person can take up to {maxPicture} sample images",
|
||||
"ANH_MAU_DA_DUOC_CHON" => "This image is selected as the sample for this person",
|
||||
"KHONG_TIM_THAY_THONG_TIN" => "No information found",
|
||||
"HUY_BO_TIM_KIEM" => "Cancel search",
|
||||
"DA_LUA_CHON_X_DOI_TUONG" => "Selected <b class='text-red' id='totals-choose'>0</b> object.",
|
||||
"DONG_BO_X_Y_DOI_TUONG" => "Synchronize <b id='progress-current' class='text-green'>0</b>/<b id='progress-totals' class='text-red'>0</b> object.",
|
||||
"CHON_TAT_CA" => "Select all",
|
||||
"BO_CHON_TAT_CA" => "Deselect all",
|
||||
"DONG_BO" => "Synchronized",
|
||||
"DONG_LAI" => "Close",
|
||||
"COMPANY_ID" => "Company ID",
|
||||
"CHON_DOI_TUONG_CHUA_TON_TAI" => "Selected object does not exist",
|
||||
"DU_LIEU_KHONG_DOI" => "Data unchanged",
|
||||
"THOI_GIAN" => "Time",
|
||||
"HINH_ANH" => "Image",
|
||||
"TRANG_THAI" => "Status",
|
||||
"REMARK" => "Remark",
|
||||
"DO_TIN_CAY" => "Reliability",
|
||||
"TRANG_THAI_DONG_BO" => "Synchronization status",
|
||||
"FROM" => "From",
|
||||
"TO" => "To",
|
||||
"HIEN_THI_TOAN_BO_DU_LIEU" => "Show all data",
|
||||
"DOI_TUONG_KHONG_TON_TAI" => "Object does not exist",
|
||||
"DA_THEM_HINH_ANH_MAU" => "Added sample images",
|
||||
"XUAT_DU_LIEU" => "Export data",
|
||||
"TEN_DANG_NHAP" => "Username",
|
||||
"HO_TEN" => "Fullname",
|
||||
"EMAIL" => "Email",
|
||||
"LOAI_NGUOI_DUNG" => "User Type",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "Information saved",
|
||||
"DOI_MAT_KHAU" => "Change Password",
|
||||
"MAT_KHAU_CU" => "Old password",
|
||||
"MAT_KHAU_MOI" => "New password",
|
||||
"NHAC_LAI_MAT_KHAU_MOI" => "Retype new password",
|
||||
"DOI_MAT_KHAU_THANH_CONG" => "Change password successfully",
|
||||
"DANG_XU_LY" => "Loading ...",
|
||||
"THONG_BAO" => "Notify",
|
||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "An error occurred, check the network connection and try again",
|
||||
"ENGINE_KHONG_HOAT_DONG" => "Engine is not running",
|
||||
"DANG_NHAP" => "Login",
|
||||
"MAT_KHAU" => "Password",
|
||||
"RESET_THIET_BI_LOI" => "Error connecting to the server. Please check your internet connection and try again.",
|
||||
"THU_LAI" => "Try again",
|
||||
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Incorrect username or password.",
|
||||
"DOI_TUONG_CHUA_DU_ANH_MAU" => "Object does not have enough images",
|
||||
"LICH_TRINH" => "Schedule",
|
||||
"HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH" => "Please select the object to assign the schedule",
|
||||
"GAN_LICH_TRINH" => "Assign schedule",
|
||||
"THOI_GIAN_VAO" => "Time in",
|
||||
"THOI_GIAN_RA" => "Time out",
|
||||
"NGAY_BAT_DAU" => "Start date",
|
||||
"NGAY_KET_THUC" => "End date",
|
||||
"NGAY_TRONG_TUAN" => "Day of the week",
|
||||
"THU_HAI" => "Monday",
|
||||
"THU_BA" => "Tuesday",
|
||||
"THU_TU" => "Wednesday",
|
||||
"THU_NAM" => "Thursday",
|
||||
"THU_SAU" => "Friday",
|
||||
"THU_BAY" => "Saturday",
|
||||
"CHU_NHAT" => "Sunday",
|
||||
"SUA_LICH_TRINH" => "Edit schedule",
|
||||
"AP_DUNG_CHO_TAT_CA_DOI_TUONG_DA_CHON" => "Apply to all selected objects",
|
||||
"XOA_LICH_TRINH" => "Delete schedule",
|
||||
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "Are you sure you want to delete this schedule?",
|
||||
"SO_SANH_MAT" => "Face comparison",
|
||||
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Are you sure you want to change the device's IP address?",
|
||||
"THONG_TIN_HE_THONG" => "System Information",
|
||||
"REBOOT" => "Reboot",
|
||||
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "Are you sure you want to reboot?",
|
||||
"DIEU_KHIEN_THIET_BI" => "Device controller",
|
||||
"DEVICE_CONTROLLER" => " ",
|
||||
"DIEU_KHIEN_CHUONG_TRINH_NHAN_DIEN" => "Control recognition program",
|
||||
"ON" => "On",
|
||||
"OFF" => "Off",
|
||||
"THOI_GIAN_HOAT_DONG_CUA_THIET_BI" => "Device operating time",
|
||||
"THOI_GIAN_BAT_DEN" => "Time to turn on the light",
|
||||
"BACKGROUND" => "Background",
|
||||
"BACKGROUND_DESCRIPTION" => "Maximum size 3.5MB (recommended resolution 1280x640px)",
|
||||
"AM_THANH" => "Sound",
|
||||
"THOI_GIAN_KHONG_DUOC_DE_TRONG" => "Time cannot be left blank",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "The information has been saved",
|
||||
"CHON_AM_THANH" => "Select sound"
|
||||
];
|
180
messages/ja/app.php
Normal file
180
messages/ja/app.php
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?php
|
||||
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
return [
|
||||
"CAU_HINH" => "構成",
|
||||
"CAU_HINH_THIET_BI" => "デバイス構成",
|
||||
"CAU_HINH_MAY_CHU" => " サーバ構成",
|
||||
"CAU_HINH_NHAN_DIEN" => "認識構成",
|
||||
"CAU_HINH_IP" => "IP 構成",
|
||||
"DEVICE_CONFIG" => "Device config",
|
||||
"SERVER_CONFIG" => "Server config",
|
||||
"ENGINE_CONFIG" => "Engine config",
|
||||
"IP_CONFIG" => "IP config",
|
||||
"SERVER_MQTT" => "server_mqtt",
|
||||
"URL" => "url",
|
||||
"LUU_LAI" => "保存する",
|
||||
"HAY_NHAP_THONG_TIN" => "情報を入力してください",
|
||||
"BOX_CHUA_DUOC_DANG_KI_TREN_CMS" => "CMSでBox に登録されていません",
|
||||
"DA_LUU_CAU_HINH" => "構成が保存されました",
|
||||
"LUU_CAU_HINH_THAT_BAI" => "構成の保存に失敗しました",
|
||||
"RESET_THIET_BI" => "デバイスをリセット",
|
||||
"XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI" => "デバイスに保存されているデータを消去します",
|
||||
"RESET_CAU_HINH_THIET_BI" => "デバイス構成をリセットする",
|
||||
"DONG_Y" => "同意",
|
||||
"HUY_BO" => "キャンセル",
|
||||
"HAY_LUA_CHON_THAO_TAC" => "アクションを選択してください",
|
||||
"DELETE_DB_CONFIRM" => "デバイスに保存されているデータをクリアしてもよろしいですか?",
|
||||
"RESET_DB_CONFIRM" => "デバイス構成をリセットしてもよろしいですか?",
|
||||
"CAU_HINH_IP_CHUA_DUNG" => "IP構成が違います",
|
||||
"SERVER_API" => "Server API",
|
||||
"DEVICE_ID" => "Device ID",
|
||||
"QUAN_LY_MAU" => "テンプレート管理",
|
||||
"LICH_SU_HE_THONG" => "システム履歴",
|
||||
"DANH_SACH_NHAN_DIEN" => "認識リスト",
|
||||
"ONLINE" => "オンライン",
|
||||
"THONG_TIN_CA_NHAN" => "個人情報",
|
||||
"DOI_MAT_KHAU" => "パスワード変更する",
|
||||
"DANG_XUAT" => "ログアウト",
|
||||
"PHIEN_BAN" => "バージョン",
|
||||
"ID" => "ID",
|
||||
"LOAI" => "タイプ",
|
||||
"TEN" => "名前",
|
||||
"HINH_ANH_DANG_KI" => "登録画像",
|
||||
"GIOI_TINH" => "性",
|
||||
"NGAY_SINH" => "生年月日",
|
||||
"DIEN_THOAI" => "電話番号",
|
||||
"DON_VI" => "部署",
|
||||
"THOI_GIAN_DANG_KI" => "登録時間",
|
||||
"TEN_HIEN_THI" => "表示名",
|
||||
"WHITE_LIST" => "Whitelist",
|
||||
"BLACK_LIST" => "Blacklist",
|
||||
"MALE" => "男",
|
||||
"FEMALE" => "女",
|
||||
"TIM_KIEM_DU_LIEU" => "データ検索",
|
||||
"TAT_CA" => "全部",
|
||||
"TIM_KIEM" => "検索",
|
||||
"XOA_NHIEU_DU_LIEU" => "複数のデータを選択",
|
||||
"CHON_TOAN_BO_TRANG" => "ページ全体を選択",
|
||||
"BO_CHON" => "取り消し",
|
||||
"XAC_NHAN_XOA" => "削除の確認",
|
||||
"DONG_BO_VOI_MAY_CHU" => "サーバーと同期する",
|
||||
"DONG_BO_TU_MAY_CHU" => "サーバーから同期する",
|
||||
"DONG_BO_LEN_MAY_CHU" => "サーバーに同期する",
|
||||
"DONG_BO_TU_THIET_BI_KHAC" => "他のデバイスから同期する",
|
||||
"NHAP_IP_THIET_BI" => "デバイスIPを入力してください",
|
||||
"SO_NGUOI_CO_ANH_TREN_TONG" => "写真を持っている人の数/合計",
|
||||
"DAC_TRUNG_1" => "特徴 1",
|
||||
"DAC_TRUNG_2" => "特徴 2",
|
||||
"DANG_CAP_NHAT" => "更新中 ...",
|
||||
"THAO_TAC" => "取り扱う",
|
||||
"SUA" => "修理する",
|
||||
"XOA" => "消す",
|
||||
"DANH_SACH" => "リスト",
|
||||
"LUU" => "保存する",
|
||||
"HUY" => "キャンセル",
|
||||
"HAY_CHON_DOI_TUONG" => "オブジェクトを選択してください",
|
||||
"HAY_NHAP_TEN" => "名前を入力してください",
|
||||
"HAY_NHAP_TEN_HIEN_THI" => "表示名を入力してください",
|
||||
"CAP_NHAT_DU_LIEU_THANH_CONG" => "データの更新に成功しました",
|
||||
"MA_DOI_TUONG_DA_TON_TAI" => "オブジェクトコードはすでに存在します",
|
||||
"DELETE_CONFIRM" => "消去してもよろしいですか?",
|
||||
"HAY_CHON_DU_LIEU_DE_XOA" => "削除するデータを選択してください",
|
||||
"DA_XOA_DU_LIEU" => "削除されたデータ",
|
||||
"CHON_HINH_ANH" => "画像を選択",
|
||||
"HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT" => "画像が顔を認識しない",
|
||||
"HAY_TAI_LEN_HINH_ANH" => "写真をアップロードしてください",
|
||||
"HAY_NHAP_DIA_CHI_IP_DONG_BO" => "同期するデバイスのIPアドレスを入力してください",
|
||||
"SAI_DINH_DANG_IP" => "間違ったIP形式",
|
||||
"TIM_KIEM_THEO_ID_HOAC_TEN" => "ID と名前で検索",
|
||||
"KHONG_CO_KET_NOI_TOI_THIET_BI" => "デバイスに接続されていません",
|
||||
"KHONG_CO_DU_LIEU_DONG_BO" => "データ同期なし",
|
||||
"DONG_BO_DU_LIEU_HOAN_THANH" => "データ同期が完了しました",
|
||||
"SO_ANH_MAU_TOI_DA" => "各オブジェクトは、最大{maxPicture}のサンプル画像のみを受信できます",
|
||||
"ANH_MAU_DA_DUOC_CHON" => "この画像は、この主題のモデルとして選択されています",
|
||||
"KHONG_TIM_THAY_THONG_TIN" => "情報が見つかりません",
|
||||
"HUY_BO_TIM_KIEM" => "検索をキャンセルする",
|
||||
"DA_LUA_CHON_X_DOI_TUONG" => "選択された<bclass = 'text-red' id = 'totals-choose'> 0 </ b>オブジェクト.",
|
||||
"DONG_BO_X_Y_DOI_TUONG" => "Đ同期<bid = 'progress-current' class = 'text-green'> 0 </ b> / <b id = 'progress-totals' class = 'text-red'> 0 </ b>オブジェクト.",
|
||||
"CHON_TAT_CA" => "すべて選択",
|
||||
"BO_CHON_TAT_CA" => "すべての選択を解除",
|
||||
"DONG_BO" => "同期",
|
||||
"DONG_LAI" => "クローズ",
|
||||
"COMPANY_ID" => "Company ID",
|
||||
"CHON_DOI_TUONG_CHUA_TON_TAI" => "存在しないオブジェクトを選択してください",
|
||||
"DU_LIEU_KHONG_DOI" => "データは変更されていません",
|
||||
"THOI_GIAN" => "時間",
|
||||
"HINH_ANH" => "画像",
|
||||
"TRANG_THAI" => "状態",
|
||||
"REMARK" => "Remark",
|
||||
"DO_TIN_CAY" => "信頼性",
|
||||
"TRANG_THAI_DONG_BO" => "同期ステータス",
|
||||
"FROM" => "フォーム",
|
||||
"TO" => "に",
|
||||
"HIEN_THI_TOAN_BO_DU_LIEU" => "すべてのデータを表示",
|
||||
"DOI_TUONG_KHONG_TON_TAI" => "オブジェクトが存在しません",
|
||||
"DA_THEM_HINH_ANH_MAU" => "サンプル画像を追加",
|
||||
"XUAT_DU_LIEU" => "データのエクスポート",
|
||||
"TEN_DANG_NHAP" => "ユーザー名",
|
||||
"HO_TEN" => "名前",
|
||||
"EMAIL" => "メール",
|
||||
"LOAI_NGUOI_DUNG" => "ユーザータイプ",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "情報が保存されました",
|
||||
"DOI_MAT_KHAU" => "パスワードを変更する",
|
||||
"MAT_KHAU_CU" => "以前のパスワード",
|
||||
"MAT_KHAU_MOI" => "新しいパスワード",
|
||||
"NHAC_LAI_MAT_KHAU_MOI" => "新しいパスワードを繰り返す",
|
||||
"DOI_MAT_KHAU_THANH_CONG" => "パスワードを正常に変更する",
|
||||
"DANG_XU_LY" => "処理中 ...",
|
||||
"THONG_BAO" => "報告",
|
||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "おそらくネットワーク接続が原因でエラーが発生しました。再試行してください",
|
||||
"ENGINE_KHONG_HOAT_DONG" => "Engine不活動",
|
||||
"DANG_NHAP" => "ログイン",
|
||||
"MAT_KHAU" => "パスワード",
|
||||
"RESET_THIET_BI_LOI" => "サーバーへの接続中にエラーが発生しました。インターネット接続を確認して、もう一度お試しください",
|
||||
"THU_LAI" => "再試行",
|
||||
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "ユーザーネームまたはパスワードが違います",
|
||||
"DOI_TUONG_CHUA_DU_ANH_MAU" => "オブジェクトに十分な画像がありません",
|
||||
"LICH_TRINH" => "スケジュール",
|
||||
"HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH" => "スケジュールを割り当てるオブジェクトを選択してください",
|
||||
"GAN_LICH_TRINH" => "スケジュールを割り当てる",
|
||||
"THOI_GIAN_VAO" => "の時間",
|
||||
"THOI_GIAN_RA" => "タイムアウト",
|
||||
"NGAY_BAT_DAU" => "開始日",
|
||||
"NGAY_KET_THUC" => "終了日",
|
||||
"NGAY_TRONG_TUAN" => "曜日",
|
||||
"THU_HAI" => "月曜日",
|
||||
"THU_BA" => "火曜日",
|
||||
"THU_TU" => "水曜日",
|
||||
"THU_NAM" => "木曜日",
|
||||
"THU_SAU" => "金曜日",
|
||||
"THU_BAY" => "土曜日",
|
||||
"CHU_NHAT" => "日曜日",
|
||||
"SUA_LICH_TRINH" => "スケジュールを編集",
|
||||
"AP_DUNG_CHO_TAT_CA_DOI_TUONG_DA_CHON" => "選択したすべてのオブジェクトに適用",
|
||||
"XOA_LICH_TRINH" => "スケジュールを削除",
|
||||
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "このスケジュールを削除してもよろしいですか?",
|
||||
"SO_SANH_MAT" => "顔比較",
|
||||
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "デバイスの IP アドレスを変更してもよろしいですか?",
|
||||
"THONG_TIN_HE_THONG" => "システムインフォメーション",
|
||||
"REBOOT" => "リブート",
|
||||
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "再起動してもよろしいですか?",
|
||||
"DIEU_KHIEN_THIET_BI" => "コントローラ",
|
||||
"DEVICE_CONTROLLER" => "Device controller",
|
||||
"DIEU_KHIEN_CHUONG_TRINH_NHAN_DIEN" => "制御認識プログラム",
|
||||
"ON" => "On",
|
||||
"OFF" => "Off",
|
||||
"THOI_GIAN_HOAT_DONG_CUA_THIET_BI" => "デバイスの動作時間",
|
||||
"THOI_GIAN_BAT_DEN" => "ライトをつける時間です",
|
||||
"BACKGROUND" => "背景",
|
||||
"BACKGROUND_DESCRIPTION" => "最大サイズ 3.5MB (推奨解像度 1280x640px)",
|
||||
"AM_THANH" => "音",
|
||||
"THOI_GIAN_KHONG_DUOC_DE_TRONG" => "時間を空白のままにすることはできません",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "情報が保存されました",
|
||||
"CHON_AM_THANH" => "サウンドを選択する"
|
||||
];
|
|
@ -6,4 +6,175 @@
|
|||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
return [];
|
||||
return [
|
||||
"CAU_HINH" => "Cấu hình",
|
||||
"CAU_HINH_THIET_BI" => "Cấu hình thiết bị",
|
||||
"CAU_HINH_MAY_CHU" => "Cấu hình máy chủ",
|
||||
"CAU_HINH_NHAN_DIEN" => "Cấu hình nhận diện",
|
||||
"CAU_HINH_IP" => "Cấu hình IP",
|
||||
"DEVICE_CONFIG" => "Device config",
|
||||
"SERVER_CONFIG" => "Server config",
|
||||
"ENGINE_CONFIG" => "Engine config",
|
||||
"IP_CONFIG" => "IP config",
|
||||
"SERVER_MQTT" => "server_mqtt",
|
||||
"URL" => "url",
|
||||
"LUU_LAI" => "Lưu lại",
|
||||
"HAY_NHAP_THONG_TIN" => "Hãy nhập thông tin",
|
||||
"BOX_CHUA_DUOC_DANG_KI_TREN_CMS" => "Box chưa được đăng kí trên CMS",
|
||||
"DA_LUU_CAU_HINH" => "Đã lưu cấu hình",
|
||||
"LUU_CAU_HINH_THAT_BAI" => "Lưu cấu hình thất bại",
|
||||
"RESET_THIET_BI" => "Reset thiết bị",
|
||||
"XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI" => "Xóa dữ liệu lưu trữ trong thiết bị",
|
||||
"RESET_CAU_HINH_THIET_BI" => "Reset cấu hình thiết bị",
|
||||
"DONG_Y" => "Đồng ý",
|
||||
"HUY_BO" => "Hủy bỏ",
|
||||
"HAY_LUA_CHON_THAO_TAC" => "Hãy lựa chọn thao tác",
|
||||
"DELETE_DB_CONFIRM" => "Bạn có chắc chắn muốn xóa dữ liệu lưu trữ trong thiết bị không?",
|
||||
"RESET_DB_CONFIRM" => "Bạn có chắc chắn muốn reset cấu hình thiết bị không?",
|
||||
"CAU_HINH_IP_CHUA_DUNG" => "Cấu hình ip chưa đúng",
|
||||
"SERVER_API" => "Server API",
|
||||
"DEVICE_ID" => "Device ID",
|
||||
"QUAN_LY_MAU" => "Quản lý mẫu",
|
||||
"LICH_SU_HE_THONG" => "Lịch sử hệ thống",
|
||||
"DANH_SACH_NHAN_DIEN" => "Danh sách nhận diện",
|
||||
"ONLINE" => "Trực tuyến",
|
||||
"THONG_TIN_CA_NHAN" => "Thông tin cá nhân",
|
||||
"DOI_MAT_KHAU" => "Đổi mật khẩu",
|
||||
"DANG_XUAT" => "Đăng xuất",
|
||||
"PHIEN_BAN" => "Phiên bản",
|
||||
"ID" => "ID",
|
||||
"LOAI" => "Loại",
|
||||
"TEN" => "Tên",
|
||||
"HINH_ANH_DANG_KI" => "Hình ảnh đăng kí",
|
||||
"GIOI_TINH" => "Giới tính",
|
||||
"NGAY_SINH" => "Ngày sinh",
|
||||
"DIEN_THOAI" => "Điện thoại",
|
||||
"DON_VI" => "Đơn vị",
|
||||
"THOI_GIAN_DANG_KI" => "Thời gian đăng kí",
|
||||
"TEN_HIEN_THI" => "Tên hiển thị",
|
||||
"WHITE_LIST" => "Whitelist",
|
||||
"BLACK_LIST" => "Blacklist",
|
||||
"MALE" => "Nam",
|
||||
"FEMALE" => "Nữ",
|
||||
"TIM_KIEM_DU_LIEU" => "Tìm kiếm dữ liệu",
|
||||
"TAT_CA" => "Tất cả",
|
||||
"TIM_KIEM" => "Tìm kiếm",
|
||||
"XOA_NHIEU_DU_LIEU" => "Chọn nhiều dữ liệu",
|
||||
"CHON_TOAN_BO_TRANG" => "Chọn toàn bộ trang",
|
||||
"BO_CHON" => "Bỏ chọn",
|
||||
"XAC_NHAN_XOA" => "Xác nhận xóa",
|
||||
"DONG_BO_VOI_MAY_CHU" => "Đồng bộ với máy chủ",
|
||||
"DONG_BO_TU_MAY_CHU" => "Đồng bộ từ máy chủ",
|
||||
"DONG_BO_LEN_MAY_CHU" => "Đồng bộ lên máy chủ",
|
||||
"DONG_BO_TU_THIET_BI_KHAC" => "Đồng bộ từ thiết bị khác",
|
||||
"NHAP_IP_THIET_BI" => "Nhập ip thiết bị",
|
||||
"SO_NGUOI_CO_ANH_TREN_TONG" => "Số người có ảnh / tổng",
|
||||
"DAC_TRUNG_1" => "Đặc trưng 1",
|
||||
"DAC_TRUNG_2" => "Đặc trưng 2",
|
||||
"DANG_CAP_NHAT" => "Đang cập nhật ...",
|
||||
"THAO_TAC" => "Thao tác",
|
||||
"SUA" => "Sửa",
|
||||
"XOA" => "Xóa",
|
||||
"DANH_SACH" => "Danh sách",
|
||||
"LUU" => "Lưu",
|
||||
"HUY" => "Hủy",
|
||||
"HAY_CHON_DOI_TUONG" => "Hãy chọn đối tượng",
|
||||
"HAY_NHAP_TEN" => "Hãy nhập tên",
|
||||
"HAY_NHAP_TEN_HIEN_THI" => "Hãy nhập tên hiển thị",
|
||||
"CAP_NHAT_DU_LIEU_THANH_CONG" => "Cập nhật dữ liệu thành công",
|
||||
"MA_DOI_TUONG_DA_TON_TAI" => "Mã đối tượng đã tồn tại",
|
||||
"DELETE_CONFIRM" => "Bạn có chắc chắn muốn xóa không",
|
||||
"HAY_CHON_DU_LIEU_DE_XOA" => "Hãy chọn dữ liệu để xóa",
|
||||
"DA_XOA_DU_LIEU" => "Đã xóa dữ liệu",
|
||||
"CHON_HINH_ANH" => "Chọn hình ảnh",
|
||||
"HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT" => "Hình ảnh không nhận diện được khuôn mặt",
|
||||
"HAY_TAI_LEN_HINH_ANH" => "Hãy tải lên hình ảnh",
|
||||
"HAY_NHAP_DIA_CHI_IP_DONG_BO" => "Hãy nhập địa chỉ ip thiết bị muốn đồng bộ",
|
||||
"SAI_DINH_DANG_IP" => "Sai định dạng ip",
|
||||
"TIM_KIEM_THEO_ID_HOAC_TEN" => "Tìm kiếm theo ID hoặc tên",
|
||||
"KHONG_CO_KET_NOI_TOI_THIET_BI" => "Không có kết nối tới thiết bị",
|
||||
"KHONG_CO_DU_LIEU_DONG_BO" => "Không có dữ liệu đồng bộ",
|
||||
"DONG_BO_DU_LIEU_HOAN_THANH" => "Đồng bộ dữ liệu hoàn thành",
|
||||
"SO_ANH_MAU_TOI_DA" => "Mỗi đối tượng chỉ nhận tối đa {maxPicture} hình ảnh mẫu",
|
||||
"ANH_MAU_DA_DUOC_CHON" => "Hình ảnh này đã được chọn làm mẫu cho đối tượng này",
|
||||
"KHONG_TIM_THAY_THONG_TIN" => "Không tìm thấy thông tin",
|
||||
"HUY_BO_TIM_KIEM" => "Hủy bỏ tìm kiếm",
|
||||
"DA_LUA_CHON_X_DOI_TUONG" => "Đã lựa chọn <b class='text-red' id='totals-choose'>0</b> đối tượng.",
|
||||
"DONG_BO_X_Y_DOI_TUONG" => "Đồng bộ <b id='progress-current' class='text-green'>0</b>/<b id='progress-totals' class='text-red'>0</b> đối tượng.",
|
||||
"CHON_TAT_CA" => "Chọn tất cả",
|
||||
"BO_CHON_TAT_CA" => "Bỏ chọn tất cả",
|
||||
"DONG_BO" => "Đồng bộ",
|
||||
"DONG_LAI" => "Đóng lại",
|
||||
"COMPANY_ID" => "Company ID",
|
||||
"CHON_DOI_TUONG_CHUA_TON_TAI" => "Chọn đối tượng chưa tồn tại",
|
||||
"DU_LIEU_KHONG_DOI" => "Dữ liệu không đổi",
|
||||
"THOI_GIAN" => "Thời gian",
|
||||
"HINH_ANH" => "Hình ảnh",
|
||||
"TRANG_THAI" => "Trạng thái",
|
||||
"REMARK" => "Remark",
|
||||
"DO_TIN_CAY" => "Độ tin cậy",
|
||||
"TRANG_THAI_DONG_BO" => "Trạng thái đồng bộ",
|
||||
"FROM" => "Từ",
|
||||
"TO" => "Đến",
|
||||
"HIEN_THI_TOAN_BO_DU_LIEU" => "Hiển thị toàn bộ dữ liệu",
|
||||
"DOI_TUONG_KHONG_TON_TAI" => "Đối tượng không tồn tại",
|
||||
"DA_THEM_HINH_ANH_MAU" => "Đã thêm hình ảnh mẫu",
|
||||
"XUAT_DU_LIEU" => "Xuất dữ liệu",
|
||||
"TEN_DANG_NHAP" => "Tên đăng nhập",
|
||||
"HO_TEN" => "Họ tên",
|
||||
"EMAIL" => "Email",
|
||||
"LOAI_NGUOI_DUNG" => "Loại người dùng",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "Thông tin đã được lưu lại",
|
||||
"DOI_MAT_KHAU" => "Đổi mật khẩu",
|
||||
"MAT_KHAU_CU" => "Mật khẩu cũ",
|
||||
"MAT_KHAU_MOI" => "Mật khẩu mới",
|
||||
"NHAC_LAI_MAT_KHAU_MOI" => "Nhắc lại mật khẩu mới",
|
||||
"DOI_MAT_KHAU_THANH_CONG" => "Đổi mật khẩu thành công",
|
||||
"DANG_XU_LY" => "Đang xử lý ...",
|
||||
"THONG_BAO" => "Thông báo",
|
||||
"CO_LOI_XAY_RA_HAY_THU_LAI" => "Có lỗi xảy ra, có thể do đường truyền mạng, xin vui lòng thử lại",
|
||||
"ENGINE_KHONG_HOAT_DONG" => "Engine không hoạt động",
|
||||
"DANG_NHAP" => "Đăng nhập",
|
||||
"MAT_KHAU" => "Mật khẩu",
|
||||
"RESET_THIET_BI_LOI" => "Lỗi kết nối đến server. Hãy kiểm tra lại kết nối internet và thử lại.",
|
||||
"THU_LAI" => "Thử lại",
|
||||
"TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG" => "Tên đăng nhập hoặc mật khẩu không đúng.",
|
||||
"DOI_TUONG_CHUA_DU_ANH_MAU" => "Đối tượng chưa đủ ảnh mẫu",
|
||||
"LICH_TRINH" => "Lịch trình",
|
||||
"HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH" => "Hãy chọn đối tượng để gán lịch trình",
|
||||
"GAN_LICH_TRINH" => "Gán lịch trình",
|
||||
"THOI_GIAN_VAO" => "Thời gian vào",
|
||||
"THOI_GIAN_RA" => "Thời gian ra",
|
||||
"NGAY_BAT_DAU" => "Ngày bắt đầu",
|
||||
"NGAY_KET_THUC" => "Ngày kết thúc",
|
||||
"NGAY_TRONG_TUAN" => "Ngày trong tuần",
|
||||
"THU_HAI" => "Thứ hai",
|
||||
"THU_BA" => "Thứ ba",
|
||||
"THU_TU" => "Thứ tư",
|
||||
"THU_NAM" => "Thứ năm",
|
||||
"THU_SAU" => "Thứ sáu",
|
||||
"THU_BAY" => "Thứ bảy",
|
||||
"CHU_NHAT" => "Chủ nhật",
|
||||
"SUA_LICH_TRINH" => "Sửa lịch trình",
|
||||
"AP_DUNG_CHO_TAT_CA_DOI_TUONG_DA_CHON" => "Áp dụng cho tất cả đối tượng đã chọn",
|
||||
"XOA_LICH_TRINH" => "Xóa lịch trình",
|
||||
"BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" => "Bạn có chắc chắn muốn xóa lịch trình này không?",
|
||||
"SO_SANH_MAT" => "So sánh mặt",
|
||||
"BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" => "Bạn có chắc chắn muốn thay đổi địa chỉ IP của thiết bị không?",
|
||||
"THONG_TIN_HE_THONG" => "Thông tin hệ thống",
|
||||
"REBOOT" => "Khởi động lại thiết bị",
|
||||
"BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" => "Bạn có chắc chắn muốn khởi động lại thiết bị không?",
|
||||
"DIEU_KHIEN_THIET_BI" => "Điều khiển thiết bị",
|
||||
"DEVICE_CONTROLLER" => "Device controller",
|
||||
"DIEU_KHIEN_CHUONG_TRINH_NHAN_DIEN" => "Điều khiển chương trình nhận diện",
|
||||
"ON" => "Bật",
|
||||
"OFF" => "Tắt",
|
||||
"THOI_GIAN_HOAT_DONG_CUA_THIET_BI" => "Thời gian hoạt động của thiết bị",
|
||||
"THOI_GIAN_BAT_DEN" => "Thời gian bật đèn",
|
||||
"BACKGROUND" => "Hình nền",
|
||||
"BACKGROUND_DESCRIPTION" => "Kích thước tối đa 3.5MB (độ phân giải khuyến nghị 1280x640px)",
|
||||
"AM_THANH" => "Âm thanh",
|
||||
"THOI_GIAN_KHONG_DUOC_DE_TRONG" => "Thời gian không được để trống",
|
||||
"THONG_TIN_DA_DUOC_LUU_LAI" => "Thông tin đã được lưu lại",
|
||||
"CHON_AM_THANH" => "Chọn âm thanh"
|
||||
];
|
||||
|
|
83
models/CaptureLogs.php
Normal file
83
models/CaptureLogs.php
Normal file
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "capture_logs".
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $staff_id
|
||||
* @property int $time
|
||||
* @property string $image
|
||||
* @property int $status
|
||||
* @property string $remark
|
||||
* @property string $confidence
|
||||
* @property int $sync_status
|
||||
*/
|
||||
class CaptureLogs extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName() {
|
||||
return 'capture_logs';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['staff_id', 'time', 'status', 'sync_status'], 'integer'],
|
||||
[['image', 'remark', 'confidence'], 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'id' => Yii::t("app", "ID"),
|
||||
'time' => Yii::t("app", "THOI_GIAN"),
|
||||
'image' => Yii::t("app", "HINH_ANH"),
|
||||
'status' => Yii::t("app", "TRANG_THAI"),
|
||||
'remark' => Yii::t("app", "REMARK"),
|
||||
'staff_name' => Yii::t("app", "TEN"),
|
||||
'staff_image' => Yii::t("app", "HINH_ANH_DANG_KI"),
|
||||
'confidence' => Yii::t("app", "DO_TIN_CAY"),
|
||||
'sync_status' => Yii::t("app", "TRANG_THAI_DONG_BO")
|
||||
];
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'staff_id' => $data['Staff'],
|
||||
'time' => $data['Time'],
|
||||
'image' => $data["Image"],
|
||||
'status' => 0,
|
||||
'remark' => '',
|
||||
'confidence' => $data["Confidence"]
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
$this->save();
|
||||
return $this->id;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static $statusArray = [
|
||||
0 => "Unknown",
|
||||
1 => "List management"
|
||||
];
|
||||
|
||||
public function getListManagement() {
|
||||
return $this->hasOne(ListManagement::className(), ["id" => "staff_id"]);
|
||||
}
|
||||
|
||||
}
|
74
models/CaptureLogsSearch.php
Normal file
74
models/CaptureLogsSearch.php
Normal file
|
@ -0,0 +1,74 @@
|
|||
<?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 {
|
||||
|
||||
public $staff_name;
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['id', 'time', 'status'], 'integer'],
|
||||
[['image', 'remark', 'staff_name', 'confidence'], '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();
|
||||
$query->joinWith("listManagement");
|
||||
|
||||
// add conditions that should always apply here
|
||||
|
||||
$dataProvider = new ActiveDataProvider([
|
||||
'query' => $query,
|
||||
'sort' => ['defaultOrder' => ['time' => SORT_DESC]],
|
||||
]);
|
||||
|
||||
$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;
|
||||
}
|
||||
|
||||
}
|
186
models/ListManagement.php
Normal file
186
models/ListManagement.php
Normal file
|
@ -0,0 +1,186 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "list_management".
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $staff_id
|
||||
* @property string $code
|
||||
* @property string $type
|
||||
* @property string $name
|
||||
* @property string $abbreviated_name
|
||||
* @property string $image
|
||||
* @property string $gender
|
||||
* @property int $birthday
|
||||
* @property string $telephone
|
||||
* @property string $address
|
||||
* @property int $time
|
||||
* @property int $last_modified
|
||||
*/
|
||||
class ListManagement extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName() {
|
||||
return 'list_management';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['type', 'name', 'gender', 'telephone', 'address', 'image', 'code', 'abbreviated_name', 'staff_id'], 'string'],
|
||||
[['birthday', 'time', 'last_modified'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'id' => Yii::t("app", "ID"),
|
||||
'code' => Yii::t("app", "ID"),
|
||||
'type' => Yii::t("app", "LOAI"),
|
||||
'name' => Yii::t("app", "TEN_HIEN_THI"),
|
||||
'image' => Yii::t("app", "HINH_ANH_DANG_KI"),
|
||||
'gender' => Yii::t("app", "GIOI_TINH"),
|
||||
'birthday' => Yii::t("app", "NGAY_SINH"),
|
||||
'telephone' => Yii::t("app", "DIEN_THOAI"),
|
||||
'address' => Yii::t("app", "DON_VI"),
|
||||
'time' => Yii::t("app", "THOI_GIAN_DANG_KI"),
|
||||
'last_modified' => 'Last Modified',
|
||||
'abbreviated_name' => Yii::t("app", "TEN"),
|
||||
'staff_id' => Yii::t("app", "ID"),
|
||||
];
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'staff_id' => $data['staff_id'],
|
||||
'code' => $data['code'],
|
||||
'type' => $data['type'],
|
||||
'name' => $data['name'],
|
||||
'image' => $data['image'],
|
||||
'gender' => $data['gender'],
|
||||
'birthday' => $data['birthday'] === "" ? 0 : date_format(date_create_from_format('d/m/Y', $data['birthday']), 'U'),
|
||||
'telephone' => $data['telephone'],
|
||||
'address' => $data['address'],
|
||||
'abbreviated_name' => $data['abbreviated_name'],
|
||||
'time' => time(),
|
||||
'last_modified' => time()
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
$this->save();
|
||||
return $this->id;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static function typeArray() {
|
||||
return [
|
||||
"wl" => Yii::t("app", "WHITE_LIST"),
|
||||
"bl" => Yii::t("app", "BLACK_LIST")
|
||||
];
|
||||
}
|
||||
|
||||
public static function genderArray() {
|
||||
return [
|
||||
"Male" => Yii::t("app", "MALE"),
|
||||
"Female" => Yii::t("app", "FEMALE"),
|
||||
];
|
||||
}
|
||||
|
||||
public static function nameArray() {
|
||||
$res = [""];
|
||||
$ls = self::find()->all();
|
||||
foreach ($ls as $key => $value) {
|
||||
$res[] = $value->name;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public static function getAllID() {
|
||||
$idArr = [];
|
||||
$imgCountArr = [];
|
||||
$ls = self::find()->all();
|
||||
foreach ($ls as $key => $value) {
|
||||
$idArr[] = $value->staff_id;
|
||||
$images = json_decode($value->image, true);
|
||||
$imgCountArr[$value->staff_id] = count($images);
|
||||
}
|
||||
return [
|
||||
"idArr" => $idArr,
|
||||
"imgCountArr" => $imgCountArr
|
||||
];
|
||||
}
|
||||
|
||||
public static function staffArray() {
|
||||
$res = [];
|
||||
$ls = self::find()->all();
|
||||
foreach ($ls as $key => $value) {
|
||||
$res[$value->id] = $value->code . " - " . $value->name;
|
||||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function getAllFeatures() {
|
||||
$features = json_decode($this->image, true);
|
||||
// $f = [];
|
||||
// foreach ($features as $k => $v) {
|
||||
// $f[] = $v['features'];
|
||||
// if (isset($v['features512']))
|
||||
// if (count($v['features512']))
|
||||
// $f[] = $v['features512'];
|
||||
// }
|
||||
$feature1 = $feature2 = [];
|
||||
foreach ($features as $k => $v) {
|
||||
$feature1[] = $v['features'];
|
||||
if (isset($v['features512']))
|
||||
if (count($v['features512']))
|
||||
$feature2[] = $v['features512'];
|
||||
}
|
||||
return [
|
||||
"feature1" => $feature1,
|
||||
"feature2" => $feature2
|
||||
];
|
||||
}
|
||||
|
||||
public static function statisticFeatures() {
|
||||
$lists = self::find()->all();
|
||||
$total128 = $total512 = $totalImg = $img = 0;
|
||||
foreach ($lists as $key => $value) {
|
||||
$images = json_decode($value->image, true);
|
||||
if (count($images) > 0)
|
||||
$totalImg++;
|
||||
$img += count($images);
|
||||
foreach ($images as $k => $v) {
|
||||
if (isset($v['features']) && count($v['features']) > 0)
|
||||
$total128++;
|
||||
if (isset($v['features512']) && count($v['features512']) > 0)
|
||||
$total512++;
|
||||
}
|
||||
}
|
||||
return [
|
||||
"total" => count($lists),
|
||||
"totalImg" => $totalImg,
|
||||
"img" => $img,
|
||||
"128" => $total128,
|
||||
"512" => $total512
|
||||
];
|
||||
}
|
||||
|
||||
public function getSchedule() {
|
||||
return Schedule::find()->andWhere(['staff_id' => $this->id])->all();
|
||||
}
|
||||
|
||||
}
|
72
models/ListManagementSearch.php
Normal file
72
models/ListManagementSearch.php
Normal file
|
@ -0,0 +1,72 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
use yii\base\Model;
|
||||
use yii\data\ActiveDataProvider;
|
||||
use app\models\ListManagement;
|
||||
|
||||
/**
|
||||
* ListMamagementSearch represents the model behind the search form of `app\models\ListManagement`.
|
||||
*/
|
||||
class ListManagementSearch extends ListManagement {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['id', 'birthday'], 'integer'],
|
||||
[['type', 'name', 'gender', 'telephone', 'address'], '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 = ListManagement::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,
|
||||
'birthday' => $this->birthday,
|
||||
]);
|
||||
|
||||
$query->andFilterWhere(['like', 'type', $this->type])
|
||||
->andFilterWhere(['like', 'name', $this->name])
|
||||
->andFilterWhere(['like', 'gender', $this->gender])
|
||||
->andFilterWhere(['like', 'telephone', $this->telephone])
|
||||
->andFilterWhere(['like', 'address', $this->address]);
|
||||
|
||||
return $dataProvider;
|
||||
}
|
||||
|
||||
}
|
|
@ -43,11 +43,18 @@ class LoginForm extends Model {
|
|||
if (!$this->hasErrors()) {
|
||||
$user = $this->getUser();
|
||||
if (!$user || !$user->validatePassword($this->password)) {
|
||||
$this->addError($attribute, 'Incorrect username or password.');
|
||||
$this->addError($attribute, Yii::t("app", "TEN_DANG_NHAP_HOAC_MAT_KHAU_KHONG_DUNG"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'username' => Yii::t("app", "TEN_DANG_NHAP"),
|
||||
'password' => Yii::t("app", "MAT_KHAU")
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs in a user using the provided username and password.
|
||||
* @return bool whether the user is logged in successfully
|
||||
|
|
80
models/Schedule.php
Normal file
80
models/Schedule.php
Normal file
|
@ -0,0 +1,80 @@
|
|||
<?php
|
||||
|
||||
namespace app\models;
|
||||
|
||||
use Yii;
|
||||
|
||||
/**
|
||||
* This is the model class for table "schedule".
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $staff_id
|
||||
* @property string $from_time
|
||||
* @property string $to_time
|
||||
* @property string $from_date
|
||||
* @property string $to_date
|
||||
* @property string $date_of_week
|
||||
* @property int $id_door_calendar
|
||||
*/
|
||||
class Schedule extends \yii\db\ActiveRecord {
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public static function tableName() {
|
||||
return 'schedule';
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function rules() {
|
||||
return [
|
||||
[['staff_id', 'from_time', 'to_time', 'from_date', 'to_date', 'date_of_week'], 'string'],
|
||||
[['id_door_calendar'], 'integer'],
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*/
|
||||
public function attributeLabels() {
|
||||
return [
|
||||
'id' => 'ID',
|
||||
'staff_id' => 'Staff ID',
|
||||
'from_time' => 'From Time',
|
||||
'to_time' => 'To Time',
|
||||
'from_date' => 'From Date',
|
||||
'to_date' => 'To Date',
|
||||
'date_of_week' => 'Date Of Week',
|
||||
'id_door_calendar' => 'id_door_calendar'
|
||||
];
|
||||
}
|
||||
|
||||
public function multiCreate($datas) {
|
||||
$field = ['staff_id', 'from_time', 'to_time', 'from_date', 'to_date', 'date_of_week'];
|
||||
static::getDb()->createCommand()->batchInsert($this->tableName(), $field, $datas)->execute();
|
||||
return;
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'staff_id' => strval($data['staff_id']),
|
||||
'from_time' => $data['from_time'],
|
||||
'to_time' => $data['to_time'],
|
||||
'from_date' => $data['from_date'],
|
||||
'to_date' => $data['to_date'],
|
||||
'date_of_week' => $data['date_of_week'],
|
||||
'id_door_calendar' => $data['id_door_calendar']
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
$this->save();
|
||||
return $this->id;
|
||||
} catch (\Exception $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -8,6 +8,7 @@ use Yii;
|
|||
* This is the model class for table "sync_url".
|
||||
*
|
||||
* @property int $id
|
||||
* @property string $key_config
|
||||
* @property string $data
|
||||
*/
|
||||
class SyncUrl extends \yii\db\ActiveRecord {
|
||||
|
@ -25,7 +26,7 @@ class SyncUrl extends \yii\db\ActiveRecord {
|
|||
public function rules() {
|
||||
return [
|
||||
[['data'], 'required'],
|
||||
[['data'], 'string'],
|
||||
[['data', 'key_config'], 'string'],
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -36,12 +37,14 @@ class SyncUrl extends \yii\db\ActiveRecord {
|
|||
return [
|
||||
'id' => 'ID',
|
||||
'data' => 'Data',
|
||||
'key_config' => 'Key Config'
|
||||
];
|
||||
}
|
||||
|
||||
public function create($data) {
|
||||
$r = $this->load([
|
||||
'data' => $data['url'],
|
||||
'key_config' => $data['key_config'],
|
||||
'data' => $data['data'],
|
||||
], '');
|
||||
if ($r) {
|
||||
try {
|
||||
|
|
|
@ -131,6 +131,33 @@ class UploadForm extends Model {
|
|||
}
|
||||
}
|
||||
|
||||
public function UploadSound($file, $fileTypes, $path) {
|
||||
$root = \Yii::getAlias('@app') . '/web/data';
|
||||
$LocalPath = "/" . $path;
|
||||
$RootFolder = $root . $LocalPath;
|
||||
$destfile = "welcome_en.wav";
|
||||
if (!empty($_FILES)) {
|
||||
$tempFile = $_FILES[$file]['tmp_name'];
|
||||
$targetPath = $RootFolder;
|
||||
if (!file_exists($targetPath)) {
|
||||
@mkdir($targetPath, 0777, true);
|
||||
}
|
||||
$targetFile = $targetPath . '/' . $destfile;
|
||||
$targetFileLocal = $LocalPath . '/' . $destfile;
|
||||
$fileParts = pathinfo($_FILES[$file]['name']);
|
||||
if (in_array(strtoupper($fileParts['extension']), $fileTypes)) {
|
||||
move_uploaded_file($tempFile, $targetFile);
|
||||
if (file_exists($targetFile)) {
|
||||
return $targetFileLocal;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Move file
|
||||
public function MoveFile($file, $folder) {
|
||||
$currentStorage = Storage::findOne(['stt' => 1])->folder;
|
||||
|
|
|
@ -59,7 +59,7 @@ class common extends \yii\db\ActiveRecord {
|
|||
// $now = time();
|
||||
// $range = $now - $time;
|
||||
// if ($range > 60 * 60 * 12) {
|
||||
return date($format, $time);
|
||||
return date($format, $time);
|
||||
// } else {
|
||||
// return Yii::$app->formatter->asRelativeTime($time);
|
||||
// }
|
||||
|
@ -171,4 +171,71 @@ class common extends \yii\db\ActiveRecord {
|
|||
return $visible;
|
||||
}
|
||||
|
||||
public static function requestToEngine($path, $data) {
|
||||
$content = @file_get_contents("http://localhost:2305" . $path, false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($data)
|
||||
]
|
||||
]));
|
||||
if ($content == false)
|
||||
return ["status" => false];
|
||||
return ["status" => true, "data" => $content];
|
||||
}
|
||||
|
||||
public static function updateFeature($datas) {
|
||||
return @file_get_contents("http://localhost:2305/update-person", false, stream_context_create([
|
||||
'http' => [
|
||||
'header' => "Content-Type: application/json",
|
||||
'method' => "POST",
|
||||
'content' => json_encode($datas)
|
||||
]
|
||||
]));
|
||||
}
|
||||
|
||||
public static function generateRandomString($length = 10) {
|
||||
$characters = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
|
||||
$charactersLength = strlen($characters);
|
||||
$randomString = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$randomString .= $characters[rand(0, $charactersLength - 1)];
|
||||
}
|
||||
return $randomString;
|
||||
}
|
||||
|
||||
public static function convert_vi_to_en($str) {
|
||||
$str = preg_replace("/(à|á|ạ|ả|ã|â|ầ|ấ|ậ|ẩ|ẫ|ă|ằ|ắ|ặ|ẳ|ẵ)/", "a", $str);
|
||||
$str = preg_replace("/(è|é|ẹ|ẻ|ẽ|ê|ề|ế|ệ|ể|ễ)/", "e", $str);
|
||||
$str = preg_replace("/(ì|í|ị|ỉ|ĩ)/", "i", $str);
|
||||
$str = preg_replace("/(ò|ó|ọ|ỏ|õ|ô|ồ|ố|ộ|ổ|ỗ|ơ|ờ|ớ|ợ|ở|ỡ)/", "o", $str);
|
||||
$str = preg_replace("/(ù|ú|ụ|ủ|ũ|ư|ừ|ứ|ự|ử|ữ)/", "u", $str);
|
||||
$str = preg_replace("/(ỳ|ý|ỵ|ỷ|ỹ)/", "y", $str);
|
||||
$str = preg_replace("/(đ)/", "d", $str);
|
||||
$str = preg_replace("/(À|Á|Ạ|Ả|Ã|Â|Ầ|Ấ|Ậ|Ẩ|Ẫ|Ă|Ằ|Ắ|Ặ|Ẳ|Ẵ)/", "A", $str);
|
||||
$str = preg_replace("/(È|É|Ẹ|Ẻ|Ẽ|Ê|Ề|Ế|Ệ|Ể|Ễ)/", "E", $str);
|
||||
$str = preg_replace("/(Ì|Í|Ị|Ỉ|Ĩ)/", "I", $str);
|
||||
$str = preg_replace("/(Ò|Ó|Ọ|Ỏ|Õ|Ô|Ồ|Ố|Ộ|Ổ|Ỗ|Ơ|Ờ|Ớ|Ợ|Ở|Ỡ)/", "O", $str);
|
||||
$str = preg_replace("/(Ù|Ú|Ụ|Ủ|Ũ|Ư|Ừ|Ứ|Ự|Ử|Ữ)/", "U", $str);
|
||||
$str = preg_replace("/(Ỳ|Ý|Ỵ|Ỷ|Ỹ)/", "Y", $str);
|
||||
$str = preg_replace("/(Đ)/", "D", $str);
|
||||
//$str = str_replace(" ", "-", str_replace("&*#39;","",$str));
|
||||
return $str;
|
||||
}
|
||||
|
||||
public static function allLanguage() {
|
||||
return [
|
||||
["icon" => "vi.png", "name" => "vi-VI", "description" => "Tiếng Việt"],
|
||||
["icon" => "en.png", "name" => "en-EN", "description" => "English"],
|
||||
["icon" => "jp.png", "name" => "ja-JA", "description" => "Japanese"]
|
||||
];
|
||||
}
|
||||
|
||||
public static function rsaEncode($text) {
|
||||
$publicKey = "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDCXB8c44cboYsGG6IzISqxf8W7q3AN0mGmekDYpBWpz9udif+jwK6h7NuOZvFDeB/32TVrtvaGDmExCeBerpcoOvGh4eUXyke2lSLzrg7pc/wD0KproEGoAAFDB0Pr5bZhg6ELp3Sk++0MPyxH6u1pgtHDxEnMwXV8cxw/rSCM+wIDAQAB";
|
||||
$publicKey = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($publicKey, 64, "\n", true) . "\n-----END PUBLIC KEY-----";
|
||||
openssl_public_encrypt($text, $encrypted, $publicKey, OPENSSL_PKCS1_PADDING);
|
||||
return base64_encode($encrypted);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
copy.src.files=false
|
||||
copy.src.on.open=false
|
||||
copy.src.target=
|
||||
remote.connection=bf_local-799e1d
|
||||
remote.connection=BiFace-99bab6
|
||||
remote.directory=/BiFace_Server_Lite
|
||||
remote.upload=ON_SAVE
|
||||
run.as=REMOTE
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
|
||||
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
|
||||
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
|
||||
<group>
|
||||
<file>file:/E:/BiFace_Server_Lite/controllers/ConfigController.php</file>
|
||||
</group>
|
||||
<group/>
|
||||
</open-files>
|
||||
</project-private>
|
||||
|
|
0
runtime/temp.txt
Normal file → Executable file
0
runtime/temp.txt
Normal file → Executable file
|
@ -1,16 +1,17 @@
|
|||
<?php
|
||||
|
||||
use yii\widgets\Breadcrumbs;
|
||||
use dmstr\widgets\Alert;
|
||||
|
||||
?>
|
||||
<div class="content-wrapper">
|
||||
<!-- <section class="content-header">
|
||||
<?=
|
||||
Breadcrumbs::widget(
|
||||
<?=
|
||||
Breadcrumbs::widget(
|
||||
[
|
||||
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
|
||||
]
|
||||
) ?>
|
||||
)
|
||||
?>
|
||||
</section>-->
|
||||
|
||||
<section class="content" style="padding: 0 0 15px 0;">
|
||||
|
@ -21,8 +22,12 @@ use dmstr\widgets\Alert;
|
|||
</div>
|
||||
|
||||
<footer class="main-footer">
|
||||
<div class="pull-right hidden-xs" style="margin-top: 10px;">
|
||||
<!--<b>Hotline</b> <a href="tel:0912461556">091.246.1556</a>-->
|
||||
<div class="pull-right hidden-xs">
|
||||
<b><?php echo Yii::t("app", "PHIEN_BAN"); ?>: </b>
|
||||
<?php
|
||||
$version = \app\models\SyncUrl::findOne(['key_config' => 'version']);
|
||||
echo $version ? $version->data : Yii::$app->params["version"];
|
||||
?>
|
||||
</div>
|
||||
<!--<strong>Copyright © 2020 <a href="https://beetinnovators.com/"><img src="/images/BI_Logo.png" width="80px"></a> & <a href="https://tctech.vn/"><img src="/images/TCTech.jpg" width="80px"></a>.</strong> All rights reserved.-->
|
||||
<strong>Copyright © 2020 <a href="https://beetinnovators.com/">BEETINNOVATORS</a>.</strong> All rights reserved.
|
||||
|
|
|
@ -36,25 +36,70 @@ use yii\widgets\ActiveForm;
|
|||
<!-- Collect the nav links, forms, and other content for toggling -->
|
||||
<div class="collapse navbar-collapse pull-left" id="navbar-collapse">
|
||||
<ul class="nav navbar-nav">
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/config']); ?>">
|
||||
<i class="fa fa-cogs"></i> Cấu hình
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/dashboard']); ?>">
|
||||
<i class="fa fa-database"></i> Dữ liệu
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/config/reset']); ?>" onclick="common.reset(this);return false;">
|
||||
<i class="fa fa-refresh"></i> Reset thiết bị
|
||||
<li class="<?php if (Yii::$app->controller->id == "config" && Yii::$app->controller->action->id != "system-info") echo "active"; ?>">
|
||||
<a href="<?php echo yii\helpers\Url::to(['/config/cau-hinh-thiet-bi']); ?>">
|
||||
<i class="fa fa-cogs"></i> <?php echo Yii::t("app", "CAU_HINH"); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php if (Yii::$app->params['type'] === "BiFace") { ?>
|
||||
<?php if (Yii::$app->user->identity->username == "admin") { ?>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/config/reset']); ?>" onclick="common.resetForm(this);return false;">
|
||||
<i class="fa fa-refresh"></i> <?php echo Yii::t("app", "RESET_THIET_BI"); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
<li class="<?php if (Yii::$app->controller->id == "list-management") echo "active"; ?>">
|
||||
<a href="<?php echo yii\helpers\Url::to(['/list-management']); ?>">
|
||||
<i class="fa fa-list"></i> <?php echo Yii::t("app", "QUAN_LY_MAU"); ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="dropdown <?php if (in_array(Yii::$app->controller->id, ['capture-logs', 'control-logs'])) echo "active"; ?>">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<i class="fa fa-list-alt"></i> <?php echo Yii::t("app", "LICH_SU_HE_THONG"); ?>
|
||||
</a>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<li><a href="<?php echo \yii\helpers\Url::to(['/capture-logs']); ?>"><i class="fa fa-camera"></i> <?php echo Yii::t("app", "LICH_SU_HE_THONG"); ?></a></li>
|
||||
<li><a href="<?php echo \yii\helpers\Url::to(['/control-logs']); ?>"><i class="fa fa-database"></i> <?php echo Yii::t("app", "DANH_SACH_NHAN_DIEN"); ?></a></li>
|
||||
<li><a href="<?php echo \yii\helpers\Url::to(['/capture-logs/face-comparison']); ?>"><i class="fa fa-users"></i> <?php echo Yii::t("app", "SO_SANH_MAT"); ?></a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="<?php if (Yii::$app->controller->id == "config" && Yii::$app->controller->action->id == "system-info") echo "active"; ?>">
|
||||
<a href="<?php echo yii\helpers\Url::to(['/config/system-info']); ?>">
|
||||
<i class="fa fa-info-circle"></i> <?php echo Yii::t("app", "THONG_TIN_HE_THONG"); ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="navbar-custom-menu">
|
||||
<?php
|
||||
$languages = app\models\common::allLanguage();
|
||||
$currentLanguage = ["icon" => "vi.png", "name" => "vi-VI", "description" => "Tiếng Việt"];
|
||||
if (Yii::$app->session->get("language"))
|
||||
$currentLanguage = Yii::$app->session->get("language");
|
||||
else
|
||||
Yii::$app->session->set("language", $currentLanguage);
|
||||
?>
|
||||
<ul class="nav navbar-nav">
|
||||
<li class="dropdown notifications-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<img src="/images/lang/<?php echo $currentLanguage["icon"]; ?>" width="20px">
|
||||
</a>
|
||||
<ul class="dropdown-menu" style="width: 150px;">
|
||||
<li>
|
||||
<ul class="menu">
|
||||
<?php foreach ($languages as $key => $value) { ?>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/dashboard/change-language', 'lang' => $value['name']]); ?>" onclick="common.changeLanguage(this);return false;">
|
||||
<img src="/images/lang/<?php echo $value['icon']; ?>" width="20px"> <?php echo $value['description']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="dropdown user user-menu">
|
||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">
|
||||
<img src="<?php
|
||||
|
@ -89,17 +134,17 @@ use yii\widgets\ActiveForm;
|
|||
</div>
|
||||
<div class="pull-left info">
|
||||
<p style="color: #fff;" class="user-profiles-name"><?= Yii::$app->user->isGuest ? "" : \Yii::$app->user->identity->first_name; ?></p>
|
||||
<a href="#" style="color: #fff;"><i class="fa fa-circle text-success"></i> <?php echo Yii::t("app", "Online"); ?></a>
|
||||
<a href="#" style="color: #fff;"><i class="fa fa-circle text-success"></i> <?php echo Yii::t("app", "ONLINE"); ?></a>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<li class="user-body" style="border:none">
|
||||
<ul style="list-style: none; padding: 0">
|
||||
<li><a class="text-bold" onclick="user.formInfo(this);return false;" href="<?php echo yii\helpers\Url::to(['/user/profiles']); ?>"><i class="fa fa-user"></i> <?php echo Yii::t("app", "Thông tin cá nhân"); ?></a></li>
|
||||
<li><a class="text-bold" onclick="user.formChangePassword(this);return false;" href="<?php echo yii\helpers\Url::to(['/user/change-password']); ?>"><i class="fa fa-lock"></i> <?php echo Yii::t("app", "Đổi mật khẩu"); ?></a></li>
|
||||
<li><a class="text-bold" href="<?php echo yii\helpers\Url::to(['/user/profiles']); ?>"><i class="fa fa-user"></i> <?php echo Yii::t("app", "THONG_TIN_CA_NHAN"); ?></a></li>
|
||||
<li><a class="text-bold" href="<?php echo yii\helpers\Url::to(['/user/change-password']); ?>"><i class="fa fa-lock"></i> <?php echo Yii::t("app", "DOI_MAT_KHAU"); ?></a></li>
|
||||
<li class="separator"><hr style="margin:0;padding:0"></li>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(["/site/logout"]); ?>" onclick="$(this).parent().find('form').submit();return false;"><i class="fa fa-sign-out"></i> <?php echo Yii::t("app", "Đăng xuất"); ?></a>
|
||||
<a href="<?php echo yii\helpers\Url::to(["/site/logout"]); ?>" onclick="$(this).parent().find('form').submit();return false;"><i class="fa fa-sign-out"></i> <?php echo Yii::t("app", "DANG_XUAT"); ?></a>
|
||||
<?php
|
||||
ActiveForm::begin([
|
||||
'action' => yii\helpers\Url::to(["/site/logout"]),
|
||||
|
@ -108,7 +153,7 @@ use yii\widgets\ActiveForm;
|
|||
]);
|
||||
?>
|
||||
<div class="pull-right">
|
||||
<button name="action" value="logout" class="btn btn-default btn-flat"><?php echo Yii::t("app", "Đăng xuất"); ?></button>
|
||||
<button name="action" value="logout" class="btn btn-default btn-flat"><?php echo Yii::t("app", "DANG_XUAT"); ?></button>
|
||||
</div>
|
||||
<?php ActiveForm::end(); ?>
|
||||
</li>
|
||||
|
|
|
@ -7,7 +7,7 @@ use yii\bootstrap\ActiveForm;
|
|||
/* @var $form yii\bootstrap\ActiveForm */
|
||||
/* @var $model \common\models\LoginForm */
|
||||
|
||||
$this->title = 'Sign In';
|
||||
$this->title = Yii::t("app", "DANG_NHAP");
|
||||
|
||||
$fieldOptions1 = [
|
||||
'options' => ['class' => 'form-group has-feedback'],
|
||||
|
@ -30,7 +30,7 @@ $fieldOptions2 = [
|
|||
</div>
|
||||
<!-- /.login-logo -->
|
||||
<div class="login-box-body">
|
||||
<p class="login-box-msg"><b>ĐĂNG NHẬP</b></p>
|
||||
<p class="login-box-msg text-uppercase"><b><?php echo Yii::t("app", "DANG_NHAP"); ?></b></p>
|
||||
|
||||
<?php $form = ActiveForm::begin(['id' => 'login-form', 'enableClientValidation' => false]); ?>
|
||||
|
||||
|
@ -38,32 +38,50 @@ $fieldOptions2 = [
|
|||
$form
|
||||
->field($model, 'username', $fieldOptions1)
|
||||
->label(false)
|
||||
->textInput(['placeholder' => $model->getAttributeLabel('username')])
|
||||
->textInput(['placeholder' => Yii::t("app", "TEN_DANG_NHAP")])
|
||||
?>
|
||||
|
||||
<?=
|
||||
$form
|
||||
->field($model, 'password', $fieldOptions2)
|
||||
->label(false)
|
||||
->passwordInput(['placeholder' => $model->getAttributeLabel('password')])
|
||||
->passwordInput(['placeholder' => Yii::t("app", "MAT_KHAU")])
|
||||
?>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-xs-7">
|
||||
<?= $form->field($model, 'rememberMe')->checkbox() ?>
|
||||
<input type="hidden" value="<?php echo Yii::$app->request->get("lang"); ?>" name="lang">
|
||||
<?php
|
||||
$languages = app\models\common::allLanguage();
|
||||
$currentLanguage = ["icon" => "vi.png", "name" => "vi-VI", "description" => "Tiếng Việt"];
|
||||
foreach ($languages as $key => $value) {
|
||||
if ($value['name'] === Yii::$app->request->get('lang'))
|
||||
$currentLanguage = $value;
|
||||
}
|
||||
?>
|
||||
<div class="btn-group" id="card-picker">
|
||||
<button type="button" class="btn btn-default dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
|
||||
<img src="/images/lang/<?php echo $currentLanguage["icon"]; ?>" width="20px">
|
||||
<span class="caret"></span>
|
||||
</button>
|
||||
<ul class="dropdown-menu" role="menu">
|
||||
<?php foreach ($languages as $key => $value) { ?>
|
||||
<li>
|
||||
<a href="<?php echo yii\helpers\Url::to(['/dashboard/change-language-login', 'lang' => $value['name']]); ?>">
|
||||
<img src="/images/lang/<?php echo $value['icon']; ?>" width="20px"> <?php echo $value['description']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<?php } ?>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-xs-5">
|
||||
<?= Html::submitButton('Đăng nhập', ['class' => 'btn btn-primary btn-block', 'name' => 'login-button']) ?>
|
||||
<?= Html::submitButton(Yii::t("app", "DANG_NHAP"), ['class' => 'btn btn-primary btn-block', 'name' => 'login-button']) ?>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
|
||||
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
<a href="#">I forgot my password</a><br>
|
||||
<?php ActiveForm::end(); ?>
|
||||
|
||||
</div>
|
||||
<!-- /.login-box-body -->
|
||||
</div><!-- /.login-box -->
|
||||
</div>
|
||||
|
|
27
views/capture-logs/face-comparison.tpl
Normal file
27
views/capture-logs/face-comparison.tpl
Normal file
|
@ -0,0 +1,27 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="app\assets\FaceComparisonAsset"}
|
||||
{FaceComparisonAsset::register($this)|void}
|
||||
{block name='content'}<br>
|
||||
<input type="hidden" name="url_upload_face" value="{Url::to(['/capture-logs/upload-face'])}">
|
||||
<input type="hidden" name="url_face_comparison" value="{Url::to(['/capture-logs/face-comparison'])}">
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-md-push-2 text-center">
|
||||
<img src="/images/user2-160x160.jpg" class="img-thumbnail" id="face1" style="width: 70%;cursor: pointer;" onclick="$('#image1').trigger('click');">
|
||||
<div class="hidden">
|
||||
<input type="file" name="image1" id="image1">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2 col-md-push-2 text-center">
|
||||
<div style="padding-top: 100px;">
|
||||
<b class="text-red" style="font-size: 40px;" id="percent">0.00%</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3 col-md-push-2 text-center">
|
||||
<img src="/images/user2-160x160.jpg" class="img-thumbnail" id="face2" style="width: 70%;cursor: pointer;" onclick="$('#image2').trigger('click');">
|
||||
<div class="hidden">
|
||||
<input type="file" name="image2" id="image2">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
172
views/capture-logs/index.tpl
Normal file
172
views/capture-logs/index.tpl
Normal file
|
@ -0,0 +1,172 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\CaptureLogsAsset"}
|
||||
{CaptureLogsAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.row{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
input{
|
||||
width: 100%;
|
||||
}
|
||||
.table-striped > tbody > tr:nth-of-type(odd){
|
||||
background-color: rgb(210, 210, 210);
|
||||
}
|
||||
.select2-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.select2-container--default .select2-selection--single, .select2-selection .select2-selection--single{
|
||||
border-color: green;
|
||||
}
|
||||
</style>
|
||||
<input type="hidden" value="{Url::to(['/capture-logs'])}" name="URL">
|
||||
<div class="row">
|
||||
<div class="col-md-10" style="max-height: 850px;overflow-y: auto;">
|
||||
{GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'layout'=> \app\helpers\CaptureLogsGrid::getLayout(),
|
||||
'tableOptions' => [
|
||||
'class' => 'table table-striped table-bordered',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rows(),
|
||||
'columns' => [
|
||||
[
|
||||
'class' => 'yii\grid\SerialColumn',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'attribute' => 'time',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::time()
|
||||
],
|
||||
[
|
||||
'attribute' => 'image',
|
||||
'format' => "raw",
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::image()
|
||||
],
|
||||
[
|
||||
'attribute' => 'confidence',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'format' => "raw",
|
||||
'value' => \app\helpers\CaptureLogsGrid::confidence()
|
||||
],
|
||||
[
|
||||
'attribute' => 'sync_status',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
]
|
||||
]
|
||||
])}
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-right: 30px;">
|
||||
<h4>{Yii::t("app", "TIM_KIEM_DU_LIEU")}</h4>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "FROM")}</label>
|
||||
<input type="text" class="form-control datepicker" value="{$f|date_format:"H:i d/m/Y"}" name="From">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "TO")}</label>
|
||||
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-info" onclick="_search(this);" data-href="{Url::to(['/capture-logs'])}">
|
||||
<i class="fa fa-search"></i> {Yii::t("app", "TIM_KIEM")}
|
||||
</button>
|
||||
</div>
|
||||
<hr style="border-top: 1px solid #000;">
|
||||
<div>
|
||||
<input type="checkbox" name="AllData" style="width: inherit;" {if Yii::$app->request->get("all")}checked=""{/if}> {Yii::t("app", "HIEN_THI_TOAN_BO_DU_LIEU")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 500px;position: absolute;right:0;top: 250px;" id='form' class="hidden">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading text-bold">
|
||||
{Yii::t("app", "QUAN_LY_MAU")}
|
||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_close();"></i>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<img src="" class="img-thumbnail" id="FaceImage" style="width: 150px;height: 150px;">
|
||||
<div class='feature-img'>
|
||||
<img src="/images/user2-160x160.jpg" class="img-thumbnail" id="closest-img" style="width: 100px;height:100px;">
|
||||
<br>
|
||||
<i id="closest-name"></i>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DANH_SACH")}</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Type">
|
||||
{html_options options=$typeArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "ID")}</div>
|
||||
<div class="col-md-8">
|
||||
<select name='Code' id='Code' onchange="chooseStaff(this);" data-href="{Url::to("/list-management/choose-staff")}">
|
||||
<option value=""></option>
|
||||
{html_options options=$staffArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "TEN")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "TEN_HIEN_THI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="AbbreviatedName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "GIOI_TINH")}</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Gender">
|
||||
{html_options options=$genderArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "NGAY_SINH")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Birthday" id="birthday">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DIEN_THOAI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Telephone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DON_VI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Address">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<input type="hidden" value="" name="CaptureLogsID">
|
||||
<button onclick="_save(this);" data-href='{Url::to(["/list-management/create"])}'>{Yii::t("app", "LUU")}</button>
|
||||
<button onclick="_close();">{Yii::t("app", "HUY")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
|
@ -142,25 +142,8 @@
|
|||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mt-element-step">
|
||||
<div class="row step-thin">
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">1</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config'])}';">
|
||||
Cấu hình máy chủ
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Server config</div>
|
||||
</div>
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">2</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
|
||||
Cấu hình nhận diện
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Engine config</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
{$menu}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -168,7 +151,7 @@
|
|||
<div class="col-md-6 col-md-push-1">
|
||||
{$config_json}
|
||||
<button style="position: fixed;left: 0;top: 170px;" class="btn btn-primary" onclick="saveStep2(this);" data-href="{Url::to(['/config/cau-hinh-nhan-dien'])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu lại
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app", "LUU_LAI")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
47
views/config/device.tpl
Normal file
47
views/config/device.tpl
Normal file
|
@ -0,0 +1,47 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 100px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{$menu}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "SERVER_API")}</div>
|
||||
<input type="input" class="form-control" name="server_api" value="{$server_api->data|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "DEVICE_ID")}</div>
|
||||
<input type="input" class="form-control" name="device_id" value="{$device_id->data|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="SaveConfigDevice(this);" data-href="{Url::to(['save-config'])}">
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app", "LUU_LAI")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
114
views/config/dieu-khien-thiet-bi.tpl
Normal file
114
views/config/dieu-khien-thiet-bi.tpl
Normal file
|
@ -0,0 +1,114 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
.table-striped > tbody > tr:nth-of-type(odd) {
|
||||
background-color: #d1d1d1;
|
||||
}
|
||||
.form-group{
|
||||
margin: 0;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{$menu}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-4 col-md-push-1">
|
||||
<table class="table table-bordered table-striped" style="background: #fff;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="width: 50%;">{Yii::t("app","DIEU_KHIEN_CHUONG_TRINH_NHAN_DIEN")}</th>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button class="btn-control-engine btn btn-{if $engineStatus.status}success{else}default{/if}" onclick="controlEngine(this);" data-href="{Url::to(['control-engine', 'status'=>"on"])}">
|
||||
{Yii::t("app","ON")}
|
||||
</button>
|
||||
<button class="btn-control-engine btn btn-{if $engineStatus.status}default{else}danger{/if}" onclick="controlEngine(this);" data-href="{Url::to(['control-engine', 'status'=>"off"])}">
|
||||
{Yii::t("app","OFF")}
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{Yii::t("app","THOI_GIAN_HOAT_DONG_CUA_THIET_BI")}</th>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app","FROM")}</div>
|
||||
<input type="text" class="form-control" name="EngineBegin" id="EngineBegin" value="{$config_engine.start_at|default:""}">
|
||||
<div class="input-group-addon">{Yii::t("app","TO")}</div>
|
||||
<input type="text" class="form-control" name="EngineEnd" id="EngineEnd" value="{$config_engine.end_at|default:""}">
|
||||
<div class="input-group-btn">
|
||||
<button id='btn-save-light' class="btn btn-primary" onclick="saveTimeEngineConfig(this);" data-href="{Url::to(['save-time-engine-config'])}">
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{Yii::t("app","THOI_GIAN_BAT_DEN")}</th>
|
||||
<td>
|
||||
<div class="btn-group">
|
||||
<button class="btn-control-light btn btn-{if $config_light.enable==="1"}success{else}default{/if}" onclick="controlSetupLight(this, true);">
|
||||
{Yii::t("app","ON")}
|
||||
</button>
|
||||
<button class="btn-control-light btn btn-{if $config_light.enable==="1"}default{else}danger{/if}" onclick="controlSetupLight(this, false);">
|
||||
{Yii::t("app","OFF")}
|
||||
</button>
|
||||
</div>
|
||||
<div id="time-light-config" class="form-group {if $config_light.enable==="0"}hidden{/if}">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app","FROM")}</div>
|
||||
<input type="text" class="form-control" name="LightBegin" id="LightBegin" value="{$config_light.start_at|default:""}">
|
||||
<div class="input-group-addon">{Yii::t("app","TO")}</div>
|
||||
<input type="text" class="form-control" name="LightEnd" id="LightEnd" value="{$config_light.end_at|default:""}">
|
||||
<div class="input-group-btn">
|
||||
<button id='btn-save-light' class="btn btn-primary" onclick="saveTimeLightConfig(this);" data-href="{Url::to(['save-time-light-config'])}" data-enable='{$config_light.enable}'>
|
||||
<i class="fa fa-floppy-o"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{Yii::t("app","BACKGROUND")}</th>
|
||||
<td>
|
||||
<input type="file" name="image" id="image">
|
||||
<input type="hidden" name="url_upload_background" value="{Url::to(['background'])}">
|
||||
<div>
|
||||
{if $background!=""}
|
||||
<img src="/data{$background}" width="100%" class="img-thumbnail">
|
||||
{/if}
|
||||
<i class="text-red"><span class="fa fa-info-circle"></span> {Yii::t("app","BACKGROUND_DESCRIPTION")}</i>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{Yii::t("app","AM_THANH")}</th>
|
||||
<td>
|
||||
<input type="file" name="sound" id="sound">
|
||||
<input type="hidden" name="url_upload_sound" value="{Url::to(['sound'])}">
|
||||
<div>
|
||||
<a href="/data/audio/welcome_en.wav">welcome_en.wav</a>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
|
@ -16,25 +16,8 @@
|
|||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="mt-element-step">
|
||||
<div class="row step-thin">
|
||||
<div class="col-md-6 bg-grey mt-step-col active">
|
||||
<div class="mt-step-number bg-white font-grey">1</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config'])}';">
|
||||
Cấu hình máy chủ
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Server config</div>
|
||||
</div>
|
||||
<div class="col-md-6 bg-grey mt-step-col">
|
||||
<div class="mt-step-number bg-white font-grey">2</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
|
||||
Cấu hình nhận diện
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">Engine config</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
{$menu}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
|
@ -42,19 +25,19 @@
|
|||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">server_mqtt</div>
|
||||
<div class="input-group-addon">{Yii::t("app", "SERVER_MQTT")}</div>
|
||||
<input type="input" class="form-control" name="servermqtt" value="{$servermqtt}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">url</div>
|
||||
<div class="input-group-addon">{Yii::t("app", "URL")}</div>
|
||||
<input type="input" class="form-control" name="url" value="{$url}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="saveStep1(this);" data-href="{Url::to(['/config/cau-hinh-may-chu'])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu lại
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app", "LUU_LAI")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
68
views/config/ip.tpl
Normal file
68
views/config/ip.tpl
Normal file
|
@ -0,0 +1,68 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 120px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{$menu}
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group" id="dhcp">
|
||||
<input type='checkbox' name='dhcp' id='dhcp_check' value="" {if $network.dhcp=="yes"}checked=""{/if}> DHCP
|
||||
</div>
|
||||
<div class="form-group" id="device_ip">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "IP Address")}</div>
|
||||
<input type="input" class="form-control" name="device_ip" value="{$network.ip_address|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="subnet_mask">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "Subnet Mask")}</div>
|
||||
<input type="input" class="form-control" name="subnet_mask" value="{$network.subnet_mask|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="gateway">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "Gateway")}</div>
|
||||
<input type="input" class="form-control" name="gateway" value="{$network.gateway|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="dns1">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "DNS1")}</div>
|
||||
<input type="input" class="form-control" name="dns1" value="{$network.dns1|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group" id="dns2">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app", "DNS2")}</div>
|
||||
<input type="input" class="form-control" name="dns2" value="{$network.dns2|default:""}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="changeIP(this);" data-href="{Url::to(['/config/cau-hinh-ip'])}">
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app", "LUU_LAI")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
45
views/config/menu.tpl
Normal file
45
views/config/menu.tpl
Normal file
|
@ -0,0 +1,45 @@
|
|||
{use class="yii\helpers\Url"}
|
||||
{if Yii::$app->params["type"]==="BiFace"}
|
||||
{$username=Yii::$app->user->identity->username}
|
||||
<div class="mt-element-step">
|
||||
<div class="row step-thin">
|
||||
{if $username=='admin'}
|
||||
<div class="col-md-2 bg-grey mt-step-col {if $tab=="device_config"}active{/if}">
|
||||
<div class="mt-step-number bg-white font-grey">1</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-thiet-bi'])}';">
|
||||
{Yii::t("app", "CAU_HINH_THIET_BI")}
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">{Yii::t("app", "DEVICE_CONFIG")}</div>
|
||||
</div>
|
||||
<div class="col-md-2 bg-grey mt-step-col {if $tab=="server_config"}active{/if}">
|
||||
<div class="mt-step-number bg-white font-grey">2</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config'])}';">
|
||||
{Yii::t("app", "CAU_HINH_MAY_CHU")}
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">{Yii::t("app", "SERVER_CONFIG")}</div>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="col-md-2 bg-grey mt-step-col {if $tab=="engine_config"}active{/if}">
|
||||
<div class="mt-step-number bg-white font-grey">{if $username=='admin'}3{else}1{/if}</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-nhan-dien'])}';">
|
||||
{Yii::t("app", "CAU_HINH_NHAN_DIEN")}
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">{Yii::t("app", "ENGINE_CONFIG")}</div>
|
||||
</div>
|
||||
<div class="col-md-2 bg-grey mt-step-col {if $tab=="ip_config"}active{/if}">
|
||||
<div class="mt-step-number bg-white font-grey">{if $username=='admin'}4{else}2{/if}</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/cau-hinh-ip'])}';">
|
||||
{Yii::t("app", "CAU_HINH_IP")}
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">{Yii::t("app", "IP_CONFIG")}</div>
|
||||
</div>
|
||||
<div class="col-md-2 bg-grey mt-step-col {if $tab=="device_controller"}active{/if}">
|
||||
<div class="mt-step-number bg-white font-grey">{if $username=='admin'}5{else}3{/if}</div>
|
||||
<div class="mt-step-title uppercase font-grey-cascade" style="cursor: pointer;" onclick="window.location = '{Url::to(['/config/dieu-khien-thiet-bi'])}';">
|
||||
{Yii::t("app", "DIEU_KHIEN_THIET_BI")}
|
||||
</div>
|
||||
<div class="mt-step-content font-grey-cascade">{Yii::t("app", "DEVICE_CONTROLLER")}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
14
views/config/reset.tpl
Normal file
14
views/config/reset.tpl
Normal file
|
@ -0,0 +1,14 @@
|
|||
<div class="alert alert-danger hidden" id="reset-error">
|
||||
<i class="fa fa-info-circle"></i> {Yii::t("app", "RESET_THIET_BI_LOI")}
|
||||
</div>
|
||||
<div class="text-left">
|
||||
<input type="checkbox" name="DeleteDatabase" style="width: inherit;"> {Yii::t("app", "XOA_DU_LIEU_LUU_TRU_TRONG_THIET_BI")}
|
||||
<br>
|
||||
<input type="checkbox" name="ResetDevice" style="width: inherit;"> {Yii::t("app", "RESET_CAU_HINH_THIET_BI")}
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-danger" onclick="common.reset(this);" data-href="{yii\helpers\Url::to(['/config/reset'])}" id="reset-accept">
|
||||
{Yii::t("app", "DONG_Y")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal" id="reset-close">{Yii::t("app", "HUY_BO")}</button>
|
||||
</div>
|
57
views/config/system-info.tpl
Normal file
57
views/config/system-info.tpl
Normal file
|
@ -0,0 +1,57 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="app\assets\ConfigAsset"}
|
||||
{ConfigAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.input-group-addon{
|
||||
width: 120px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.input-group{
|
||||
width: 100%;
|
||||
}
|
||||
.table-striped > tbody > tr:nth-of-type(odd) {
|
||||
background-color: #d1d1d1;
|
||||
}
|
||||
</style>
|
||||
<div class="container-fluid">
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-3 col-md-push-1">
|
||||
<table class="table table-bordered table-striped" style="background: #fff;">
|
||||
<thead>
|
||||
<tr style="background-color: #3c8dbc;color:#fff;">
|
||||
<th colspan="2">{Yii::t("app", "THONG_TIN_HE_THONG")|upper}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>CPU</th>
|
||||
<td>ARM Mali-450 penta-core</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>MemTotal</th>
|
||||
<td>2.0 GiB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>DiskTotal</th>
|
||||
<td>16.0 GiB</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Software version number</th>
|
||||
<td>{$version}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Build time</th>
|
||||
<td>{$build_time}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<button class="btn btn-danger" onclick="reboot(this);" data-href="{Url::to(['system-info'])}">
|
||||
<i class="fa fa-refresh"></i> {Yii::t("app","REBOOT")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
120
views/control-logs/index.tpl
Normal file
120
views/control-logs/index.tpl
Normal file
|
@ -0,0 +1,120 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ControlLogsAsset"}
|
||||
{ControlLogsAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.row{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
input{
|
||||
width: 100%;
|
||||
}
|
||||
.table-striped > tbody > tr:nth-of-type(odd){
|
||||
background-color: rgb(210, 210, 210);
|
||||
}
|
||||
.feature-img{
|
||||
display:inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.feature-img:hover .btn{
|
||||
visibility: visible !important;
|
||||
}
|
||||
</style>
|
||||
<div class="row">
|
||||
<div class="col-md-10" style="max-height: 850px;overflow-y: auto;">
|
||||
{GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'layout'=> \app\helpers\CaptureLogsGrid::getLayout(),
|
||||
'tableOptions' => [
|
||||
'class' => 'table table-striped table-bordered',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\CaptureLogsGrid::rowsControlLogs(),
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'id',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'attribute' => 'time',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::time()
|
||||
],
|
||||
[
|
||||
'attribute' => 'staff_image',
|
||||
'format' => 'raw',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:15%'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::registrationImage()
|
||||
],
|
||||
[
|
||||
'attribute' => 'image',
|
||||
'format' => "raw",
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center', 'style' => 'width:15%'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::image(true)
|
||||
],
|
||||
[
|
||||
'attribute' => 'confidence',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::confidenceControlLogs()
|
||||
],
|
||||
'listManagement.name',
|
||||
'listManagement.gender',
|
||||
'listManagement.telephone',
|
||||
[
|
||||
'attribute' => 'listManagement.birthday',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\CaptureLogsGrid::birthday()
|
||||
],
|
||||
'listManagement.address',
|
||||
'sync_status'
|
||||
]
|
||||
])}
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-right: 30px;">
|
||||
<h4>{Yii::t("app", "TIM_KIEM_DU_LIEU")}</h4>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "FROM")}</label>
|
||||
<input type="text" class="form-control datepicker" value="{$f|date_format:"H:i d/m/Y"}" name="From">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "TO")}</label>
|
||||
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "ID")}</label>
|
||||
<input type="text" class="form-control" value="{Yii::$app->request->get("id")}" name="IDSearch">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "TEN")}</label>
|
||||
<input type="text" class="form-control" value="{Yii::$app->request->get("name")}" name="NameSearch">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "LOAI")}</label>
|
||||
<select class="form-control" name="TypeSearch">
|
||||
<option value="all">{Yii::t("app", "TAT_CA")}</option>
|
||||
{html_options options=$typeArray selected=Yii::$app->request->get("type")}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "GIOI_TINH")}</label>
|
||||
<select class="form-control" name="GenderSearch">
|
||||
<option value="all">{Yii::t("app", "TAT_CA")}</option>
|
||||
{html_options options=$genderArray selected=Yii::$app->request->get("gender")}
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-info" onclick="_search(this);" data-href="{Url::to(['/control-logs'])}">
|
||||
<i class="fa fa-search"></i> {Yii::t("app", "TIM_KIEM")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
|
@ -8,7 +8,7 @@
|
|||
<div style="margin-top: 20px;">
|
||||
<div>
|
||||
<a class="btn btn-success" href='{Url::to(['/dashboard/export'])}'>
|
||||
<i class="fa fa-download"></i> Xuất dữ liệu
|
||||
<i class="fa fa-download"></i> {Yii::t("app", "Xuất dữ liệu")}
|
||||
</a>
|
||||
</div>
|
||||
<br>
|
||||
|
|
|
@ -2,6 +2,42 @@
|
|||
{block name="content"}
|
||||
{/block}
|
||||
</div>
|
||||
|
||||
<input type="hidden" name="HAY_NHAP_THONG_TIN" value="{Yii::t("app", "HAY_NHAP_THONG_TIN")}">
|
||||
<input type="hidden" name="BOX_CHUA_DUOC_DANG_KI_TREN_CMS" value="{Yii::t("app", "BOX_CHUA_DUOC_DANG_KI_TREN_CMS")}">
|
||||
<input type="hidden" name="DA_LUU_CAU_HINH" value="{Yii::t("app", "DA_LUU_CAU_HINH")}">
|
||||
<input type="hidden" name="LUU_CAU_HINH_THAT_BAI" value="{Yii::t("app", "LUU_CAU_HINH_THAT_BAI")}">
|
||||
<input type="hidden" name="HAY_LUA_CHON_THAO_TAC" value="{Yii::t("app", "HAY_LUA_CHON_THAO_TAC")}">
|
||||
<input type="hidden" name="DELETE_DB_CONFIRM" value="{Yii::t("app", "DELETE_DB_CONFIRM")}">
|
||||
<input type="hidden" name="RESET_DB_CONFIRM" value="{Yii::t("app", "RESET_DB_CONFIRM")}">
|
||||
<input type="hidden" name="HAY_CHON_DOI_TUONG" value="{Yii::t("app", "HAY_CHON_DOI_TUONG")}">
|
||||
<input type="hidden" name="HAY_NHAP_TEN" value="{Yii::t("app", "HAY_NHAP_TEN")}">
|
||||
<input type="hidden" name="HAY_NHAP_TEN_HIEN_THI" value="{Yii::t("app", "HAY_NHAP_TEN_HIEN_THI")}">
|
||||
<input type="hidden" name="CAP_NHAT_DU_LIEU_THANH_CONG" value="{Yii::t("app", "CAP_NHAT_DU_LIEU_THANH_CONG")}">
|
||||
<input type="hidden" name="MA_DOI_TUONG_DA_TON_TAI" value="{Yii::t("app", "MA_DOI_TUONG_DA_TON_TAI")}">
|
||||
<input type="hidden" name="DELETE_CONFIRM" value="{Yii::t("app", "DELETE_CONFIRM")}">
|
||||
<input type="hidden" name="HAY_CHON_DU_LIEU_DE_XOA" value="{Yii::t("app", "HAY_CHON_DU_LIEU_DE_XOA")}">
|
||||
<input type="hidden" name="DA_XOA_DU_LIEU" value="{Yii::t("app", "DA_XOA_DU_LIEU")}">
|
||||
<input type="hidden" name="CHON_HINH_ANH" value="{Yii::t("app", "CHON_HINH_ANH")}">
|
||||
<input type="hidden" name="HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT" value="{Yii::t("app", "HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT")}">
|
||||
<input type="hidden" name="HAY_TAI_LEN_HINH_ANH" value="{Yii::t("app", "HAY_TAI_LEN_HINH_ANH")}">
|
||||
<input type="hidden" name="HAY_NHAP_DIA_CHI_IP_DONG_BO" value="{Yii::t("app", "HAY_NHAP_DIA_CHI_IP_DONG_BO")}">
|
||||
<input type="hidden" name="SAI_DINH_DANG_IP" value="{Yii::t("app", "SAI_DINH_DANG_IP")}">
|
||||
<input type="hidden" name="TIM_KIEM_THEO_ID_HOAC_TEN" value="{Yii::t("app", "TIM_KIEM_THEO_ID_HOAC_TEN")}">
|
||||
<input type="hidden" name="KHONG_CO_KET_NOI_TOI_THIET_BI" value="{Yii::t("app", "KHONG_CO_KET_NOI_TOI_THIET_BI")}">
|
||||
<input type="hidden" name="KHONG_CO_DU_LIEU_DONG_BO" value="{Yii::t("app", "KHONG_CO_DU_LIEU_DONG_BO")}">
|
||||
<input type="hidden" name="DONG_BO_DU_LIEU_HOAN_THANH" value="{Yii::t("app", "DONG_BO_DU_LIEU_HOAN_THANH")}">
|
||||
<input type="hidden" name="DA_THEM_HINH_ANH_MAU" value="{Yii::t("app", "DA_THEM_HINH_ANH_MAU")}">
|
||||
<input type="hidden" name="CO_LOI_XAY_RA_HAY_THU_LAI" value="{Yii::t("app", "CO_LOI_XAY_RA_HAY_THU_LAI")}">
|
||||
<input type="hidden" name="ENGINE_KHONG_HOAT_DONG" value="{Yii::t("app", "ENGINE_KHONG_HOAT_DONG")}">
|
||||
<input type="hidden" name="HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH" value="{Yii::t("app", "HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH")}">
|
||||
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG")}">
|
||||
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG")}">
|
||||
<input type="hidden" name="BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG" value="{Yii::t("app", "BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG")}">
|
||||
<input type="hidden" name="THOI_GIAN_KHONG_DUOC_DE_TRONG" value="{Yii::t("app", "THOI_GIAN_KHONG_DUOC_DE_TRONG")}">
|
||||
<input type="hidden" name="THONG_TIN_DA_DUOC_LUU_LAI" value="{Yii::t("app", "THONG_TIN_DA_DUOC_LUU_LAI")}">
|
||||
<input type="hidden" name="CHON_AM_THANH" value="{Yii::t("app", "CHON_AM_THANH")}">
|
||||
|
||||
<div id="blocking" class="fade modal" role="dialog" tabindex="-1">
|
||||
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
|
||||
<div class="modal-content" style="background-color: transparent;box-shadow: none;">
|
||||
|
@ -9,7 +45,20 @@
|
|||
<div id='modelContent' class="text-center">
|
||||
<i class="fa fa-spinner fa-pulse fa-5x fa-fw" style="color: #fff;"></i>
|
||||
<br>
|
||||
<b style="color: #fff;font-size: 25px;">Đang xử lý ...</b>
|
||||
<b style="color: #fff;font-size: 25px;">{Yii::t("app", "DANG_XU_LY")}</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="reboot-blocking" class="fade modal" role="dialog" tabindex="-1">
|
||||
<div class="modal-dialog" style="top: 50%;margin-top: -45px;">
|
||||
<div class="modal-content" style="background-color: transparent;box-shadow: none;">
|
||||
<div class="modal-body">
|
||||
<div id='modelContent' class="text-center">
|
||||
<i class="fa fa-spinner fa-pulse fa-5x fa-fw" style="color: #fff;"></i>
|
||||
<br>
|
||||
<b style="color: #fff;font-size: 25px;">Đang khởi động lại thiết bị, vui lòng chờ trong vài phút và tải lại trang!</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -39,7 +88,7 @@
|
|||
...
|
||||
</div>
|
||||
<div class="modal-footer" id='myModalFooter'>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> Đóng lại</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_LAI")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -67,14 +116,14 @@
|
|||
<div class="modal-content">
|
||||
<div class="modal-header" id="alertModalHeader" style="background-color: #ffcc66;color: green;">
|
||||
<h4 class="modal-title" id="alertModalLabel" style="color: #fff;">
|
||||
<span class="fa fa-info-circle"></span> <b>Thông báo</b>
|
||||
<span class="fa fa-info-circle"></span> <b>{Yii::t("app", "THONG_BAO")}</b>
|
||||
</h4>
|
||||
</div>
|
||||
<div class="modal-body c-red" id="alertModalContent" style="font-weight: bold;">
|
||||
...
|
||||
</div>
|
||||
<div class="modal-footer" id="alertModalFooter">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> Đồng ý</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_Y")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
327
views/list-management/index.tpl
Normal file
327
views/list-management/index.tpl
Normal file
|
@ -0,0 +1,327 @@
|
|||
{extends file=$smarty.current_dir|cat:'/../extends.tpl'}
|
||||
{use class="yii\helpers\Url"}
|
||||
{use class="yii\grid\GridView"}
|
||||
{use class="app\assets\ListManagementAsset"}
|
||||
{ListManagementAsset::register($this)|void}
|
||||
{block name='content'}
|
||||
<style>
|
||||
.row{
|
||||
margin-bottom: 5px;
|
||||
}
|
||||
{*input{
|
||||
width: 100%;
|
||||
}*}
|
||||
.table-striped > tbody > tr:nth-of-type(odd){
|
||||
background-color: rgb(210, 210, 210);
|
||||
}
|
||||
.feature-img{
|
||||
display:inline-block;
|
||||
position: relative;
|
||||
}
|
||||
.feature-img:hover .btn{
|
||||
visibility: visible !important;
|
||||
}
|
||||
.btn-schedule{
|
||||
visibility: hidden;
|
||||
}
|
||||
.schedule-item:hover .btn-schedule{
|
||||
visibility: visible !important;
|
||||
}
|
||||
.table > tbody > tr.delete-choose > td{
|
||||
background-color: #F7D3D2;
|
||||
}
|
||||
#filters-face .select2-container {
|
||||
width: 100% !important;
|
||||
}
|
||||
.pagination {
|
||||
margin: 0;
|
||||
}
|
||||
#form-add-staff .select2-container--default .select2-selection--single, .select2-selection .select2-selection--single{
|
||||
border-color: green;
|
||||
}
|
||||
.select2-container--default .select2-selection--single, .select2-selection .select2-selection--single{
|
||||
height: 34px !important;
|
||||
}
|
||||
</style>
|
||||
<input type="hidden" value="{Url::to(["/list-management/add"])}" name="create_url">
|
||||
<input type="hidden" value="{Url::to(["/list-management/update"])}" name="update_url">
|
||||
<input type="hidden" value="{Url::to(["/list-management/sync-feature"])}" name="sync_feature_url">
|
||||
<input type="hidden" value="{Url::to(["/list-management/sync-feature-to-server"])}" name="sync_feature_to_server_url">
|
||||
<input type="hidden" value="{Url::to(["/list-management/sync-feature-from-device"])}" name="sync_feature_from_device_url">
|
||||
<input type="hidden" value="{Url::to(["/list-management/update-feature"])}" name="update_feature_url">
|
||||
<input type="hidden" value="{Url::to(["/api/get-total-feature"])}" name="get_total_feature_url">
|
||||
<div class="row">
|
||||
<div class="col-md-10" id="list-face" style="max-height: 850px;overflow-y: auto;">
|
||||
{GridView::widget([
|
||||
'dataProvider' => $dataProvider,
|
||||
'layout'=> \app\helpers\ListManagementGrid::layout(20),
|
||||
'tableOptions' => [
|
||||
'class' => 'table table-striped table-bordered',
|
||||
'style' => 'background:#fff;min-width:700px;'
|
||||
],
|
||||
'rowOptions' => \app\helpers\ListManagementGrid::rows(),
|
||||
'columns' => [
|
||||
[
|
||||
'attribute' => 'code',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'contentOptions' => ['class' => 'text-center hidden checkbox-column'],
|
||||
'headerOptions' => ['style' => 'width:3%', 'class' => 'hidden checkbox-column'],
|
||||
'format' => "raw",
|
||||
'value' => \app\helpers\ListManagementGrid::check()
|
||||
],
|
||||
[
|
||||
'attribute' => 'type',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\ListManagementGrid::type($typeArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'name',
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'attribute' => 'abbreviated_name',
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'attribute' => 'gender',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'value' => \app\helpers\ListManagementGrid::gender($genderArray)
|
||||
],
|
||||
[
|
||||
'attribute' => 'image',
|
||||
'format' => "raw",
|
||||
'value' => \app\helpers\ListManagementGrid::image()
|
||||
],
|
||||
[
|
||||
'label' => Yii::t("app", "LICH_TRINH"),
|
||||
'headerOptions' => ['class' => 'text-center'],
|
||||
'format' => "raw",
|
||||
'value' => \app\helpers\ListManagementGrid::schedule()
|
||||
],
|
||||
[
|
||||
'attribute' => 'telephone',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
],
|
||||
[
|
||||
'attribute' => 'address',
|
||||
'contentOptions' => ['class' => 'text-center'],
|
||||
'headerOptions' => ['class' => 'text-center']
|
||||
]
|
||||
],
|
||||
'pager' => [
|
||||
'firstPageLabel' => "<i class='fa fa-backward'></i>",
|
||||
'lastPageLabel' => "<i class='fa fa-forward'></i>",
|
||||
'nextPageLabel' => "<i class='fa fa-chevron-right'></i>",
|
||||
'prevPageLabel' => "<i class='fa fa-chevron-left'></i>",
|
||||
'maxButtonCount' => 5
|
||||
]
|
||||
])}
|
||||
</div>
|
||||
<div class="col-md-2" style="padding-right: 30px;">
|
||||
<h4>{Yii::t("app", "TIM_KIEM_DU_LIEU")}</h4>
|
||||
{*<div class="form-group">
|
||||
<label class="control-label">Từ</label>
|
||||
<input type="text" class="form-control datepicker" value="{$f|date_format:"H:i d/m/Y"}" name="From">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">Đến</label>
|
||||
<input type="text" class="form-control datepicker" value="{$t|date_format:"H:i d/m/Y"}" name="To">
|
||||
</div>*}
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "ID")}</label>
|
||||
<input type="text" class="form-control" value="{Yii::$app->request->get("id")}" name="IDSearch">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "TEN")}</label>
|
||||
<input type="text" class="form-control" value="{Yii::$app->request->get("name")}" name="NameSearch">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "LOAI")}</label>
|
||||
<select class="form-control" name="TypeSearch">
|
||||
<option value="all">{Yii::t("app", "TAT_CA")}</option>
|
||||
{html_options options=$typeArray selected=Yii::$app->request->get("type")}
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "GIOI_TINH")}</label>
|
||||
<select class="form-control" name="GenderSearch">
|
||||
<option value="all">{Yii::t("app", "TAT_CA")}</option>
|
||||
{html_options options=$genderArray selected=Yii::$app->request->get("gender")}
|
||||
</select>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-info" onclick="_search(this);" data-href="{Url::to(['/list-management'])}">
|
||||
<i class="fa fa-search"></i> {Yii::t("app", "TIM_KIEM")}
|
||||
</button>
|
||||
</div>
|
||||
<hr style="border-top: 1px solid #000;">
|
||||
<div>
|
||||
<input type="checkbox" name="BatchDelete" style="width: inherit;"> {Yii::t("app", "XOA_NHIEU_DU_LIEU")}
|
||||
<br>
|
||||
<div class="hidden" id="delete-btn-group">
|
||||
<div class="text-center">
|
||||
<button onclick="checkAll(true);">{Yii::t("app", "CHON_TOAN_BO_TRANG")}</button>
|
||||
<button onclick="checkAll(false);">{Yii::t("app", "BO_CHON")}</button>
|
||||
</div>
|
||||
<br>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-danger" onclick="batchDelete(this);" data-href="{Url::to(['/list-management/batch-delete'])}">{Yii::t("app", "XAC_NHAN_XOA")}</button>
|
||||
<button class="btn btn-success" onclick="scheduleForm(this);" data-href="{Url::to(['/list-management/schedule'])}">{Yii::t("app", "LICH_TRINH")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<hr style="border-top: 1px solid #000;">
|
||||
<h4>{Yii::t("app", "DONG_BO_VOI_MAY_CHU")}</h4>
|
||||
<div class="text-center">
|
||||
{*<button class="btn btn-info" onclick="_form();">
|
||||
<i class="fa fa-plus-circle"></i> Thêm mới
|
||||
</button>*}
|
||||
<button class="btn btn-info btn-block" onclick="_syncFromServerForm(this);" data-href="{Url::to(['/list-management/sync-from-server'])}">
|
||||
<i class="fa fa-download"></i> {Yii::t("app", "DONG_BO_TU_MAY_CHU")}
|
||||
</button>
|
||||
<button class="btn btn-success btn-block" onclick="_syncToServerForm(this);" data-href="{Url::to(['/list-management/sync-to-server'])}">
|
||||
<i class="fa fa-upload"></i> {Yii::t("app", "DONG_BO_LEN_MAY_CHU")}
|
||||
</button>
|
||||
</div>
|
||||
<hr style="border-top: 1px solid #000;">
|
||||
<h4>{Yii::t("app", "DONG_BO_TU_THIET_BI_KHAC")}</h4>
|
||||
<div class="form-group" id="ip">
|
||||
<div class="input-group">
|
||||
<input type="text" value="" class="form-control" name="SyncIP" placeholder="{Yii::t("app", "NHAP_IP_THIET_BI")}">
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-info" onclick="_syncForm(this);" data-href="{Url::to(['form-sync'])}">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<hr style="border-top: 1px solid #000;">
|
||||
<table class="table table-bordered" style="background: #fff;">
|
||||
<tr>
|
||||
<td>{Yii::t("app", "SO_NGUOI_CO_ANH_TREN_TONG")}</td>
|
||||
<td class="text-right" id="totalPeople">
|
||||
{*<b class="text-red">{$statistics.totalImg}</b>/<b>{$statistics.total}</b>*}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{Yii::t("app", "DAC_TRUNG_1")}</td>
|
||||
<td class="text-right" id="total128">
|
||||
{* <b class="text-red">{$statistics.128}</b>/<b>{$statistics.img}</b>*}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
{Yii::t("app", "DAC_TRUNG_2")}
|
||||
{if $updating->data==="true"}
|
||||
<label class="label label-danger" id="updating-label">{Yii::t("app", "DANG_CAP_NHAT")}</label>
|
||||
{/if}
|
||||
</td>
|
||||
<td class="text-right" id="total512">
|
||||
{* <b class="text-red">{$statistics.512}</b>/<b>{$statistics.img}</b>*}
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 200px;position: absolute;" id="menu" class="hidden">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading text-bold">
|
||||
{Yii::t("app", "THAO_TAC")}
|
||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_closeMenu();"></i>
|
||||
</div>
|
||||
<div class="panel-body text-center">
|
||||
<button onclick="_formModified(this);" data-href='{Url::to(["/list-management/form-update"])}'>{Yii::t("app", "SUA")}</button>
|
||||
<button onclick="_delete(this);" data-href="{Url::to(["/list-management/delete"])}">{Yii::t("app", "XOA")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="width: 500px;position: absolute;right:0;top: 250px;" id='form' class="hidden">
|
||||
<div class="panel panel-info">
|
||||
<div class="panel-heading text-bold">
|
||||
{Yii::t("app", "QUAN_LY_MAU")}
|
||||
<i class="fa fa-remove pull-right" style="cursor: pointer;" onclick="_close();"></i>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-center">
|
||||
<img src="" class="img-thumbnail" id="FaceImage" style="width: 150px;height: 150px;">
|
||||
<div class="" id="upload-btn">
|
||||
<input type="file" name="AnhNhanVien" id="AnhNhanVien">
|
||||
<input type="hidden" name="AnhNhanVienUrl" value="">
|
||||
<input type="hidden" name="url_upload_staff_image" value="{Url::to(['upload'])}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DANH_SACH")}</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Type">
|
||||
{html_options options=$typeArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row hidden">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "ID")}</div>
|
||||
<div class="col-md-8" id="form-add-staff">
|
||||
<select name='Code' id='Code' onchange="chooseStaff(this);" data-href="{Url::to("/list-management/choose-staff")}">
|
||||
<option value=""></option>
|
||||
{html_options options=$staffArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "TEN")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Name">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "TEN_HIEN_THI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="AbbreviatedName">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "GIOI_TINH")}</div>
|
||||
<div class="col-md-8">
|
||||
<select style="width: 100%;height: 26px;" name="Gender">
|
||||
{html_options options=$genderArray}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "NGAY_SINH")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Birthday" id="birthday">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DIEN_THOAI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Telephone">
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4 text-right">{Yii::t("app", "DON_VI")}</div>
|
||||
<div class="col-md-8">
|
||||
<input type="text" name="Address">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<input type="hidden" value="" name="ListManagementID">
|
||||
<button onclick="_update(this);" data-href='{Url::to(["/list-management/update"])}' id="save-btn">{Yii::t("app", "LUU")}</button>
|
||||
<button onclick="_close();">{Yii::t("app", "HUY")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
108
views/list-management/list-server.tpl
Normal file
108
views/list-management/list-server.tpl
Normal file
|
@ -0,0 +1,108 @@
|
|||
<div class="row" id="filters-face">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app" ,"TIM_KIEM")}</div>
|
||||
<select class="form-control" id="filter-from-server" onchange="filters(this);">
|
||||
<option value=""></option>
|
||||
{html_options options=$filters}
|
||||
</select>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" data-toggle="tooltip" title="{Yii::t("app", "HUY_BO_TIM_KIEM")}" onclick="removeFilters();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-8 text-right">
|
||||
<button class="btn btn-default btn-select" id="btnCheckLossImage" onclick="filtersLossImage(this);">
|
||||
{Yii::t("app", "DOI_TUONG_CHUA_DU_ANH_MAU")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="max-height: 750px;overflow-y: auto;">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{Yii::t("app", "ID")}</th>
|
||||
<th>{Yii::t("app", "TEN_HIEN_THI")}</th>
|
||||
<th>{Yii::t("app", "TEN")}</th>
|
||||
<th>{Yii::t("app", "DON_VI")}</th>
|
||||
<th>{Yii::t("app", "HINH_ANH_DANG_KI")}</th>
|
||||
<th>{Yii::t("app", "COMPANY_ID")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sync-lists">
|
||||
{$totalDevice=0}
|
||||
{$totalCloud=0}
|
||||
{foreach from=$datas item=arr}
|
||||
{$totalImg=0}
|
||||
{if isset($personImage[$arr.id])}
|
||||
{$totalImg=$personImage[$arr.id]}
|
||||
{/if}
|
||||
{$totalDevice=$totalDevice+$totalImg}
|
||||
{$totalCloud=$totalCloud+count($arr.images)}
|
||||
<tr id="filters-{$arr.id}" onclick="choooseToSync(this);" style="cursor: pointer;" class="filters {if $totalImg!==count($arr.images)}loss-image{/if} {if !in_array($arr.id,$allID)}not-in-list{/if}" data-stt="false" data-id="{trim($arr.id)}">
|
||||
<td>
|
||||
<div id="full-data-{trim($arr.id)}" class="hidden">{json_encode($arr)}</div>
|
||||
{$arr.code}
|
||||
{if in_array($arr.id,$allID)}
|
||||
<i class="fa fa-check-circle text-green"></i>
|
||||
{/if}
|
||||
</td>
|
||||
<td>
|
||||
<b class="text-green">[{$totalImg}]</b>
|
||||
<b class="text-red">[{count($arr.images)}]</b>
|
||||
{$arr.name}
|
||||
</td>
|
||||
<td>{$arr.abbreviated_name}</td>
|
||||
<td>{$arr.department}</td>
|
||||
<td>
|
||||
{foreach from=$arr.images item=img key=k}
|
||||
{if $k<Yii::$app->params['maxPicture']}
|
||||
<div class='feature-img'>
|
||||
<img src="{$img}" class="img-thumbnail" style="width: 100px;height:100px;">
|
||||
</div>
|
||||
{/if}
|
||||
{/foreach}
|
||||
</td>
|
||||
<td>{$arr.id_company}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<b class="text-green" id="totalDevice">[{$totalDevice}]</b>
|
||||
<b class="text-red" id="totalCloud">[{$totalCloud}]</b>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<i class="fa fa-info-circle"></i> {Yii::t("app", "DA_LUA_CHON_X_DOI_TUONG")}
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<div class="hidden" id="progress-form">
|
||||
{Yii::t("app", "DONG_BO_X_Y_DOI_TUONG")}
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-primary progress-bar-striped" id='progress' role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
|
||||
0%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-5 text-right">
|
||||
<button class="btn btn-default btn-select" onclick="checkAllNotInList();">
|
||||
{Yii::t("app", "CHON_DOI_TUONG_CHUA_TON_TAI")}
|
||||
</button>
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(true);">
|
||||
{Yii::t("app", "CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(false);">
|
||||
{Yii::t("app", "BO_CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-primary" onclick="_syncFromServer();">
|
||||
<i class="fa fa-refresh"></i> {Yii::t("app", "DONG_BO")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_LAI")}</button>
|
||||
</div>
|
||||
</div>
|
83
views/list-management/list-to-server.tpl
Normal file
83
views/list-management/list-to-server.tpl
Normal file
|
@ -0,0 +1,83 @@
|
|||
<div class="row" id="filters-face">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app" ,"TIM_KIEM")}</div>
|
||||
<select class="form-control" id="filter-from-server" onchange="filters(this);">
|
||||
<option value=""></option>
|
||||
{html_options options=$filters}
|
||||
</select>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" data-toggle="tooltip" title="{Yii::t("app", "HUY_BO_TIM_KIEM")}" onclick="removeFilters();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="max-height: 750px;overflow-y: auto;">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{Yii::t("app", "ID")}<</th>
|
||||
<th>{Yii::t("app", "TEN_HIEN_THI")}</th>
|
||||
<th>{Yii::t("app", "TEN")}<</th>
|
||||
<th>{Yii::t("app", "GIOI_TINH")}</th>
|
||||
<th>{Yii::t("app", "HINH_ANH_DANG_KI")}</th>
|
||||
<th>{Yii::t("app", "NGAY_SINH")}</th>
|
||||
<th>{Yii::t("app", "DIEN_THOAI")}</th>
|
||||
<th>{Yii::t("app", "DON_VI")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sync-lists">
|
||||
{foreach from=$datas item=arr}
|
||||
<tr id="filters-{$arr.staff_id}" class="filters" onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr->staff_id}">
|
||||
<td>{$arr->code}</td>
|
||||
<td>{$arr->name}</td>
|
||||
<td>{$arr.abbreviated_name}</td>
|
||||
<td>{$arr->gender}</td>
|
||||
<td>
|
||||
{$images = json_decode($arr->image, true)}
|
||||
{foreach from=$images item=img}
|
||||
<div class='feature-img'>
|
||||
<img src="/data/uploads/face/{$img.url}" class="img-thumbnail" style="width: 100px;height:100px;">
|
||||
</div>
|
||||
{/foreach}
|
||||
</td>
|
||||
<td>{$arr->birthday|date_format:"%d/%m/%Y"}</td>
|
||||
<td>{$arr->telephone}</td>
|
||||
<td>{$arr->address}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<i class="fa fa-info-circle"></i> {Yii::t("app", "DA_LUA_CHON_X_DOI_TUONG")}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="hidden" id="progress-form">
|
||||
{Yii::t("app", "DONG_BO_X_Y_DOI_TUONG")}
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-primary progress-bar-striped" id='progress' role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
|
||||
0%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 text-right">
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(true);">
|
||||
{Yii::t("app", "CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(false);">
|
||||
{Yii::t("app", "BO_CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-primary" onclick="_syncToServer();">
|
||||
<i class="fa fa-refresh"></i> {Yii::t("app", "DONG_BO")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_LAI")}</button>
|
||||
</div>
|
||||
</div>
|
85
views/list-management/list.tpl
Normal file
85
views/list-management/list.tpl
Normal file
|
@ -0,0 +1,85 @@
|
|||
<div class="row" id="filters-face">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<div class="input-group-addon">{Yii::t("app" ,"TIM_KIEM")}</div>
|
||||
<select class="form-control" id="filter-from-server" onchange="filters(this);">
|
||||
<option value=""></option>
|
||||
{html_options options=$filters}
|
||||
</select>
|
||||
<div class="input-group-btn">
|
||||
<button class="btn btn-default" data-toggle="tooltip" title="{Yii::t("app", "HUY_BO_TIM_KIEM")}" onclick="removeFilters();">
|
||||
<i class="fa fa-remove"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div style="max-height: 750px;overflow-y: auto;">
|
||||
<table class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{Yii::t("app", "ID")}</th>
|
||||
<th>{Yii::t("app", "LOAI")}</th>
|
||||
<th>{Yii::t("app", "TEN")}</th>
|
||||
<th>{Yii::t("app", "GIOI_TINH")}</th>
|
||||
<th>{Yii::t("app", "HINH_ANH_DANG_KI")}</th>
|
||||
<th>{Yii::t("app", "THOI_GIAN_DANG_KI")}</th>
|
||||
<th>{Yii::t("app", "NGAY_SINH")}</th>
|
||||
<th>{Yii::t("app", "DIEN_THOAI")}</th>
|
||||
<th>{Yii::t("app", "DON_VI")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="sync-lists">
|
||||
{foreach from=$results item=arr}
|
||||
<tr id="filters-{$arr.code}" class="filters" onclick="choooseToSync(this);" style="cursor: pointer;" data-stt="false" data-id="{$arr.code}">
|
||||
<td>{$arr.code}</td>
|
||||
<td>{$typeArray[$arr.type]}</td>
|
||||
<td>{$arr.name}</td>
|
||||
<td>{$arr.gender}</td>
|
||||
<td>
|
||||
{$images = json_decode($arr.image, true)}
|
||||
{foreach from=$images item=img}
|
||||
<div class='feature-img'>
|
||||
<img src="http://{$ip}/data/uploads/face/{$img.url}" class="img-thumbnail" style="width: 100px;height:100px;">
|
||||
</div>
|
||||
{/foreach}
|
||||
</td>
|
||||
<td>{$arr.time|date_format:"H:i:s d/m/Y"}</td>
|
||||
<td>{$arr.birthday|date_format:"d/m/Y"}</td>
|
||||
<td>{$arr.telephone}</td>
|
||||
<td>{$arr.address}</td>
|
||||
</tr>
|
||||
{/foreach}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<br>
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<i class="fa fa-info-circle"></i> {Yii::t("app", "DA_LUA_CHON_X_DOI_TUONG")}
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="hidden" id="progress-form">
|
||||
{Yii::t("app", "DONG_BO_X_Y_DOI_TUONG")}
|
||||
<div class="progress">
|
||||
<div class="progress-bar progress-bar-primary progress-bar-striped" id='progress' role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%">
|
||||
0%
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 text-right">
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(true);">
|
||||
{Yii::t("app", "CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-default btn-select" onclick="checkAllSync(false);">
|
||||
{Yii::t("app", "BO_CHON_TAT_CA")}
|
||||
</button>
|
||||
<button class="btn btn-primary" onclick="_sync();">
|
||||
<i class="fa fa-refresh"></i> {Yii::t("app", "DONG_BO")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_LAI")}</button>
|
||||
</div>
|
||||
</div>
|
71
views/list-management/schedule-delete.tpl
Normal file
71
views/list-management/schedule-delete.tpl
Normal file
|
@ -0,0 +1,71 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "THOI_GIAN_VAO")}</label>
|
||||
<input type="text" value="{$model->from_time|default:"00:00"}" class="form-control" id="fromTime" disabled="" name="FromTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "THOI_GIAN_RA")}</label>
|
||||
<input type="text" value="{$model->to_time|default:"23:59"}" class="form-control" id="toTime" disabled=" name="ToTime">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_BAT_DAU")}</label>
|
||||
<input type="text" value="{$model->from_date|default:date("d/m/Y")}" class="form-control" disabled=" id="fromDate" name="FromDate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_KET_THUC")}</label>
|
||||
<input type="text" value="{$model->to_date|default:date("d/m/Y")}" class="form-control" disabled=" id="toDate" name="ToDate">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_TRONG_TUAN")}</label>
|
||||
{$dateOfWeek=["1","2","3","4","5","6","7","8"]}
|
||||
{$dateOfWeek=explode(",",$model->date_of_week)}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
{if in_array("2",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_HAI")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("3",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_BA")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("4",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_TU")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("5",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_NAM")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("6",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_SAU")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("7",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "THU_BAY")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
{if in_array("8",$dateOfWeek)}<i class="fa fa-check text-green"></i>{else}<i class="fa fa-remove text-red"></i>{/if} {Yii::t("app", "CHU_NHAT")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<input type='checkbox' value='1' name='editAll' checked=""> {Yii::t("app","AP_DUNG_CHO_TAT_CA_DOI_TUONG_DA_CHON")}
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
<button class="btn btn-danger" onclick="deleteSchedule(this);" data-href="{yii\helpers\Url::to(["/list-management/delete-schedule","id"=>$model->id])}">
|
||||
<i class="fa fa-remove"></i> {Yii::t("app","XOA_LICH_TRINH")}
|
||||
</button>
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal"><span class="fa fa-remove"></span> {Yii::t("app", "DONG_LAI")}</button>
|
||||
</div>
|
||||
</div>
|
80
views/list-management/schedule.tpl
Normal file
80
views/list-management/schedule.tpl
Normal file
|
@ -0,0 +1,80 @@
|
|||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "THOI_GIAN_VAO")}</label>
|
||||
<input type="text" value="{$model->from_time|default:"00:00"}" class="form-control" id="fromTime" name="FromTime">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "THOI_GIAN_RA")}</label>
|
||||
<input type="text" value="{$model->to_time|default:"23:59"}" class="form-control" id="toTime" name="ToTime">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_BAT_DAU")}</label>
|
||||
<input type="text" value="{$model->from_date|default:date("d/m/Y")}" class="form-control" id="fromDate" name="FromDate">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_KET_THUC")}</label>
|
||||
<input type="text" value="{$model->to_date|default:date("d/m/Y")}" class="form-control" id="toDate" name="ToDate">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{Yii::t("app", "NGAY_TRONG_TUAN")}</label>
|
||||
{$dateOfWeek=["1","2","3","4","5","6","7","8"]}
|
||||
{if $type=="edit"}
|
||||
{$dateOfWeek=explode(",",$model->date_of_week)}
|
||||
{/if}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='2' name="checkbox-date" {if in_array("2",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_HAI")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='3' name="checkbox-date" {if in_array("3",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_BA")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='4' name="checkbox-date" {if in_array("4",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_TU")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='5' name="checkbox-date" {if in_array("5",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_NAM")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='6' name="checkbox-date" {if in_array("6",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_SAU")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='7' name="checkbox-date" {if in_array("7",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "THU_BAY")}
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<input type='checkbox' value='8' name="checkbox-date" {if in_array("8",$dateOfWeek)}checked=""{/if}> {Yii::t("app", "CHU_NHAT")}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{if $type=="edit"}
|
||||
<input type='checkbox' value='1' name='editAll' checked=""> {Yii::t("app","AP_DUNG_CHO_TAT_CA_DOI_TUONG_DA_CHON")}
|
||||
{/if}
|
||||
</div>
|
||||
<div class="col-md-6 text-right">
|
||||
{if $type=="edit"}
|
||||
<button class="btn btn-primary" onclick="editSchedule(this);" data-href="{yii\helpers\Url::to(["/list-management/edit-schedule",'id'=>$model->id])}">
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app","LUU_LAI")}
|
||||
</button>
|
||||
{else}
|
||||
<button class="btn btn-primary" onclick="addSchedule(this);" data-href="{yii\helpers\Url::to(["/list-management/schedule"])}">
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app","LUU_LAI")}
|
||||
</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
|
@ -10,26 +10,26 @@
|
|||
<input type="hidden" value="{$model->password}" name="password">
|
||||
<div class="well" style="background: #fff;">
|
||||
<div class="form-group" id="old-password">
|
||||
<label class="control-label">Mật khẩu cũ</label>
|
||||
<label class="control-label">{Yii::t("app", "MAT_KHAU_CU")}</label>
|
||||
<input type="password" class="form-control" name="OldPassword">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="new-password">
|
||||
<label class="control-label">Mật khẩu mới</label>
|
||||
<label class="control-label">{Yii::t("app", "MAT_KHAU_MOI")}</label>
|
||||
<input type="password" class="form-control" name="NewPassword">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="re-new-password">
|
||||
<label class="control-label">Nhắc lại mật khẩu mới</label>
|
||||
<label class="control-label">{Yii::t("app", "NHAC_LAI_MAT_KHAU_MOI")}</label>
|
||||
<input type="password" class="form-control" name="ReNewPassword">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="alert alert-success hidden" id='success' style="padding: 5px;">
|
||||
<i class="fa fa-check"></i> Đổi mật khẩu thành công!
|
||||
<i class="fa fa-check"></i> {Yii::t("app", "DOI_MAT_KHAU_THANH_CONG")}
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="user.changePassword(this);" data-href="{Url::to(['/user/change-password','id'=>$model->id])}">
|
||||
<i class="fa fa-lock"></i> Đổi mật khẩu
|
||||
<i class="fa fa-lock"></i> {Yii::t("app", "DOI_MAT_KHAU")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -26,37 +26,37 @@
|
|||
</div>
|
||||
<br>
|
||||
<div class="form-group" id="username">
|
||||
<label class="control-label" for="user-username">Tên đăng nhập</label>
|
||||
<label class="control-label" for="user-username">{Yii::t("app", "TEN_DANG_NHAP")}</label>
|
||||
<input type="text" class="form-control" name="Username" readonly="" value="{$model->username}">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="name">
|
||||
<label class="control-label" for="user-first-name">Họ tên</label>
|
||||
<label class="control-label" for="user-first-name">{Yii::t("app", "HO_TEN")}</label>
|
||||
<input type="text" class="form-control" name="Name" value="{$model->first_name}">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="phone">
|
||||
<label class="control-label" for="user-phone-number">Điện thoại</label>
|
||||
<label class="control-label" for="user-phone-number">{Yii::t("app", "DIEN_THOAI")}</label>
|
||||
<input type="text" class="form-control" name="PhoneNumber" value="{$model->phone_number}">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="email">
|
||||
<label class="control-label" for="user-email">Email</label>
|
||||
<label class="control-label" for="user-email">{Yii::t("app", "EMAIL")}</label>
|
||||
<input type="text" class="form-control" name="Email" value="{$model->email}">
|
||||
<span class="help-block hidden"></span>
|
||||
</div>
|
||||
<div class="form-group" id="roles">
|
||||
<label class="control-label" for="user-role">Loại người dùng</label>
|
||||
<label class="control-label" for="user-role">{Yii::t("app", "LOAI_NGUOI_DUNG")}</label>
|
||||
<br>
|
||||
{$model->roleName}
|
||||
</div>
|
||||
<hr>
|
||||
<div class="alert alert-success hidden" id='success' style="padding: 5px;">
|
||||
<i class="fa fa-check"></i> Thông tin đã được lưu lại!
|
||||
<i class="fa fa-check"></i> {Yii::t("app", "THONG_TIN_DA_DUOC_LUU_LAI")}
|
||||
</div>
|
||||
<div class="text-center">
|
||||
<button class="btn btn-primary" onclick="user.saveInfo(this);" data-href="{Url::to(['/user/info','id'=>$model->id])}">
|
||||
<i class="fa fa-floppy-o"></i> Lưu lại
|
||||
<i class="fa fa-floppy-o"></i> {Yii::t("app", "LUU_LAI")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
|
0
web/assets/temp.txt
Normal file → Executable file
0
web/assets/temp.txt
Normal file → Executable file
|
@ -673,4 +673,8 @@ body::-webkit-scrollbar {
|
|||
}
|
||||
.font-grey-cascade {
|
||||
color: #95A5A6!important;
|
||||
}
|
||||
|
||||
.skin-blue .main-header .navbar .nav>li>a{
|
||||
font-size:23px !important;
|
||||
}
|
BIN
web/images/lang/en.png
Normal file
BIN
web/images/lang/en.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 8.6 KiB |
BIN
web/images/lang/jp.png
Normal file
BIN
web/images/lang/jp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.5 KiB |
BIN
web/images/lang/vi.png
Normal file
BIN
web/images/lang/vi.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.0 KiB |
BIN
web/images/user2-160x160.jpg
Normal file
BIN
web/images/user2-160x160.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 5.0 KiB |
|
@ -1,8 +1,8 @@
|
|||
<?php
|
||||
|
||||
// comment out the following two lines when deployed to production
|
||||
//defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
//defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
defined('YII_DEBUG') or define('YII_DEBUG', true);
|
||||
defined('YII_ENV') or define('YII_ENV', 'dev');
|
||||
|
||||
require __DIR__ . '/../vendor/autoload.php';
|
||||
require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php';
|
||||
|
|
104
web/js/capture-logs.js
Normal file
104
web/js/capture-logs.js
Normal file
|
@ -0,0 +1,104 @@
|
|||
$(function () {
|
||||
common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY");
|
||||
common.dateTimePickerDay("birthday");
|
||||
$("#Code").select2();
|
||||
$("input[name='AllData']").change(function () {
|
||||
if ($('input[name=AllData]').is(':checked')) {
|
||||
window.location = $("input[name='URL']").val() + "?all=true" + "&from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val();
|
||||
} else {
|
||||
window.location = $("input[name='URL']").val() + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val();
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function _search(e) {
|
||||
var all = "";
|
||||
if ($('input[name=AllData]').is(':checked')) {
|
||||
all = "&all=true";
|
||||
}
|
||||
window.location = $(e).attr("data-href") + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val() + all;
|
||||
}
|
||||
|
||||
function _form(e) {
|
||||
$("#form").removeClass("hidden");
|
||||
$("input[name='CaptureLogsID']").val($(e).attr("data-id"));
|
||||
$("#FaceImage").attr("src", $(e).attr("data-img"));
|
||||
var confidence = JSON.parse($(e).attr("data-confidence"));
|
||||
$("#closest-img").attr("src", confidence.img != "" ? confidence.img : "/images/user2-160x160.jpg");
|
||||
$("#closest-name").html(confidence.name + " [" + confidence.score + "]");
|
||||
}
|
||||
|
||||
function _close() {
|
||||
$("#form").addClass("hidden");
|
||||
}
|
||||
|
||||
function _save(e) {
|
||||
var code = $("select[name='Code']").val();
|
||||
if (code === "") {
|
||||
alert($("input[name='HAY_CHON_DOI_TUONG']").val());
|
||||
return;
|
||||
}
|
||||
var name = $("input[name='Name']").val();
|
||||
if (name === "") {
|
||||
alert($("input[name='HAY_NHAP_TEN']").val());
|
||||
return;
|
||||
}
|
||||
var abbreviated_name = $("input[name='AbbreviatedName']").val();
|
||||
if (abbreviated_name === "") {
|
||||
alert($("input[name='HAY_NHAP_TEN_HIEN_THI']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
code: code,
|
||||
name: name,
|
||||
abbreviated_name: abbreviated_name,
|
||||
type: $("select[name='Type']").val(),
|
||||
gender: $("select[name='Gender']").val(),
|
||||
birthday: $("input[name='Birthday']").val(),
|
||||
telephone: $("input[name='Telephone']").val(),
|
||||
address: $("input[name='Address']").val(),
|
||||
id: $("input[name='CaptureLogsID']").val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data.status) {
|
||||
alert($("input[name='CAP_NHAT_DU_LIEU_THANH_CONG']").val());
|
||||
window.location.reload(true);
|
||||
} else {
|
||||
alert(data.text);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function chooseStaff(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
code: $(e).val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$("input[name='Name']").val(data.name);
|
||||
$("input[name='AbbreviatedName']").val(data.abbreviated_name);
|
||||
$("select[name='Gender']").val(data.gender);
|
||||
$("input[name='Birthday']").val(data.birthday);
|
||||
$("input[name='Telephone']").val(data.telephone);
|
||||
$("input[name='Address']").val(data.department);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
|
@ -49,6 +49,7 @@ $(document).on('focusin', function (e) {
|
|||
/**
|
||||
* Các hàm sử dụng chung
|
||||
*/
|
||||
$('select').select2();
|
||||
var common = {};
|
||||
common.csrf = $('meta[name="csrf-token"]').attr("content");
|
||||
common.csrfParam = $('meta[name="csrf-param"]').attr("content");
|
||||
|
@ -155,7 +156,7 @@ common.modalAlert = function (text, cls, link) {
|
|||
}
|
||||
};
|
||||
common.ajaxError = function () {
|
||||
common.modalAlert("Có lỗi xảy ra, có thể do đường truyền mạng, xin vui lòng thử lại!", "danger", "");
|
||||
common.modalAlert($("input[name='CO_LOI_XAY_RA_HAY_THU_LAI']").val(), "danger", "");
|
||||
};
|
||||
common.btnUpload = function (mUrl, className, extension, fileSize) {
|
||||
var fData = {
|
||||
|
@ -241,6 +242,14 @@ common.dateTimePickerHour = function (id) {
|
|||
format: 'HH:mm'
|
||||
});
|
||||
};
|
||||
common.dateTimePickerByClass = function (cls, format) {
|
||||
$('.' + cls).datetimepicker({
|
||||
locale: 'vi',
|
||||
ignoreReadonly: true,
|
||||
sideBySide: true,
|
||||
format: format
|
||||
});
|
||||
};
|
||||
common.checkAll = function (id, cls) {
|
||||
$('#' + id).on('ifChecked', function (event) {
|
||||
$('.' + cls).iCheck('check');
|
||||
|
@ -279,14 +288,55 @@ common.success = function (id) {
|
|||
$("#" + id).addClass("has-success").removeClass("has-error");
|
||||
$("#" + id).find(".help-block").addClass("hidden");
|
||||
};
|
||||
common.resetForm = function (e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpen(data.form, false, data.title);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
};
|
||||
common.reset = function (e) {
|
||||
if (confirm("Bạn có chắc chắn muốn reset thiết bị về cấu hình mặc định không?")) {
|
||||
var deleteDB = false;
|
||||
var resetDevice = false;
|
||||
if ($("input[name='DeleteDatabase']").is(':checked'))
|
||||
deleteDB = true;
|
||||
if ($("input[name='ResetDevice']").is(':checked'))
|
||||
resetDevice = true;
|
||||
if (!deleteDB && !resetDevice) {
|
||||
alert($("input[name='HAY_LUA_CHON_THAO_TAC']").val());
|
||||
return;
|
||||
}
|
||||
var confirmText = "";
|
||||
if (deleteDB)
|
||||
confirmText = $("input[name='DELETE_DB_CONFIRM']").val();
|
||||
if (resetDevice)
|
||||
confirmText = $("input[name='RESET_DB_CONFIRM']").val();
|
||||
if (confirm(confirmText)) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("href"),
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
deleteDB: deleteDB,
|
||||
resetDevice: resetDevice
|
||||
},
|
||||
success: function (data) {
|
||||
window.location = data;
|
||||
common.modalBlock(false);
|
||||
if (data.status)
|
||||
window.location = data.url;
|
||||
else {
|
||||
$("#reset-error").removeClass("hidden");
|
||||
$("#reset-close").addClass("hidden");
|
||||
$("#reset-accept").html(data.btnText);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
|
@ -295,6 +345,42 @@ common.reset = function (e) {
|
|||
});
|
||||
}
|
||||
};
|
||||
common.validateIp = function (Ip) {
|
||||
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(Ip)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
common.changeLanguage = function (e) {
|
||||
$.ajax({
|
||||
url: $(e).attr("href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
};
|
||||
common.changePerPage = function (e) {
|
||||
if (window.location.search !== "") {
|
||||
var perPage = common.getUrlParameter("per-page");
|
||||
if (perPage) {
|
||||
var sPageURL = decodeURIComponent(window.location.search.substring(1));
|
||||
var sURLVariables = sPageURL.split('&');
|
||||
var newUrl = [];
|
||||
for (var i = 0; i < sURLVariables.length; i++) {
|
||||
var temp = sURLVariables[i].split('=');
|
||||
if (temp[0] !== "per-page")
|
||||
newUrl.push(sURLVariables[i]);
|
||||
}
|
||||
newUrl.push("per-page=" + $(e).val());
|
||||
window.location = window.location.origin + window.location.pathname + "?" + newUrl.join("&");
|
||||
} else
|
||||
window.location = window.location + "&per-page=" + $(e).val();
|
||||
} else
|
||||
window.location = window.location + "?per-page=" + $(e).val();
|
||||
};
|
||||
/**
|
||||
* =========================
|
||||
*/
|
||||
|
|
272
web/js/config.js
272
web/js/config.js
|
@ -1,15 +1,20 @@
|
|||
$(function () {
|
||||
|
||||
common.dateTimePickerHour("LightBegin");
|
||||
common.dateTimePickerHour("LightEnd");
|
||||
common.dateTimePickerHour("EngineBegin");
|
||||
common.dateTimePickerHour("EngineEnd");
|
||||
btnBackground($("input[name='url_upload_background']").val(), "", '.png,.jpg,.jpeg,.gif', 3.5);
|
||||
btnSound($("input[name='url_upload_sound']").val(), "", '.wav', 3.5);
|
||||
});
|
||||
function saveStep1(e) {
|
||||
var servermqtt = $("input[name='servermqtt']").val();
|
||||
if (servermqtt === "") {
|
||||
alert("Hãy nhập thông tin!");
|
||||
alert($("input[name='HAY_NHAP_THONG_TIN']").val());
|
||||
return;
|
||||
}
|
||||
var url = $("input[name='url']").val();
|
||||
if (url === "") {
|
||||
alert("Hãy nhập thông tin!");
|
||||
alert($("input[name='HAY_NHAP_THONG_TIN']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
|
@ -34,7 +39,7 @@ function saveStep1(e) {
|
|||
if (data.text === "error") {
|
||||
c++;
|
||||
if (c == 5) {
|
||||
alert("Box chưa được đăng kí trên CMS!");
|
||||
alert($("input[name='BOX_CHUA_DUOC_DANG_KI_TREN_CMS']").val());
|
||||
window.location.reload(true);
|
||||
}
|
||||
} else {
|
||||
|
@ -56,6 +61,7 @@ function saveStep1(e) {
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveStep2(e) {
|
||||
var cfgLists = $(".editform");
|
||||
var cfg = [];
|
||||
|
@ -74,11 +80,10 @@ function saveStep2(e) {
|
|||
config: cfg
|
||||
},
|
||||
success: function (data) {
|
||||
if (data) {
|
||||
notification.success("Đã lưu cấu hình!", 2000);
|
||||
} else {
|
||||
notification.success("Lưu cấu hình thất bại!", 2000);
|
||||
}
|
||||
if (data)
|
||||
notification.success($("input[name='DA_LUU_CAU_HINH']").val(), 2000);
|
||||
else
|
||||
notification.success($("input[name='LUU_CAU_HINH_THAT_BAI']").val(), 2000);
|
||||
common.modalBlock(false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
|
@ -86,4 +91,253 @@ function saveStep2(e) {
|
|||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function SaveConfigDevice(e) {
|
||||
var server_api = $("input[name='server_api']").val();
|
||||
var device_id = $("input[name='device_id']").val();
|
||||
if (server_api === "" || device_id === "") {
|
||||
alert($("input[name='HAY_NHAP_THONG_TIN']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
server_api: server_api,
|
||||
device_id: device_id
|
||||
},
|
||||
success: function (data) {
|
||||
if (data)
|
||||
notification.success($("input[name='DA_LUU_CAU_HINH']").val(), 2000);
|
||||
else
|
||||
notification.success($("input[name='LUU_CAU_HINH_THAT_BAI']").val(), 2000);
|
||||
common.modalBlock(false);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function ValidateIPaddress(ipaddress) {
|
||||
if (/^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/.test(ipaddress))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
function validData(inputName) {
|
||||
var ip = $("input[name='" + inputName + "']").val();
|
||||
if (ip == "" && document.getElementById('dhcp_check').checked)
|
||||
return true;
|
||||
if (!ValidateIPaddress(ip)) {
|
||||
common.error(inputName, "");
|
||||
return false;
|
||||
} else {
|
||||
common.success(inputName);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
function validDNS(inputName) {
|
||||
var dns = $("input[name='" + inputName + "']").val();
|
||||
if (dns == "")
|
||||
return true;
|
||||
return validData(inputName);
|
||||
}
|
||||
|
||||
function changeIP(e) {
|
||||
var valid = validData("device_ip");
|
||||
valid = validData("subnet_mask");
|
||||
valid = validData("gateway");
|
||||
valid = validDNS("dns1");
|
||||
valid = validDNS("dns2");
|
||||
if (!valid)
|
||||
return;
|
||||
if (confirm($("input[name='BAN_CO_CHAC_CHAN_MUON_DOI_IP_KHONG']").val())) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
device_ip: $("input[name='device_ip']").val(),
|
||||
subnet_mask: $("input[name='subnet_mask']").val(),
|
||||
gateway: $("input[name='gateway']").val(),
|
||||
dns1: $("input[name='dns1']").val(),
|
||||
dns2: $("input[name='dns2']").val(),
|
||||
dhcp: document.getElementById('dhcp_check').checked
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (!data.status)
|
||||
common.error("subnet_mask", "");
|
||||
else
|
||||
window.location = data.url;
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function reboot(e) {
|
||||
if (confirm($("input[name='BAN_CO_CHAC_CHAN_MUON_REBOOT_KHONG']").val())) {
|
||||
$("#reboot-blocking").modal({
|
||||
keyboard: false,
|
||||
backdrop: false
|
||||
});
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
// $("#reboot-blocking").modal("hide");
|
||||
// common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function controlEngine(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$(".btn-control-engine").removeClass("btn-success").removeClass("btn-danger").addClass("btn-default");
|
||||
$(e).removeClass("btn-default").addClass(data == "on" ? "btn-success" : "btn-danger");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function controlSetupLight(e, status) {
|
||||
if (status)
|
||||
$("#time-light-config").removeClass("hidden");
|
||||
else
|
||||
$("#time-light-config").addClass("hidden");
|
||||
$("#btn-save-light").attr("data-enable", status ? "1" : "0");
|
||||
$(".btn-control-light").removeClass("btn-success").removeClass("btn-danger").addClass("btn-default");
|
||||
$(e).removeClass("btn-default").addClass(status ? "btn-success" : "btn-danger");
|
||||
if (!status)
|
||||
$("#btn-save-light").trigger("click");
|
||||
}
|
||||
|
||||
function saveTimeLightConfig(e) {
|
||||
var enable = $(e).attr("data-enable");
|
||||
var start_at = $("input[name='LightBegin']").val();
|
||||
var end_at = $("input[name='LightEnd']").val();
|
||||
if (enable === "1" && (start_at == "" || end_at == "")) {
|
||||
alert($("input[name='THOI_GIAN_KHONG_DUOC_DE_TRONG']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
enable: enable,
|
||||
start_at: start_at,
|
||||
end_at: end_at
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data)
|
||||
notification.success($("input[name='THONG_TIN_DA_DUOC_LUU_LAI']").val(), 2000);
|
||||
else
|
||||
notification.danger($("input[name='CO_LOI_XAY_RA_HAY_THU_LAI']").val(), 2000);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveTimeEngineConfig(e) {
|
||||
var start_at = $("input[name='EngineBegin']").val();
|
||||
var end_at = $("input[name='EngineEnd']").val();
|
||||
if (start_at == "" || end_at == "") {
|
||||
alert($("input[name='THOI_GIAN_KHONG_DUOC_DE_TRONG']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
start_at: start_at,
|
||||
end_at: end_at
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data)
|
||||
notification.success($("input[name='THONG_TIN_DA_DUOC_LUU_LAI']").val(), 2000);
|
||||
else
|
||||
notification.danger($("input[name='CO_LOI_XAY_RA_HAY_THU_LAI']").val(), 2000);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
function btnBackground(mUrl, className, extension, fileSize) {
|
||||
var fData = {
|
||||
UploadFile: true,
|
||||
Name: className
|
||||
};
|
||||
fData[common.csrfParam] = common.csrf;
|
||||
new afuButton({
|
||||
uploadURI: mUrl,
|
||||
formData: fData,
|
||||
wrap: {
|
||||
tagName: 'div',
|
||||
classes: ''
|
||||
},
|
||||
fileExtension: extension,
|
||||
fileSizeLimit: fileSize,
|
||||
classes: 'btn btn-default btn-xs file-paperclip-' + className,
|
||||
fakeInputContent: '<span class=\'fa fa-picture-o\'></span> ' + $("input[name='CHON_HINH_ANH']").val(),
|
||||
onUploaded: function (data) {
|
||||
common.uploadBlock(false);
|
||||
window.location.reload(true);
|
||||
}
|
||||
}).addInstance('image' + className);
|
||||
$(".file-paperclip-" + className).closest("div").attr("style", "display:inline-block;");
|
||||
}
|
||||
|
||||
function btnSound(mUrl, className, extension, fileSize) {
|
||||
var fData = {
|
||||
UploadFile: true,
|
||||
Name: className
|
||||
};
|
||||
fData[common.csrfParam] = common.csrf;
|
||||
new afuButton({
|
||||
uploadURI: mUrl,
|
||||
formData: fData,
|
||||
wrap: {
|
||||
tagName: 'div',
|
||||
classes: ''
|
||||
},
|
||||
fileExtension: extension,
|
||||
fileSizeLimit: fileSize,
|
||||
classes: 'btn btn-default btn-xs file-paperclip-' + className,
|
||||
fakeInputContent: '<span class=\'fa fa-file\'></span> ' + $("input[name='CHON_AM_THANH']").val(),
|
||||
onUploaded: function (data) {
|
||||
common.uploadBlock(false);
|
||||
notification.success($("input[name='THONG_TIN_DA_DUOC_LUU_LAI']").val(), 2000);
|
||||
}
|
||||
}).addInstance('sound' + className);
|
||||
$(".file-paperclip-" + className).closest("div").attr("style", "display:inline-block;");
|
||||
}
|
35
web/js/control-logs.js
Normal file
35
web/js/control-logs.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
$(function () {
|
||||
common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY");
|
||||
});
|
||||
|
||||
function _search(e) {
|
||||
var location = $(e).attr("data-href") + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val();
|
||||
location = location + "&id=" + $("input[name='IDSearch']").val();
|
||||
location = location + "&name=" + $("input[name='NameSearch']").val();
|
||||
location = location + "&type=" + $("select[name='TypeSearch']").val();
|
||||
location = location + "&gender=" + $("select[name='GenderSearch']").val();
|
||||
window.location = location;
|
||||
}
|
||||
|
||||
function _useFeature(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: $(e).val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data.status) {
|
||||
alert($("input[name='DA_THEM_HINH_ANH_MAU']").val());
|
||||
} else {
|
||||
alert(data.text);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
53
web/js/face-comparison.js
Normal file
53
web/js/face-comparison.js
Normal file
|
@ -0,0 +1,53 @@
|
|||
$(function () {
|
||||
btnFace("1");
|
||||
btnFace("2");
|
||||
});
|
||||
|
||||
function btnFace(imageIndex) {
|
||||
var fData = {
|
||||
UploadImage: true,
|
||||
imageIndex: imageIndex
|
||||
};
|
||||
fData[common.csrfParam] = common.csrf;
|
||||
new afuButton({
|
||||
uploadURI: $("input[name='url_upload_face']").val(),
|
||||
formData: fData,
|
||||
wrap: {
|
||||
tagName: 'div',
|
||||
classes: ''
|
||||
},
|
||||
fileExtension: '.png,.jpg,.jpeg,.gif',
|
||||
fileSizeLimit: 1,
|
||||
classes: 'btn btn-default',
|
||||
fakeInputContent: '<span class=\'fa fa-file-image-o\'></span> Chọn hình ảnh',
|
||||
onUploaded: function (data) {
|
||||
$("#face" + imageIndex).attr("src", "/data/uploads" + data);
|
||||
common.uploadBlock(false);
|
||||
compareFace();
|
||||
}
|
||||
}).addInstance('image' + imageIndex);
|
||||
}
|
||||
|
||||
function compareFace() {
|
||||
var face1 = $("#face1").attr("src");
|
||||
var face2 = $("#face2").attr("src");
|
||||
if (face1 == "/images/user2-160x160.jpg" || face2 == "/images/user2-160x160.jpg")
|
||||
return;
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $("input[name='url_face_comparison']").val(),
|
||||
type: 'POST',
|
||||
data: {
|
||||
face1: face1,
|
||||
face2: face2
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$("#percent").html(data.type1 + "%<br>[" + data.type2 + "%]");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
851
web/js/list-management.js
Normal file
851
web/js/list-management.js
Normal file
|
@ -0,0 +1,851 @@
|
|||
var x = 0, y = 0;
|
||||
var multiChoose = false;
|
||||
$(function () {
|
||||
common.dateTimePickerByClass("datepicker", "HH:mm DD/MM/YYYY");
|
||||
common.dateTimePickerDay("birthday");
|
||||
$("tr").bind("click", function (event) {
|
||||
x = event.pageX;
|
||||
y = event.pageY;
|
||||
});
|
||||
$("input[name='BatchDelete']").change(function () {
|
||||
if (this.checked) {
|
||||
$("#delete-btn-group").removeClass("hidden");
|
||||
multiChoose = true;
|
||||
$(".checkbox-column").removeClass("hidden");
|
||||
} else {
|
||||
$("tr").removeClass("delete-choose");
|
||||
$("#delete-btn-group").addClass("hidden");
|
||||
multiChoose = false;
|
||||
$(".checkbox-column").addClass("hidden");
|
||||
}
|
||||
});
|
||||
btnImage();
|
||||
$("#Code").select2();
|
||||
getTotalFeature();
|
||||
setInterval(function () {
|
||||
var current = parseInt($("#current-512").html());
|
||||
var total = parseInt($("#total-512").html());
|
||||
if (current < total)
|
||||
getTotalFeature();
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
function _search(e) {
|
||||
var location = $(e).attr("data-href"); // + "?from=" + $("input[name='From']").val() + "&to=" + $("input[name='To']").val();
|
||||
location = location + "?id=" + $("input[name='IDSearch']").val();
|
||||
location = location + "&name=" + $("input[name='NameSearch']").val();
|
||||
location = location + "&type=" + $("select[name='TypeSearch']").val();
|
||||
location = location + "&gender=" + $("select[name='GenderSearch']").val();
|
||||
window.location = location;
|
||||
}
|
||||
|
||||
function _close() {
|
||||
$("#form").addClass("hidden");
|
||||
}
|
||||
|
||||
function _menu(e) {
|
||||
var isDelete = $("input[name='BatchDelete']").is(':checked');
|
||||
if (isDelete) {
|
||||
if ($(e).hasClass("delete-choose"))
|
||||
$(e).removeClass("delete-choose");
|
||||
else
|
||||
$(e).addClass("delete-choose");
|
||||
$("#menu").addClass("hidden");
|
||||
} else {
|
||||
$("input[name='ListManagementID']").val($(e).attr("data-id"));
|
||||
$("#menu").css({top: y, left: x}).removeClass("hidden");
|
||||
}
|
||||
}
|
||||
|
||||
function _closeMenu() {
|
||||
$("#menu").addClass("hidden");
|
||||
}
|
||||
|
||||
function _formModified(e) {
|
||||
_closeMenu();
|
||||
$("#form").removeClass("hidden");
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: $("input[name='ListManagementID']").val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data.canUpload)
|
||||
$("#upload-btn").removeClass("hidden");
|
||||
else
|
||||
$("#upload-btn").addClass("hidden");
|
||||
$("select[name='Type']").val(data.type);
|
||||
$("select[name='Code']").val(data.code);
|
||||
$("input[name='Name']").val(data.name);
|
||||
$("input[name='AbbreviatedName']").val(data.abbreviated_name);
|
||||
$("select[name='Gender']").val(data.gender);
|
||||
$("input[name='Birthday']").val(data.birthday);
|
||||
$("input[name='Telephone']").val(data.telephone);
|
||||
$("input[name='Address']").val(data.address);
|
||||
$("#FaceImage").attr("src", data.image);
|
||||
$("#save-btn").attr("onclick", "_update(this);");
|
||||
$("#save-btn").attr("data-href", $("input[name='update_url']").val());
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _update(e) {
|
||||
var code = $("select[name='Code']").val();
|
||||
if (code === "") {
|
||||
alert($("input[name='HAY_CHON_DOI_TUONG']").val());
|
||||
return;
|
||||
}
|
||||
var name = $("input[name='Name']").val();
|
||||
if (name === "") {
|
||||
alert($("input[name='HAY_NHAP_TEN']").val());
|
||||
return;
|
||||
}
|
||||
var abbreviated_name = $("input[name='AbbreviatedName']").val();
|
||||
if (abbreviated_name === "") {
|
||||
alert($("input[name='HAY_NHAP_TEN_HIEN_THI']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
code: code,
|
||||
name: name,
|
||||
abbreviated_name: abbreviated_name,
|
||||
type: $("select[name='Type']").val(),
|
||||
gender: $("select[name='Gender']").val(),
|
||||
birthday: $("input[name='Birthday']").val(),
|
||||
telephone: $("input[name='Telephone']").val(),
|
||||
address: $("input[name='Address']").val(),
|
||||
id: $("input[name='ListManagementID']").val(),
|
||||
image: $("input[name='AnhNhanVienUrl']").val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data) {
|
||||
alert($("input[name='CAP_NHAT_DU_LIEU_THANH_CONG']").val());
|
||||
window.location.reload(true);
|
||||
} else
|
||||
alert($("input[name='MA_DOI_TUONG_DA_TON_TAI']").val());
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _delete(e) {
|
||||
if (confirm($("input[name='DELETE_CONFIRM']").val())) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: $("input[name='ListManagementID']").val()
|
||||
},
|
||||
success: function (data) {
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function _deleteFeature(e) {
|
||||
if (confirm($("input[name='DELETE_CONFIRM']").val())) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
image: $(e).attr("data-img"),
|
||||
id: $(e).attr("data-id")
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$(e).closest("div").remove();
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function checkAll(status) {
|
||||
if (status) {
|
||||
$("#list-face").find("tr").addClass("delete-choose");
|
||||
$(".checkbox-column").find("input").prop('checked', true);
|
||||
} else {
|
||||
$("#list-face").find("tr").removeClass("delete-choose");
|
||||
$(".checkbox-column").find("input").prop('checked', false);
|
||||
}
|
||||
}
|
||||
|
||||
function choose(e) {
|
||||
if (!multiChoose)
|
||||
return false;
|
||||
if ($(e).closest("tr").hasClass("delete-choose"))
|
||||
$(e).closest("tr").removeClass("delete-choose");
|
||||
else
|
||||
$(e).closest("tr").addClass("delete-choose");
|
||||
}
|
||||
|
||||
function batchDelete(e) {
|
||||
var check = $(".delete-choose");
|
||||
if (check.length == 0) {
|
||||
alert($("input[name='HAY_CHON_DU_LIEU_DE_XOA']").val());
|
||||
return;
|
||||
}
|
||||
var lists = [];
|
||||
$.each($(".delete-choose"), function () {
|
||||
if ($(this).attr("data-id") !== "")
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
if (confirm($("input[name='DELETE_CONFIRM']").val())) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
lists: lists
|
||||
},
|
||||
success: function (data) {
|
||||
alert($("input[name='DA_XOA_DU_LIEU']").val());
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function _form() {
|
||||
$("#form").removeClass("hidden");
|
||||
$("#upload-btn").removeClass("hidden");
|
||||
$("#FaceImage").attr("src", "/images/user2-160x160.jpg");
|
||||
$("#save-btn").attr("onclick", "_create(this);");
|
||||
$("#save-btn").attr("data-href", $("input[name='create_url']").val());
|
||||
$("input[name='Code']").val($("input[name='isAuto']").val());
|
||||
$("input[name='Name']").val("");
|
||||
$("input[name='Birthday']").val("");
|
||||
$("input[name='Telephone']").val("");
|
||||
$("input[name='Address']").val("");
|
||||
}
|
||||
|
||||
function btnImage() {
|
||||
var fData = {
|
||||
UploadImage: true
|
||||
};
|
||||
fData[common.csrfParam] = common.csrf;
|
||||
new afuButton({
|
||||
uploadURI: $("input[name='url_upload_staff_image']").val(),
|
||||
formData: fData,
|
||||
wrap: {
|
||||
tagName: 'div',
|
||||
classes: ''
|
||||
},
|
||||
fileExtension: '.png,.jpg,.jpeg,.gif',
|
||||
fileSizeLimit: 1,
|
||||
classes: 'btn btn-default btn-xs',
|
||||
fakeInputContent: '<span class=\'fa fa-file-image-o\'></span> ' + $("input[name='CHON_HINH_ANH']").val(),
|
||||
onUploaded: function (data) {
|
||||
var res = JSON.parse(data);
|
||||
if (res.status) {
|
||||
$("#FaceImage").attr("src", "/" + res.dataPath + res.url);
|
||||
$("input[name='AnhNhanVienUrl']").val(res.url);
|
||||
common.uploadBlock(false);
|
||||
} else {
|
||||
alert($("input[name='HINH_ANH_KHONG_NHAN_DIEN_DUOC_KHUON_MAT']").val());
|
||||
}
|
||||
}
|
||||
}).addInstance('AnhNhanVien');
|
||||
}
|
||||
|
||||
function _create(e) {
|
||||
var code = $("select[name='Code']").val();
|
||||
if (code === "") {
|
||||
alert($("input[name='HAY_CHON_DOI_TUONG']").val());
|
||||
return;
|
||||
}
|
||||
var name = $("input[name='Name']").val();
|
||||
if (name === "") {
|
||||
alert($("input[name='HAY_NHAP_TEN']").val());
|
||||
return;
|
||||
}
|
||||
var image = $("input[name='AnhNhanVienUrl']").val();
|
||||
if (image === "") {
|
||||
alert($("input[name='HAY_TAI_LEN_HINH_ANH']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
code: code,
|
||||
name: name,
|
||||
type: $("select[name='Type']").val(),
|
||||
gender: $("select[name='Gender']").val(),
|
||||
birthday: $("input[name='Birthday']").val(),
|
||||
telephone: $("input[name='Telephone']").val(),
|
||||
address: $("input[name='Address']").val(),
|
||||
image: image
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
if (data.status) {
|
||||
alert($("input[name='CAP_NHAT_DU_LIEU_THANH_CONG']").val());
|
||||
window.location.reload(true);
|
||||
} else
|
||||
alert($("input[name='MA_DOI_TUONG_DA_TON_TAI']").val());
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _syncForm(e) {
|
||||
var ip = $("input[name='SyncIP']").val();
|
||||
if (ip === "") {
|
||||
common.error("ip", $("input[name='HAY_NHAP_DIA_CHI_IP_DONG_BO']").val());
|
||||
return;
|
||||
}
|
||||
if (!common.validateIp(ip)) {
|
||||
common.error("ip", $("input[name='SAI_DINH_DANG_IP']").val());
|
||||
return;
|
||||
}
|
||||
common.success("ip");
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
ip: ip
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpenFullScreen(data.form, data.title);
|
||||
$("#filter-from-server").select2({
|
||||
placeholder: $("input[name='TIM_KIEM_THEO_ID_HOAC_TEN']").val()
|
||||
});
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
alert($("input[name='KHONG_CO_KET_NOI_TOI_THIET_BI']").val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function choooseToSync(e) {
|
||||
var stt = $(e).attr("data-stt");
|
||||
if (stt === "false") {
|
||||
$(e).addClass("success");
|
||||
$(e).attr("data-stt", "true");
|
||||
$("#totals-choose").html(parseInt($("#totals-choose").html()) + 1);
|
||||
} else {
|
||||
$(e).removeClass("success");
|
||||
$(e).attr("data-stt", "false");
|
||||
$("#totals-choose").html(parseInt($("#totals-choose").html()) - 1);
|
||||
}
|
||||
}
|
||||
|
||||
function checkAllSync(stt) {
|
||||
if (stt) {
|
||||
$("#sync-lists").find("tr").addClass("success").attr("data-stt", "true");
|
||||
$("#totals-choose").html($("#sync-lists").find("tr").length);
|
||||
} else {
|
||||
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
|
||||
$("#totals-choose").html("0");
|
||||
}
|
||||
}
|
||||
|
||||
function checkAllNotInList() {
|
||||
$(".filters").addClass("hidden");
|
||||
$(".not-in-list").removeClass("hidden");
|
||||
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
|
||||
$(".not-in-list").addClass("success").attr("data-stt", "true");
|
||||
$("#totals-choose").html($(".not-in-list").length);
|
||||
}
|
||||
|
||||
var progress = 0;
|
||||
var totals = 0;
|
||||
function _sync() {
|
||||
var lists = [];
|
||||
$.each($("#sync-lists").find(".success"), function () {
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
if (lists.length == 0) {
|
||||
alert($("input[name='KHONG_CO_DU_LIEU_DONG_BO']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$("#progress-totals").html(lists.length);
|
||||
$("#progress-form").removeClass("hidden");
|
||||
totals = lists.length;
|
||||
syncFeatureFromDevice(lists[0], lists);
|
||||
}
|
||||
|
||||
function syncFeatureFromDevice(id, fullData) {
|
||||
$.ajax({
|
||||
url: $("input[name='sync_feature_from_device_url']").val(),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: id,
|
||||
ip: $("input[name='SyncIP']").val(),
|
||||
totals: totals
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data, progress);
|
||||
progress++;
|
||||
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
||||
var percent = parseInt(progress / totals * 100);
|
||||
$("#progress").attr("aria-valuenow", percent);
|
||||
$("#progress").attr("style", "width: " + percent + "%");
|
||||
$("#progress").html(percent + "%");
|
||||
if (percent >= 100) {
|
||||
common.modalBlock(false);
|
||||
if (totals > 10) {
|
||||
updateFeature();
|
||||
progress = 0;
|
||||
} else {
|
||||
window.location.reload(true);
|
||||
}
|
||||
} else {
|
||||
syncFeatureFromDevice(fullData[progress], fullData);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
alert($("input[name='KHONG_CO_KET_NOI_TOI_THIET_BI']").val());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _syncFromServerForm(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpenFullScreen(data.form, data.title);
|
||||
$("#filter-from-server").select2({
|
||||
placeholder: $("input[name='TIM_KIEM_THEO_ID_HOAC_TEN']").val()
|
||||
});
|
||||
if ($("#totalDevice").html() === $("#totalCloud").html())
|
||||
$("#btnCheckLossImage").addClass("hidden");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _syncFromServer() {
|
||||
var lists = [];
|
||||
$.each($("#sync-lists").find(".success"), function () {
|
||||
var id = $(this).attr("data-id");
|
||||
lists.push(JSON.parse($("#full-data-" + id).html()));
|
||||
});
|
||||
if (lists.length == 0) {
|
||||
alert($("input[name='KHONG_CO_DU_LIEU_DONG_BO']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$("#progress-totals").html(lists.length);
|
||||
$("#progress-form").removeClass("hidden");
|
||||
totals = lists.length;
|
||||
syncFeature(lists[0], lists);
|
||||
}
|
||||
|
||||
function syncFeature(id, fullData) {
|
||||
$.ajax({
|
||||
url: $("input[name='sync_feature_url']").val(),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: id,
|
||||
totals: totals
|
||||
},
|
||||
success: function (data) {
|
||||
if (!data) {
|
||||
common.modalBlock(false);
|
||||
common.modalAlert($("input[name='ENGINE_KHONG_HOAT_DONG']").val(), "danger", "");
|
||||
return;
|
||||
}
|
||||
console.log(data, progress);
|
||||
progress++;
|
||||
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
||||
var percent = parseInt(progress / totals * 100);
|
||||
$("#progress").attr("aria-valuenow", percent);
|
||||
$("#progress").attr("style", "width: " + percent + "%");
|
||||
$("#progress").html(percent + "%");
|
||||
if (percent >= 100) {
|
||||
common.modalBlock(false);
|
||||
if (totals > 10) {
|
||||
updateFeature();
|
||||
progress = 0;
|
||||
} else {
|
||||
window.location.reload(true);
|
||||
}
|
||||
} else {
|
||||
syncFeature(fullData[progress], fullData);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function updateFeature() {
|
||||
$.ajax({
|
||||
url: $("input[name='update_feature_url']").val(),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function chooseStaff(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
code: $(e).val()
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
$("input[name='Name']").val(data.name);
|
||||
$("select[name='Gender']").val(data.gender);
|
||||
$("input[name='Birthday']").val(data.birthday);
|
||||
$("input[name='Telephone']").val(data.telephone);
|
||||
$("input[name='Address']").val(data.department);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function _syncToServerForm(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpenFullScreen(data.form, data.title);
|
||||
$("#filter-from-server").select2({
|
||||
placeholder: $("input[name='TIM_KIEM_THEO_ID_HOAC_TEN']").val()
|
||||
});
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
var progressToServer = 0;
|
||||
var totalsToServer = 0;
|
||||
function _syncToServer() {
|
||||
var lists = [];
|
||||
$.each($("#sync-lists").find(".success"), function () {
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
if (lists.length == 0) {
|
||||
alert($("input[name='KHONG_CO_DU_LIEU_DONG_BO']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$("#progress-totals").html(lists.length);
|
||||
$("#progress-form").removeClass("hidden");
|
||||
totalsToServer = lists.length;
|
||||
syncFeatureToServer(lists[0], lists);
|
||||
}
|
||||
var error = 0;
|
||||
function syncFeatureToServer(id, fullData) {
|
||||
$.ajax({
|
||||
url: $("input[name='sync_feature_to_server_url']").val(),
|
||||
type: 'POST',
|
||||
data: {
|
||||
id: id
|
||||
},
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
// if (data.status != 10000) {
|
||||
// error++;
|
||||
// console.log(error);
|
||||
// }
|
||||
progressToServer++;
|
||||
$("#progress-current").html(parseInt($("#progress-current").html()) + 1);
|
||||
var percent = parseInt(progressToServer / totalsToServer * 100);
|
||||
$("#progress").attr("aria-valuenow", percent);
|
||||
$("#progress").attr("style", "width: " + percent + "%");
|
||||
$("#progress").html(percent + "%");
|
||||
if (percent >= 100) {
|
||||
common.modalBlock(false);
|
||||
setTimeout(function () {
|
||||
alert($("input[name='DONG_BO_DU_LIEU_HOAN_THANH']").val());
|
||||
window.location.reload(true);
|
||||
}, 2000)
|
||||
} else {
|
||||
syncFeatureToServer(fullData[progressToServer], fullData);
|
||||
}
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function filters(e) {
|
||||
var id = $(e).val();
|
||||
if (id === "") {
|
||||
$(".filters").removeClass("hidden");
|
||||
$(".btn-select").removeClass("hidden");
|
||||
// checkAllSync(false);
|
||||
} else {
|
||||
$(".filters").addClass("hidden");
|
||||
$("#filters-" + id).removeClass("hidden");
|
||||
$(".btn-select").addClass("hidden");
|
||||
// checkAllSync(false);
|
||||
choooseToSync($("#filters-" + id));
|
||||
}
|
||||
}
|
||||
|
||||
function removeFilters() {
|
||||
$(".filters").removeClass("hidden");
|
||||
$(".btn-select").removeClass("hidden");
|
||||
$("#filter-from-server").val('').trigger('change');
|
||||
// checkAllSync(false);
|
||||
}
|
||||
|
||||
function getTotalFeature() {
|
||||
$.ajax({
|
||||
url: $("input[name='get_total_feature_url']").val(),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
console.log(data);
|
||||
$("#totalPeople").html(`<b class="text-red">` + data.statistics.totalImg + `</b>/<b>` + data.statistics.total + `</b>`);
|
||||
$("#total128").html(`<b class="text-red">` + data.statistics["128"] + `</b>/<b>` + data.statistics.img + `</b>`);
|
||||
$("#total512").html(`<b class="text-red" id="current-512">` + data.statistics["512"] + `</b>/<b id="total-512">` + data.statistics.img + `</b>`);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function reGenFeature(e) {
|
||||
$.ajax({
|
||||
url: $(e).attr("href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
// window.location.reload(true);
|
||||
$("#updating-label").removeClass("hidden");
|
||||
$(e).addClass("hidden");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function filtersLossImage(e) {
|
||||
if ($(e).hasClass("btn-danger")) {
|
||||
$(e).addClass("btn-default").removeClass("btn-danger");
|
||||
$(".filters").removeClass("hidden");
|
||||
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
|
||||
$("#totals-choose").html("0");
|
||||
} else {
|
||||
$(e).removeClass("btn-default").addClass("btn-danger");
|
||||
$(".filters").addClass("hidden");
|
||||
$(".loss-image").removeClass("hidden");
|
||||
$("#sync-lists").find("tr").removeClass("success").attr("data-stt", "false");
|
||||
$(".loss-image").addClass("success").attr("data-stt", "true");
|
||||
$("#totals-choose").html($(".loss-image").length);
|
||||
}
|
||||
}
|
||||
|
||||
function scheduleForm(e) {
|
||||
var check = $(".delete-choose");
|
||||
if (check.length == 0) {
|
||||
alert($("input[name='HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH']").val());
|
||||
return;
|
||||
}
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpen(data.form, false, data.title);
|
||||
common.dateTimePickerDay("fromDate");
|
||||
common.dateTimePickerDay("toDate");
|
||||
common.dateTimePickerHour("fromTime");
|
||||
common.dateTimePickerHour("toTime");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function addSchedule(e) {
|
||||
var lists = [];
|
||||
$.each($(".delete-choose"), function () {
|
||||
if ($(this).attr("data-id") !== "")
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
if (lists.length == 0) {
|
||||
alert($("input[name='HAY_CHON_DOI_TUONG_DE_GAN_LICH_TRINH']").val());
|
||||
return;
|
||||
}
|
||||
var dateOfWeek = [];
|
||||
$.each($("input[name='checkbox-date']:checked"), function () {
|
||||
dateOfWeek.push($(this).val());
|
||||
});
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
fromTime: $("input[name='FromTime']").val(),
|
||||
toTime: $("input[name='ToTime']").val(),
|
||||
fromDate: $("input[name='FromDate']").val(),
|
||||
toDate: $("input[name='ToDate']").val(),
|
||||
dateOfWeek: dateOfWeek,
|
||||
lists: lists
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(errorThrown);
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formEditSchedule(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpen(data.form, false, data.title);
|
||||
common.dateTimePickerDay("fromDate");
|
||||
common.dateTimePickerDay("toDate");
|
||||
common.dateTimePickerHour("fromTime");
|
||||
common.dateTimePickerHour("toTime");
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function editSchedule(e) {
|
||||
var lists = [];
|
||||
$.each($(".delete-choose"), function () {
|
||||
if ($(this).attr("data-id") !== "")
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
var dateOfWeek = [];
|
||||
$.each($("input[name='checkbox-date']:checked"), function () {
|
||||
dateOfWeek.push($(this).val());
|
||||
});
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
fromTime: $("input[name='FromTime']").val(),
|
||||
toTime: $("input[name='ToTime']").val(),
|
||||
fromDate: $("input[name='FromDate']").val(),
|
||||
toDate: $("input[name='ToDate']").val(),
|
||||
dateOfWeek: dateOfWeek,
|
||||
lists: lists,
|
||||
editAll: $("input[name='editAll']").is(":checked")
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(errorThrown);
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function formDeleteSchedule(e) {
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
common.modalOpen(data.form, false, data.title);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function deleteSchedule(e) {
|
||||
if (confirm($("input[name='BAN_CO_CHAC_CHAN_MUON_XOA_LICH_TRINH_NAY_KHONG']").val())) {
|
||||
var lists = [];
|
||||
$.each($(".delete-choose"), function () {
|
||||
if ($(this).attr("data-id") !== "")
|
||||
lists.push($(this).attr("data-id"));
|
||||
});
|
||||
common.modalBlock(true);
|
||||
$.ajax({
|
||||
url: $(e).attr("data-href"),
|
||||
type: 'POST',
|
||||
data: {
|
||||
editAll: $("input[name='editAll']").is(":checked"),
|
||||
lists: lists
|
||||
},
|
||||
success: function (data) {
|
||||
common.modalBlock(false);
|
||||
window.location.reload(true);
|
||||
},
|
||||
error: function (jqXHR, textStatus, errorThrown) {
|
||||
console.log(errorThrown);
|
||||
common.modalBlock(false);
|
||||
common.ajaxError();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
|
@ -17,8 +17,10 @@ class ConfigTree extends Widget {
|
|||
|
||||
public function run() {
|
||||
|
||||
$public_root = ['engine', 'recognition', 'open_door', 'screen', 'lang'];
|
||||
$public_cfg = ['engine|cam_id', 'engine|server_authen', 'recognition|server_recog', 'open_door|enable', 'open_door|port_name', 'screen|banner', 'lang'];
|
||||
// $public_root = ['engine', 'recognition', 'open_door', 'screen', 'lang', 'camera'];
|
||||
// $public_cfg = ['engine|cam_id', 'engine|server_authen', 'recognition|server_recog', 'open_door|enable', 'open_door|port_name', 'screen|banner', 'lang', 'camera|rgb', 'camera|ir', 'camera|rgb|url', 'camera|ir|url'];
|
||||
$public_root = ['open_door', 'screen', 'lang', 'play_sound', 'background', 'filter', 'ads'];
|
||||
$public_cfg = ['open_door|door_1', 'open_door|door_2', 'open_door|light', 'open_door|light|enable', 'open_door|light|start_at', 'open_door|light|end_at', 'filter|enable', 'filter|show_name', 'filter|urls', 'screen|banner', 'lang', 'ads|enable', 'ads|get_rules', 'ads|check_new_every', 'ads|ads_type', 'ads|show_video_after', 'ads|audio'];
|
||||
|
||||
return $this->render("config-tree", [
|
||||
"configLists" => $this->configLists,
|
||||
|
|
Loading…
Reference in New Issue
Block a user