Make judges_jdiv groupings obey the filterdivisionsbycategory config option and dont show div/cat's that shouldnt exist

This commit is contained in:
james 2007-12-20 15:47:19 +00:00
parent 9a7383f552
commit 93f610c214

View File

@ -52,6 +52,8 @@ function newbuttonclicked(jdivs)
<?
$div = array();
$divshort = array();
$q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY id");
while($r=mysql_fetch_object($q)) {
$divshort[$r->id]=$r->division_shortform;
@ -64,6 +66,26 @@ function newbuttonclicked(jdivs)
$cat[$r->id]=$r->category;
}
$dkeys = array_keys($div);
$ckeys = array_keys($cat);
if($config['filterdivisionbycategory']=="yes") {
$q=mysql_query("SELECT * FROM projectcategoriesdivisions_link WHERE year='".$config['FAIRYEAR']."' ORDER BY projectdivisions_id,projectcategories_id");
$divcat=array();
while($r=mysql_fetch_object($q)) {
$divcat[]=array("c"=>$r->projectcategories_id,"d"=>$r->projectdivisions_id);
}
}
else {
$divcat=array();
foreach($dkeys AS $d) {
foreach($ckeys AS $c) {
$divcat[]=array("c"=>$c,"d"=>$d);
}
}
}
$langr = array();
$q=mysql_query("SELECT * FROM languages WHERE active='Y'");
while($r=mysql_fetch_object($q)) {
@ -75,6 +97,7 @@ function get_all_divs()
{
global $config;
global $divshort, $div,$cat, $langr;
global $divcat;
$cdlcheck = array();
$cdl = array();
@ -93,8 +116,10 @@ function get_all_divs()
$divkeys = array_keys($divshort);
$catkeys = array_keys($cat);
$lankeys = array_keys($langr);
foreach($catkeys as $x) {
foreach($divkeys as $y) {
foreach($divcat AS $dc) {
$y=$dc['d'];
$x=$dc['c'];
foreach($lankeys as $z) {
if($cdlcheck[$x][$y][$z] == 1)
continue;
@ -118,9 +143,7 @@ function get_all_divs()
}
reset($lankeys);
}
reset($catkeys);
}
reset($divkeys);
reset($divcat);
/* Make names for all the DCLs, and count the number of projects */
$dkeys = array_keys($cdl);