forked from science-ation/science-ation
Fix the custom judge report -its the only way to get div/cat/lang prefs, and the answers to judge questions
This commit is contained in:
parent
5676c39b54
commit
eb2f9e769f
@ -48,7 +48,9 @@ else if($type=="csv")
|
|||||||
}
|
}
|
||||||
|
|
||||||
$table=array();
|
$table=array();
|
||||||
$table['header']=array( i18n("ID"),
|
$table['header']=array(
|
||||||
|
i18n("ID"),
|
||||||
|
i18n("Unique ID"),
|
||||||
i18n("Last Name"),
|
i18n("Last Name"),
|
||||||
i18n("First Name"),
|
i18n("First Name"),
|
||||||
i18n("Email"),
|
i18n("Email"),
|
||||||
@ -103,97 +105,44 @@ $table['widths']=array();
|
|||||||
$table['dataalign']=array();
|
$table['dataalign']=array();
|
||||||
|
|
||||||
$q=mysql_query("SELECT
|
$q=mysql_query("SELECT
|
||||||
judges.*
|
users.*,
|
||||||
|
users_judge.*
|
||||||
FROM
|
FROM
|
||||||
judges,
|
users
|
||||||
judges_years
|
JOIN users_judge ON users.id=users_judge.users_id
|
||||||
WHERE
|
WHERE
|
||||||
judges.complete='yes' AND
|
users.deleted='no' AND
|
||||||
judges.deleted='no' AND
|
users.year='".$config['FAIRYEAR']."'
|
||||||
judges_years.year='".$config['FAIRYEAR']."' AND
|
AND users.types LIKE '%judge%'
|
||||||
judges.id=judges_years.judges_id
|
|
||||||
ORDER BY
|
ORDER BY
|
||||||
lastname,
|
lastname,
|
||||||
firstname");
|
firstname");
|
||||||
while($r=mysql_fetch_object($q))
|
echo mysql_error();
|
||||||
{
|
while($r=mysql_fetch_object($q)) {
|
||||||
|
$u=user_load($r->id);
|
||||||
|
|
||||||
$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
|
|
||||||
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_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();
|
if(isset($catdata)) unset($catdata); $catdata=array();
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
foreach($divs as $div)
|
|
||||||
{
|
|
||||||
$divdata[]=$judge_divs[$div];
|
|
||||||
if(count($judge_subdivs[$div]))
|
|
||||||
$divdata[]=implode(",",$judge_subdivs[$div]);
|
|
||||||
else
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$languages="";
|
$languages="";
|
||||||
//and finally, grab their languages
|
|
||||||
$langq=mysql_query("SELECT * FROM judges_languages WHERE judges_id='".$r->id."' ORDER BY languages_lang");
|
|
||||||
while($langr=mysql_fetch_object($langq))
|
|
||||||
$languages.=$langr->languages_lang."/";
|
|
||||||
//stip off the last /
|
|
||||||
$languages=substr($languages,0,-1);
|
|
||||||
|
|
||||||
// print_r($judge_divs);
|
foreach($u['cat_prefs'] AS $c) {
|
||||||
// print_r($judge_subdivs);
|
$catdata[]=$c+2;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($u['div_prefs'] AS $d) {
|
||||||
|
$divdata[]=$d;
|
||||||
|
//FIXME: 2010-01-22 - James - get the sub divisions for now we use a placeholder
|
||||||
|
$divdata[]="";
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($u['languages'] AS $k=>$v) {
|
||||||
|
$languages.="$v/";
|
||||||
|
}
|
||||||
|
$languages=substr($languages,0,-1);
|
||||||
|
|
||||||
$qarray = array();
|
$qarray = array();
|
||||||
$qans = questions_load_answers('judgereg', $r->id, $config['FAIRYEAR']);
|
$qans = questions_load_answers('judgereg', $r->id, $config['FAIRYEAR']);
|
||||||
@ -204,6 +153,7 @@ while($r=mysql_fetch_object($q))
|
|||||||
|
|
||||||
$tmp=array(
|
$tmp=array(
|
||||||
$r->id,
|
$r->id,
|
||||||
|
$r->uid,
|
||||||
$r->lastname,
|
$r->lastname,
|
||||||
$r->firstname,
|
$r->firstname,
|
||||||
$r->email,
|
$r->email,
|
||||||
|
Loading…
Reference in New Issue
Block a user