forked from BNUACM/bnuoj-web-v2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcontest_report.php
103 lines (99 loc) · 3.76 KB
/
contest_report.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
<?php
include_once("conn.php");
$cid=convert_str($_GET["cid"]);
if (db_contest_exist($cid)&&(db_contest_ispublic($cid)||(db_contest_private($cid)&&db_user_in_contest($cid,$nowuser))||(db_contest_password($cid)&&db_user_in_contest($cid,$nowuser)))) {
$query="select report from contest where cid='$cid'";
$result=mysql_query($query);
$crow=mysql_fetch_array($result);
?>
<div id="sidebar_container">
<!-- insert your sidebar items here -->
<?php
include("contest_sidebar.php");
?>
</div>
<div id="content_container">
<div id="content_top"></div>
<div id="content">
<!-- insert the page content here -->
<h1 class="pagetitle">Report to <?php echo db_get_contest_title($cid); ?></h1>
Current Server Time: <span id="servertime"><?php echo date("Y-m-d H:i:s"); ?></span>
<?php
$canshow=false;
if (db_contest_passed($cid)) $canshow=true;
?>
<?php
if ($canshow) {
?>
<div id="contestrep" class="content-wrapper ui-corner-all" style="margin:20px 0;">
<?php echo latex_content($crow["report"]); ?>
</div>
<h2>Problem Statistics</h2>
<table id="cprobreport" class="display">
<thead>
<tr>
<th width="60px">ID</th>
<th>Title</th>
<th width="110px">Ratio</th>
<th width="110px">User</th>
</tr>
</thead>
<tfoot></tfoot>
<tbody>
<?php
$cctype=db_contest_type($cid);
if ($cctype=="99") $prefix="replay_";
else $prefix="";
$cha = "SELECT pid,lable,cpid FROM contest_problem WHERE cid = '$cid' order by lable asc";
$que = mysql_query($cha);
while ( $go = mysql_fetch_array($que) ) {
$cha2 ="SELECT title FROM problem WHERE pid = '$go[0]'";
$que2 = mysql_query($cha2);
list($title) = mysql_fetch_row($que2);
$query = "select count(*) from ".$prefix."status where contest_belong='$cid' and pid='$go[0]'";
$result = mysql_query($query);
list($submitsum) = mysql_fetch_row($result);
$query = "select count(*) from ".$prefix."status where contest_belong='$cid' and pid='$go[0]' and result='Accepted'";
$result = mysql_query($query);
list($acsum) = mysql_fetch_row($result);
$query = "select count(distinct username) from ".$prefix."status where contest_belong='$cid' and pid='$go[0]'";
$result = mysql_query($query);
list($submitsumuser) = mysql_fetch_row($result);
$query = "select count(distinct username) from ".$prefix."status where contest_belong='$cid' and pid='$go[0]' and result='Accepted'";
$result = mysql_query($query);
list($acsumuser) = mysql_fetch_row($result);
echo "<tr>\n";
echo "<td>$go[1]</td>\n";
echo "<td>$title</td>\n";
echo "<td> $acsum/$submitsum </td>\n";
echo "<td> $acsumuser/$submitsumuser </td>\n";
echo "</tr>\n";
}
?>
</tbody>
</table>
<?php
} else {
?>
<h2 style="margin-bottom:0">Not finished, come back later :) .</h2>
<?php
}
?>
</div>
<div id="content_base"></div>
</div>
<?php
} else {
?>
<div id="one_content_container">
<div id="one_content_top"></div>
<div id="one_content">
<p>
<div class="error"><b>Contest Unavailable!</b></div>
</p>
</div>
<div id="one_content_base"></div>
</div>
<?php
}
?>