diff --git a/SeedDMS_Core/Core/inc.ClassDMS.php b/SeedDMS_Core/Core/inc.ClassDMS.php index 88a7e9cdc..a41ede652 100644 --- a/SeedDMS_Core/Core/inc.ClassDMS.php +++ b/SeedDMS_Core/Core/inc.ClassDMS.php @@ -4012,7 +4012,14 @@ class SeedDMS_Core_DMS { function getStatisticalData($type='') { /* {{{ */ switch($type) { case 'docsperuser': - $queryStr = "select b.`fullName` as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`"; + $queryStr = "select concat(b.`fullName`, ' (', b.`login`, ')') as `key`, count(`owner`) as total from `tblDocuments` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`"; + $resArr = $this->db->getResultArray($queryStr); + if (!$resArr) + return false; + + return $resArr; + case 'foldersperuser': + $queryStr = "select concat(b.`fullName`, ' (', b.`login`, ')') as `key`, count(`owner`) as total from `tblFolders` a left join `tblUsers` b on a.`owner`=b.`id` group by `owner`, b.`fullName`"; $resArr = $this->db->getResultArray($queryStr); if (!$resArr) return false; diff --git a/SeedDMS_Core/Core/inc.ClassUser.php b/SeedDMS_Core/Core/inc.ClassUser.php index 46dc7fbe5..80512e9b2 100644 --- a/SeedDMS_Core/Core/inc.ClassUser.php +++ b/SeedDMS_Core/Core/inc.ClassUser.php @@ -1585,6 +1585,106 @@ class SeedDMS_Core_User { /* {{{ */ $documents[] = $document; } return $documents; + } + + /** + * Returns all document links of a given user + * @return SeedDMS_Core_DocumentLink[]|bool list of document links + */ + function getDocumentLinks() { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "SELECT * FROM `tblDocumentLinks` ". + "WHERE `userID` = " . $this->_id; + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) + return false; + + $links = array(); + $classname = 'SeedDMS_Core_DocumentLink'; + foreach ($resArr as $row) { + $document = $this->_dms->getDocument($row["document"]); + $target = $this->_dms->getDocument($row["target"]); + /** @var SeedDMS_Core_Document $document */ + $link = new $classname((int) $row["id"], $document, $target, $row["userID"], $row["public"]); + $links[] = $link; + } + return $links; + } /* }}} */ + + /** + * Returns all document files of a given user + * @return SeedDMS_Core_DocumentFile[]|bool list of document files + */ + function getDocumentFiles() { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "SELECT * FROM `tblDocumentFiles` ". + "WHERE `userID` = " . $this->_id; + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) + return false; + + $files = array(); + $classname = 'SeedDMS_Core_DocumentFile'; + foreach ($resArr as $row) { + $document = $this->_dms->getDocument($row["document"]); + /** @var SeedDMS_Core_DocumentFile $file */ + $file = new $classname((int) $row["id"], $document, $row["userID"], $row["comment"], $row["date"], $row["dir"], $row["fileType"], $row["mimeType"], $row["orgFileName"], $row["name"],$row["version"],$row["public"]); + $files[] = $file; + } + return $files; + } /* }}} */ + + /** + * Returns all document contents of a given user + * @return SeedDMS_Core_DocumentContent[]|bool list of document contents + */ + function getDocumentContents() { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "SELECT * FROM `tblDocumentContent` WHERE `createdBy` = " . $this->_id; + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) + return false; + + $contents = array(); + $classname = $this->_dms->getClassname('documentcontent'); + foreach ($resArr as $row) { + $document = $this->_dms->getDocument($row["document"]); + /** @var SeedDMS_Core_DocumentContent $content */ + $content = new $classname((int) $row["id"], $this, $row["version"], $row["comment"], $row["date"], $row["createdBy"], $row["dir"], $row["orgFileName"], $row["fileType"], $row["mimeType"], $row['fileSize'], $row['checksum']); + $contents[] = $content; + } + return $contents; + } /* }}} */ + + /** + * Returns all folders of a given user + * @return SeedDMS_Core_Folder[]|bool list of folders + */ + function getFolders() { /* {{{ */ + $db = $this->_dms->getDB(); + + $queryStr = "SELECT * FROM `tblFolders` ". + "WHERE `owner` = " . $this->_id . " ORDER BY `sequence`"; + + $resArr = $db->getResultArray($queryStr); + if (is_bool($resArr) && !$resArr) + return false; + + $folders = array(); + $classname = $this->_dms->getClassname('folder'); + foreach ($resArr as $row) { + /** @var SeedDMS_Core_Folder $folder */ + $folder = new $classname((int) $row["id"], $row["name"], $row['parent'], $row["comment"], $row["date"], $row["owner"], $row["inheritAccess"], $row["defaultAccess"], $row["sequence"]); + $folder->setDMS($this->_dms); + $folders[] = $folder; + } + return $folders; } /* }}} */ /** diff --git a/SeedDMS_Core/package.xml b/SeedDMS_Core/package.xml index c317a90de..7e0211c43 100644 --- a/SeedDMS_Core/package.xml +++ b/SeedDMS_Core/package.xml @@ -24,9 +24,19 @@ GPL License -- removeFromProcesses() documents in comment of log when a user was replaced -- move SeedDMS_Core_Document::checkForDueRevisionWorkflow() into SeedDMS_Core_DocumentContent - and add a wrapper method in SeedDMЅ_Core_Document +- SeedDMS_Core_DMS::getTimeline() uses status log instead of document content +- add methods SeedDMS_Core_DocumentContent::getReviewers() and SeedDMS_Core_DocumentContent::getApprovers() +- add methods SeedDMS_Core_DocumentContent::getApproveLog() and SeedDMS_Core_DocumentContent::getReviewLog() +- better handling of document with an empty workflow state +- fix checking of email addresses by using filter_var instead of regex +- add new method SeedDMS_Core_Document::hasCategory() +- add new method SeedDMS_Core_DocumentContent::removeReview() +- add new method SeedDMS_Core_DocumentContent::removeApproval() +- add new method SeedDMS_Core_User::getFolders() +- add new method SeedDMS_Core_User::getDocumentContents() +- add new method SeedDMS_Core_User::getDocumentFiles() +- add new method SeedDMS_Core_User::getDocumentLinks() +- add new type 'foldersperuser' to method SeedDMS_Core_DMS::getStatisticalData() @@ -1909,6 +1919,11 @@ add method SeedDMS_Core_DatabaseAccess::setLogFp() - add new method SeedDMS_Core_Document::hasCategory() - add new method SeedDMS_Core_DocumentContent::removeReview() - add new method SeedDMS_Core_DocumentContent::removeApproval() +- add new method SeedDMS_Core_User::getFolders() +- add new method SeedDMS_Core_User::getDocumentContents() +- add new method SeedDMS_Core_User::getDocumentFiles() +- add new method SeedDMS_Core_User::getDocumentLinks() +- add new type 'foldersperuser' to method SeedDMS_Core_DMS::getStatisticalData() diff --git a/views/bootstrap/class.Charts.php b/views/bootstrap/class.Charts.php index e7f5ee535..e701bd03c 100644 --- a/views/bootstrap/class.Charts.php +++ b/views/bootstrap/class.Charts.php @@ -208,7 +208,7 @@ $(document).ready( function() { $this->columnStart(3); $this->contentHeading(getMLText("chart_selection")); $this->contentContainerStart(); - foreach(array('docsperuser', 'sizeperuser', 'docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) { + foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) { echo "
".getMLText('chart_'.$atype.'_title')."
\n"; } $this->contentContainerEnd(); @@ -235,6 +235,7 @@ $(document).ready( function() { switch($type) { case 'docspermonth': case 'docsperuser': + case 'foldersperuser': case 'docspermimetype': case 'docspercategory': case 'docsperstatus': diff --git a/views/bootstrap/class.UsrMgr.php b/views/bootstrap/class.UsrMgr.php index b2dccdd1d..c56c1af47 100644 --- a/views/bootstrap/class.UsrMgr.php +++ b/views/bootstrap/class.UsrMgr.php @@ -116,8 +116,16 @@ $(document).ready( function() { echo "\n"; $documents = $seluser->getDocuments(); echo "".getMLText('documents')."".count($documents)."\n"; + $contents = $seluser->getDocumentContents(); + echo "".getMLText('document_versions')."".count($contents)."\n"; $documents = $seluser->getDocumentsLocked(); echo "".getMLText('documents_locked')."".count($documents)."\n"; + $links = $seluser->getDocumentLinks(); + echo "".getMLText('document_links')."".count($links)."\n"; + $files = $seluser->getDocumentFiles(); + echo "".getMLText('document_files')."".count($files)."\n"; + $folders = $seluser->getFolders(); + echo "".getMLText('folders')."".count($folders)."\n"; $categories = $seluser->getKeywordCategories(); echo "".getMLText('personal_default_keywords')."".count($categories)."\n"; $dnot = $seluser->getNotifications(T_DOCUMENT);