From 185550fcf40c1e36be6b5f7289151cb184c06db0 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 11 Apr 2023 16:11:55 +0800 Subject: [PATCH 1/6] * Code for task #90779. --- module/block/control.php | 1 + module/block/view/docstatisticblock.html.php | 65 ++++++++++++++++++++ module/doc/lang/de.php | 5 ++ module/doc/lang/en.php | 5 ++ module/doc/lang/fr.php | 5 ++ module/doc/lang/zh-cn.php | 11 +++- module/doc/model.php | 22 ++----- 7 files changed, 95 insertions(+), 19 deletions(-) diff --git a/module/block/control.php b/module/block/control.php index 76415e75ec..e1438b6578 100755 --- a/module/block/control.php +++ b/module/block/control.php @@ -2042,6 +2042,7 @@ class block extends control */ public function printDocStatisticBlock() { + $this->view->statistic = $this->loadModel('doc')->getStatisticInfo(); } /** diff --git a/module/block/view/docstatisticblock.html.php b/module/block/view/docstatisticblock.html.php index e69de29bb2..27b0706732 100644 --- a/module/block/view/docstatisticblock.html.php +++ b/module/block/view/docstatisticblock.html.php @@ -0,0 +1,65 @@ + + * @package block + * @version $Id$ + * @link http://www.zentao.net + */ +?> + +
+
+

doc->docStatistic;?>

+
+
+
totalDocs;?>
+
doc->allDoc;?>
+
+
+
todayEditedDocs;?>
+
doc->todayEdited;?>
+
+
+
+
+

doc->openedByMe;?>

+
+
+
myDocs;?>
+
doc->docCreated;?>
+
+
+
myDoc->docViews;?>
+
doc->docViews;?>
+
+
+
myDoc->docCollects;?>
+
doc->docCollects;?>
+
+
+
+
+

doc->editedByMe;?>

+
+
+
myEditedDocs;?>
+
doc->docEdited;?>
+
+
+
+
diff --git a/module/doc/lang/de.php b/module/doc/lang/de.php index 96b543a40d..d5dda417a7 100644 --- a/module/doc/lang/de.php +++ b/module/doc/lang/de.php @@ -145,6 +145,11 @@ $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; $lang->doc->deleteCatalog = 'Delete Catalog'; +$lang->doc->docStatistic = 'Statistic'; +$lang->doc->docCreated = 'Created Documents'; +$lang->doc->docEdited = 'Edited Documents'; +$lang->doc->docViews = 'Page Views'; +$lang->doc->docCollects = 'Collection'; /* Methods list */ $lang->doc->index = 'Dashboard'; diff --git a/module/doc/lang/en.php b/module/doc/lang/en.php index 8f37a1dcf2..a7f3f06ada 100644 --- a/module/doc/lang/en.php +++ b/module/doc/lang/en.php @@ -145,6 +145,11 @@ $lang->doc->tableContents = 'Directory'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; $lang->doc->deleteCatalog = 'Delete Catalog'; +$lang->doc->docStatistic = 'Statistic'; +$lang->doc->docCreated = 'Created Documents'; +$lang->doc->docEdited = 'Edited Documents'; +$lang->doc->docViews = 'Page Views'; +$lang->doc->docCollects = 'Collection'; /* Methods list */ $lang->doc->index = 'Dashboard'; diff --git a/module/doc/lang/fr.php b/module/doc/lang/fr.php index c6b8a3e9c5..9ec7cd6fa0 100644 --- a/module/doc/lang/fr.php +++ b/module/doc/lang/fr.php @@ -145,6 +145,11 @@ $lang->doc->tableContents = 'Catalog'; $lang->doc->addCatalog = 'Add Catalog'; $lang->doc->editCatalog = 'Edit Catalog'; $lang->doc->deleteCatalog = 'Delete Catalog'; +$lang->doc->docStatistic = 'Statistic'; +$lang->doc->docCreated = 'Created Documents'; +$lang->doc->docEdited = 'Edited Documents'; +$lang->doc->docViews = 'Page Views'; +$lang->doc->docCollects = 'Collection'; /* Methods list */ $lang->doc->index = 'Dashboard'; diff --git a/module/doc/lang/zh-cn.php b/module/doc/lang/zh-cn.php index 5d6130f3a2..dd2261c845 100644 --- a/module/doc/lang/zh-cn.php +++ b/module/doc/lang/zh-cn.php @@ -128,9 +128,9 @@ $lang->doc->team = '团队'; $lang->doc->moduleDoc = '按模块浏览'; $lang->doc->searchDoc = '搜索'; $lang->doc->fast = '快速访问'; -$lang->doc->allDoc = '所有文档'; -$lang->doc->openedByMe = '由我创建'; -$lang->doc->editedByMe = '由我编辑'; +$lang->doc->allDoc = '全部文档'; +$lang->doc->openedByMe = '我的创建'; +$lang->doc->editedByMe = '我的编辑'; $lang->doc->orderByOpen = '最近添加'; $lang->doc->orderByEdit = '最近更新'; $lang->doc->orderByVisit = '最近访问'; @@ -145,6 +145,11 @@ $lang->doc->tableContents = '目录'; $lang->doc->addCatalog = '添加目录'; $lang->doc->editCatalog = '编辑目录'; $lang->doc->deleteCatalog = '删除目录'; +$lang->doc->docStatistic = '文档统计'; +$lang->doc->docCreated = '创建的文档'; +$lang->doc->docEdited = '编辑的文档'; +$lang->doc->docViews = '被浏览量'; +$lang->doc->docCollects = '被收藏量'; /* 方法列表。*/ $lang->doc->index = '仪表盘'; diff --git a/module/doc/model.php b/module/doc/model.php index a6a9266f73..63a5ed9384 100644 --- a/module/doc/model.php +++ b/module/doc/model.php @@ -2145,29 +2145,19 @@ class docModel extends model { $allLibs = array_keys($this->getLibs('all')); $docIdList = $this->getPrivDocs($allLibs); + $myDocList = $this->dao->select('id')->from(TABLE_DOC)->where('addedBy')->eq($this->app->user->account)->fetchPairs('id'); - $today = date('Y-m-d'); - $lately = date('Y-m-d', strtotime('-3 day')); - $statisticInfo = $this->dao->select("count(id) as totalDocs, count(IF(editedDate like '{$today}%', 1, null)) as todayEditedDocs, - count(IF(editedDate > '{$lately}', 1, null)) as lastEditedDocs, count(IF(addedDate > '{$lately}', 1, null)) as lastAddedDocs, - count(IF(addedBy = '{$this->app->user->account}', 1, null)) as myDocs")->from(TABLE_DOC) + $today = date('Y-m-d'); + $statistic = $this->dao->select("count(id) as totalDocs, count(IF(editedDate like '{$today}%', 1, null)) as todayEditedDocs, + count(IF(editedBy = '{$this->app->user->account}', 1, null)) as myEditedDocs, count(IF(addedBy = '{$this->app->user->account}', 1, null)) as myDocs")->from(TABLE_DOC) ->where('deleted')->eq(0) ->andWhere('vision')->eq($this->config->vision) ->andWhere('id')->in($docIdList) ->fetch(); - $statisticInfo->myCollection = $this->dao->select('count(*) as count')->from(TABLE_DOCACTION) - ->where('doc')->in($docIdList) - ->andWhere('action')->eq('collect') - ->andWhere('actor')->eq($this->app->user->account) - ->fetch('count'); - $statisticInfo->pastEditedDocs = $statisticInfo->totalDocs - $statisticInfo->todayEditedDocs; - $statisticInfo->lastEditedProgress = $statisticInfo->totalDocs ? round($statisticInfo->lastEditedDocs / $statisticInfo->totalDocs, 2) * 100 : 0; - $statisticInfo->lastAddedProgress = $statisticInfo->totalDocs ? round($statisticInfo->lastAddedDocs / $statisticInfo->totalDocs, 2) * 100 : 0; - $statisticInfo->myCollectionProgress = $statisticInfo->totalDocs ? round($statisticInfo->myCollection / $statisticInfo->totalDocs, 2) * 100 : 0; - $statisticInfo->myDocsProgress = $statisticInfo->totalDocs ? round($statisticInfo->myDocs / $statisticInfo->totalDocs, 2) * 100 : 0; + $statistic->myDoc = $this->dao->select("count(IF(`action` = 'view', 1, null)) as docViews, count(IF(`action` = 'collect', 1, null)) as docCollects")->from(TABLE_DOCACTION)->where('doc')->in($myDocList)->fetch(); - return $statisticInfo; + return $statistic; } /** From 675f25a19194fd567638898d44f4802a535f0da5 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 11 Apr 2023 16:47:45 +0800 Subject: [PATCH 2/6] * Modify style for right block. --- module/block/view/docstatisticblock.html.php | 37 ++++++++++++++++---- 1 file changed, 30 insertions(+), 7 deletions(-) diff --git a/module/block/view/docstatisticblock.html.php b/module/block/view/docstatisticblock.html.php index 27b0706732..dd2fcd8af0 100644 --- a/module/block/view/docstatisticblock.html.php +++ b/module/block/view/docstatisticblock.html.php @@ -16,22 +16,37 @@ .block-statistic .statistic {flex: 0 1 32%;} .block-statistic .created {flex: 0 1 48%;} .block-statistic .edited {flex: 0 1 16%; padding-left: 20px;} -.block-statistic .divider {border-right: 1px solid #eee; padding-right: 35px;} +.block-statistic .divider {border-right: 1px solid #eee; padding-right: 12%;} .block-statistic .title-line {height: 32px;} .block-statistic .panel-title {display: none;} .block-statistic .panel-body {margin-top: -32px; padding: 30px;} .block-statistic .tile-title {white-space: nowrap;} + +.block-statistic.block-sm .flex {justify-content: start;} +.block-statistic.block-sm .panel-body.flex {flex-direction: column;} +.block-statistic.block-sm .divider {border-right: none;} +.block-statistic.block-sm .panel-title {display: block;} +.block-statistic.block-sm .statistic .title-line {display: none;} +.block-statistic.block-sm .statistic .flex {margin-top: -28px;} +.block-statistic.block-sm .title-line {height: 0; padding-top: 10px;} +.block-statistic.block-sm .tile {padding: 10px 32px 20px;} +.block-statistic.block-sm .panel-body {margin-top: 0px; padding: 10px;} +.block-statistic.block-sm .flex-column .flex .tile:nth-child(1) {padding-left: 0;} +.block-statistic.block-sm .edited {padding-left: 10px;} +.block-statistic.block-sm .flex-column {border-bottom: 1px solid #eee;} +.block-statistic.block-sm .flex-column:last-child {border-bottom: none;} +

doc->docStatistic;?>

-
totalDocs;?>
+
totalDocs;?>
doc->allDoc;?>
-
todayEditedDocs;?>
+
todayEditedDocs;?>
doc->todayEdited;?>
@@ -39,16 +54,24 @@

doc->openedByMe;?>

+ + + +
-
myDoc->docViews;?>
+
myDoc->docViews;?>
doc->docViews;?>
-
myDoc->docCollects;?>
+
myDoc->docCollects;?>
doc->docCollects;?>
@@ -57,7 +80,7 @@

doc->editedByMe;?>

-
myEditedDocs;?>
+
myEditedDocs;?>
doc->docEdited;?>
From c78ed61098af55e6b5bf000b81753b73586c0a48 Mon Sep 17 00:00:00 2001 From: caoyanyi Date: Tue, 11 Apr 2023 16:58:00 +0800 Subject: [PATCH 3/6] * Modify action btn style. --- module/doc/view/doclist.html.php | 1 + 1 file changed, 1 insertion(+) diff --git a/module/doc/view/doclist.html.php b/module/doc/view/doclist.html.php index 62719df5f6..68a57af082 100644 --- a/module/doc/view/doclist.html.php +++ b/module/doc/view/doclist.html.php @@ -20,6 +20,7 @@ body {margin-bottom: 25px;} #docListForm .checkbox-primary > label {height: 16px; line-height: 16px; padding-left: 16px;} #docListForm .checkbox-primary > label:before {left: -1px; font-size: 10px;} #docListForm .checkbox-primary > label:after {width: 12px; height: 12px;} +.table-files .btn {padding: 0 2px;}