/**
 * Show clarification thread and reply box.
 * When no id is given, show clarification request box.
 *
 * Part of the DOMjudge Programming Contest Jury System and licenced
 * under the GNU GPL. See README and COPYING for details.
 */
require 'init.php';
$id = getRequestID();
if (isset($id)) {
    $req = $DB->q('MAYBETUPLE SELECT * FROM clarification
	               WHERE cid = %i AND clarid = %i', $cid, $id);
    if (!$req) {
        error("clarification {$id} not found");
    }
    if (!canViewClarification($teamid, $req)) {
        error("Permission denied");
    }
    $myrequest = $req['sender'] == $teamid;
    $respid = empty($req['respid']) ? $id : $req['respid'];
}
// insert a request (if posted)
if (isset($_POST['submit']) && !empty($_POST['bodytext'])) {
    list($cid, $probid) = explode('-', $_POST['problem']);
    $category = NULL;
    if (!ctype_digit($probid)) {
        $category = $probid;
        $probid = NULL;
    }
    // Disallow problems that are not submittable or
    // before contest start.
Beispiel #2
0
/**
 * Print a list of clarifications in a table with links to the clarifications.
 */
function putClarificationList($clars, $team = NULL)
{
    global $username, $cids;
    if ($team == NULL && !IS_JURY) {
        error("access denied to clarifications: you seem to be team nor jury");
    }
    echo "<table class=\"list sortable\">\n<thead>\n<tr>" . (IS_JURY ? "<th scope=\"col\">ID</th>" : "") . (IS_JURY && count($cids) > 1 ? "<th scope=\"col\">contest</th>" : "") . "<th scope=\"col\">time</th>" . "<th scope=\"col\">from</th>" . "<th scope=\"col\">to</th><th scope=\"col\">subject</th>" . "<th scope=\"col\">text</th>" . (IS_JURY ? "<th scope=\"col\">answered</th><th scope=\"col\">by</th>" : "") . "</tr>\n</thead>\n<tbody>\n";
    while ($clar = $clars->next()) {
        // check viewing permission for teams
        if (!IS_JURY && !canViewClarification($team, $clar)) {
            continue;
        }
        $clar['clarid'] = (int) $clar['clarid'];
        $link = '<a href="clarification.php?id=' . urlencode($clar['clarid']) . '">';
        if (isset($clar['unread'])) {
            echo '<tr class="unread">';
        } else {
            echo '<tr>';
        }
        if (IS_JURY) {
            echo '<td>' . $link . $clar['clarid'] . '</a></td>';
        }
        echo IS_JURY && count($cids) > 1 ? '<td>' . $link . $clar['contestshortname'] . '</a></td>' : '';
        echo '<td>' . $link . printtime($clar['submittime']) . '</a></td>';
        if ($clar['sender'] == NULL) {
            $sender = 'Jury';
            if ($clar['recipient'] == NULL) {
                $recipient = 'All';
            } else {
                $recipient = htmlspecialchars($clar['toname']);
            }
        } else {
            $sender = htmlspecialchars($clar['fromname']);
            $recipient = 'Jury';
        }
        echo '<td>' . $link . $sender . '</a></td>' . '<td>' . $link . $recipient . '</a></td>';
        echo '<td>' . $link;
        if (is_null($clar['probid'])) {
            echo "general";
        } else {
            echo "problem " . $clar['shortname'];
        }
        echo "</a></td>";
        echo '<td class="clartext">' . $link . summarizeClarification($clar['body']) . "</a></td>";
        if (IS_JURY) {
            unset($answered, $jury_member);
            $claim = FALSE;
            $answered = printyn($clar['answered']);
            if (empty($clar['jury_member'])) {
                $jury_member = '&nbsp;';
            } else {
                $jury_member = htmlspecialchars($clar['jury_member']);
            }
            if (!$clar['answered']) {
                if (empty($clar['jury_member'])) {
                    $claim = TRUE;
                } else {
                    $answered = 'claimed';
                }
            }
            echo "<td>{$link} {$answered}</a></td><td>";
            if ($claim && isset($clar['sender'])) {
                echo "<a class=\"button\" href=\"clarification.php?claim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">claim</a>";
            } else {
                if (!$clar['answered'] && $jury_member == $username) {
                    echo "<a class=\"button\" href=\"clarification.php?unclaim=1&amp;id=" . htmlspecialchars($clar['clarid']) . "\">unclaim</a>";
                } else {
                    echo "{$link} {$jury_member}</a>";
                }
            }
            echo "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}