<< ".i18n("Back to Configuration")."
"; if($_POST['action']=="edit") { if($_POST['id'] && $_POST['division'] ) { $q=mysql_query("SELECT id FROM projectdivisions WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { echo error(i18n("Division ID %1 already exists",array($_POST['id']))); } else { mysql_query("UPDATE projectdivisions SET ". "id='".$_POST['id']."', ". "division='".mysql_escape_string(stripslashes($_POST['division']))."', ". "division_shortform='".mysql_escape_string(stripslashes($_POST['division_shortform']))."' ". "WHERE id='".$_POST['saveid']."'"); echo happy(i18n("Division successfully saved")); } } else { echo error(i18n("All fields are required")); } } if($_POST['action']=="new") { if($_POST['id'] && $_POST['division']) { $q=mysql_query("SELECT id FROM projectdivisions WHERE id='".$_POST['id']."' AND year='".$config['FAIRYEAR']."'"); if(mysql_num_rows($q)) { echo error(i18n("Division ID %1 already exists",array($_POST['id']))); } else { mysql_query("INSERT INTO projectdivisions (id,division,division_shortform,year) VALUES ( ". "'".$_POST['id']."', ". "'".mysql_escape_string(stripslashes($_POST['division']))."', ". "'".mysql_escape_string(stripslashes($_POST['division_shortform']))."', ". "'".$config['FAIRYEAR']."') "); echo happy(i18n("Division successfully added")); } } else { echo error(i18n("All fields are required")); } } if($_GET['action']=="remove" && $_GET['remove']) { mysql_query("DELETE FROM projectdivisions WHERE id='".$_GET['remove']."'"); echo happy(i18n("Division successfully removed")); } echo "
"; echo "

".i18n("Project Divisions")."

"; if(! ($_GET['action']=="edit" || $_GET['action']=="new") ) echo "".i18n("Add new division")."\n"; echo ""; echo ""; 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 projectdivisions WHERE id='".$_GET['edit']."' AND year='".$config['FAIRYEAR']."'"); $divisionr=mysql_fetch_object($q); $buttontext="Save"; } else if($_GET['action']=="new") { $buttontext="Add"; } echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; } else { $q=mysql_query("SELECT * FROM projectdivisions WHERE year='".$config['FAIRYEAR']."' ORDER BY division"); while($r=mysql_fetch_object($q)) { echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; } } echo "
".i18n("Division ID")."".i18n("Division Name")."".i18n("Short Form")."".i18n("Actions")."
id\" />division\" />division_shortform\" />
$r->id$r->division$r->division_shortform"; echo "id\">"; echo "   "; echo "id\">"; echo "
"; echo "
"; send_footer(); ?>