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. */ ?> << ".i18n("Back to Administration")."\n"; echo "<< ".i18n("Back to Awards Main")."\n"; echo "<< ".i18n("Back to Awards List")."\n"; if($award_awards_id) { if($award_awards_id==-1) { $award->name="Generic Prize Template"; } else { $q=mysql_query("SELECT * FROM award_awards WHERE id='".$award_awards_id."'"); $award=mysql_fetch_object($q); } if($_POST['save']=="edit" || $_POST['save']=="add") { if($_POST['save']=="add") { if($award_awards_id==-1) $q=mysql_query("INSERT INTO award_prizes (award_awards_id,year) VALUES ('0','-1')"); else $q=mysql_query("INSERT INTO award_prizes (award_awards_id,year) VALUES ('$award_awards_id','".$config['FAIRYEAR']."')"); $id=mysql_insert_id(); } else $id=$_POST['id']; $exec="UPDATE award_prizes SET ". "prize='".mysql_escape_string(stripslashes($_POST['prize']))."', ". "cash='".mysql_escape_string(stripslashes($_POST['cash']))."', ". "scholarship='".mysql_escape_string(stripslashes($_POST['scholarship']))."', ". "number='".mysql_escape_string(stripslashes($_POST['number']))."', ". "excludefromac='".mysql_escape_string(stripslashes($_POST['excludefromac']))."', ". "`order`='".mysql_escape_string(stripslashes($_POST['order']))."' ". "WHERE id='$id'"; mysql_query($exec); if($_POST['save']=="add") echo happy("Prize successfully added"); else echo happy("Successfully saved changes to prize"); } if($_POST['action']=="reorder") { if(is_array($_POST['reorder'])) { foreach($_POST['reorder'] AS $key=>$val) { mysql_query("UPDATE award_prizes SET `order`='$val' WHERE id='$key'"); } echo happy("Award Prizes successfully reordered"); } } if($_GET['action']=="delete" && $_GET['delete']) { mysql_query("DELETE FROM award_prizes WHERE id='".$_GET['delete']."'"); echo happy("Contact successfully deleted"); } if($_GET['action']=="edit" || $action=="add") { echo "<< ".i18n("Back to Prizes for %1",array($award->name))."\n"; echo "
"; echo "
"; if($_GET['action']=="edit") { echo "

".i18n("Edit Prize for %1",array($award->name))."

\n"; $buttontext="Save Prize"; $q=mysql_query("SELECT * FROM award_prizes WHERE id='".$_GET['edit']."'"); $r=mysql_fetch_object($q); } else if($action=="add") { echo "

".i18n("Add Prize for %1",array($award->name))."

\n"; $buttontext="Add Prize"; } $buttontext=i18n($buttontext); echo "
\n"; echo "\n"; echo "\n"; if($_GET['action']=="edit") echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "\n"; echo "
".i18n("Prize Description")."prize)."\" size=\"40\" maxlength=\"128\" />
".i18n("Cash Amount")."\$cash)."\" size=\"10\" maxlength=\"10\" />
".i18n("Scholarship Amount")."\$scholarship)."\" size=\"10\" maxlength=\"10\" />
".i18n("Number")."number)."\" size=\"3\" maxlength=\"5\" />
".i18n("Order")."order)."\" size=\"3\" maxlength=\"5\" />
"; if($r->excludefromac==1) $ch="checked=\"checked\""; else $ch=""; echo "".i18n("Exclude this prize from the award ceremony script")."
\n"; echo "
\n"; } else { echo "
"; echo "
"; echo "".i18n("Add New Prize to %1",array($award->name))."\n"; echo "
"; if($award_awards_id==-1) { $q=mysql_query("SELECT * FROM award_prizes WHERE year='-1' AND award_awards_id='0' ORDER BY `order`"); } else { $q=mysql_query("SELECT * FROM award_prizes WHERE year='".$config['FAIRYEAR']."' AND award_awards_id='$award_awards_id' ORDER BY `order`"); } if(mysql_num_rows($q)) { echo "
"; echo ""; echo ""; echo ""; echo ""; echo " "; echo " "; echo " "; echo " "; echo " "; echo " "; echo "\n"; while($r=mysql_fetch_object($q)) { echo "\n"; echo " \n"; echo " \n"; echo " "; echo " "; echo " \n"; echo " \n"; echo "\n"; } echo "
".i18n("Order")."".i18n("Prize Description")."".i18n("Cash Amount")."".i18n("Scholarship Amount")."".i18n("# of Prizes")."Actions
id]\" value=\"$r->order\" size=\"3\" />$r->prize"; if($r->cash) echo "\$$r->cash"; else echo " "; echo " "; if($r->scholarship) echo "\$$r->scholarship"; else echo " "; echo " $r->number"; echo "id\">"; echo " "; echo "id\">"; echo "
\n"; echo ""; echo "
"; } } } else { echo error(i18n("No Award ID specified")); echo "".i18n("Choose an award").""; } send_footer(); ?>