Merges from upstream Kabuki.

This commit is contained in:
2017-11-05 16:27:12 +01:00
parent 31e1357b47
commit 1a15e347f2
6 changed files with 35 additions and 25 deletions

View File

@@ -114,15 +114,16 @@ class GenericTable extends PageIndex
private function parseAllRows($rows, $options)
{
// Parse all rows...
$i = 0;
foreach ($rows as $row)
foreach ($rows as $i => $row)
{
$i ++;
$newRow = array(
'class' => $i %2 == 1 ? 'odd' : 'even',
'cells' => array(),
);
$className = $i & 1 ? 'even' : 'odd';
if (isset($options['row_classifier']))
$className .= $options['row_classifier']($row);
$newRow = [
'class' => $className,
'cells' => [],
];
foreach ($options['columns'] as $column)
{
@@ -154,7 +155,12 @@ class GenericTable extends PageIndex
// timestamps: let's make them readable!
case 'timestamp':
$pattern = !empty($column['parse']['data']['pattern']) && $column['parse']['data']['pattern'] == 'long' ? '%F %H:%M' : '%H:%M';
if (empty($column['parse']['data']['pattern']) || $column['parse']['data']['pattern'] === 'long')
$pattern = '%F %H:%M';
elseif ($column['parse']['data']['pattern'] === 'short')
$pattern = '%F';
else
$pattern = $column['parse']['data']['pattern'];
if (!is_numeric($row[$column['parse']['data']['timestamp']]))
$timestamp = strtotime($row[$column['parse']['data']['timestamp']]);