<?php
echo '<h1>Übersicht</h1>';
echo '<table>';
//debug(json_decode(json_encode($results))[0]);
echo '<tr>';
//foreach (json_decode(json_encode($results))[0] as $key => $value) {
    echo '<th>snr</th><th>name</th><th>status</th><th>lieferdatum</th><th>lieferung</th><th>auftrag</th><th>sst_objekt</th>';
//}
echo '</tr>';
foreach($results as $result) {
    //debug($result);
    $resultarray = json_decode(json_encode($result));
    //debug($resultarray);
    echo '<tr>';
    echo '<td>'. $this->Html->link($resultarray->snr,'/usfails/showdetails/'. $resultarray->snr) . '</td>';
    echo '<td>'. $resultarray->name . '</td>';
    echo '<td>'. $resultarray->status . '</td>';
    $timestamp = strtotime($resultarray->lieferdatum);
    $new_date = date('Y-m-d H:i',$timestamp );
    echo '<td>'. $new_date . '</td>';
    echo '<td>'. $resultarray->lieferung . '</td>';
    echo '<td>'. $resultarray->auftrag . '</td>';
    echo '<td>'. $resultarray->sst_objekt . '</td>';
    //foreach($resultarray as $key => $value) {
    //    echo '<td>'.$value.'</td>';
    //}
    echo '</tr>';
    //debug($result);
}
echo '</table>';
