From 06834f41b66f6c9fd269754f00509c5f360bd109 Mon Sep 17 00:00:00 2001 From: Cassio de Campos Date: Fri, 4 Aug 2017 16:05:57 +0100 Subject: report for staff --- src/staff/report/header.php | 65 ++++++++ src/staff/report/linechart.php | 45 ++++++ src/staff/report/piechart.php | 68 ++++++++ src/staff/report/stat.php | 343 +++++++++++++++++++++++++++++++++++++++++ 4 files changed, 521 insertions(+) create mode 100755 src/staff/report/header.php create mode 100755 src/staff/report/linechart.php create mode 100755 src/staff/report/piechart.php create mode 100755 src/staff/report/stat.php (limited to 'src') diff --git a/src/staff/report/header.php b/src/staff/report/header.php new file mode 100755 index 0000000..6ebcc32 --- /dev/null +++ b/src/staff/report/header.php @@ -0,0 +1,65 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// 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"] != "staff") { + IntrusionNotify($_SERVER['PHP_SELF']); + ForceLoad($loc."/index.php"); +} + +require_once($locr."/db.php"); +require_once($locr."/freport.php"); + +echo "Report Page\n"; +echo "\n"; + +echo "\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 "\n"; +echo "\n"; +echo "
"; +echo "\"\""; +echo "BOCA"; +echo "\n"; +echo $ct["contestname"] . " - " . $st["sitename"] . "
\n"; +?> diff --git a/src/staff/report/linechart.php b/src/staff/report/linechart.php new file mode 100755 index 0000000..fa47b17 --- /dev/null +++ b/src/staff/report/linechart.php @@ -0,0 +1,45 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// 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;$iaddPoint(new Point($v[$i], $v[$i+1])); + +$chart->setTitle($v[0]); +$chart->setLogo($locr. "/images/poweredbyboca.png"); +$chart->render(); +?> diff --git a/src/staff/report/piechart.php b/src/staff/report/piechart.php new file mode 100755 index 0000000..e6dbf95 --- /dev/null +++ b/src/staff/report/piechart.php @@ -0,0 +1,68 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// 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; +else $chart->order=false; + +$tot=0; +for($i=1;$i $tot/100) + $chart->addPoint(new Point($v[$i], $v[$i+1], $color)); + else + $chart->addPoint(new Point($v[$i], $tot/100, $color)); +} + +$chart->setTitle($v[0]); +$chart->setLogo($locr. "/images/poweredbyboca.png"); +$chart->render(); + +?> diff --git a/src/staff/report/stat.php b/src/staff/report/stat.php new file mode 100755 index 0000000..8a706e4 --- /dev/null +++ b/src/staff/report/stat.php @@ -0,0 +1,343 @@ +. +//////////////////////////////////////////////////////////////////////////////// +// Last modified 05/aug/2012 by cassio@ime.usp.br + +require('header.php'); + +$d = DBRunReport($_SESSION["usertable"]["contestnumber"],$_SESSION["usertable"]["usersitenumber"]); + +echo "

Statistics

\n"; +//---------------------------------------------------------- +echo "

Runs by Problem

\n"; +echo "
\n"; +echo ""; + +echo ""; +echo "\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 ""; + echo ""; + if(isset($d['problemyes'][$keya])) { + echo ""; + } + else + echo ""; + echo ""; +} +echo "
ProblemsTotalAccepted
$keya "; + echo "\"balloon\"\n"; + echo "$val".$d['problemyes'][$keya]; + if($val != 0) { + $p = round(100*$d['problemyes'][$keya] / $val); + echo " (".$p."%)"; + } + echo "0 (0%)
"; + +echo "
"; +echo "\n"; +echo "
\"\"\"\"
\n"; + +//---------------------------------------------------------- +echo "

Runs by Problem and Answer

\n"; +echo "
\n"; +echo ""; +reset($d['answer']); +while (list($key, $val) = each($d['answer'])) + echo ""; +echo "\n"; + +reset($d['problem']); +while (list($keya, $vala) = each($d['problem'])) { + echo ""; + reset($d['answer']); + while (list($key, $val) = each($d['answer'])) { + if(!isset($d['pa'][$keya][$key])) + echo ""; + else { + $p = round(100*$d['pa'][$keya][$key] / $vala); + echo ""; + } + } + echo ""; + echo ""; +} +echo "
Problems x Answers$keyTotal
$keya "; + echo "\"balloon\"\n"; + echo "0".$d['pa'][$keya][$key]." (".$p."%)$vala
"; + +//---------------------------------------------------------- +echo "

Runs by Problem and Language

\n"; +echo "
\n"; +echo ""; +reset($d['language']); +while (list($key, $val) = each($d['language'])) + echo ""; +echo "\n"; + +reset($d['problem']); +while (list($keya, $vala) = each($d['problem'])) { + echo ""; + reset($d['language']); + while (list($key, $val) = each($d['language'])) { + if(!isset($d['pl'][$keya][$key])) + echo ""; + else { + $p = round(100*$d['pl'][$keya][$key] / $vala); + echo ""; + } + } + echo ""; + echo ""; +} +echo "
Problems x Languages$keyTotal
$keya "; + echo "\"balloon\"\n"; + echo "0".$d['pl'][$keya][$key]." (".$p."%)$vala
"; + +//---------------------------------------------------------- +echo "
"; +echo "
"; +echo "

Runs by Language

\n"; +echo "
\n"; +echo ""; + +echo ""; +echo "\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 ""; + echo ""; + if(isset($d['languageyes'][$keya])) { + $p = round(100*$d['languageyes'][$keya] / $val); + echo ""; + } + else + echo ""; + echo ""; +} +echo "
LanguagesTotalAccepted
$keya$val".$d['languageyes'][$keya]." (".$p."%)0 (0%)
"; + +echo "
"; +echo "\n"; +echo "
\"\"\"\"
\n"; + +//---------------------------------------------------------- +echo "

Runs by Language and Answer

\n"; +echo "
\n"; +echo ""; +reset($d['answer']); +while (list($key, $val) = each($d['answer'])) + echo ""; +echo "\n"; + +reset($d['language']); +while (list($keya, $vala) = each($d['language'])) { + echo ""; + reset($d['answer']); + while (list($key, $val) = each($d['answer'])) { + if(!isset($d['la'][$keya][$key])) + echo ""; + else { + $p = round(100*$d['la'][$keya][$key] / $vala); + echo ""; + } + } + echo ""; + echo ""; +} +echo "
Languages x Answers$keyTotal
$keya0".$d['la'][$keya][$key]." (".$p."%)$vala
"; + +//---------------------------------------------------------- +echo "
"; +echo "
"; +echo "

Runs by Answer

\n"; + +echo "
"; +echo ""; +echo "
"; + +echo "
\n"; +echo ""; + +echo ""; +echo "\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 ""; + echo ""; + echo ""; +} +echo "
AnswersAnswers
$keya$val
"; + +echo "
\"\"
\n"; + +//---------------------------------------------------------- +echo "
"; +echo "
"; +echo "

Runs by User and Problem

\n"; +echo "
\n"; +echo ""; +reset($d['problem']); +while (list($key, $val) = each($d['problem'])) { + echo ""; +} +echo "\n"; + +reset($d['username']); +while (list($keya, $vala) = each($d['username'])) { + $keya = $d['username'][$keya]; + if(isset($d['user'][$keya])) + $vala = $d['user'][$keya]; + else $vala=0; + echo ""; + reset($d['problem']); + while (list($key, $val) = each($d['problem'])) { + if(!isset($d['up'][$keya][$key])) + echo ""; + else { + $q = $d['up'][$keya][$key]; + $color = "ff5555"; + if($q < 0) { + $q = - $q; + $color = "22ee22"; + } + echo ""; + } + } + if($vala != "") + echo ""; + else + echo ""; + if(isset($d['useryes'][$keya])) { + if($vala != 0) { + $p = round(100*$d['useryes'][$keya] / $vala); + echo ""; + } else + echo ""; + } else + echo ""; + + echo ""; +} +echo "
Users x Problems$key "; + echo "\"balloon\"\n"; + echo "TotalAccepted
".$d['userfull'][$keya]."0".$q; + if($vala != 0) { + $p = round(100*$q / $vala); + echo " (".$p."%)"; + } + echo "$vala0".$d['useryes'][$keya]." (".$p."%)".$d['useryes'][$keya]."0
"; + +//---------------------------------------------------------- +echo "
"; +echo "
"; +echo "

Runs by Time Period

\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++; + } + if(isset($res[$pos])) + $res[$pos]++; + else $res[$pos]=1; + if($res[$pos] > $m) $m=$res[$pos]; +} + +$str="Runs by Time Period" . chr(1) . $m; +$atual=0; +for($pos=0; $pos<$vezes; $pos++) { + if(!isset($res[$pos]) || $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 "
\"\"
\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++; + } + if(isset($res[$pos])) + $res[$pos]++; + else $res[$pos]=1; +} + +$str="Accepted Runs by Time Period" . chr(1) . $m; +$atual=0; +for($pos=0; $pos<$vezes; $pos++) { + if(!isset($res[$pos]) || $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 "
\"\"
\n"; + +include("$locr/footnote.php"); +?> -- cgit v1.2.3