aboutsummaryrefslogtreecommitdiff
path: root/boca-1.5.0/src/admin/report
diff options
context:
space:
mode:
authorcassiopc <cassiopc@gmail.com>2012-08-06 09:09:10 +0000
committercassiopc <cassiopc@gmail.com>2012-08-06 09:09:10 +0000
commit866658cded5b92ddb2681dead1ebaf111d712fcc (patch)
treecf7534c4726a142189e096ce82f8d73b2a398ecc /boca-1.5.0/src/admin/report
downloadboca-866658cded5b92ddb2681dead1ebaf111d712fcc.tar.gz
boca-866658cded5b92ddb2681dead1ebaf111d712fcc.zip
init
Diffstat (limited to 'boca-1.5.0/src/admin/report')
-rw-r--r--boca-1.5.0/src/admin/report/clar.php82
-rw-r--r--boca-1.5.0/src/admin/report/header.php65
-rw-r--r--boca-1.5.0/src/admin/report/icpc.php46
-rw-r--r--boca-1.5.0/src/admin/report/linechart.php45
-rw-r--r--boca-1.5.0/src/admin/report/piechart.php60
-rw-r--r--boca-1.5.0/src/admin/report/run.php93
-rw-r--r--boca-1.5.0/src/admin/report/score.php43
-rw-r--r--boca-1.5.0/src/admin/report/site.php128
-rw-r--r--boca-1.5.0/src/admin/report/stat.php337
-rw-r--r--boca-1.5.0/src/admin/report/task.php68
10 files changed, 967 insertions, 0 deletions
diff --git a/boca-1.5.0/src/admin/report/clar.php b/boca-1.5.0/src/admin/report/clar.php
new file mode 100644
index 0000000..66bd4cd
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/clar.php
@@ -0,0 +1,82 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+require('header.php');
+?>
+<br>
+<center><h2>Clarification List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Site</b></td>
+ <td><b>User</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Status</b></td>
+ <td><b>Judge (Site)</b></td>
+ <td><b>Question</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$s = $st;
+
+// forca aparecer as clars do proprio site
+if (trim($s["sitejudging"])!="") $s["sitejudging"].=",".$_SESSION["usertable"]["usersitenumber"];
+else $s["sitejudging"]=$_SESSION["usertable"]["usersitenumber"];
+
+$clar = DBAllClarsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], 'normal');
+
+for ($i=0; $i<count($clar); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap>" . $clar[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["site"] . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["user"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($clar[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>" . $clar[$i]["problem"] . "</td>\n";
+
+ echo " <td nowrap>" . $clar[$i]["status"] . "</td>\n";
+ if ($clar[$i]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $clar[$i]["judgesite"], $clar[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $clar[$i]["judgesite"] . ")</td>\n";
+ }
+ else
+ echo " <td>&nbsp;</td>\n";
+
+ if ($clar[$i]["question"] == "") $clar[$i]["question"] = "&nbsp;";
+
+ echo " <td>";
+// echo "<pre>" . $clar[$i]["question"] . "</pre>";
+// echo $clar[$i]["question"];
+ echo " <textarea name=\"m$i\" cols=\"60\" rows=\"8\" readonly>".$clar[$i]["question"]."</textarea>\n";
+ echo "</td>\n";
+ if (trim($clar[$i]["answer"]) == "") $clar[$i]["answer"] = "Not answered yet";
+ echo " <td>";
+// echo " <pre>" . $clar[$i]["answer"] . "</pre>";
+// echo $clar[$i]["answer"];
+ echo " <textarea name=\"a$i\" cols=\"60\" rows=\"8\" readonly>".$clar[$i]["answer"]."</textarea>\n";
+ echo "</td>\n";
+
+ echo " </tr>\n";
+}
+
+echo "</table>";
+if (count($clar) == 0) echo "<br><center><b><font color=\"#ff0000\">NO CLARIFICATIONS AVAILABLE</font></b></center>";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/header.php b/boca-1.5.0/src/admin/report/header.php
new file mode 100644
index 0000000..1d191de
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/header.php
@@ -0,0 +1,65 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+ob_start();
+header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Cache-Control: no-cache, must-revalidate");
+header ("Pragma: no-cache");
+header ("Content-Type: text/html; charset=utf-8");
+session_start();
+ob_end_flush();
+//$locr = $_SESSION['locr'];
+//$loc = $_SESSION['loc'];
+$loc = $locr = "../..";
+
+require $locr.'/version.php';
+require_once($locr . "/globals.php");
+if(!ValidSession()) {
+ InvalidSession($_SERVER['PHP_SELF']);
+ ForceLoad($loc."/index.php");
+}
+if($_SESSION["usertable"]["usertype"] != "admin") {
+ IntrusionNotify($_SERVER['PHP_SELF']);
+ ForceLoad($loc."/index.php");
+}
+
+require_once($locr."/db.php");
+require_once($locr."/freport.php");
+
+echo "<html><head><title>Report Page</title>\n";
+echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">\n";
+
+echo "<link rel=stylesheet href=\"$loc/Css.php\" type=\"text/css\">\n";
+
+$contest=$_SESSION["usertable"]["contestnumber"];
+if(($ct = DBContestInfo($contest)) == null)
+ ForceLoad($loc."/index.php");
+$site=$_SESSION["usertable"]["usersitenumber"];
+if(($st = DBSiteInfo($contest,$site)) == null)
+ ForceLoad($loc."/index.php");
+
+echo "</head><body><table border=1 width=\"100%\">\n";
+echo "<tr><td bgcolor=\"eeee00\" nowrap align=center>";
+echo "<img src=\"$loc/images/smallballoontransp.png\" alt=\"\">";
+echo "<font color=\"#ffffff\"><a href=\"http://www.ime.usp.br/~cassio/boca/\">BOCA</a></font>";
+echo "</td><td bgcolor=\"#eeee00\" width=\"99%\">\n";
+echo $ct["contestname"] . " - " . $st["sitename"] . "</td>\n";
+echo "</tr></table>\n";
+?>
diff --git a/boca-1.5.0/src/admin/report/icpc.php b/boca-1.5.0/src/admin/report/icpc.php
new file mode 100644
index 0000000..1bf2b86
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/icpc.php
@@ -0,0 +1,46 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+//Last updated 10/jul/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$score = DBScore($_SESSION["usertable"]["contestnumber"], false, -1, $st["siteglobalscore"]);
+
+echo "<h2>ICPC Output</h2>";
+echo "<pre>";
+$n=0;
+$class=1;
+while(list($e, $c) = each($score)) {
+ if(isset($score[$e]["site"]) && isset($score[$e]["user"])) {
+ $r = DBUserInfo($_SESSION["usertable"]["contestnumber"],
+ $score[$e]["site"], $score[$e]["user"]);
+ echo $r["usericpcid"] . ",";
+ echo $class++ . ",";
+ echo $score[$e]["totalcount"] . ",";
+ echo $score[$e]["totaltime"] . ",";
+
+ if($score[$e]["first"])
+ echo $score[$e]["first"] . "\n";
+ else echo "0\n";
+ $n++;
+ }
+}
+echo "</pre>";
+?>
+<?php include("$locr/footnote.php"); ?>
+
diff --git a/boca-1.5.0/src/admin/report/linechart.php b/boca-1.5.0/src/admin/report/linechart.php
new file mode 100644
index 0000000..fa47b17
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/linechart.php
@@ -0,0 +1,45 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+ob_start();
+header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Cache-Control: no-cache, must-revalidate");
+header ("Pragma: no-cache");
+session_start();
+$locr = $_SESSION['locr'];
+$loc = $_SESSION['loc'];
+
+require_once($locr . "/libchart/libchart.php");
+header ("Content-type: image/png");
+ob_end_flush();
+
+$v = explode(chr(1),rawurldecode($_GET['dados']),100);
+
+$chart = new VerticalChart(1000, 300);
+
+$chart->setUpperBound($v[1]);
+
+for($i=2;$i<count($v); $i+=2)
+ $chart->addPoint(new Point($v[$i], $v[$i+1]));
+
+$chart->setTitle($v[0]);
+$chart->setLogo($locr. "/images/poweredbyboca.png");
+$chart->render();
+?>
diff --git a/boca-1.5.0/src/admin/report/piechart.php b/boca-1.5.0/src/admin/report/piechart.php
new file mode 100644
index 0000000..18d8d04
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/piechart.php
@@ -0,0 +1,60 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+ob_start();
+header ("Expires: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+header ("Cache-Control: no-cache, must-revalidate");
+header ("Pragma: no-cache");
+session_start();
+$locr = $_SESSION['locr'];
+$loc = $_SESSION['loc'];
+
+require_once($locr . "/libchart/libchart.php");
+header("Content-type: image/png");
+ob_end_flush();
+
+$v = explode(chr(1),rawurldecode($_GET['dados']),100);
+$cor = null;
+if(isset($_GET['color']))
+ $cor = explode("-",rawurldecode($_GET['color']),100);
+
+if(count($v)/2 > 8)
+ $chart = new PieChart(450, 300);
+else
+ $chart = new PieChart(400, 250);
+
+if(isset($_GET['order'])) $chart->order=true;
+
+for($i=1;$i<count($v); $i+=2) {
+ $color = null;
+ if($cor != null) {
+ $r = hexdec( substr($cor[($i-1)/2], 0, 2) );
+ $g = hexdec( substr($cor[($i-1)/2], 2, 2) );
+ $b = hexdec( substr($cor[($i-1)/2], 4, 2) );
+ $color = array($r, $g, $b);
+ }
+ $chart->addPoint(new Point($v[$i], $v[$i+1], $color));
+}
+
+$chart->setTitle($v[0]);
+$chart->setLogo($locr. "/images/poweredbyboca.png");
+$chart->render();
+
+?>
diff --git a/boca-1.5.0/src/admin/report/run.php b/boca-1.5.0/src/admin/report/run.php
new file mode 100644
index 0000000..422200d
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/run.php
@@ -0,0 +1,93 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+require('header.php');
+?>
+<br>
+<center><h2>Run List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Site</b></td>
+ <td><b>User</b></td>
+ <td><b>Time</b></td>
+ <td><b>Problem</b></td>
+ <td><b>Language</b></td>
+ <td><b>Filename</b></td>
+ <td><b>Status</b></td>
+ <td><b>Judge (Site)</b></td>
+ <td><b>Answer</b></td>
+ </tr>
+<?php
+$s = $st;
+// forca aparecer as runs do proprio site
+if (trim($s["sitejudging"])!="") $s["sitejudging"].=",".$_SESSION["usertable"]["usersitenumber"];
+else $s["sitejudging"]=$_SESSION["usertable"]["usersitenumber"];
+
+$run = DBAllRunsInSites($_SESSION["usertable"]["contestnumber"], $s["sitejudging"], 'normal');
+
+for ($i=0; $i<count($run); $i++) {
+ echo " <tr>\n";
+ echo " <td nowrap>" . $run[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["site"] . "</td>\n";
+ if ($run[$i]["user"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["site"], $run[$i]["user"]);
+ echo " <td nowrap>" . $u["userfullname"] . "</td>\n";
+ }
+ echo " <td nowrap>" . dateconvminutes($run[$i]["timestamp"]) . "</td>\n";
+
+ if($run[$i]["status"] == "deleted") {
+ echo "<td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo " <td nowrap>" . $run[$i]["status"] . "</td>\n";
+ if ($run[$i]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["judgesite"], $run[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $run[$i]["judgesite"] . ")</td>\n";
+ } else
+ echo " <td>&nbsp;</td>\n";
+ echo "<td>&nbsp;</td>\n";
+ echo "</tr>";
+ continue;
+ }
+
+ echo " <td nowrap>" . $run[$i]["problem"];
+ if($run[$i]["colorname"] != "")
+ echo "(".$run[$i]["colorname"].")";
+ echo "</td>\n";
+ echo " <td nowrap>" . $run[$i]["language"] . "</td>\n";
+ echo " <td nowrap>" . $run[$i]["filename"] . "</td>\n";
+
+ echo " <td nowrap>" . $run[$i]["status"] . "</td>\n";
+ if ($run[$i]["judge"] != "") {
+ $u = DBUserInfo ($_SESSION["usertable"]["contestnumber"], $run[$i]["judgesite"], $run[$i]["judge"]);
+ echo " <td nowrap>" . $u["username"] . " (" . $run[$i]["judgesite"] . ")</td>\n";
+ } else
+ echo " <td>&nbsp;</td>\n";
+
+ if ($run[$i]["answer"] == "") $run[$i]["answer"] = "&nbsp;";
+ echo " <td>" . $run[$i]["answer"] . "</td>\n";
+ echo " </tr>\n";
+}
+
+echo "</table>";
+if (count($run) == 0) echo "<br><center><b><font color=\"#ff0000\">NO RUNS AVAILABLE</font></b></center>";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/score.php b/boca-1.5.0/src/admin/report/score.php
new file mode 100644
index 0000000..0196b3a
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/score.php
@@ -0,0 +1,43 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA System (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+//Last updated 10/jul/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$final = true;
+$s = $st;
+$des = true;
+$detail=true;
+if($_GET["p"] == "0") $ver = false;
+else if($_GET["p"] == "2") $detail=false;
+else {
+ $ver = true;
+ $des = false;
+}
+if(isset($_GET["hor"])) $hor = $_GET["hor"];
+else $hor = -1;
+
+if ($s["currenttime"] >= $s["sitelastmilescore"] && $ver) {
+ $togo = (int) (($s['siteduration'] - $s["sitelastmilescore"])/60);
+ echo"<br /><center><h2>Scoreboard (as of $togo minutes to go)</h2></center>\n";
+} else
+ echo"<br /><center><h2>Final Scoreboard</h2></center>\n";
+
+require("$locr/scoretable.php");
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/site.php b/boca-1.5.0/src/admin/report/site.php
new file mode 100644
index 0000000..001d48e
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/site.php
@@ -0,0 +1,128 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$sitetime = DBAllSiteTime($_SESSION["usertable"]["contestnumber"], $site);
+?>
+<br />
+<center><h2>Site Start/Stop Logs</h2></center>
+
+ <table border="0">
+<?php
+echo " <td nowrap width=\"50%\" align=right>Start date (contest=" . dateconv($ct["conteststartdate"]) . "):</td>";
+echo "<td width=\"50%\"><b>" . dateconv($st["sitestartdate"]) . "</b></td>\n";
+echo "<tr>";
+if (!$st["siterunning"]) {
+ echo " <tr>\n";
+ echo " <td nowrap width=\"50%\" align=right><b>Finished at:</b></td>\n";
+ echo " <td width=\"50%\"><b>" . dateconv($st["siteendeddate"]);
+ if($st["siteautoended"]) echo " (auto)";
+ echo "</b></td>\n";
+ echo " </tr>\n";
+ if($st["siteautoended"]) {
+ $w = (int) ($st["siteduration"]/60);
+ $ww = $st["siteduration"] % 60;
+ }
+ else {
+ $w = (int) ($st["currenttime"]/60);
+ $ww = $st["currenttime"] % 60;
+ }
+ echo " <tr>\n";
+ echo " <td nowrap width=\"50%\" align=right><b>Real duration:</b></td>\n";
+ echo " <td width=\"50%\"><b>$w minutes";
+ if($ww != 0) echo " plus $ww seconds";
+ echo "</b></td>\n";
+ echo " </tr>\n";
+}
+echo "<tr>\n";
+echo " <td width=\"50%\" align=right>Planned Duration (contest=";
+echo $ct["contestduration"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["siteduration"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"50%\" align=right>Stop answering (contest=";
+echo $ct["contestlastmileanswer"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["sitelastmileanswer"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+<?php
+echo " <td width=\"50%\" align=right>Stop scoreboard (contest=";
+echo $ct["contestlastmilescore"]/60;
+echo "):</td>";
+?>
+ <td width="50%">
+ <?php echo $st["sitelastmilescore"]/60; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Clars:</td>
+ <td width="50%"><?php echo $st["sitenextclar"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Runs:</td>
+ <td width="50%"><?php echo $st["sitenextrun"]; ?>
+ </td>
+ </tr>
+ <tr>
+ <td width=\"50%\" align=right>Number of Tasks:</td>
+ <td width="50%"><?php echo $st["sitenexttask"]; ?>
+ </td>
+ </tr>
+ </table>
+ </center>
+<center>
+<br />
+<table border=1>
+<tr>
+<td nowrap width=\"50%\" align=right>Starting at</td><td nowrap width=\"50%\" align=left>Ending at</td>
+</tr>
+<?php
+$n = count($sitetime);
+for ($i=0; $i< $n; $i++) {
+ echo "<tr>";
+ echo "<td nowrap align=right>";
+ echo dateconv($sitetime[$i]["sitestartdate"]);
+ echo "</td>";
+ echo "<td nowrap align=left>";
+ if($sitetime[$i]["siteenddate"] == 0) {
+ if($st["siterunning"])
+ echo "still open";
+ else echo "auto-ended";
+ }
+ else
+ echo dateconv($sitetime[$i]["siteenddate"]);
+ echo "</td>";
+ echo "</tr>";
+}
+?>
+</table>
+</center>
+
+<?php include("$locr/footnote.php"); ?>
diff --git a/boca-1.5.0/src/admin/report/stat.php b/boca-1.5.0/src/admin/report/stat.php
new file mode 100644
index 0000000..7d99cb3
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/stat.php
@@ -0,0 +1,337 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+
+require('header.php');
+
+$d = DBRunReport($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"]);
+
+echo "<center><h2>Statistics</h2></center>\n";
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems</u></b></td>";
+
+echo "<td>Total</td><td>Accepted</td>";
+echo "</tr>\n";
+
+$str="All Runs by Problem";
+$str2="Accepted Runs by Problem";
+reset($d['problem']);
+$cor = "";
+while (list($keya, $val) = each($d['problem'])) {
+ $val = $d['problemyes'][$keya]; if($val=="") $val=0;
+ $str2 .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ $cor .= "-" . $d['color'][$keya];
+}
+$cor = substr($cor,1);
+
+reset($d['problem']);
+while (list($keya, $val) = each($d['problem'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ echo "<td>$val</td>";
+ if(isset($d['problemyes'][$keya])) {
+ echo "<td nowrap>".$d['problemyes'][$keya];
+ if($val != 0) {
+ $p = round(100*$d['problemyes'][$keya] / $val);
+ echo " (".$p."%)";
+ }
+ echo "</td>";
+ }
+ else
+ echo "<td nowrap>0 (0%)</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "<center><table><tr>";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str)."&color=".rawurlencode($cor)."\" /></td>\n";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str2)."&color=".rawurlencode($cor)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem and Answer</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems x Answers</u></b></td>";
+reset($d['answer']);
+while (list($key, $val) = each($d['answer']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['problem']);
+while (list($keya, $vala) = each($d['problem'])) {
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ reset($d['answer']);
+ while (list($key, $val) = each($d['answer'])) {
+ if(!isset($d['pa'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['pa'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['pa'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Problem and Language</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Problems x Languages</u></b></td>";
+reset($d['language']);
+while (list($key, $val) = each($d['language']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['problem']);
+while (list($keya, $vala) = each($d['problem'])) {
+ echo "<tr><td>$keya ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$keya]) ."\" />\n";
+ echo "</td>";
+ reset($d['language']);
+ while (list($key, $val) = each($d['language'])) {
+ if(!isset($d['pl'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['pl'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['pl'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Language</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Languages</u></b></td>";
+
+echo "<td>Total</td><td>Accepted</td>";
+echo "</tr>\n";
+
+$str="All Runs by Language";
+$str2="Accepted Runs by Language";
+reset($d['language']);
+while (list($keya, $val) = each($d['language'])) {
+ $val = $d['languageyes'][$keya]; if($val=="") $val=0;
+ $str2 .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+}
+
+reset($d['language']);
+while (list($keya, $val) = each($d['language'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya</td>";
+ echo "<td>$val</td>";
+ if(isset($d['languageyes'][$keya])) {
+ $p = round(100*$d['languageyes'][$keya] / $val);
+ echo "<td nowrap>".$d['languageyes'][$keya]." (".$p."%)</td>";
+ }
+ else
+ echo "<td nowrap>0 (0%)</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "<center><table><tr>";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str)."\" /></td>\n";
+echo "<td><img alt=\"\" src=\"piechart.php?dados=".rawurlencode($str2)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<center><h3>Runs by Language and Answer</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Languages x Answers</u></b></td>";
+reset($d['answer']);
+while (list($key, $val) = each($d['answer']))
+ echo "<td>$key</td>";
+echo "<td>Total</td></tr>\n";
+
+reset($d['language']);
+while (list($keya, $vala) = each($d['language'])) {
+ echo "<tr><td>$keya</td>";
+ reset($d['answer']);
+ while (list($key, $val) = each($d['answer'])) {
+ if(!isset($d['la'][$keya][$key]))
+ echo "<td>0</td>";
+ else {
+ $p = round(100*$d['la'][$keya][$key] / $vala);
+ echo "<td nowrap>".$d['la'][$keya][$key]." (".$p."%)</td>";
+ }
+ }
+ echo "<td>$vala</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Answer</h3></center>\n";
+
+echo "<center><table><tr>";
+echo "<td>";
+
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Answers</u></b></td>";
+
+echo "<td>Answers</td>";
+echo "</tr>\n";
+
+$str="All Runs by Answer";
+reset($d['answer']);
+while (list($keya, $val) = each($d['answer'])) {
+ $str .= chr(1) . $keya . "(" . $val . ")" . chr(1) . $val;
+ echo "<tr><td>$keya</td>";
+ echo "<td>$val</td>";
+ echo "</tr>";
+}
+echo "</table></center>";
+
+echo "</td>";
+echo "<td><img alt=\"\" src=\"piechart.php?order=1&dados=".rawurlencode($str)."\" /></td></tr></table></center>\n";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by User and Problem</h3></center>\n";
+echo "<center><table border=1>\n";
+echo "<tr><td><b><u>Users x Problems</u></b></td>";
+reset($d['problem']);
+while (list($key, $val) = each($d['problem'])) {
+ echo "<td>$key ";
+ echo "<img alt=\"balloon\" width=\"15\" ".
+ "src=\"" . balloonurl($d['color'][$key]) ."\" />\n";
+ echo "</td>";
+}
+echo "<td>Total</td><td>Accepted</td></tr>\n";
+
+reset($d['username']);
+while (list($keya, $vala) = each($d['username'])) {
+ $keya = $d['username'][$keya];
+ $vala = $d['user'][$keya];
+ echo "<tr><td>".$d['userfull'][$keya]."</td>";
+ reset($d['problem']);
+ while (list($key, $val) = each($d['problem'])) {
+ if(!isset($d['up'][$keya][$key]))
+ echo "<td bgcolor=\"ffff88\">0</td>";
+ else {
+ $q = $d['up'][$keya][$key];
+ $color = "ff5555";
+ if($q < 0) {
+ $q = - $q;
+ $color = "22ee22";
+ }
+ echo "<td nowrap bgcolor=\"$color\">".$q;
+ if($vala != 0) {
+ $p = round(100*$q / $vala);
+ echo " (".$p."%)";
+ }
+ echo "</td>";
+ }
+ }
+ if($vala != "")
+ echo "<td>$vala</td>";
+ else
+ echo "<td>0</td>";
+ if(isset($d['useryes'][$keya])) {
+ if($vala != 0) {
+ $p = round(100*$d['useryes'][$keya] / $vala);
+ echo "<td nowrap>".$d['useryes'][$keya]." (".$p."%)</td>";
+ } else
+ echo "<td>".$d['useryes'][$keya]."</td>";
+ } else
+ echo "<td>0</td>";
+
+ echo "</tr>";
+}
+echo "</table></center>";
+
+//----------------------------------------------------------
+echo "<br />";
+echo "<hr />";
+echo "<center><h3>Runs by Time Period</h3></center>\n";
+
+$vezes = 30;
+$passo = $st['siteduration']/$vezes;
+$atual = 0;
+$pos = 0;
+$res = array();
+$m = 0;
+sort($d['timestamp']);
+reset($d['timestamp']);
+while (list($keya, $val) = each($d['timestamp'])) {
+ while($atual+$passo < $val) {
+ $atual += $passo;
+ $pos++;
+ }
+ $res[$pos]++;
+ if($res[$pos] > $m) $m=$res[$pos];
+}
+
+$str="Runs by Time Period" . chr(1) . $m;
+$atual=0;
+for($pos=0; $pos<$vezes; $pos++) {
+ if($res[$pos]=="") $res[$pos] = 0;
+ $q = (int) ($atual/60);
+ $atual += $passo;
+ $qq = (int) ($atual/60);
+ $str .= chr(1) . $q . "-" .$qq . chr(1) . $res[$pos];
+}
+
+echo "<center><img alt=\"\" src=\"linechart.php?dados=".rawurlencode($str)."\" /></center>\n";
+
+//------------------------------------------------
+$vezes = 30;
+$passo = $st['siteduration']/$vezes;
+$atual = 0;
+$pos = 0;
+$res = array();
+sort($d['timestampyes']);
+reset($d['timestampyes']);
+while (list($keya, $val) = each($d['timestampyes'])) {
+ while($atual+$passo < $val) {
+ $atual += $passo;
+ $pos++;
+ }
+ $res[$pos]++;
+}
+
+$str="Accepted Runs by Time Period" . chr(1) . $m;
+$atual=0;
+for($pos=0; $pos<$vezes; $pos++) {
+ if($res[$pos]=="") $res[$pos] = 0;
+ $q = (int) ($atual/60);
+ $atual += $passo;
+ $qq = (int) ($atual/60);
+ $str .= chr(1) . $q . "-" .$qq . chr(1) . $res[$pos];
+}
+
+echo "<center><img alt=\"\" src=\"linechart.php?dados=".rawurlencode($str)."\" /></center>\n";
+
+include("$locr/footnote.php");
+?>
diff --git a/boca-1.5.0/src/admin/report/task.php b/boca-1.5.0/src/admin/report/task.php
new file mode 100644
index 0000000..59ca0e2
--- /dev/null
+++ b/boca-1.5.0/src/admin/report/task.php
@@ -0,0 +1,68 @@
+<?php
+////////////////////////////////////////////////////////////////////////////////
+//BOCA Online Contest Administrator
+// Copyright (C) 2003-2012 by BOCA Development Team (bocasystem@gmail.com)
+//
+// This program is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+// You should have received a copy of the GNU General Public License
+// along with this program. If not, see <http://www.gnu.org/licenses/>.
+////////////////////////////////////////////////////////////////////////////////
+// Last modified 05/aug/2012 by cassio@ime.usp.br
+require('header.php');
+
+?>
+<br>
+<center><h2>Task List</h2></center>
+<table width="100%" border=1>
+ <tr>
+ <td><b>#</b></td>
+ <td><b>Time</b></td>
+ <td><b>User / Site</b></td>
+ <td><b>Description</b></td>
+ <td><b>File</b></td>
+ <td><b>Staff / Site</b></td>
+ <td><b>Status</b></td>
+ </tr>
+<?php
+$s = $st;
+$task = DBAllTasksInSites($_SESSION["usertable"]["contestnumber"], $s["sitetasking"], 'normal');
+$cf = globalconf();
+for ($i=0; $i<count($task); $i++) {
+ $st = $task[$i]["status"];
+
+ if($st == "processing" && $task[$i]["staff"]==$_SESSION["usertable"]["usernumber"] &&
+ $task[$i]["staffsite"]==$_SESSION["usertable"]["usersitenumber"]) $mine=1;
+ else $mine=0;
+
+ echo " <tr>\n";
+ echo " <td nowrap>" . $task[$i]["number"] . "</td>\n";
+ echo " <td nowrap>" . dateconvminutes($task[$i]["timestamp"]) . "</td>\n";
+ echo " <td nowrap>".$task[$i]["username"]." / ".$task[$i]["site"]."</td>\n";
+ echo " <td>" . $task[$i]["description"] . "</td>\n";
+ if ($task[$i]["oid"] != null) {
+ echo " <td nowrap>" . $task[$i]["filename"];
+ echo "</td>\n";
+
+ }
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+ if($st != "opentask")
+ echo " <td nowrap>". $task[$i]["staffname"] . "(" . $task[$i]["staff"] .") / ".$task[$i]["staffsite"]."</td>\n";
+ else
+ echo " <td nowrap>&nbsp;</td>\n";
+
+ echo " <td nowrap>$st</td>\n";
+}
+echo "</table>";
+if (count($task) == 0) echo "<br><center><b><font color=\"#ff0000\">NO TASKS FOUND</font></b></center>";
+
+include("$locr/footnote.php");
+?>