diff --git a/admin/award_awardcreatedivisional.php b/admin/award_awardcreatedivisional.php index f152397..023bed1 100644 --- a/admin/award_awardcreatedivisional.php +++ b/admin/award_awardcreatedivisional.php @@ -56,6 +56,26 @@ while($r=mysql_fetch_object($q)) $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); + } + } + } + if($_GET['action']=="create" && $_GET['award_sponsors_id']) { @@ -66,17 +86,24 @@ $prizes[]=array( "cash"=>$r->cash, "scholarship"=>$r->scholarship, + "value"=>$r->value, "prize"=>$r->prize, "number"=>$r->number, + "excludefromac"=>$r->excludefromac, + "trophystudentkeeper"=>$r->trophystudentkeeper, + "trophystudentreturn"=>$r->trophystudentreturn, + "trophyschoolkeeper"=>$r->trophyschoolkeeper, + "trophyschoolreturn"=>$r->trophyschoolreturn, "order"=>$r->order); } $ord=1; echo "
"; - foreach($div AS $d_id=>$d_division) - { - foreach($cat AS $c_id=>$c_category) - { + foreach($divcat AS $dc) { + $d_id=$dc['d']; + $c_id=$dc['c']; + $d_division=$div[$d_id]; + $c_category=$cat[$c_id]; echo i18n("Creating %1 - %2",array($c_category,$d_division))."
"; mysql_query("INSERT INTO award_awards (award_sponsors_id,award_types_id,name,criteria,`order`,year) VALUES ( @@ -99,19 +126,24 @@ echo "  ".i18n("Prizes: "); foreach($prizes AS $prize) { - mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,prize,number,`order`,year) VALUES ( + mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,year) VALUES ( '$award_awards_id', '{$prize['cash']}', '{$prize['scholarship']}', + '{$prize['value']}', '{$prize['prize']}', '{$prize['number']}', '{$prize['order']}', + '{$prize['excludefromac']}', + '{$prize['trophystudentkeeper']}', + '{$prize['trophystudentreturn']}', + '{$prize['trophyschoolkeeper']}', + '{$prize['trophyschoolreturn']}', '{$config['FAIRYEAR']}' )"); echo $prize['prize'].","; } echo "
"; - } } echo happy(i18n("All divisional awards and prizes successfully created")); echo "".i18n("Go to awards manager")."\n"; @@ -159,6 +191,7 @@ echo " ".i18n("Prize Description").""; echo " ".i18n("Cash Amount").""; echo " ".i18n("Scholarship Amount").""; + echo " ".i18n("Value").""; echo " ".i18n("# of Prizes").""; // echo " Actions"; echo "\n"; @@ -176,6 +209,10 @@ if($r->scholarship) echo "\$$r->scholarship"; else echo " "; echo " "; + echo " "; + if($r->value) echo "\$$r->value"; + else echo " "; + echo " "; echo " $r->number\n"; echo "\n"; } @@ -189,12 +226,13 @@ echo "".i18n("We will create the following awards with the prizes listed above").":"; echo "
"; - foreach($div AS $d_id=>$d_division) - { - foreach($cat AS $c_id=>$c_category) - { - echo i18n($c_category)." - ".i18n($d_division)."
"; - } + foreach($divcat AS $dc) { + $d_id=$dc['d']; + $c_id=$dc['c']; + $d_division=$div[$d_id]; + $c_category=$cat[$c_id]; + + echo i18n($c_category)." - ".i18n($d_division)."
"; } echo ""; diff --git a/admin/award_prizes.php b/admin/award_prizes.php index cb437d2..0d0ff21 100644 --- a/admin/award_prizes.php +++ b/admin/award_prizes.php @@ -166,7 +166,6 @@ else { - echo "
"; echo "
"; echo "".i18n("Add New Prize to %1",array($award->name))."\n"; echo "
"; diff --git a/admin/judges_jdiv.php b/admin/judges_jdiv.php index 8ce5141..f578f00 100644 --- a/admin/judges_jdiv.php +++ b/admin/judges_jdiv.php @@ -191,6 +191,12 @@ function get_all_divs() echo happy(i18n("Emptied all divisions from Judging Division Group %1",array($_GET['jdiv_id']))); } + if($_GET['action']=="recreate") { + //just delete them all, they'll be recreated automagically + mysql_query("TRUNCATE TABLE judges_jdiv"); + echo happy(i18n("Recreated all division/category/language options")); + } + /* Sort out all the judging divisions */ $cdl = get_all_divs(); @@ -265,7 +271,7 @@ function get_all_divs() $p += $cdl[$id]['projects']; } - echo "\n"; + echo "
\n"; echo "\n"; @@ -309,6 +315,11 @@ function get_all_divs() echo "
Judging Division $jdiv ($p project".($p==1?'':'s').")"; echo "
"; echo ""; + echo "
"; + echo "".i18n("Re-create all division/category/language options").". ".i18n("This will completely empty ALL of your groupings and recreate all the possibly division/category/language options. Do this if for example you end up with a division/category that should not exist (due to the config option to filter divisions by category, or due to changing your divisions/categories alltogether)"); + echo "
"; + echo "
"; + send_footer();