<?php
/**
* @modyfy		Stephan W. 3d-hobby-art.de
* @package		ui-TopStyle v1.0.4
************************************************************************/
?>

<table class="uk-table uk-table-hover uk-table-middle tm-width">
    <thead>
        <tr>
            <th><?php echo $node->first('rows')->attr('label') ?></th>
            <?php foreach ($node->children('field') as $field) : ?>
            <th data-uk-tooltip="{pos:'left'}" title="<?php echo $field->attr('tooltip') ?>"><?php echo $field->attr('label') ?: $field->attr('column') ?></th>
            <?php endforeach ?>
        </tr>
    </thead>
    <tbody>
        <?php foreach ($node->find('rows > row') as $row) : ?>
        <?php $id = $row->text() ?>
        <tr>
            <td><?php echo $id ?></td>
            <?php foreach ($node->children('field') as $field) : ?>
            <td>
                <?php
                    $fname = $field->attr('name');
                    $fvalue = isset($value[$id][$fname]) ? $value[$id][$fname] : $node->attr('default');

                    echo $this['field']->render($field->attr('type'), "{$name}[{$id}][{$fname}]", $fvalue, $field, compact('field'));
                ?>
            </td>
            <?php endforeach ?>
        </tr>
        <?php endforeach ?>
    </tbody>
</table>