From ffb6b0a0c34bb4a606bec8330c9951d66f361990 Mon Sep 17 00:00:00 2001 From: guofeilong Date: Wed, 8 Feb 2023 14:57:43 +0800 Subject: [PATCH] * Code for genDateUsed --- module/admin/control.php | 1 + module/admin/model.php | 20 ++++++++++++++++++++ module/admin/view/index.html.php | 10 +++++++++- 3 files changed, 30 insertions(+), 1 deletion(-) diff --git a/module/admin/control.php b/module/admin/control.php index c49cd97b5e..c24f70ed60 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -42,6 +42,7 @@ class admin extends control $this->view->position[] = $this->lang->admin->index; $this->view->plugins = $this->admin->getExtensionsByAPI('plugin', $langNotCN ? 5 : 6, $hasInternet); $this->view->patches = $this->admin->getExtensionsByAPI('patch', 3, $hasInternet); + $this->view->dateUsed = $this->admin->genDateUsed(); $this->view->hasInternet = $hasInternet; $this->view->publicClass = ($hasInternet and !$langNotCN) ? $this->admin->getPublicClassByAPI(3) : array(); $this->view->langNotCN = $langNotCN; diff --git a/module/admin/model.php b/module/admin/model.php index 473552b348..ebae255e82 100755 --- a/module/admin/model.php +++ b/module/admin/model.php @@ -591,4 +591,24 @@ class adminModel extends model return (bool)$connected; } + + /** + * get date used. + * + * @access public + * @return $interval + */ + public function genDateUsed() + { + $firstUseDate = $this->dao->select('date')->from(TABLE_ACTION) + ->where('date')->gt('0000-00-00') + ->andWhere('actor')->eq($this->app->user->account) + ->orderBy('date_asc') + ->fetch('date'); + $firstUseDate = date_create($firstUseDate); + $dateNow = date("Y-m-d H:i", time()); + $dateNow = date_create($dateNow); + $interval = date_diff($dateNow, $firstUseDate); + return $interval; + } } diff --git a/module/admin/view/index.html.php b/module/admin/view/index.html.php index 7fae6c12d4..3b27c0251b 100755 --- a/module/admin/view/index.html.php +++ b/module/admin/view/index.html.php @@ -90,7 +90,15 @@
admin->zentaoInfo?>
-
您已使用禅道5year?>9admin->mon?>19admin->day?>
+
您已使用禅道 + view->dateUsed->format('%y') != 0) :?> + view->dateUsed->format('%y')?>year?> + + view->dateUsed->format('%m') != 0) :?> + view->dateUsed->format('%m')?>admin->mon?> + + view->dateUsed->format('%d') + 1?>admin->day?> +