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', 'SFIAB Configuration' => 'config/index.php', 'Project Sub-Divisions' => 'config/subdivisions.php'), "project_sub_divisions"); } else { send_header("Project Sub-Divisions", array('Committee Main' => 'committee_main.php', 'SFIAB Configuration' => 'config/index.php'), "project_sub_divisions"); } if($_POST['action']=="edit") { if($_POST['id'] && $_POST['projectdivisions_id'] && $_POST['subdivision'] ) { $q=mysql_query("SELECT id FROM projectsubdivisions WHERE id='".intval($_POST['id'])."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { echo error(i18n("Sub-Division ID %1 already exists",array($_POST['id']))); } else { mysql_query("UPDATE projectsubdivisions SET ". "id='".intval($_POST['id'])."', ". "projectdivisions_id='".$_POST['projectdivisions_id']."', ". "subdivision='".mysql_real_escape_string($_POST['subdivision'])."' ". "WHERE id='".intval($_POST['saveid'])."'"); echo happy(i18n("Sub-Division successfully saved")); } } else { echo error(i18n("All fields are required")); } } if($_POST['action']=="new") { if($_POST['projectdivisions_id'] && $_POST['subdivision']) { if(!$_POST['id']) { $idq=mysql_query("SELECT MAX(id) AS id FROM projectsubdivisions"); $idr=mysql_fetch_object($idq); $newid=$idr->id+1; } else $newid=$_POST['id']; $q=mysql_query("SELECT id FROM projectsubdivisions WHERE id='$newid' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)) { echo error(i18n("Sub-Division ID %1 already exists",array($newid))); } else { mysql_query("INSERT INTO projectsubdivisions (id,projectdivisions_id,subdivision,conferences_id) VALUES ( ". "'$newid', ". "'".intval($_POST['projectdivisions_id'])."', ". "'".mysql_real_escape_string($_POST['subdivision'])."', ". "'".$conference['id']."') "); echo happy(i18n("Sub-Division successfully added")); } } else { echo error(i18n("All fields except ID are required")); } } if($_GET['action']=="remove" && $_GET['remove']) { mysql_query("DELETE FROM projectsubdivisions WHERE id='".intval($_GET['remove'])."'"); echo happy(i18n("Sub-Division successfully removed")); } echo "
"; if(! ($_GET['action']=="edit" || $_GET['action']=="new") ) echo "".i18n("Add new sub-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 projectsubdivisions WHERE id='".$_GET['edit']."' AND conferences_id='".$conference['id']."'"); $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 projectsubdivisions.id, projectsubdivisions.projectdivisions_id, projectsubdivisions.subdivision, projectdivisions.division FROM projectsubdivisions, projectdivisions WHERE projectsubdivisions.conferences_id='".$conference['id']."' AND projectdivisions.conferences_id='".$conference['id']."' AND projectsubdivisions.projectdivisions_id=projectdivisions.id ORDER BY division,subdivision"); echo mysql_error(); while($r=mysql_fetch_object($q)) { echo ""; echo " "; echo " "; echo " "; echo " "; echo ""; } } echo "
".i18n("Parent Division")."".i18n("ID")."".i18n("Sub-Division")."".i18n("Actions")."
"; echo ""; echo "id\">subdivision)."\">
$r->division$r->id$r->subdivision"; echo "id\">"; echo "   "; echo "id\">"; echo "
"; if($_GET['action']=="new") echo "         ".i18n("Leave ID field blank to auto-assign next available ID"); echo "
"; send_footer(); ?>