Browse Source

Enhance [master] add column descriptions to xml_cdr (#2571)

update th_order_by to accept optional description parameter that will
populate the title field and append the , sort(order)
Mafoo 8 years ago
parent
commit
4323fda251
1 changed files with 9 additions and 9 deletions
  1. 9 9
      resources/functions.php

+ 9 - 9
resources/functions.php

@@ -460,20 +460,20 @@
 
 	if (!function_exists('th_order_by')) {
 		//html table header order by
-		function th_order_by($field_name, $columntitle, $order_by, $order, $app_uuid = '', $css = '', $additional_get_params='') {
+		function th_order_by($field_name, $columntitle, $order_by, $order, $app_uuid = '', $css = '', $additional_get_params='', $description='') {
 			if (strlen($app_uuid) > 0) { $app_uuid = "&app_uuid=".$app_uuid; }	// accomodate need to pass app_uuid where necessary (inbound/outbound routes lists)
 			if (strlen($additional_get_params) > 0) {$additional_get_params = '&'.$additional_get_params; } // you may need to pass other parameters
 			$html = "<th ".$css." nowrap>";
-			if (strlen($order_by)==0) {
-				$html .= "<a href='?order_by=$field_name&order=desc".$app_uuid."$additional_get_params' title='ascending'>$columntitle</a>";
+			$description = (strlen($description) > 0) ? $description . ', ': '';
+			if (strlen($order_by) == 0)
+				$order = 'asc';
+			if ($order == "asc") {
+				$description .= 'sort(ascending)';
+				$html .= "<a href='?order_by=$field_name&order=desc".$app_uuid."$additional_get_params' title='$description'>$columntitle</a>";
 			}
 			else {
-				if ($order=="asc") {
-					$html .= "<a href='?order_by=$field_name&order=desc".$app_uuid."$additional_get_params' title='ascending'>$columntitle</a>";
-				}
-				else {
-					$html .= "<a href='?order_by=$field_name&order=asc".$app_uuid."$additional_get_params' title='descending'>$columntitle</a>";
-				}
+				$description .= 'sort(descending)';
+				$html .= "<a href='?order_by=$field_name&order=asc".$app_uuid."$additional_get_params' title='$description'>$columntitle</a>";
 			}
 			$html .= "</th>";
 			return $html;