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 Divisions' => 'config/divisions.php'), "project_divisions" ); } else { send_header("Project Divisions", array('Committee Main' => 'committee_main.php', 'SFIAB Configuration' => 'config/index.php'), "project_divisions"); } if($_POST['action']=="edit") { if($_POST['id'] && $_POST['division'] ) { $q=mysql_query("SELECT id FROM projectdivisions WHERE id='".$_POST['id']."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id']) { echo error(i18n("Division ID %1 already exists",array($_POST['id']),array("division ID"))); } else { mysql_query("UPDATE projectdivisions SET ". "id='".intval($_POST['id'])."', ". "division='".mysql_real_escape_string($_POST['division'])."', ". "division_shortform='".mysql_real_escape_string($_POST['division_shortform'])."' ". "WHERE id='".intval($_POST['saveid'])."' AND conferences_id='{$conference['id']}'"); //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes"){ mysql_query("DELETE FROM projectcategoriesdivisions_link WHERE projectdivisions_id='".intval($_POST['saveid'])."' AND conferences_id='".$conference['id']."'"); if(is_array($_POST['divcat'])) { foreach($_POST['divcat'] as $tempcat) { mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,conferences_id) VALUES ( ". "'".$_POST['id']."', ". "'".$tempcat."', ". "'".$conference['id']."') "); } } } //########### 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='".intval($_POST['id'])."' AND conferences_id='".$conference['id']."'"); if(mysql_num_rows($q)) { echo error(i18n("Division ID %1 already exists",array($_POST['id']),array("division ID"))); } else { mysql_query("INSERT INTO projectdivisions (id,division,division_shortform,conferences_id) VALUES ( ". "'".intval($_POST['id'])."', ". "'".mysql_real_escape_string($_POST['division'])."', ". "'".mysql_real_escape_string($_POST['division_shortform'])."', ". "'".$conference['id']."') "); //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes"){ foreach($_POST['divcat'] as $tempcat){ mysql_query("INSERT INTO projectcategoriesdivisions_link (projectdivisions_id,projectcategories_id,conferences_id) VALUES ( ". "'".intval($tempcat)."', ". "'".$conference['id']."') "); } } //####### echo happy(i18n("Division successfully added")); } } else { echo error(i18n("All fields are required")); } } if($_GET['action']=="remove" && $_GET['remove']) { //###### Feature Specific - filtering divisions by category - not conditional, cause even if they have the filtering turned off..if any links //for this division exist they should be deleted mysql_query("DELETE FROM projectcategoriesdivisions_link WHERE projectdivisions_id='".intval($_GET['remove'])."' AND conferences_id='".$conference['id']."'"); mysql_query("DELETE FROM projectdivisions WHERE id='".intval($_GET['remove'])."' AND conferences_id='".$conference['id']."'"); echo happy(i18n("Division successfully removed")); } echo "
"; if(! ($_GET['action']=="edit" || $_GET['action']=="new") ) echo "".i18n("Add new division")."\n"; echo ""; echo ""; echo "\n"; echo "\n"; echo "\n"; //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes") 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 conferences_id='".$conference['id']."'"); $divisionr=mysql_fetch_object($q); $buttontext="Save"; } else if($_GET['action']=="new") { $buttontext="Add"; } echo ""; echo " "; echo " "; echo " "; //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes"){ echo " "; } echo " "; echo ""; } else { $q=mysql_query("SELECT * FROM projectdivisions WHERE conferences_id='".$conference['id']."' ORDER BY id"); while($r=mysql_fetch_object($q)) { echo ""; echo " "; echo " "; echo " "; //###### Feature Specific - filtering divisions by category if($config['filterdivisionbycategory']=="yes"){ $c=mysql_query("SELECT category FROM projectcategoriesdivisions_link, projectcategories WHERE projectcategoriesdivisions_link.projectcategories_id = projectcategories.id AND projectdivisions_id='$r->id' AND projectcategoriesdivisions_link.conferences_id='".$conference['id']."' AND projectcategories.conferences_id='".$conference['id']."' ORDER BY projectcategories.mingrade"); echo mysql_error(); if(!$c){ $tempcat=" "; }else{ $tempcat=""; while($categoryr=mysql_fetch_object($c)){ $tempcat.=",".$categoryr->category; } $tempcat=substr($tempcat,1); } echo ""; } //############ echo " "; echo ""; } } echo "
".i18n("Division ID")."".i18n("Division Name")."".i18n("Short Form")."".i18n("Categories")."".i18n("Actions")."
id\" />division)."\" />division_shortform)."\" />"; $q=mysql_query("SELECT * FROM projectcategories WHERE conferences_id='".$conference['id']."' ORDER BY mingrade"); while($categoryr=mysql_fetch_object($q)){ $query="SELECT * FROM projectcategoriesdivisions_link WHERE projectdivisions_id=".$divisionr->id." AND projectcategories_id=".$categoryr->id." AND conferences_id='".$conference['id']."'"; $t=mysql_query($query); if($t && mysql_num_rows($t)>0) echo "id\" checked=\"checked\" /> $categoryr->category
"; else echo "id\" /> $categoryr->category
"; } echo "
$r->id".i18n($r->division)."$r->division_shortform {$tempcat} "; echo "id\">"; echo "   "; echo "id\">"; echo "
"; echo "
"; echo i18n("You should assign the 'Division ID's in numerical order, starting with 1. This Division ID is used to generate the project number"); send_footer(); ?>