+ /* get sorting order */
+ if(sqgetGlobalVar('abook_sort_order', $temp, SQ_GET)) {
+ $abook_sort_order = (int) $temp;
+
+ if ($abook_sort_order < 0 or $abook_sort_order > 8)
+ $abook_sort_order=8;
+
+ setPref($data_dir, $username, 'abook_sort_order', $abook_sort_order);
+ } else {
+ /* get previous sorting options. default to unsorted */
+ $abook_sort_order = getPref($data_dir, $username, 'abook_sort_order', 8);
+ }
+
+ return $abook_sort_order;
+}
+
+/**
+ * This function shows the address book sort button.
+ *
+ * @param integer $abook_sort_order Current sort value
+ * @param string $alt_tag The alt tag value (string
+ * visible to text only browsers)
+ * @param integer $Down Sort value when list is sorted
+ * ascending
+ * @param integer $Up Sort value when list is sorted
+ * descending
+ * @param array $uri_extra Any additional parameters to add
+ * to the button's link, as an
+ * associative array of key/value pairs
+ * (OPTIONAL; default none)
+ *
+ * @return string html code with sorting images and urls
+ *
+ */
+function show_abook_sort_button($abook_sort_order, $alt_tag,
+ $Down, $Up, $uri_extra=array() ) {
+
+ global $form_url, $icon_theme_path;
+
+ /* Figure out which image we want to use. */
+ if ($abook_sort_order != $Up && $abook_sort_order != $Down) {
+ $img = 'sort_none.png';
+ $text_icon = '◻'; // U+25FB WHITE MEDIUM SQUARE
+ $which = $Up;
+ } elseif ($abook_sort_order == $Up) {
+ $img = 'up_pointer.png';
+ $text_icon = '⇧'; // U+21E7 UPWARDS WHITE ARROW
+ $which = $Down;
+ } else {
+ $img = 'down_pointer.png';
+ $text_icon = '⇩'; // U+21E9 DOWNWARDS WHITE ARROW
+ $which = 8;
+ }