add search link in tables

This commit is contained in:
Uwe Steinmann 2025-04-23 14:24:31 +02:00
parent 67a2afc626
commit 6a39584dcc

View File

@ -244,6 +244,41 @@ $(document).ready( function() {
return true;
} /* }}} */
protected function getSearchUrl($type, $item) {
$dms = $this->params['dms'];
$searchurl = null;
switch($type) {
case 'docsperuser':
case 'sizeperuser':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&owner%5B%5D='.$item['res'];
break;
case 'foldersperuser':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=2&owner%5B%5D='.$item['res'];
break;
case 'docspercategory':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&category%5B%5D='.$item['res'];
break;
case 'docsperstatus':
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&status%5B%5D='.$item['res'];
break;
case 'docspermonth':
case 'sizepermonth':
$startmonth = $item['key'].'-01';
$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 'docspermimetype':
break;
case 'docsaccumulated':
$start = date('Y-m-d', $item['key']/1000);
$end = date('Y-m-d', $item['key']/1000 + 86400);
$searchurl = $settings->_httpRoot.'/out/out.Search.php?fullsearch=0&query=&mode=1&orderby=&resultmode=1&created%5Bfrom%5D='.$start.'&created%5Bto%5D='.$end;
break;
}
return $searchurl;
}
public function show() { /* {{{ */
$dms = $this->params['dms'];
$user = $this->params['user'];
@ -293,6 +328,7 @@ $(document).ready( function() {
$types[] = 'sizeperuser';
if(in_array($type, $types))
echo "<th></th>";
echo "<th>Search</th>";
echo "</tr>";
$total = 0;
switch($type) {
@ -309,6 +345,11 @@ $(document).ready( function() {
echo "<td>".$item['total']."</td>";
if(in_array($type, array('docspermonth')))
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
$searchurl = $this->getSearchUrl($type, $item);
if($searchurl)
echo "<td><a href=\"".$searchurl."\"><i class=\"fa fa-search\"></i></a></td>";
else
echo "<td></td>";
echo "</tr>";
$oldtotal = $item['total'];
$total += $item['total'];
@ -322,6 +363,11 @@ $(document).ready( function() {
echo "<td>".getReadableDate($item['key']/1000)."</td>";
echo "<td>".$item['total']."</td>";
echo "<td>".sprintf('%+d', $item['total']-$oldtotal)."</td>";
$searchurl = $this->getSearchUrl($type, $item);
if($searchurl)
echo "<td><a href=\"".$searchurl."\"><i class=\"fa fa-search\"></i></a></td>";
else
echo "<td></td>";
echo "</tr>";
$oldtotal = $item['total'];
$total += $item['total'];
@ -338,6 +384,11 @@ $(document).ready( function() {
echo $this->getProgressBar($currUser->getUsedDiskSpace(), $qt);
echo "</td>";
}
$searchurl = $this->getSearchUrl($type, $item);
if($searchurl)
echo "<td><a href=\"".$searchurl."\"><i class=\"fa fa-search\"></i></a></td>";
else
echo "<td></td>";
echo "</tr>";
$total += $item['total'];
}
@ -345,7 +396,13 @@ $(document).ready( function() {
break;
case 'sizepermonth':
foreach($data as $item) {
echo "<tr><td>".htmlspecialchars($item['key'])."</td><td>".SeedDMS_Core_File::format_filesize((int) $item['total'])."</td></tr>";
echo "<tr><td>".htmlspecialchars($item['key'])."</td><td>".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>";
else
echo "<td></td>";
echo "</tr>";
$total += $item['total'];
}
echo "<tr><th></th><th>".SeedDMS_Core_File::format_filesize($total)."<th></tr>";