Example #1
0
    echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\">ID</th><th scope=\"col\">name</th>" . "<th scope=\"col\" class=\"sorttable_numeric\"># contests</th>" . "<th scope=\"col\">time<br />limit</th>" . "<th scope=\"col\">memory<br />limit</th>" . "<th scope=\"col\">output<br />limit</th>" . "<th scope=\"col\">test<br />cases</th>" . "<th scope=\"col\"></th>" . (IS_ADMIN ? "<th scope=\"col\"></th><th scope=\"col\"></th>" : '') . "</tr></thead>\n<tbody>\n";
    $lastcid = -1;
    while ($row = $res->next()) {
        $classes = array();
        if (!isset($activecontests[$row['probid']])) {
            $classes[] = 'disabled';
        }
        $link = '<a href="problem.php?id=' . urlencode($row['probid']) . '">';
        echo "<tr class=\"" . implode(' ', $classes) . "\"><td>" . $link . "p" . specialchars($row['probid']) . "</a>" . "</td><td>" . $link . specialchars($row['name']) . "</a>" . "</td><td>" . $link . specialchars(isset($activecontests[$row['probid']]) ? $activecontests[$row['probid']] : 0) . "</a>" . "</td><td>" . $link . (int) $row['timelimit'] . "</a>" . "</td><td>" . $link . (isset($row['memlimit']) ? (int) $row['memlimit'] : 'default') . "</a>" . "</td><td>" . $link . (isset($row['outputlimit']) ? (int) $row['outputlimit'] : 'default') . "</a>" . "</td><td><a href=\"testcase.php?probid=" . $row['probid'] . "\">" . $row['testcases'] . "</a></td>";
        if (!empty($row['problemtext_type'])) {
            echo '<td title="view problem description">' . '<a href="problem.php?id=' . urlencode($row['probid']) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($row['problemtext_type']) . '.png" alt="problem text" /></a></td>';
        } else {
            echo '<td></td>';
        }
        if (IS_ADMIN) {
            echo '<td title="export problem as zip-file">' . exportProblemLink($row['probid']) . '</td>' . "<td class=\"editdel\">" . editLink('problem', $row['probid']) . "&nbsp;" . delLink('problem', 'probid', $row['probid'], $row['name']) . "</td>";
        }
        echo "</tr>\n";
    }
    echo "</tbody>\n</table>\n\n";
}
if (IS_ADMIN) {
    echo "<p>" . addLink('problem') . "</p>\n\n";
    if (class_exists("ZipArchive")) {
        $selected_cid = $cid === null ? -1 : $cid;
        $contests = $DB->q("KEYVALUETABLE SELECT cid,\n\t\t                    CONCAT('c', cid, ': ', shortname, ' - ', name) FROM contest");
        $values = array(-1 => 'Do not link to a contest');
        foreach ($contests as $cid => $contest) {
            $values[$cid] = $contest;
        }
        echo "\n" . addForm('problem.php', 'post', null, 'multipart/form-data') . 'Contest: ' . addSelect('contest', $values, $selected_cid, true) . 'Problem archive(s): ' . addFileField('problem_archive[]', null, ' required multiple accept="application/zip"') . addSubmit('Upload', 'upload') . addEndForm() . "\n";
Example #2
0
</td></tr>
<?php 
if (!empty($data['color'])) {
    echo '<tr><td>Colour:</td><td><div class="circle" style="background-color: ' . specialchars($data['color']) . ';"></div> ' . specialchars($data['color']) . "</td></tr>\n";
}
if (!empty($data['problemtext_type'])) {
    echo '<tr><td>Problem text:</td><td class="nobreak"><a href="problem.php?id=' . urlencode($id) . '&amp;cmd=viewtext"><img src="../images/' . urlencode($data['problemtext_type']) . '.png" alt="problem text" ' . 'title="view problem description" /></a> ' . "</td></tr>\n";
}
echo '<tr><td>Run script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_run']) . '">' . specialchars($data['special_run']) . "</a>" . (@$defaultrun ? ' (default)' : '') . "</td></tr>\n";
echo '<tr><td>Compare script:</td><td class="filename">' . '<a href="executable.php?id=' . urlencode($data['special_compare']) . '">' . specialchars($data['special_compare']) . "</a>" . (@$defaultcompare ? ' (default)' : '') . "</td></tr>\n";
if (!empty($data['special_compare_args'])) {
    echo '<tr><td>Compare script arguments:</td><td>' . specialchars($data['special_compare_args']) . "</td></tr>\n";
}
echo "</table>\n" . addEndForm();
if (IS_ADMIN) {
    echo "<p>" . exportProblemLink($id) . "\n" . editLink('problem', $id) . "\n" . delLink('problem', 'probid', $id, $data['name']) . "</p>\n\n";
}
echo rejudgeForm('problem', $id) . "<br />\n\n";
if ($current_cid === null) {
    echo "<h3>Contests</h3>\n\n";
    $res = $DB->q('TABLE SELECT c.*, cp.shortname AS problemshortname,
	                            cp.allow_submit, cp.allow_judge, cp.color
	               FROM contest c
	               INNER JOIN contestproblem cp USING (cid)
	               WHERE cp.probid = %i ORDER BY starttime DESC', $id);
    if (count($res) == 0) {
        echo "<p class=\"nodata\">No contests defined</p>\n\n";
    } else {
        $times = array('activate', 'start', 'freeze', 'end', 'unfreeze');
        echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">CID</th>";
        echo "<th scope=\"col\">contest<br />shortname</th>\n";