Ejemplo n.º 1
0
    $pidToProbCode = array();
    foreach ($problems as $prob) {
        $pidToProbCode[$prob['pid']] = $prob['code'];
    }
    ?>
<center><?php 
    if (isset($_SESSION['loggedin']) && $_SESSION['team']['status'] == "Admin") {
    }
    ?>
<h1>Rankings - <?php 
    echo $contest['name'];
    ?>
</h1></center>
    <?php 
    if ($contest['ranktable'] != "") {
        $rank = getrankings($contest['code']);
    } else {
        $rank = null;
    }
    $i = 1;
    $probCells = "";
    foreach ($pidToProbCode as $pid => $code) {
        $probCells .= "<th><a target='_blank' href='" . SITE_URL . "/problems/{$code}" . "'>" . $code . "</a></th>";
    }
    echo "<table class='table table-hover'><tr><th>Rank</th><th>Teamname</th><th>Score</th>{$probCells}<th>Final Time</th></tr>";
    foreach ($rank as $val) {
        $finaltime = $val['time'] + $val['penalty'] * $admin['value'] * 60;
        $val['time'] = timeformating($val['time']);
        $finaltime = timeformating($finaltime);
        $probCells = "";
        foreach ($pidToProbCode as $pid => $code) {
Ejemplo n.º 2
0
     DB::insert('broadcast', $bcast);
     $_SESSION['msg'] = 'Message queued for delievery.';
     redirectTo("http://" . $_SERVER['HTTP_HOST'] . $_SESSION['url']);
 } else {
     if (isset($_POST['delbmsg'])) {
         $id = addslashes($_POST['id']);
         DB::delete('broadcast', "id={$id}");
         $_SESSION['msg'] = 'Message deleted.';
         redirectTo("http://" . $_SERVER['HTTP_HOST'] . $_SESSION['url']);
     } else {
         if (isset($_GET['freeze'])) {
             require_once 'components.php';
             if (!in_array(strtolower($_GET['freeze']), array("admin", "broadcast", "clar", "contest", "groups", "logs", "problems", "teams", "runs", "subs_code"))) {
                 DB::query("Drop table if exists {$_GET['freeze']}");
                 DB::query("CREATE TABLE {$_GET['freeze']} (\n  rank int(11) NOT NULL,\n  teamname text NOT NULL,\n  time int(11) NOT NULL,\n  penalty int(11) NOT NULL,\n  score int(11) NOT NULL,\n  solved int(11) NOT NULL,\n  PRIMARY KEY (rank)\n) ENGINE=InnoDB DEFAULT CHARSET=utf8;");
                 $rank = getrankings($_GET['freeze']);
                 $i = 1;
                 $sql = "INSERT INTO {$_GET['freeze']} (rank, teamname, time, penalty, score, solved) VALUES";
                 $row = array();
                 foreach ($rank as $val) {
                     array_push($row, "({$i}, '{$val['teamname']}', {$val['time']}, {$val['penalty']}, {$val['score']}, {$val['solved']})");
                     $i++;
                 }
                 $row = implode(",", $row);
                 DB::query($sql . $row);
                 DB::query("update contest set ranktable='{$_GET['freeze']}' where code = '{$_GET['freeze']}'");
             } else {
                 $_SERVER['msg'] = "Contest code not allowed. Please change contest's code";
             }
             redirectTo("http://" . $_SERVER['HTTP_HOST'] . $_SESSION['url']);
         }