|
|
@@ -113,8 +113,10 @@ class UI {
|
|
|
public static function table($params) {
|
|
|
$cols = V::get('cols', array(), $params);
|
|
|
$rows = V::get('rows', array(), $params);
|
|
|
+ $cols_help = V::get('cols_help', array(), $params);
|
|
|
$caption = V::get('caption', '', $params);
|
|
|
$showLp = (!V::get('disable_lp', false, $params));
|
|
|
+ $countCols = 1;
|
|
|
if (empty($cols) && !empty($rows)) {
|
|
|
$firstRow = array();
|
|
|
foreach ($rows as $row) {
|
|
|
@@ -128,6 +130,19 @@ class UI {
|
|
|
}
|
|
|
);
|
|
|
}
|
|
|
+ $countCols = count($cols);
|
|
|
+ $countCols = ($showLp) ? $countCols + 1 : $countCols;
|
|
|
+ {
|
|
|
+ $help = array();
|
|
|
+ foreach ($cols as $name) {
|
|
|
+ $helpMsg = V::get($name, '', $cols_help);
|
|
|
+ if (empty($helpMsg)) continue;
|
|
|
+ $help[$name] = self::h('i', [
|
|
|
+ 'class' => "glyphicon glyphicon-question-sign",
|
|
|
+ 'title' => $helpMsg
|
|
|
+ ], "");
|
|
|
+ }
|
|
|
+ }
|
|
|
// if (empty($cols)) return;
|
|
|
$hiddenCols = V::get('hidden_cols', array(), $params);
|
|
|
|
|
|
@@ -142,7 +157,11 @@ class UI {
|
|
|
if ($showLp) { self::tag('th', [ 'style' => "padding:2px" ], "Lp."); echo "\n"; }
|
|
|
foreach ($cols as $colName) {
|
|
|
if (in_array($colName, $hiddenCols)) continue;
|
|
|
- self::tag('th', [ 'style' => "padding:2px"], $colName); echo "\n";
|
|
|
+ echo self::h('th', [ 'style' => "padding:2px" ], [
|
|
|
+ $colName,
|
|
|
+ " " . V::get($colName, '', $help)
|
|
|
+ ]);
|
|
|
+ echo "\n";
|
|
|
}
|
|
|
self::endTag('tr'); echo "\n";
|
|
|
self::endTag('thead'); echo "\n";
|
|
|
@@ -150,7 +169,7 @@ class UI {
|
|
|
self::startTag('tbody', null); echo "\n";
|
|
|
if (empty($rows)) {
|
|
|
self::startTag('tr'); echo "\n";
|
|
|
- self::tag('td', [ 'style' => "padding:2px" ], V::get('empty_msg', "Brak danych", $params)); echo "\n";
|
|
|
+ self::tag('td', [ 'style' => "padding:2px", 'colspan' => $countCols ], V::get('empty_msg', "Brak danych", $params)); echo "\n";
|
|
|
self::endTag('tr'); echo "\n";
|
|
|
} else {
|
|
|
$i = 0;
|