mirror of
https://git.code.sf.net/p/seeddms/code
synced 2025-05-12 12:41:30 +00:00
new method getStatisticalData()
This commit is contained in:
parent
aa725b8dce
commit
9cb368fcab
|
@ -2032,6 +2032,50 @@ class SeedDMS_Core_DMS {
|
||||||
|
|
||||||
} /* }}} */
|
} /* }}} */
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns statitical information
|
||||||
|
*
|
||||||
|
* This method returns all kind of statistical information like
|
||||||
|
* documents or used space per user, recent activity, etc.
|
||||||
|
*
|
||||||
|
* @param string $type type of statistic
|
||||||
|
* @param array statistical data
|
||||||
|
*/
|
||||||
|
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";
|
||||||
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
if (!$resArr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $resArr;
|
||||||
|
case 'docspermimetype':
|
||||||
|
$queryStr = "select b.mimeType as `key`, count(mimeType) as total from tblDocuments a left join tblDocumentContent b on a.id=b.document group by b.mimeType";
|
||||||
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
if (!$resArr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $resArr;
|
||||||
|
case 'docspercategory':
|
||||||
|
$queryStr = "select b.name as `key`, count(a.categoryID) as total from tblDocumentCategory a left join tblCategory b on a.categoryID=b.id group by a.categoryID";
|
||||||
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
if (!$resArr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $resArr;
|
||||||
|
case 'sizeperuser':
|
||||||
|
$queryStr = "select c.fullname as `key`, sum(fileSize) as total from tblDocuments a left join tblDocumentContent b on a.id=b.document left join tblUsers c on a.owner=c.id group by a.owner";
|
||||||
|
$resArr = $this->db->getResultArray($queryStr);
|
||||||
|
if (!$resArr)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return $resArr;
|
||||||
|
default:
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
} /* }}} */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a callback function
|
* Set a callback function
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue
Block a user