Add time available to judge list custom report

This commit is contained in:
james 2013-02-20 21:18:52 +00:00
parent 88f1cc7614
commit b957eb58ad

View File

@ -99,6 +99,34 @@ while($r=mysql_fetch_object($q))
//now append the arrays together //now append the arrays together
$table['header']=array_merge($table['header'],array_merge($catheadings,$divheadings)); $table['header']=array_merge($table['header'],array_merge($catheadings,$divheadings));
$times = array();
$datetimeheadings=array();
/* Load the judging rounds */
$q = mysql_query("SELECT date,starttime,endtime,name FROM judges_timeslots WHERE round_id='0' AND year='{$config['FAIRYEAR']}' ORDER BY starttime,type");
$x = 0;
while($r = mysql_fetch_object($q)) {
$found = false;
foreach($times as $xx => $t) {
if($t['date'] == $r->date && $t['starttime'] == $r->starttime && $t['endtime'] == $r->endtime) {
$times[$xx]['name'] .= ", {$r->name}";
$found = true;
break;
}
}
if(!$found) {
$times[$x] = array( 'date' => $r->date,
'starttime' => $r->starttime,
'endtime' => $r->endtime,
'name' => $r->name);
$datetimeheadings[]=$r->name;
$x++;
}
}
$table['header']=array_merge($table['header'],$datetimeheadings);
//fill these in if we ever make this PDFable //fill these in if we ever make this PDFable
$table['widths']=array(); $table['widths']=array();
@ -150,6 +178,32 @@ while($r=mysql_fetch_object($q)) {
foreach($keys as $qid) { foreach($keys as $qid) {
$qarray[] = $qans[$qid]; $qarray[] = $qans[$qid];
} }
$tq = mysql_query("SELECT * FROM judges_availability WHERE users_id=\"".$r->id."\" ORDER BY `start`");
$sel = array();
$timedata=array();
while($tr=mysql_fetch_object($tq)) {
foreach($times as $x=>$t) {
if($tr->start == $t['starttime'] && $tr->end == $t['endtime'] && $tr->date == $t['date']) {
$sel[$x] = true;
}
}
}
foreach($times as $x=>$t) {
if($sel[$x]==true) {
$timedata[]="yes";
} else {
$timedata[]="no";
}
}
$tmp=array( $tmp=array(
$r->id, $r->id,
@ -175,7 +229,7 @@ while($r=mysql_fetch_object($q)) {
$tmp = array_merge($tmp, $qarray); $tmp = array_merge($tmp, $qarray);
$extradata=array_merge($catdata,$divdata); $extradata=array_merge($catdata,$divdata);
$table['data'][]=array_merge($tmp,$extradata); $table['data'][]=array_merge(array_merge($tmp,$extradata),$timedata);
} }
$rep->addTable($table); $rep->addTable($table);