Skip to content
Permalink
Browse files

remember search sorting options when switching pages

  • Loading branch information...
following5 committed Feb 29, 2016
1 parent 108c673 commit ce517618c07a8da3c716650afba5024ddfb76034
Showing with 18 additions and 18 deletions.
  1. +8 −4 htdocs/lib2/search/search.html.inc.php
  2. +10 −14 htdocs/search.php
@@ -112,7 +112,12 @@ function search_output()
$tpl->assign('caches', $caches);
$pager = new pager('search.php?queryid=' . $options['queryid'] . '&startat={offset}', 2, 9);
$page = 'search.php?queryid=' . $options['queryid'] . '&startat={offset}&sortby='.$options['sort'];
if (isset($options['sortorder']) && $options['sortorder'])
$page .= "&sortorder=".$options['sortorder'];
if (isset($options['creationdate']) && $options['creationdate'])
$page .= "&creationdate=".$options['creationdate'];
$pager = new pager($page, 2, 9);
$pager->make_from_offset($startat, $resultcount, $caches_per_page);
// downloads
@@ -144,11 +149,10 @@ function search_output()
$tpl->assign('sortby', $options['sort']);
if (isset($options['sortorder'])) {
$tpl->assign('sortorder', $options['sortorder']);
} else {
$options['sortorder']="";
}
if ($options['sort']=='bycreated' || isset($options['creationdate']))
if ($options['sort']=='bycreated' || isset($options['creationdate'])) {
$tpl->assign('creationdate', true);
}
// cachelist data
if (isset($options['cachelist']))
@@ -185,21 +185,11 @@
$options['showresult'] = 0;
}
// overwrite variable options for sort direction & sort type
// overwrite variable options; see 'set common variable options' for more
if (isset($_REQUEST['sortby'])) {
$options['sort'] = $_REQUEST['sortby'];
}
if (isset($_REQUEST['sortorder'])) {
$options['sortorder'] = $_REQUEST['sortorder'];
}
// display creation date?
if (isset($_REQUEST['creationdate'])) {
$options['creationdate'] = $_REQUEST['creationdate'];
}
// get findername from finderid
$options['finderid'] = isset($options['finderid']) ? $options['finderid'] + 0 : 0; // Ocprop
if (isset($options['finder']) && $options['finderid'] > 0)
@@ -438,10 +428,9 @@
}
$options['sort'] = isset($_REQUEST['sort']) ? $_REQUEST['sort'] : ($homecoords ? 'bydistance' : 'byname');
$options['sortorder'] = isset($_REQUEST['sortorder']) ? $_REQUEST['sortorder'] : false;
if (isset($_REQUEST['orderRatingFirst']) && $_REQUEST['orderRatingFirst']==1)
if (isset($_REQUEST['orderRatingFirst']) && $_REQUEST['orderRatingFirst']==1) {
$options['orderRatingFirst'] = true;
}
$options['country'] = isset($_REQUEST['country']) ? $_REQUEST['country'] : '';
$options['language'] = isset($_REQUEST['language']) ? $_REQUEST['language'] : '';
@@ -473,6 +462,13 @@
$options['queryid'] = 0;
} // $queryid == 0
// set common variable options
if (isset($_REQUEST['sortorder'])) {
$options['sortorder'] = $_REQUEST['sortorder'];
}
if (isset($_REQUEST['creationdate'])) {
$options['creationdate'] = $_REQUEST['creationdate'];
}
//=========================================================
// 3. query caching

0 comments on commit ce51761

Please sign in to comment.
You can’t perform that action at this time.