function get_queued_tasks() { $qTask = mysql_query("SELECT id\n FROM control_task_queue\n WHERE control_unit_id = {$this->unit_id} AND\n start = 0\n ORDER BY id LIMIT 1") or die(mysql_error()); $tasks = array(); while ($task = mysql_fetch_object($qTask)) { $tasks[] = QueuedTask::FromId($task->id); } return $tasks; }
} $etime = $reference - $ptime; if ($etime < 1) { return '0 seconds'; } $interval = array(12 * 30 * 24 * 60 * 60 => 'year', 30 * 24 * 60 * 60 => 'month', 24 * 60 * 60 => 'day', 60 * 60 => 'hour', 60 => 'minute', 1 => 'second'); foreach ($interval as $secs => $str) { $d = $etime / $secs; if ($d >= 1) { $r = round($d); return $r . ' ' . $str . ($r > 1 ? 's' : ''); } } } if ($task_id = GET_int("start")) { $task = QueuedTask::FromId($task_id); if ($task && $task->finish_time() == 0) { $task->set_available_time(0); } } echo "<table width='100%'>"; echo "<thead>"; echo "<th>Control unit id</th>"; echo "<th>Machine and mode"; echo "<th>Status"; echo "<th>Queue"; echo "<th>Last finished task"; echo "</thead>"; $qUnits = mysql_query("SELECT * FROM control_unit"); while ($unit = mysql_fetch_object($qUnits)) { echo "<tr><td>" . $unit->id;