本文整理汇总了PHP中getCurContests函数的典型用法代码示例。如果您正苦于以下问题:PHP getCurContests函数的具体用法?PHP getCurContests怎么用?PHP getCurContests使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getCurContests函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: addForm
</td></tr>
</table>
<?php
if (IS_ADMIN) {
$cmd = $row['active'] == 1 ? 'deactivate' : 'activate';
echo addForm($pagename) . "<p>\n" . addHidden('id', $row['hostname']) . addHidden('cmd', $cmd) . addSubmit($cmd) . "</p>\n" . addEndForm();
}
if (IS_ADMIN) {
echo "<p>" . delLink('judgehost', 'hostname', $row['hostname']) . "</p>\n\n";
}
echo rejudgeForm('judgehost', $row['hostname']) . "<br />\n\n";
echo "<h3>Judgings by " . printhost($row['hostname']) . "</h3>\n\n";
// get the judgings for a specific key and value pair
// select only specific fields to avoid retrieving large blobs
$cids = getCurContests(FALSE);
if (!empty($cids)) {
$res = $DB->q('SELECT judgingid, submitid, starttime, endtime, judgehost,
result, verified, valid FROM judging
WHERE cid IN (%Ai) AND judgehost = %s
ORDER BY starttime DESC, judgingid DESC', $cids, $row['hostname']);
}
if (empty($cids) || $res->count() == 0) {
echo "<p class=\"nodata\">No judgings.</p>\n\n";
} else {
echo "<table class=\"list sortable\">\n<thead>\n" . "<tr><th scope=\"col\" class=\"sorttable_numeric\">ID</th><th " . "scope=\"col\">started</th><th scope=\"col\">runtime</th><th " . "scope=\"col\">result</th><th scope=\"col\">valid</th><th " . "scope=\"col\">verified</th></tr>\n</thead>\n<tbody>\n";
while ($jud = $res->next()) {
if (empty($jud['endtime'])) {
if ($jud['valid']) {
$runtime = printtimediff($jud['starttime'], NULL);
} else {
开发者ID:kien8995,项目名称:domjudge,代码行数:31,代码来源:judgehost.php
示例2: queue
/**
* Judging Queue
*
* FIXME: duplicates code with judgings_post
* not used in judgedaemon
*/
function queue($args)
{
global $DB;
// TODO: make this configurable
$cdatas = getCurContests(TRUE);
$cids = array_keys($cdatas);
if (empty($cids)) {
return array();
}
$hasLimit = array_key_exists('limit', $args);
// TODO: validate limit
$sdatas = $DB->q('TABLE SELECT submitid
FROM submission s
LEFT JOIN team t USING (teamid)
LEFT JOIN problem p USING (probid)
LEFT JOIN language l USING (langid)
LEFT JOIN contestproblem cp USING (probid, cid)
WHERE judgehost IS NULL AND s.cid IN (%Ai)
AND l.allow_judge = 1 AND cp.allow_judge = 1 AND valid = 1
ORDER BY judging_last_started ASC, submittime ASC, submitid ASC' . ($hasLimit ? ' LIMIT %i' : ' %_'), $cids, $hasLimit ? $args['limit'] : -1);
return array_map(function ($sdata) {
return array('submitid' => safe_int($sdata['submitid']));
}, $sdatas);
}
开发者ID:retnan,项目名称:domjudge,代码行数:30,代码来源:index.php
示例3: dbconfig_get
// TODO: event-feed-port
$contest_data['penaltytime'] = dbconfig_get('penalty_time');
/*
$contest_data['default-clars'] = dbconfig_get('clar_answers');
$contest_data['clar-categories'] = array_values(dbconfig_get('clar_categories'));
*/
$contest_data['languages'] = array();
$q = $DB->q("SELECT * FROM language");
while ($lang = $q->next()) {
$language = array();
$language['name'] = $lang['name'];
// TODO: compiler, -flags, runner, -flags?
$contest_data['languages'][] = $language;
}
$contest_data['problems'] = array();
$contests = getCurContests(FALSE);
if (!empty($contests)) {
$q = $DB->q("SELECT * FROM problem INNER JOIN contestproblem USING (probid) WHERE cid IN (%Ai)", $contests);
while ($prob = $q->next()) {
$problem = array();
$problem['letter'] = $prob['probid'];
$problem['short-name'] = $prob['name'];
// Our color field can be both a HTML color name and an RGB value,
// so we output it only in the human-readable field "color" and
// leave the field "rgb" unset.
$problem['color'] = $prob['color'];
$contest_data['problems'][] = $problem;
}
}
$yaml = Spyc::YAMLDump($contest_data);
echo $yaml;
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:31,代码来源:impexp_contestyaml.php
示例4: calcContestTime
/**
* Calculate contest time from wall-clock time.
* Returns time since contest start in seconds.
* This function is currently a stub around timediff, but introduced
* to allow minimal changes wrt. the removed intervals required for
* the ICPC specification.
*/
function calcContestTime($walltime, $cid)
{
// get contest data in case of non-public contests
$cdatas = getCurContests(TRUE);
$contesttime = difftime($walltime, $cdatas[$cid]['starttime']);
return $contesttime;
}
开发者ID:22a,项目名称:Cleaner-Ducss-Judge,代码行数:14,代码来源:lib.misc.php
示例5: do_login
if (@$_POST['cmd'] == 'login') {
do_login();
}
if (!logged_in()) {
show_loginpage();
}
if (!checkrole('team')) {
error("You do not have permission to perform that action (Missing role: 'team')");
}
if (empty($teamdata)) {
error("You do not have a team associated with your account. Please contact a staff member.");
}
if ($teamdata['enabled'] != 1) {
error("Team is not enabled.");
}
$cdatas = getCurContests(TRUE, $teamdata['teamid']);
$cids = array_keys($cdatas);
// If the cookie has a existing contest, use it
if (isset($_COOKIE['domjudge_cid']) && isset($cdatas[$_COOKIE['domjudge_cid']])) {
$cid = $_COOKIE['domjudge_cid'];
$cdata = $cdatas[$cid];
} elseif (count($cids) >= 1) {
// Otherwise, select the first contest
$cid = $cids[0];
$cdata = $cdatas[$cid];
}
// Data to be sent as AJAX updates:
$updates = array('clarifications' => array(), 'judgings' => array());
if (count($cids)) {
$updates['clarifications'] = $DB->q('TABLE SELECT clarid, submittime, sender, recipient, probid, body
FROM team_unread
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:31,代码来源:init.php
示例6: setup_database_connection
<?php
/**
* Include required files.
*
* Part of the DOMjudge Programming Contest Jury System and licenced
* under the GNU GPL. See README and COPYING for details.
*/
require_once '../configure.php';
/* For plugins to have jury access rights to the DB, they should
* successfully authenticate as user 'jury'.
*/
require_once LIBDIR . '/init.php';
require_once LIBWWWDIR . '/common.php';
require_once LIBWWWDIR . '/print.php';
require_once LIBWWWDIR . '/auth.php';
setup_database_connection();
if (!logged_in() && isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
do_login_native($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
$userdata['roles'] = get_user_roles($userdata['userid']);
}
if (!checkrole('full_event_reader')) {
error("User role full_event_reader required.");
}
define('IS_JURY', true);
define('IS_PUBLIC', false);
$cdatas = getCurContests(TRUE);
$cids = array_keys($cdatas);
开发者ID:sponi78,项目名称:domjudge,代码行数:28,代码来源:init.php
示例7: putClarificationForm
/**
* Output a form to send a new clarification.
* Set respid to a clarid, to make only responses to same
* sender(s)/recipient(s) or ALL selectable.
*/
function putClarificationForm($action, $respid = NULL, $onlycontest = NULL)
{
$cdatas = getCurContests(TRUE);
if (isset($onlycontest)) {
$cdatas = array($onlycontest => $cdatas[$onlycontest]);
}
$cids = array_keys($cdatas);
if (empty($cids)) {
echo '<p class="nodata">No active contests</p>';
return;
}
require_once 'forms.php';
global $DB;
?>
<script type="text/javascript">
<!--
function confirmClar() {
<?php
if (IS_JURY) {
?>
var sendto_field = document.forms['sendclar'].sendto;
var sendto = sendto_field.value;
var sendto_text = sendto_field.options[sendto_field.selectedIndex].text;
if ( sendto=='domjudge-must-select' ) {
alert('You must select a recipient for this clarification.');
return false;
}
return confirm("Send clarification to " + sendto_text + "?");
<?php
} else {
?>
return confirm("Send clarification request to Jury?");
<?php
}
?>
}
// -->
</script>
<?php
echo addForm($action, 'post', 'sendclar');
echo "<table>\n";
if ($respid) {
$clar = $DB->q('MAYBETUPLE SELECT c.*, t.name AS toname, f.name AS fromname
FROM clarification c
LEFT JOIN team t ON (t.teamid = c.recipient)
LEFT JOIN team f ON (f.teamid = c.sender)
WHERE c.clarid = %i', $respid);
}
if (IS_JURY) {
// list all possible recipients in the "sendto" box
echo "<tr><td><b><label for=\"sendto\">Send to</label>:</b></td><td>\n";
if (!empty($respid)) {
echo addHidden('id', $respid);
}
$options = array('domjudge-must-select' => '(select...)', '' => 'ALL');
if (!$respid) {
$teams = $DB->q('KEYVALUETABLE SELECT teamid, name
FROM team
ORDER BY categoryid ASC, team.name COLLATE utf8_general_ci ASC');
$options += $teams;
} else {
if ($clar['sender']) {
$options[$clar['sender']] = $clar['fromname'] . ' (t' . $clar['sender'] . ')';
} else {
if ($clar['recipient']) {
$options[$clar['recipient']] = $clar['toname'] . ' (t' . $clar['recipient'] . ')';
}
}
}
echo addSelect('sendto', $options, 'domjudge-must-select', true);
echo "</td></tr>\n";
} else {
echo "<tr><td><b>To:</b></td><td>Jury</td></tr>\n";
}
// Select box for a specific problem (only when the contest
// has started) or general issue.
$options = array();
foreach ($cdatas as $cid => $cdata) {
$row = $DB->q('TUPLE SELECT CONCAT(cid, "-general") AS c
FROM contest WHERE cid = %i', $cid);
if (IS_JURY && count($cdatas) > 1) {
$options[$row['c']] = "{$cdata['shortname']} - General issue";
} else {
$options[$row['c']] = "General issue";
}
if (difftime($cdata['starttime'], now()) <= 0) {
$problem_options = $DB->q('KEYVALUETABLE SELECT CONCAT(cid, "-", probid),
CONCAT(shortname, ": ", name) as name
FROM problem
INNER JOIN contestproblem USING (probid)
WHERE cid = %i AND allow_submit = 1
ORDER BY shortname ASC', $cid);
//.........这里部分代码省略.........
开发者ID:nya3jp,项目名称:domjudge,代码行数:101,代码来源:clarification.php
示例8: requireAdmin
require LIBWWWDIR . '/header.php';
require LIBWWWDIR . '/scoreboard.php';
echo "<h1>Refresh Cache</h1>\n\n";
requireAdmin();
if (!isset($_REQUEST['refresh'])) {
echo addForm($pagename);
echo msgbox('Significant database impact', 'Refreshing the scoreboard cache can have a significant impact on the database load, ' . 'and is not necessary in normal operating circumstances.<br /><br />Refresh scoreboard cache now?' . '<br /><br />' . addSubmit(" Refresh now! ", 'refresh'));
echo addEndForm();
require LIBWWWDIR . '/footer.php';
exit;
}
$time_start = microtime(TRUE);
auditlog('scoreboard', null, 'refresh cache');
// no output buffering... we want to see what's going on real-time
ob_implicit_flush();
$contests = getCurContests(TRUE);
foreach ($contests as $contest) {
// get the contest, teams and problems
$teams = $DB->q('TABLE SELECT t.teamid FROM team t
INNER JOIN contest c ON c.cid = %i
LEFT JOIN contestteam ct ON ct.teamid = t.teamid AND ct.cid = c.cid
WHERE (c.public = 1 OR ct.teamid IS NOT NULL) ORDER BY teamid', $contest['cid']);
$probs = $DB->q('TABLE SELECT probid, cid FROM problem
INNER JOIN contestproblem USING (probid)
WHERE cid = %i ORDER BY shortname', $contest['cid']);
echo "<p>Recalculating all values for the scoreboard cache for contest c{$contest['cid']} (" . count($teams) . " teams, " . count($probs) . " problems)...</p>\n\n<pre>\n";
if (count($teams) == 0) {
echo "No teams defined, doing nothing.</pre>\n\n";
continue;
}
if (count($probs) == 0) {
开发者ID:reduanrafi,项目名称:domjudge,代码行数:31,代码来源:refresh_cache.php
示例9: setup_database_connection
<?php
/**
* DOMjudge REST API
*
* Part of the DOMjudge Programming Contest Jury System and licenced
* under the GNU GPL. See README and COPYING for details.
*/
require_once '../configure.php';
require_once LIBDIR . '/init.php';
setup_database_connection();
require_once LIBWWWDIR . '/common.php';
require_once LIBWWWDIR . '/print.php';
require_once LIBWWWDIR . '/scoreboard.php';
require_once LIBWWWDIR . '/auth.php';
require_once LIBWWWDIR . '/restapi.php';
$cdatas = getCurContests(TRUE, -1);
$cids = array_keys($cdatas);
if (!logged_in() && isset($_SERVER['PHP_AUTH_USER']) && isset($_SERVER['PHP_AUTH_PW'])) {
do_login_native($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']);
$userdata['roles'] = get_user_roles($userdata['userid']);
}
开发者ID:rohit-takhar,项目名称:domjudge,代码行数:22,代码来源:init.php
示例10: array
$REQUIRED_ROLES = array('jury');
}
$allowed = false;
foreach ($REQUIRED_ROLES as $role) {
if (checkrole($role)) {
$allowed = true;
}
}
if (!$allowed) {
error("You do not have permission to perform that action (Missing role(s): " . implode($REQUIRED_ROLES, ',') . ")");
}
require_once LIBWWWDIR . '/common.jury.php';
if ($_SERVER['REQUEST_METHOD'] == 'POST' && empty($_POST) && empty($_FILES) && isset($_SERVER['CONTENT_LENGTH']) && $_SERVER['CONTENT_LENGTH'] > 0) {
error("POST data exceeded php.ini's 'post_max_size' directive.");
}
$cdatas = getCurContests(TRUE, null, TRUE);
$cids = array_keys($cdatas);
// List of executable script types, used in various places:
$executable_types = array('compare' => 'compare', 'compile' => 'compile', 'run' => 'run');
// If the cookie has a existing contest, use it
if (isset($_COOKIE['domjudge_cid'])) {
if (isset($cdatas[$_COOKIE['domjudge_cid']])) {
$cid = $_COOKIE['domjudge_cid'];
$cdata = $cdatas[$cid];
}
} elseif (count($cids) >= 1) {
// Otherwise, select the first contest
$cid = $cids[0];
$cdata = $cdatas[$cid];
}
// Data to be sent as AJAX updates:
开发者ID:sponi78,项目名称:domjudge,代码行数:31,代码来源:init.php
注:本文中的getCurContests函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论