mirror of
https://git.code.sf.net/p/seeddms/code
synced 2026-05-08 13:31:24 +00:00
add new chart with docs per size range
This commit is contained in:
parent
d9faaf840b
commit
cb16c002bd
|
|
@ -173,7 +173,7 @@ if(in_array($type, array('docspermonth'))) {
|
|||
<?php
|
||||
if($data) {
|
||||
foreach($data as $rec) {
|
||||
echo '{ label: "'.htmlspecialchars($rec['key']).'", data: [[1,'.$rec['total'].']]},'."\n";
|
||||
echo '{ label: "'.$this->getKeyValue($type, $rec).'", data: [[1,'.$rec['total'].']]},'."\n";
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
|
@ -245,7 +245,31 @@ $(document).ready( function() {
|
|||
return true;
|
||||
} /* }}} */
|
||||
|
||||
protected function getSearchUrl($type, $item) {
|
||||
protected function getKeyValue($type, $item) { /* {{{ */
|
||||
switch ($type) {
|
||||
case 'docspersizerange':
|
||||
return htmlspecialchars('< '.SeedDMS_Core_File::format_filesize(pow(10, $item['key']+1), ['Bytes', 'KB', 'MB', 'GB'], 10, 1000).', >= '.SeedDMS_Core_File::format_filesize(pow(10, $item['key']), ['Bytes', 'KB', 'MB', 'GB'], 10, 1000));
|
||||
break;
|
||||
case 'docsaccumulated':
|
||||
return getReadableDate($item['key']/1000);
|
||||
break;
|
||||
default:
|
||||
return htmlspecialchars($item['key']);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
protected function getTotalValue($type, $total) { /* {{{ */
|
||||
switch ($type) {
|
||||
case 'sizeperuser':
|
||||
case 'sizepermonth':
|
||||
return htmlspecialchars(SeedDMS_Core_File::format_filesize($total));
|
||||
break;
|
||||
default:
|
||||
return htmlspecialchars($total);
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
protected function getSearchUrl($type, $item) { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
$settings = $this->params['settings'];
|
||||
|
||||
|
|
@ -270,6 +294,11 @@ $(document).ready( function() {
|
|||
$endmonth = date('Y-m-t', strtotime($startmonth));
|
||||
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$startmonth.'&created%5Bto%5D='.$endmonth;
|
||||
break;
|
||||
case 'docspersizerange':
|
||||
$filesizestart = pow(10, $item['key']);
|
||||
$filesizeend = pow(10, $item['key']+1)-1;
|
||||
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&filesize%5Bfrom%5D='.$filesizestart.'&filesize%5Bto%5D='.$filesizeend;
|
||||
break;
|
||||
case 'docspermimetype':
|
||||
$searchurl = $settings->_httpRoot.'out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&mimetype%5B%5D='.urlencode($item['key']);
|
||||
break;
|
||||
|
|
@ -280,7 +309,7 @@ $(document).ready( function() {
|
|||
break;
|
||||
}
|
||||
return $searchurl;
|
||||
}
|
||||
} /* }}} */
|
||||
|
||||
public function show() { /* {{{ */
|
||||
$dms = $this->params['dms'];
|
||||
|
|
@ -306,7 +335,7 @@ $(document).ready( function() {
|
|||
$this->columnStart(3);
|
||||
$this->contentHeading(getMLText("chart_selection"));
|
||||
$this->contentContainerStart();
|
||||
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
|
||||
foreach(array('docsperuser', 'foldersperuser', 'sizeperuser', 'sizepermonth','docspersizerange', 'docspermimetype', 'docspercategory', 'docsperstatus', 'docspermonth', 'docsaccumulated') as $atype) {
|
||||
if($this->showChart($atype))
|
||||
echo "<div><a href=\"?type=".$atype."\">".getMLText('chart_'.$atype.'_title')."</a></div>\n";
|
||||
}
|
||||
|
|
@ -349,7 +378,7 @@ $(document).ready( function() {
|
|||
$oldtotal = 0;
|
||||
foreach($data as $item) {
|
||||
echo "<tr>";
|
||||
echo "<td data-sort=\"".str_replace('-', '', $item['key'])."\">".htmlspecialchars($item['key'])."</td>";
|
||||
echo "<td data-sort=\"".str_replace('-', '', $item['key'])."\">".$this->getKeyValue($type, $item)."</td>";
|
||||
echo "<td>".$item['total']."</td>";
|
||||
if(in_array($type, array('docspermonth')))
|
||||
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
|
||||
|
|
@ -371,7 +400,7 @@ $(document).ready( function() {
|
|||
$oldtotal = 0;
|
||||
foreach($data as $item) {
|
||||
echo "<tr>";
|
||||
echo "<td data-sort=\"".$item['key']."\">".getReadableDate($item['key']/1000)."</td>";
|
||||
echo "<td data-sort=\"".$item['key']."\">".$this->getKeyValue($type, $item)."</td>";
|
||||
echo "<td>".$item['total']."</td>";
|
||||
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
|
||||
$searchurl = $this->getSearchUrl($type, $item);
|
||||
|
|
@ -388,8 +417,8 @@ $(document).ready( function() {
|
|||
case 'sizeperuser':
|
||||
foreach($data as $item) {
|
||||
$currUser = $dms->getUser($item['res']);
|
||||
echo "<tr><td>".htmlspecialchars($item['key'])."</td>";
|
||||
echo "<td data-sort=\"".$item['total']."\">".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
|
||||
echo "<tr><td>".$this->getKeyValue($type, $item)."</td>";
|
||||
echo "<td data-sort=\"".$item['total']."\">".$this->getTotalValue($type, (int) $item['total'])."</td>";
|
||||
if($quota) {
|
||||
echo "<td width=\"100\">";
|
||||
$qt = $currUser->getQuota() ? $currUser->getQuota() : $quota;
|
||||
|
|
@ -406,13 +435,14 @@ $(document).ready( function() {
|
|||
}
|
||||
echo "</tbody>";
|
||||
echo "<tfoot>";
|
||||
echo "<tr><th></th><th>".SeedDMS_Core_File::format_filesize($total)."<th></tr>";
|
||||
echo "<tr><th></th><th>".$this->getTotalValue($type, $total)."<th></tr>";
|
||||
echo "<tfoot>";
|
||||
break;
|
||||
case 'docspersizerange':
|
||||
case 'sizepermonth':
|
||||
foreach($data as $item) {
|
||||
echo "<tr><td>".htmlspecialchars($item['key'])."</td>";
|
||||
echo "<td data-sort=\"".$item['total']."\">".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
|
||||
echo "<tr><td>".$this->getKeyValue($type, $item)."</td>";
|
||||
echo "<td data-sort=\"".$item['total']."\">".$this->getTotalValue($type, (int) $item['total'])."</td>";
|
||||
$searchurl = $this->getSearchUrl($type, $item);
|
||||
if($searchurl)
|
||||
echo "<td><a href=\"".$searchurl."\"><i class=\"fa fa-search\"></i></a></td>";
|
||||
|
|
@ -423,7 +453,7 @@ $(document).ready( function() {
|
|||
}
|
||||
echo "</tbody>";
|
||||
echo "<tfoot>";
|
||||
echo "<tr><th></th><th>".SeedDMS_Core_File::format_filesize($total)."<th></tr>";
|
||||
echo "<tr><th></th><th>".$this->getTotalValue($type, $total)."<th></tr>";
|
||||
echo "</tfoot>";
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user