aboutsummaryrefslogtreecommitdiff
path: root/src/admin/report
diff options
context:
space:
mode:
authorCarlos Joa <cjoa@yahoo.com>2017-10-20 01:39:13 +0000
committerCarlos Joa <cjoa@yahoo.com>2017-10-20 01:39:13 +0000
commitbf6f929ce5119aa5669696b6596ce9435962422a (patch)
tree60529befdd5b7ccefbdee7486e402a4217603d10 /src/admin/report
parent0f0a9f31132ea420a63cf492dba5cd1db7e56c40 (diff)
downloadboca-bf6f929ce5119aa5669696b6596ce9435962422a.tar.gz
boca-bf6f929ce5119aa5669696b6596ce9435962422a.zip
Fix error when appending the contestant's institution.
Diffstat (limited to 'src/admin/report')
-rw-r--r--src/admin/report/s4ris.php150
1 files changed, 75 insertions, 75 deletions
diff --git a/src/admin/report/s4ris.php b/src/admin/report/s4ris.php
index eaa0264..7c2908b 100644
--- a/src/admin/report/s4ris.php
+++ b/src/admin/report/s4ris.php
@@ -24,25 +24,25 @@ $site = $_SESSION["usertable"]["usersitenumber"];
$ct = DBContestInfo($contest);
if(($st = DBSiteInfo($contest, $site)) == null)
- ForceLoad("../index.php");
+ ForceLoad("../index.php");
//if(isset($_GET['full']) && $_GET['full'] > 0)
- $freezeTime = $st['siteduration'];
+ $freezeTime = $st['siteduration'];
//else
-// $freezeTime = $st['sitelastmilescore'];
+// $freezeTime = $st['sitelastmilescore'];
$obj = array(
- 'contestName' => $ct['contestname'],
- 'freezeTimeMinutesFromStart' => $ct['contestlastmilescore']/60
+ 'contestName' => $ct['contestname'],
+ 'freezeTimeMinutesFromStart' => $ct['contestlastmilescore']/60
);
$c = DBConnect();
$r = DBExec($c,
- 'SELECT problemname FROM problemtable' .
- ' WHERE contestnumber = ' . $contest .
- ' AND problemnumber > 0');
+ 'SELECT problemname FROM problemtable' .
+ ' WHERE contestnumber = ' . $contest .
+ ' AND problemnumber > 0');
$problems = array();
$numProblems = DBnlines($r);
@@ -55,30 +55,30 @@ $obj['problemLetters'] = $problems;
$r = DBExec($c,
- 'SELECT * FROM usertable' .
- ' WHERE contestnumber = ' . $contest .
- ' AND userenabled = \'t\' AND usersitenumber = ' . $site .
- ' AND usertype = \'team\'');
+ 'SELECT * FROM usertable' .
+ ' WHERE contestnumber = ' . $contest .
+ ' AND userenabled = \'t\' AND usersitenumber = ' . $site .
+ ' AND usertype = \'team\'');
$contestans = array();
$numTeams = DBnlines($r);
for ($i = 0; $i < $numTeams; $i++) {
- $a = cleanuserdesc(DBRow($r, $i));
- //$teamID = $a['username'];
-
- if (isset($a['usershortname']))
- $teamName = $a['usershortname'];
- else
- $teamName = $a['userfullname'];
-
- if (isset($a['usershortinstitution'])) {
- $teamName .= ' @ ' . $a['usershortinstitution'];
- if (isset($a['userflag'])) {
- $teamName .= '.' . $a['userflag'];
- }
- }
-
- $contestants[$i] = $teamName;
+ $a = cleanuserdesc(DBRow($r, $i));
+ //$teamID = $a['username'];
+
+ if (isset($a['usershortname']))
+ $teamName = $a['usershortname'];
+ else
+ $teamName = $a['userfullname'];
+
+ if (isset($a['usershortinstitution'])) {
+ $teamName .= ' @ ' . $a['usershortinstitution'];
+ if (isset($a['userflag'])) {
+ $teamName .= '.' . $a['userflag'];
+ }
+ }
+
+ $contestants[$i] = $teamName;
}
$obj['contestants'] = $contestants;
@@ -88,33 +88,33 @@ $numRuns = count($run);
$runs = array();
for ($i = 0; $i < $numRuns; $i++) {
- $runTime = dateconvminutes($run[$i]['timestamp']);
- if ($runTime > $freezeTime) {
- continue;
- }
-
- $u = DBUserInfo($contest, $site, $run[$i]['user']);
-
- if(isset($u['usershortname']))
- $runTeam = $u['usershortname'];
- else
- $runTeam = $u['userfullname'];
-
- if(isset($u['usershortinstitution'])) {
- $runTeam .= ' @ ' . $u['usershortinstitution'];
- if (isset($a['userflag'])) {
- $runTeam .= '.' . $a['userflag'];
- }
- }
-
- $runProblem = $run[$i]['problem'];
-
- $runs[$i] = array(
- 'contestant' => $runTeam,
- 'problemLetter' => $runProblem,
- 'timeMinutesFromStart' => $runTime,
- 'success' => $run[$i]['yes'] == 't'
- );
+ $runTime = dateconvminutes($run[$i]['timestamp']);
+ if ($runTime > $freezeTime) {
+ continue;
+ }
+
+ $u = DBUserInfo($contest, $site, $run[$i]['user']);
+
+ if(isset($u['usershortname']))
+ $runTeam = $u['usershortname'];
+ else
+ $runTeam = $u['userfullname'];
+
+ if(isset($u['usershortinstitution'])) {
+ $runTeam .= ' @ ' . $u['usershortinstitution'];
+ if (isset($u['userflag'])) {
+ $runTeam .= '.' . $u['userflag'];
+ }
+ }
+
+ $runProblem = $run[$i]['problem'];
+
+ $runs[$i] = array(
+ 'contestant' => $runTeam,
+ 'problemLetter' => $runProblem,
+ 'timeMinutesFromStart' => $runTime,
+ 'success' => $run[$i]['yes'] == 't'
+ );
}
$obj['runs'] = $runs;
@@ -125,32 +125,32 @@ $ds = DIRECTORY_SEPARATOR;
if($ds=="") $ds = "/";
if(isset($_SESSION['locr'])) {
- $s4risparentdir = $_SESSION['locr'] . $ds. 'private';
- $s4risdir = $s4risparentdir .$ds. 's4ris';
+ $s4risparentdir = $_SESSION['locr'] . $ds. 'private';
+ $s4risdir = $s4risparentdir .$ds. 's4ris';
} else {
- $s4risparentdir = $locr . $ds . 'private';
- $s4risdir = $s4risparentdir . $ds . 's4ris';
+ $s4risparentdir = $locr . $ds . 'private';
+ $s4risdir = $s4risparentdir . $ds . 's4ris';
}
cleardir($s4risdir);
@mkdir($s4risdir);
if(is_writable($s4risdir)) {
- file_put_contents($s4risdir . $ds . 'results.json', json_encode($obj, JSON_PRETTY_PRINT));
- if(@create_zip($s4risparentdir,array('s4ris'), $s4risdir . ".tmp") != 1) {
- LOGError("Cannot create score s4risdir.tmp file");
- MSGError("Cannot create score s4risdir.tmp file");
- } else {
- $cf = globalconf();
- file_put_contents($s4risdir . ".tmp", encryptData(file_get_contents($s4risdir . ".tmp"), $cf["key"],false));
- @rename($s4risdir . ".tmp",$s4risdir . '.zip');
- }
- echo "<br><br><br><center>";
- echo "<a href=\"$locr/filedownload.php?".
- filedownload(-1,$s4risdir . '.zip') . "\">CLICK TO DOWNLOAD</a>";
- echo "</center>";
+ file_put_contents($s4risdir . $ds . 'results.json', json_encode($obj, JSON_PRETTY_PRINT));
+ if(@create_zip($s4risparentdir,array('s4ris'), $s4risdir . ".tmp") != 1) {
+ LOGError("Cannot create score s4risdir.tmp file");
+ MSGError("Cannot create score s4risdir.tmp file");
+ } else {
+ $cf = globalconf();
+ file_put_contents($s4risdir . ".tmp", encryptData(file_get_contents($s4risdir . ".tmp"), $cf["key"],false));
+ @rename($s4risdir . ".tmp",$s4risdir . '.zip');
+ }
+ echo "<br><br><br><center>";
+ echo "<a href=\"$locr/filedownload.php?".
+ filedownload(-1,$s4risdir . '.zip') . "\">CLICK TO DOWNLOAD</a>";
+ echo "</center>";
} else {
- LOGError('Error creating the folder for the ZIP file: '. $s4risdir);
- MSGError('Error creating the folder for the ZIP file: '.$s4risdir);
- ForceLoad("../index.php");
+ LOGError('Error creating the folder for the ZIP file: '. $s4risdir);
+ MSGError('Error creating the folder for the ZIP file: '.$s4risdir);
+ ForceLoad("../index.php");
}
echo "<br><br><br>\n";
echo "<br><br><br>\n";