summaryrefslogtreecommitdiffstats
path: root/lib/helper/SortHeaderHelper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/helper/SortHeaderHelper.php')
-rw-r--r--lib/helper/SortHeaderHelper.php21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/helper/SortHeaderHelper.php b/lib/helper/SortHeaderHelper.php
new file mode 100644
index 0000000..ef16eb1
--- /dev/null
+++ b/lib/helper/SortHeaderHelper.php
@@ -0,0 +1,21 @@
+<?php
+
+use_helper("Asset");
+
+function sortheader_link_to($caption, $targetURI, $column, $headers)
+{
+ $uri = $targetURI."?sort=".$column;
+ if($headers[$column])
+ $uri .= "&type=".($headers[$column]=="asc" ? "desc": "asc");
+ return link_to($caption, $uri);
+}
+
+function sortheader_type_if($column, $headers, $asc, $desc)
+{
+ if($headers[$column])
+ {
+ return ($headers[$column]=="asc" ? $asc: $desc);
+ }
+}
+
+?>