update phân quyền chi tiết
This commit is contained in:
@@ -47,17 +47,23 @@ class LogsController extends Controller {
|
||||
$f = $t = 0;
|
||||
$this->view->title = 'Tất cả sự kiện';
|
||||
if ($type === "today" && $from === "" && $to === "") {
|
||||
if (!Yii::$app->user->can(Yii::$app->controller->id . "Today"))
|
||||
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
||||
$f = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . date("d/m/Y")), 'U');
|
||||
$t = date_format(date_create_from_format('H:i:s d/m/Y', "23:59:59 " . date("d/m/Y")), 'U');
|
||||
$this->view->title = 'Sự kiện hôm nay';
|
||||
}
|
||||
if ($type === "3days" && $from === "" && $to === "") {
|
||||
if (!Yii::$app->user->can(Yii::$app->controller->id . "3days"))
|
||||
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
||||
$f = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . date("d/m/Y")), 'U');
|
||||
$f = $f - 60 * 60 * 24 * 2;
|
||||
$t = date_format(date_create_from_format('H:i:s d/m/Y', "23:59:59 " . date("d/m/Y")), 'U');
|
||||
$this->view->title = 'Sự kiện 3 ngày gần đây';
|
||||
}
|
||||
if ($type === "thisWeek" && $from === "" && $to === "") {
|
||||
if (!Yii::$app->user->can(Yii::$app->controller->id . "ThisWeek"))
|
||||
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
||||
$dayOfWeek = date("w");
|
||||
$f = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . date("d/m/Y")), 'U');
|
||||
$f = $f - 60 * 60 * 24 * ($dayOfWeek - 1);
|
||||
@@ -66,6 +72,8 @@ class LogsController extends Controller {
|
||||
$this->view->title = 'Sự kiện tuần này';
|
||||
}
|
||||
if ($type === "lastWeek" && $from === "" && $to === "") {
|
||||
if (!Yii::$app->user->can(Yii::$app->controller->id . "LastWeek"))
|
||||
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
||||
$dayOfWeek = date("w");
|
||||
$f = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . date("d/m/Y")), 'U');
|
||||
$f = $f - 60 * 60 * 24 * ($dayOfWeek - 1) - 60 * 60 * 24 * 7;
|
||||
@@ -97,6 +105,8 @@ class LogsController extends Controller {
|
||||
}
|
||||
|
||||
public function actionStatistics($day = "") {
|
||||
if (!Yii::$app->user->can(Yii::$app->controller->id . "Statistics"))
|
||||
throw new \yii\web\HttpException(403, 'Bạn không có quyền truy cập nội dung này');
|
||||
$day = $day === "" ? date("d/m/Y") : $day;
|
||||
$f = date_format(date_create_from_format('H:i:s d/m/Y', "00:00:00 " . $day), 'U');
|
||||
$t = date_format(date_create_from_format('H:i:s d/m/Y', "23:59:59 " . $day), 'U');
|
||||
|
||||
Reference in New Issue
Block a user