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 Configuration")."
"; if($_POST['action']=="edit") { //ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden if($_POST['id'] && $_POST['category'] && isset($_POST['mingrade']) && $_POST['maxgrade']) { $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); echo mysql_error(); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { echo error(i18n("Category ID %1 already exists",array($_POST['id']),array("category ID"))); } else { mysql_query("UPDATE projectcategories SET ". "id='".$_POST['id']."', ". "category='".mysql_escape_string(stripslashes($_POST['category']))."', ". "mingrade='".$_POST['mingrade']."', ". "maxgrade='".$_POST['maxgrade']."' ". "WHERE id='".$_POST['saveid']."'"); echo happy(i18n("Category successfully saved")); } } else { echo error(i18n("All fields are required")); } } if($_POST['action']=="new") { //ues isset($_POST['mingrade']) instead of just $_POST['mingrade'] to allow entering 0 for kindergarden if($_POST['id'] && $_POST['category'] && isset($_POST['mingrade']) && $_POST['maxgrade']) { $q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { echo error(i18n("Category ID %1 already exists",array($_POST['id']),array("category ID"))); } else { mysql_query("INSERT INTO projectcategories (id,category,mingrade,maxgrade,year) VALUES ( ". "'".$_POST['id']."', ". "'".mysql_escape_string(stripslashes($_POST['category']))."', ". "'".$_POST['mingrade']."', ". "'".$_POST['maxgrade']."', ". "'".$config['FAIRYEAR']."')"); echo happy(i18n("Category successfully added")); } } else { echo error(i18n("All fields are required")); } } if($_GET['action']=="remove" && $_GET['remove']) { mysql_query("DELETE FROM projectcategories WHERE id='".$_GET['remove']."'"); echo happy(i18n("Category successfully removed")); } echo "
"; echo "

".i18n("Age Categories")."

"; if(! ($_GET['action']=="edit" || $_GET['action']=="new") ) echo "".i18n("Add new age category")."\n"; echo ""; echo ""; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo ""; if($_GET['action']=="edit" || $_GET['action']=="new") { echo "\n"; if($_GET['action']=="edit") { echo "\n"; $q=mysql_query("SELECT * FROM projectcategories WHERE id='".$_GET['edit']."' AND year='".$config['FAIRYEAR']."'"); $categoryr=mysql_fetch_object($q); $buttontext="Save"; } else if($_GET['action']=="new") { $buttontext="Add"; } echo ""; echo " "; echo " "; echo " "; echo " "; echo " "; echo ""; } else { $q=mysql_query("SELECT * FROM projectcategories WHERE year='".$config['FAIRYEAR']."' ORDER BY mingrade"); while($r=mysql_fetch_object($q)) { echo ""; echo " "; echo " "; echo " "; echo " "; echo " "; echo ""; } } echo "
".i18n("Category ID")."".i18n("Category Name")."".i18n("Minimum Grade")."".i18n("Maximum Grade")."".i18n("Actions")."
id\">category\">mingrade\">maxgrade\">
$r->id".i18n($r->category)."$r->mingrade$r->maxgrade"; echo "id\">"; echo "   "; echo "id\">"; echo "
"; echo "
"; echo i18n("You should assign the 'Category ID's in numerical order, starting with 1. This Category ID is used to generate the project number"); send_footer(); ?>