forked from science-ation/science-ation
Fix the judges report
This commit is contained in:
parent
4aff70ef17
commit
a85faefe2d
@ -60,8 +60,6 @@ $table['header']=array( i18n("ID"),
|
|||||||
i18n("City"),
|
i18n("City"),
|
||||||
i18n("Province"),
|
i18n("Province"),
|
||||||
i18n("Postal Code"),
|
i18n("Postal Code"),
|
||||||
i18n("Category Pref"),
|
|
||||||
i18n("Division Pref"),
|
|
||||||
i18n("Highest PostSecDeg"),
|
i18n("Highest PostSecDeg"),
|
||||||
i18n("Professional Quals"),
|
i18n("Professional Quals"),
|
||||||
i18n("Years School"),
|
i18n("Years School"),
|
||||||
@ -72,6 +70,15 @@ $table['header']=array( i18n("ID"),
|
|||||||
i18n("Expertise Other"));
|
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 projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||||
|
$numcats=mysql_num_rows($q);
|
||||||
|
$catheadings=array();
|
||||||
|
while($r=mysql_fetch_object($q))
|
||||||
|
{
|
||||||
|
$cats[]=$r->id;
|
||||||
|
$catheadings[]="$r->category (out of 5)";
|
||||||
|
}
|
||||||
//grab the list of divisions, because the last fields of the table will be the sub-divisions
|
//grab the list of divisions, because the last fields of the table will be the sub-divisions
|
||||||
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
|
||||||
$divheadings=array();
|
$divheadings=array();
|
||||||
@ -83,7 +90,7 @@ while($r=mysql_fetch_object($q))
|
|||||||
}
|
}
|
||||||
|
|
||||||
//now append the arrays together
|
//now append the arrays together
|
||||||
$table['header']=array_merge($table['header'],$divheadings);
|
$table['header']=array_merge($table['header'],array_merge($catheadings,$divheadings));
|
||||||
|
|
||||||
|
|
||||||
//fill these in if we ever make this PDFable
|
//fill these in if we ever make this PDFable
|
||||||
@ -91,14 +98,10 @@ $table['widths']=array();
|
|||||||
$table['dataalign']=array();
|
$table['dataalign']=array();
|
||||||
|
|
||||||
$q=mysql_query("SELECT
|
$q=mysql_query("SELECT
|
||||||
judges.*,
|
judges.*
|
||||||
projectcategories.category AS catpref_name,
|
|
||||||
projectdivisions.division AS divpref_name
|
|
||||||
FROM
|
FROM
|
||||||
judges,
|
judges,
|
||||||
judges_years
|
judges_years
|
||||||
LEFT JOIN projectcategories ON judges.catpref=projectcategories.id
|
|
||||||
LEFT JOIN projectdivisions ON judges.divpref=projectdivisions.id
|
|
||||||
WHERE
|
WHERE
|
||||||
judges.complete='yes' AND
|
judges.complete='yes' AND
|
||||||
judges_years.year='".$config['FAIRYEAR']."' AND
|
judges_years.year='".$config['FAIRYEAR']."' AND
|
||||||
@ -111,12 +114,21 @@ while($r=mysql_fetch_object($q))
|
|||||||
$expertise_other=str_replace("\n"," ",$r->expertise_other);
|
$expertise_other=str_replace("\n"," ",$r->expertise_other);
|
||||||
$expertise_other=str_replace("\r","",$expertise_other);
|
$expertise_other=str_replace("\r","",$expertise_other);
|
||||||
|
|
||||||
$subdivq=mysql_query("SELECT judges_expertise.*, projectsubdivisions.subdivision, projectsubdivisions.projectdivisions_id AS parent_id FROM judges_expertise
|
$subdivq=mysql_query("SELECT judges_expertise.*,
|
||||||
LEFT JOIN projectsubdivisions ON judges_expertise.projectsubdivisions_id=projectsubdivisions.id
|
projectsubdivisions.subdivision,
|
||||||
WHERE judges_id='$r->id' AND judges_expertise.year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id, projectsubdivisions_id");
|
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");
|
||||||
if(isset($judge_divs)) unset($judge_divs); $judge_divs=array();
|
if(isset($judge_divs)) unset($judge_divs); $judge_divs=array();
|
||||||
if(isset($judge_subdivs)) unset($judge_subdivs); $judge_subdivs=array();
|
if(isset($judge_subdivs)) unset($judge_subdivs); $judge_subdivs=array();
|
||||||
if(isset($divdata)) unset($divdata); $divdata=array();
|
if(isset($divdata)) unset($divdata); $divdata=array();
|
||||||
|
if(isset($catdata)) unset($catdata); $catdata=array();
|
||||||
|
|
||||||
while($subdivr=mysql_fetch_object($subdivq))
|
while($subdivr=mysql_fetch_object($subdivq))
|
||||||
{
|
{
|
||||||
@ -138,6 +150,34 @@ while($r=mysql_fetch_object($q))
|
|||||||
$divdata[]="";
|
$divdata[]="";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$catprefq=mysql_query("SELECT judges_catpref.rank, projectcategories.category
|
||||||
|
FROM judges_catpref,
|
||||||
|
projectcategories
|
||||||
|
WHERE
|
||||||
|
projectcategories.year='".$config['FAIRYEAR']."' AND
|
||||||
|
judges_catpref.year='".$config['FAIRYEAR']."' AND
|
||||||
|
judges_catpref.judges_id='".$r->id."' AND
|
||||||
|
judges_catpref.projectcategories_id=projectcategories.id
|
||||||
|
ORDER BY
|
||||||
|
judges_catpref.projectcategories_id");
|
||||||
|
if(mysql_num_rows($catprefq)!=$numcats)
|
||||||
|
{
|
||||||
|
//somethings messed up, we're missing data or have too much, so we really cant draw any conclusions from the data we have
|
||||||
|
//so instead, we will simply blank these out to 0
|
||||||
|
for($x=0;$x<$numcats;$x++)
|
||||||
|
$catdata[]=0;
|
||||||
|
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
while($cr=mysql_fetch_object($catprefq))
|
||||||
|
{
|
||||||
|
//this is stored in teh db as -2 ... +2 so if we add 2 we get a nice 0 ... 5
|
||||||
|
$catdata[]=$cr->rank+2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// print_r($judge_divs);
|
// print_r($judge_divs);
|
||||||
// print_r($judge_subdivs);
|
// print_r($judge_subdivs);
|
||||||
|
|
||||||
@ -156,8 +196,6 @@ while($r=mysql_fetch_object($q))
|
|||||||
$r->city,
|
$r->city,
|
||||||
$r->province,
|
$r->province,
|
||||||
$r->postalcode,
|
$r->postalcode,
|
||||||
$r->catpref_name,
|
|
||||||
$r->divpref_name,
|
|
||||||
$r->highest_psd,
|
$r->highest_psd,
|
||||||
$r->professional_quals,
|
$r->professional_quals,
|
||||||
$r->years_school,
|
$r->years_school,
|
||||||
@ -168,7 +206,8 @@ while($r=mysql_fetch_object($q))
|
|||||||
$expertise_other
|
$expertise_other
|
||||||
);
|
);
|
||||||
|
|
||||||
$table['data'][]=array_merge($tmp,$divdata);
|
$extradata=array_merge($catdata,$divdata);
|
||||||
|
$table['data'][]=array_merge($tmp,$extradata);
|
||||||
}
|
}
|
||||||
|
|
||||||
$rep->addTable($table);
|
$rep->addTable($table);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user