|
@@ -133,28 +133,36 @@ class UI {
|
|
|
if ($html_id) $tableAttrs['id'] = $html_id;
|
|
if ($html_id) $tableAttrs['id'] = $html_id;
|
|
|
self::startTag('table', $tableAttrs); echo "\n";
|
|
self::startTag('table', $tableAttrs); echo "\n";
|
|
|
if ($caption) { self::tag('caption', null, $caption); echo "\n"; }
|
|
if ($caption) { self::tag('caption', null, $caption); echo "\n"; }
|
|
|
- self::startTag('thead', null); echo "\n";
|
|
|
|
|
- self::startTag('tr', null); echo "\n";
|
|
|
|
|
- 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";
|
|
|
|
|
- }
|
|
|
|
|
- self::endTag('tr'); echo "\n";
|
|
|
|
|
- self::endTag('thead'); echo "\n";
|
|
|
|
|
- self::startTag('tbody', null); echo "\n";
|
|
|
|
|
- $i = 0;
|
|
|
|
|
- foreach ($rows as $row) {
|
|
|
|
|
- $i++;
|
|
|
|
|
- $trAttrs = array();
|
|
|
|
|
- if (!empty($row['__js_on_click'])) $trAttrs['onClick'] = $row['__js_on_click'];
|
|
|
|
|
- self::startTag('tr', $trAttrs); echo "\n";
|
|
|
|
|
- if ($showLp) { self::tag('th', [ 'style' => "padding:2px; color:#ccc" ], $i); echo "\n"; }
|
|
|
|
|
|
|
+ if (!empty($cols)) {
|
|
|
|
|
+ self::startTag('thead', null); echo "\n";
|
|
|
|
|
+ self::startTag('tr', null); echo "\n";
|
|
|
|
|
+ if ($showLp) { self::tag('th', [ 'style' => "padding:2px" ], "Lp."); echo "\n"; }
|
|
|
foreach ($cols as $colName) {
|
|
foreach ($cols as $colName) {
|
|
|
if (in_array($colName, $hiddenCols)) continue;
|
|
if (in_array($colName, $hiddenCols)) continue;
|
|
|
- self::tag('td', [ 'style' => "padding:2px" ], V::get($colName, '', $row)); echo "\n";
|
|
|
|
|
|
|
+ self::tag('th', [ 'style' => "padding:2px"], $colName); echo "\n";
|
|
|
}
|
|
}
|
|
|
self::endTag('tr'); echo "\n";
|
|
self::endTag('tr'); echo "\n";
|
|
|
|
|
+ self::endTag('thead'); echo "\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ 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::endTag('tr'); echo "\n";
|
|
|
|
|
+ } else {
|
|
|
|
|
+ $i = 0;
|
|
|
|
|
+ foreach ($rows as $row) {
|
|
|
|
|
+ $i++;
|
|
|
|
|
+ $trAttrs = array();
|
|
|
|
|
+ if (!empty($row['__js_on_click'])) $trAttrs['onClick'] = $row['__js_on_click'];
|
|
|
|
|
+ self::startTag('tr', $trAttrs); echo "\n";
|
|
|
|
|
+ if ($showLp) { self::tag('th', [ 'style' => "padding:2px; color:#ccc" ], $i); echo "\n"; }
|
|
|
|
|
+ foreach ($cols as $colName) {
|
|
|
|
|
+ if (in_array($colName, $hiddenCols)) continue;
|
|
|
|
|
+ self::tag('td', [ 'style' => "padding:2px" ], V::get($colName, '', $row)); echo "\n";
|
|
|
|
|
+ }
|
|
|
|
|
+ self::endTag('tr'); echo "\n";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
self::endTag('tbody'); echo "\n";
|
|
self::endTag('tbody'); echo "\n";
|
|
|
self::endTag('table'); echo "\n";
|
|
self::endTag('table'); echo "\n";
|