tables can be sorted, better header for first column

This commit is contained in:
Uwe Steinmann 2026-02-10 12:09:51 +01:00
parent aa79261205
commit c552e4bb9f

View File

@ -32,6 +32,7 @@ class SeedDMS_View_Charts extends SeedDMS_Theme_Style {
header('Content-Type: application/javascript; charset=UTF-8');
?>
new Tablesort(document.getElementById('charttable'));
$("<div id='tooltip'></div>").css({
position: "absolute",
display: "none",
@ -293,6 +294,8 @@ $(document).ready( function() {
'<script type="text/javascript" src="../styles/bootstrap/flot/jquery.flot.pie.min.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/flot/jquery.flot.categories.min.js"></script>'."\n".
'<script type="text/javascript" src="../styles/bootstrap/flot/jquery.flot.time.min.js"></script>'."\n");
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/tablesort/tablesort.min.js"></script>'."\n", 'js');
$this->htmlAddHeader('<script type="text/javascript" src="../views/'.$this->theme.'/vendors/tablesort/sorts/tablesort.number.min.js"></script>'."\n", 'js');
$this->htmlStartPage(getMLText("folders_and_documents_statistic"));
$this->globalNavigation();
@ -321,9 +324,10 @@ $(document).ready( function() {
<div id="chart" style="height: 400px;" class="chart"></div>
<?php
$this->contentContainerEnd();
echo "<table class=\"table table-condensed table-sm table-hover\">";
echo "<table id=\"charttable\" class=\"table table-condensed table-sm table-hover\">";
echo "<thead>";
echo "<tr>";
echo "<th>".getMLText('chart_'.$type.'_title')."</th>";
echo "<th>".getMLText('chart_'.$type.'_first_col')."</th>";
echo "<th>".getMLText('total')."</th>";
$types = array('docspermonth', 'docsaccumulated');
if($quota)
@ -332,6 +336,8 @@ $(document).ready( function() {
echo "<th></th>";
echo "<th>Search</th>";
echo "</tr>";
echo "</thead>";
echo "<tbody>";
$total = 0;
switch($type) {
case 'docspermonth':
@ -343,7 +349,7 @@ $(document).ready( function() {
$oldtotal = 0;
foreach($data as $item) {
echo "<tr>";
echo "<td>".htmlspecialchars($item['key'])."</td>";
echo "<td data-sort=\"".$item['key']."\">".htmlspecialchars($item['key'])."</td>";
echo "<td>".$item['total']."</td>";
if(in_array($type, array('docspermonth')))
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
@ -356,13 +362,16 @@ $(document).ready( function() {
$oldtotal = $item['total'];
$total += $item['total'];
}
echo "</tbody>";
echo "<tfoot>";
echo "<tr><th></th><th>".$total."<th></tr>";
echo "</tfoot>";
break;
case 'docsaccumulated':
$oldtotal = 0;
foreach($data as $item) {
echo "<tr>";
echo "<td>".getReadableDate($item['key']/1000)."</td>";
echo "<td data-sort=\"".$item['key']."\">".getReadableDate($item['key']/1000)."</td>";
echo "<td>".$item['total']."</td>";
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
$searchurl = $this->getSearchUrl($type, $item);
@ -374,12 +383,13 @@ $(document).ready( function() {
$oldtotal = $item['total'];
$total += $item['total'];
}
echo "</tbody>";
break;
case 'sizeperuser':
foreach($data as $item) {
$currUser = $dms->getUser($item['res']);
echo "<tr><td>".htmlspecialchars($item['key'])."</td>";
echo "<td>".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
echo "<td data-sort=\"".$item['total']."\">".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
if($quota) {
echo "<td width=\"100\">";
$qt = $currUser->getQuota() ? $currUser->getQuota() : $quota;
@ -394,11 +404,15 @@ $(document).ready( function() {
echo "</tr>";
$total += $item['total'];
}
echo "</tbody>";
echo "<tfoot>";
echo "<tr><th></th><th>".SeedDMS_Core_File::format_filesize($total)."<th></tr>";
echo "<tfoot>";
break;
case 'sizepermonth':
foreach($data as $item) {
echo "<tr><td>".htmlspecialchars($item['key'])."</td><td>".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
echo "<tr><td>".htmlspecialchars($item['key'])."</td>";
echo "<td data-sort=\"".$item['total']."\">".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td>";
$searchurl = $this->getSearchUrl($type, $item);
if($searchurl)
echo "<td><a href=\"".$searchurl."\"><i class=\"fa fa-search\"></i></a></td>";
@ -407,7 +421,10 @@ $(document).ready( function() {
echo "</tr>";
$total += $item['total'];
}
echo "</tbody>";
echo "<tfoot>";
echo "<tr><th></th><th>".SeedDMS_Core_File::format_filesize($total)."<th></tr>";
echo "</tfoot>";
break;
}
echo "</table>";