summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Unterkircher <unki@netshadow.at>2008-01-01 11:36:44 +0100
committerAndreas Unterkircher <unki@netshadow.at>2008-01-01 11:43:40 +0100
commitbb3bcfbb5f2627788d4ee498ddbd3b7024a2d326 (patch)
tree1191f3e2f7bdf9b9f47dd941bd41b173290d9509
parent16e51d9a51305667e72131272033f1de9634b3b3 (diff)
default theme, make sort-select box a template function
-rw-r--r--phpfspot.class.php23
-rw-r--r--themes/default/templates/search.tpl4
2 files changed, 18 insertions, 9 deletions
diff --git a/phpfspot.class.php b/phpfspot.class.php
index 80f02ed..40b6551 100644
--- a/phpfspot.class.php
+++ b/phpfspot.class.php
@@ -191,9 +191,9 @@ class PHPFSPOT {
if(isset($_SESSION['from_date']) && isset($_SESSION['to_date']))
$this->tmpl->assign('date_search_enabled', true);
+ $this->tmpl->register_function("sort_select_list", array(&$this, "smarty_sort_select_list"), false);
$this->tmpl->assign('from_date', $this->get_calendar('from'));
$this->tmpl->assign('to_date', $this->get_calendar('to'));
- $this->tmpl->assign('sort_field', $this->get_sort_field());
$this->tmpl->assign('content_page', 'welcome.tpl');
$this->tmpl->show("index.tpl");
@@ -1929,20 +1929,29 @@ class PHPFSPOT {
/**
* returns a select-dropdown box to select photo index sort parameters
*/
- private function get_sort_field()
+ public function smarty_sort_select_list($params, &$smarty)
{
$output = "<select name=\"sort_order\">";
- foreach(array('date_asc', 'date_desc', 'name_asc', 'name_desc') as $sort_order) {
- $output.= "<option value=\"". $sort_order ."\"";
- if($sort_order == $_SESSION['sort_order']) {
+
+ $sorter = array(
+ 'date_asc' => 'Date &uarr;',
+ 'date_desc' => 'Date &darr;',
+ 'name_asc' => 'Name &uarr;',
+ 'name_desc' => 'Name &darr;'
+ );
+
+ foreach($sorter as $key => $value) {
+ $output.= "<option value=\"". $key ."\"";
+ if($key == $_SESSION['sort_order']) {
$output.= " selected=\"selected\"";
}
- $output.= ">". $sort_order ."</option>";
+ $output.= ">". $value ."</option>";
}
$output.= "</select>";
+
return $output;
- } // get_sort_field()
+ } // smarty_sort_select_list()
/**
* returns the currently selected sort order
diff --git a/themes/default/templates/search.tpl b/themes/default/templates/search.tpl
index 760a265..e12a099 100644
--- a/themes/default/templates/search.tpl
+++ b/themes/default/templates/search.tpl
@@ -25,7 +25,7 @@
{ else }
<input type="checkbox" name="consider_date" value="Y" onclick="datesearch();" checked="checked">
{ /if }
- consider date-search
+ consider date-range
</td>
</tr>
<tr>
@@ -46,7 +46,7 @@
Sort-Order:
</td>
<td>
- {$sort_field}
+ { sort_select_list }
</td>
<td>
<input type="image" src="resources/doit.png" alt="Tag-Search" onclick="click(this);" />