Przeglądaj źródła

added cols_label in UI::table

Piotr Labudda 8 lat temu
rodzic
commit
6c0ff01a9e
1 zmienionych plików z 8 dodań i 1 usunięć
  1. 8 1
      SE/se-lib/UI.php

+ 8 - 1
SE/se-lib/UI.php

@@ -114,6 +114,7 @@ class UI {
 		$cols = V::get('cols', array(), $params);
 		$rows = V::get('rows', array(), $params);
 		$cols_help = V::get('cols_help', array(), $params);
+		$cols_label = V::get('cols_label', array(), $params);
 		$caption = V::get('caption', '', $params);
 		$cellPadding = V::get('cell_padding', 2, $params, 'int');
 		$showLp = (!V::get('disable_lp', false, $params));
@@ -145,6 +146,12 @@ class UI {
 				], "");
 			}
 		}
+		{
+			$label = array();
+			foreach ($cols as $name) {
+				$label[$name] = V::get($name, $name, $cols_label);
+			}
+		}
 		// if (empty($cols)) return;
 		$hiddenCols = V::get('hidden_cols', array(), $params);
 
@@ -160,7 +167,7 @@ class UI {
 			foreach ($cols as $colName) {
 				if (in_array($colName, $hiddenCols)) continue;
 				echo self::h('th', [ 'style' => "padding:{$cellPadding}px" ], [
-					$colName,
+					$label[$colName],
 					" " . V::get($colName, '', $help)
 				]);
 				echo "\n";