diff options
Diffstat (limited to 'phpfspot.class.php')
-rw-r--r-- | phpfspot.class.php | 23 |
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 ↑', + 'date_desc' => 'Date ↓', + 'name_asc' => 'Name ↑', + 'name_desc' => 'Name ↓' + ); + + 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 |