forked from science-ation/science-ation
add divisions and subdivision info to the judge list report.
This commit is contained in:
parent
09918861fc
commit
2813dcaa7a
@ -71,6 +71,21 @@ $table['header']=array( i18n("ID"),
|
||||
i18n("Attending Lunch"),
|
||||
i18n("Expertise Other"));
|
||||
|
||||
|
||||
//grab the list of divisions, because the last fields of the table will be the sub-divisions
|
||||
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY id AND year='".$config['FAIRYEAR']."'");
|
||||
$divheadings=array();
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$divs[]=$r->id;
|
||||
$divheadings[]="$r->division (out of 5)";
|
||||
$divheadings[]="$r->division subdivisions";
|
||||
}
|
||||
|
||||
//now append the arrays together
|
||||
$table['header']=array_merge($table['header'],$divheadings);
|
||||
|
||||
|
||||
//fill these in if we ever make this PDFable
|
||||
$table['widths']=array();
|
||||
$table['dataalign']=array();
|
||||
@ -96,7 +111,37 @@ while($r=mysql_fetch_object($q))
|
||||
$expertise_other=str_replace("\n"," ",$r->expertise_other);
|
||||
$expertise_other=str_replace("\r","",$expertise_other);
|
||||
|
||||
$table['data'][]=array(
|
||||
$subdivq=mysql_query("SELECT judges_expertise.*, projectsubdivisions.subdivision, projectsubdivisions.projectdivisions_id AS parent_id FROM judges_expertise
|
||||
LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id
|
||||
WHERE judges_id='$r->id' AND judges_expertise.year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id, projectsubdivisions_id");
|
||||
while($subdivr=mysql_fetch_object($subdivq))
|
||||
{
|
||||
if($subdivr->projectdivisions_id)
|
||||
{
|
||||
$judge_divs[$subdivr->projectdivisions_id]=$subdivr->val;
|
||||
}
|
||||
else
|
||||
$judge_subdivs[$subdivr->parent_id][]=$subdivr->subdivision;
|
||||
}
|
||||
|
||||
//make sure divdata is empty
|
||||
if($divdata) unset($divdata);
|
||||
//now redeclare the empty array
|
||||
$divdata=array();
|
||||
|
||||
foreach($divs as $div)
|
||||
{
|
||||
$divdata[]=$judge_divs[$div];
|
||||
if(count($judge_subdivs[$div]))
|
||||
$divdata[]=implode(",",$judge_subdivs[$div]);
|
||||
else
|
||||
$divdata[]="";
|
||||
}
|
||||
|
||||
// print_r($judge_divs);
|
||||
// print_r($judge_subdivs);
|
||||
|
||||
$tmp=array(
|
||||
$r->id,
|
||||
$r->lastname,
|
||||
$r->firstname,
|
||||
@ -122,6 +167,8 @@ while($r=mysql_fetch_object($q))
|
||||
$r->attending_lunch,
|
||||
$expertise_other
|
||||
);
|
||||
|
||||
$table['data'][]=array_merge($tmp,$divdata);
|
||||
}
|
||||
|
||||
$rep->addTable($table);
|
||||
|
Loading…
Reference in New Issue
Block a user