$min_task = $task[0]; foreach ($tasks as $task) { if ($min <= $task->available_time()) { continue; } $min = $task->available_time(); $min_task = $task; } if ($min < time()) { echo " starting immediately"; } else { echo " starting in " . time_diff(time(), $min); echo "<br><a href='?start=" . $task->id . "'>(overide)"; } } } else { echo "empty"; } echo "<td>"; if ($last = $queue->last_finished_task()) { echo "finished "; echo "<span title='" . date("G:i d/m/Y", $last->finish_time()) . "'>" . time_ago($last->finish_time()) . " ago, </span>"; echo "(took " . time_diff($last->start_time(), $last->finish_time()) . ")"; if ($last->hasError()) { echo " unsuccesfull (error: " . htmlspecialchars($last->error()) . ")"; } } else { echo "/"; } } echo "</table>";