Example #1
0
    return $table;
});
HTML::macro('tableBody', function (array $keys, array $data, $resource = NULL, $showView = true, $showEdit = true, $showDelete = true) {
    $table = '<tbody>';
    foreach ($data as $d) {
        $table .= '<tr>';
        foreach ($keys as $key) {
            $table .= '<td>' . $d->{$key} . '</td>';
        }
        if ($showEdit || $showDelete || $showView) {
            $table .= '<td>';
            if ($showView) {
                $table .= HTML::details($resource, $d->id);
            }
            if ($showEdit) {
                $table .= Form::edit($resource, $d->id);
            }
            if ($showDelete) {
                $table .= Form::delete($resource, $d->id);
            }
            $table .= '</td>';
        }
        $table .= '</tr>';
    }
    $table = '</tbody>';
    return $table;
});
HTML::macro('closeTable', function () {
    $table = '</table>';
    return $table;
});