adding ordering of result for database search

This commit is contained in:
Uwe Steinmann 2019-06-26 18:03:36 +02:00
parent 3ab6d050cd
commit 619a1de980

View File

@ -88,6 +88,7 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
$expirationdate = $this->params['expirationdate'];
$status = $this->params['status'];
$this->query = $this->params['query'];
$orderby = $this->params['orderby'];
$entries = $this->params['searchhits'];
$totalpages = $this->params['totalpages'];
$pageNumber = $this->params['pagenumber'];
@ -219,7 +220,6 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
</table>
<?php
$this->contentContainerEnd();
// }}}
/* First check if any of the folder filters are set. If it is,
* open the accordion.
@ -369,6 +369,9 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
</div>
</div>
</div>
<?php
// }}}
?>
</form>
</div>
<?php
@ -459,10 +462,18 @@ class SeedDMS_View_Search extends SeedDMS_Bootstrap_Style {
if(is_string($txt))
echo $txt;
else {
parse_str($_SERVER['QUERY_STRING'], $tmp);
$tmp['orderby'] = $orderby=="n"||$orderby=="na)"?"nd":"n";
print "<table class=\"table table-hover\">";
print "<thead>\n<tr>\n";
print "<th></th>\n";
print "<th>".getMLText("name")."</th>\n";
print "<th>".getMLText("name");
if(!$fullsearch) {
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_name")."\">".($orderby=="n"||$orderby=="na"?' <i class="icon-sort-by-alphabet selected"></i>':($orderby=="nd"?' <i class="icon-sort-by-alphabet-alt selected"></i>':' <i class="icon-sort-by-alphabet"></i>'))."</a>";
$tmp['orderby'] = $orderby=="d"||$orderby=="da)"?"dd":"d";
print " <a href=\"../out/out.Search.php?".http_build_query($tmp)."\" title=\"".getMLText("sort_by_date")."\">".($orderby=="d"||$orderby=="da"?' <i class="icon-sort-by-attributes selected"></i>':($orderby=="dd"?' <i class="icon-sort-by-attributes-alt selected"></i>':' <i class="icon-sort-by-attributes"></i>'))."</a>";
}
print "</th>\n";
//print "<th>".getMLText("attributes")."</th>\n";
print "<th>".getMLText("status")."</th>\n";
print "<th>".getMLText("action")."</th>\n";