Copyright (C) 2005 James Grant This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> 'committee_main.php', 'Administration' => 'admin/index.php', 'Awards Main' => 'admin/awards.php') ); if($_GET['sponsors_id']) $sponsors_id=$_GET['sponsors_id']; else if($_POST['sponsors_id']) $sponsors_id=$_POST['sponsors_id']; if($_GET['award_types_id']) $award_types_id=$_GET['award_types_id']; else if($_POST['award_types_id']) $award_types_id=$_POST['award_types_id']; if($_GET['force'] == "true") { $q=mysql_query("SELECT id FROM award_awards WHERE award_types_id='1' AND conferences_id='{$conference['id']}'"); while($r=mysql_fetch_object($q)) { award_delete($r->id); } } //first, we can only do this if we dont have any type=divisional awards created yet $q=mysql_query("SELECT COUNT(id) AS num FROM award_awards WHERE award_types_id='1' AND conferences_id='{$conference['id']}'"); $r=mysql_fetch_object($q); if($r->num) { echo error(i18n("%1 Divisional awards already exist. There must not be any divisional awards in order to run this wizard",array($r->num))); echo "

" . i18n("Proceed Anyways?") . " "; echo i18n("This will delete all existing divisional awards."); echo "

"; } else { $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) $div[$r->id]=$r->division; $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY id"); 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 conferences_id='".$conference['id']."' 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['sponsors_id']) { $q=mysql_query("SELECT * FROM award_prizes WHERE conferences_id='-1' AND award_awards_id='0' ORDER BY `order`"); $prizes=array(); while($r=mysql_fetch_object($q)) { $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($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 (sponsors_id,award_types_id,name,criteria,`order`,conferences_id) VALUES ( '{$_GET['sponsors_id']}', '1', '$c_category - $d_division', '".i18n("Best %1 projects in the %2 division",array($c_category,$d_division))."', '$ord', '{$conference['id']}' )"); echo mysql_error(); $award_awards_id=mysql_insert_id(); mysql_query("INSERT INTO award_awards_projectcategories (award_awards_id,projectcategories_id,conferences_id) VALUES ('$award_awards_id','$c_id','{$conference['id']}')"); mysql_query("INSERT INTO award_awards_projectdivisions (award_awards_id,projectdivisions_id,conferences_id) VALUES ('$award_awards_id','$d_id','{$conference['id']}')"); $ord++; echo "  ".i18n("Prizes: "); foreach($prizes AS $prize) { mysql_query("INSERT INTO award_prizes (award_awards_id,cash,scholarship,value,prize,number,`order`,excludefromac,trophystudentkeeper,trophystudentreturn,trophyschoolkeeper,trophyschoolreturn,conferences_id) 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']}', '{$conference['id']}' )"); echo $prize['prize'].","; } echo "
"; } echo happy(i18n("All divisional awards and prizes successfully created")); echo "".i18n("Go to awards manager")."\n"; } else { echo "
"; echo i18n("Please choose the sponsor and create the prizes that will be added to all divisional awards"); echo "
"; echo ""; echo ""; echo ""; echo "
".i18n("Sponsor").":"; $sq=mysql_query("SELECT id,organization FROM sponsors ORDER BY organization"); echo ""; echo "
".i18n("Prizes")."Edit prize template for divisional awards"; //the 'generic' template prizes for the awards are stored with conferences_id =-1 and award_awards_id=0 $q=mysql_query("SELECT * FROM award_prizes WHERE conferences_id='-1' AND award_awards_id='0' ORDER BY `order`"); if(mysql_num_rows($q)) { /* echo ""; echo ""; echo ""; */ echo ""; echo ""; // echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; // echo " "; echo "\n"; while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; echo " "; echo " "; echo " "; echo " \n"; echo "\n"; } echo "
".i18n("Order")."".i18n("Prize Description")."".i18n("Cash Amount")."".i18n("Scholarship Amount")."".i18n("Value")."".i18n("# of Prizes")."Actions
$r->prize"; if($r->cash) echo "\$$r->cash"; else echo " "; echo " "; if($r->scholarship) echo "\$$r->scholarship"; else echo " "; echo " "; if($r->value) echo "\$$r->value"; else echo " "; echo " $r->number
\n"; } echo "
"; echo "".i18n("We will create the following awards with the prizes listed above").":"; echo "
"; 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 ""; echo ""; echo "
"; } } send_footer(); ?>