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_safety_questions" ); if($_POST['action']=="save" && $_POST['save']) { if($_POST['question']) { if(!ereg("^[0-9]*$",$_POST['ord'])) echo notice(i18n("Defaulting non-numeric order value %1 to 0",array($_POST['ord']))); mysql_query("UPDATE safetyquestions SET question='".mysql_escape_string(stripslashes($_POST['question']))."', `type`='".mysql_escape_string(stripslashes($_POST['type']))."', `required`='".mysql_escape_string(stripslashes($_POST['required']))."', ord='".mysql_escape_string(stripslashes($_POST['ord']))."' WHERE id='".$_POST['save']."' AND conferences_id='".$conference['id']."'"); echo mysql_error(); echo happy(i18n("Safety question successfully saved")); } else echo error(i18n("Question is required")); } if($_POST['action']=="new") { if($_POST['question']) { mysql_query("INSERT INTO safetyquestions (question,type,required,ord,conferences_id) VALUES ( '".mysql_escape_string(stripslashes($_POST['question']))."', '".mysql_escape_string(stripslashes($_POST['type']))."', '".mysql_escape_string(stripslashes($_POST['required']))."', '".mysql_escape_string(stripslashes($_POST['ord']))."', '".$conference['id']."' )"); echo mysql_error(); echo happy(i18n("Safety question successfully added")); } else echo error(i18n("Question is required")); } if($_GET['action']=="remove" && $_GET['remove']) { mysql_query("DELETE FROM safetyquestions WHERE id='".$_GET['remove']."' AND conferences_id='".$conference['id']."'"); echo happy(i18n("Safety question successfully removed")); } if(($_GET['action']=="edit" && $_GET['edit']) || $_GET['action']=="new") { $showform=true; echo "
"; if($_GET['action']=="new") { $buttontext="Add safety question"; echo "\n"; $r=null; } else if($_GET['action']=="edit") { $buttontext="Save safety question"; echo "\n"; $q=mysql_query("SELECT * FROM safetyquestions WHERE id='".$_GET['edit']."' AND conferences_id='".$conference['id']."'"); echo "\n"; if(!$r=mysql_fetch_object($q)) { $showform=false; echo error(i18n("Invalid safety question")); } } if($showform) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo "
".i18n("Question").""; echo "question)."\">\n"; echo "
".i18n("Type").""; echo ""; echo "
".i18n("Required?").""; echo ""; echo "
".i18n("Display Order").""; echo "ord)."\">\n"; echo "
"; echo "\n"; echo "
"; echo "
"; echo "
"; echo "
"; } else { } } echo "
"; echo "".i18n("Add new safety question").""; echo ""; $q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord"); echo ""; while($r=mysql_fetch_object($q)) { echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
".i18n("Ord")."".i18n("Question")."".i18n("Type")."".i18n("Required")."".i18n("Actions")."
$r->ord$r->question$r->type$r->required"; echo "id\">"; echo "   "; echo "id\">"; echo "
"; send_footer(); ?>