Ejemplo n.º 1
0
 function write_judges($judges)
 {
     if (empty($judges)) {
         echo "<em>There are no active judges!</em>";
         return;
     }
     echo "<table>";
     echo "<tr><th>Name</th><th>Status</th><th>Started</th><th>Last heared from</th></tr>";
     foreach ($judges as $judge) {
         echo "<tr>";
         echo "<td>" . htmlspecialchars($judge->name);
         echo "<td>" . $judge->status_text();
         echo "<td>" . format_date_compact($judge->start_time);
         echo "<td>" . (time() - $judge->ping_time) . " second(s) ago";
         echo "<td>";
         $links = array();
         if ($judge->status == JudgeDaemon::PAUSED) {
             $links['unpause'] = "admin_judge_daemons.php?judgeid={$judge->judgeid}&amp;status=" . JudgeDaemon::ACTIVE;
         } else {
             $links['pause'] = "admin_judge_daemons.php?judgeid={$judge->judgeid}&amp;status=" . JudgeDaemon::PAUSED;
         }
         $links['stop'] = "admin_judge_daemons.php?judgeid={$judge->judgeid}&amp;status=" . JudgeDaemon::MUST_STOP;
         $links['restart'] = "admin_judge_daemons.php?judgeid={$judge->judgeid}&amp;status=" . JudgeDaemon::MUST_RESTART;
         $this->write_links($links);
         echo "</tr>";
     }
     echo "</table>";
     // Control all
     $links = array();
     $links['unpause all'] = "admin_judge_daemons.php?judgeid=all&amp;status=" . JudgeDaemon::ACTIVE;
     $links['pause all'] = "admin_judge_daemons.php?judgeid=all&amp;status=" . JudgeDaemon::PAUSED;
     $links['stop all'] = "admin_judge_daemons.php?judgeid=all&amp;status=" . JudgeDaemon::MUST_STOP;
     $links['restart all'] = "admin_judge_daemons.php?judgeid=all&amp;status=" . JudgeDaemon::MUST_RESTART;
     $this->write_links($links);
 }
Ejemplo n.º 2
0
 function write_entries($entries)
 {
     echo "<table>";
     echo "<tr><th>Time</th><th>Type</th><th>Entity</th><th>Message</th><th>Judge host</th><th>User</th><th>IP</th></tr>";
     foreach ($entries as $entry) {
         echo "<tr>";
         echo "<td>" . format_date_compact($entry->time);
         echo "<td>" . htmlspecialchars(LogLevel::toString($entry->level));
         echo "<td>" . ($entry->entity_path ? "<a href=\"index.php" . htmlspecialchars($entry->entity_path) . "\">" . $entry->entity_path . "</a>" : "-");
         echo "<td>" . nl2br(htmlspecialchars($entry->message));
         echo "<td>" . ($entry->judge_host ? htmlspecialchars($entry->judge_host) : '-');
         echo "<td>" . ($entry->userid ? htmlspecialchars(User::by_id($entry->userid, false)->name_and_login()) : '-');
         echo "<td>" . ($entry->ip ? htmlspecialchars($entry->ip) : '-');
         echo "</tr>";
     }
     echo "</table>";
 }