summaryrefslogtreecommitdiffstats
path: root/phpfspot.class.php
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 /phpfspot.class.php
parent16e51d9a51305667e72131272033f1de9634b3b3 (diff)
default theme, make sort-select box a template function
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r--phpfspot.class.php23
1 files changed, 16 insertions, 7 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