瀏覽代碼

Functions - th_order_by: Order column asc on first click.

fusionate 4 年之前
父節點
當前提交
a9388f8bdf
共有 1 個文件被更改,包括 10 次插入4 次删除
  1. 10 4
      resources/functions.php

+ 10 - 4
resources/functions.php

@@ -438,12 +438,18 @@
 			if (strlen($order_by) == 0) {
 				$order = 'asc';
 			}
-			if ($order == "asc") {
-				$description .= $text['label-order'].': '.$text['label-ascending'];
-				$html .= "<a href='?order_by=".urlencode($field_name)."&order=desc".$app_uuid.$sanitized_parameters."' title=\"".escape($description)."\">".escape($column_title)."</a>";
+			if ($order_by == $field_name) {
+				if ($order == "asc") {
+					$description .= $text['label-order'].' '.$text['label-descending'];
+					$html .= "<a href='?order_by=".urlencode($field_name)."&order=desc".$app_uuid.$sanitized_parameters."' title=\"".escape($description)."\">".escape($column_title)."</a>";
+				}
+				else {
+					$description .= $text['label-order'].' '.$text['label-ascending'];
+					$html .= "<a href='?order_by=".urlencode($field_name)."&order=asc".$app_uuid.$sanitized_parameters."' title=\"".escape($description)."\">".escape($column_title)."</a>";
+				}
 			}
 			else {
-				$description .= $text['label-order'].': '.$text['label-descending'];
+				$description .= $text['label-order'].' '.$text['label-ascending'];
 				$html .= "<a href='?order_by=".urlencode($field_name)."&order=asc".$app_uuid.$sanitized_parameters."' title=\"".escape($description)."\">".escape($column_title)."</a>";
 			}
 			$html .= "</th>";