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']=="save" && $_POST['save']) { 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 year='".$config['FAIRYEAR']."'"); echo mysql_error(); echo happy(i18n("Safety question successfully saved")); } if($_POST['action']=="new") { mysql_query("INSERT INTO safetyquestions (question,type,required,ord,year) 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']))."', '".$config['FAIRYEAR']."' )"); echo mysql_error(); echo happy(i18n("Safety question successfully added")); } if($_GET['action']=="remove" && $_GET['remove']) { mysql_query("DELETE FROM safetyquestions WHERE id='".$_GET['remove']."' AND year='".$config['FAIRYEAR']."'"); 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"; echo "id\">\n"; $q=mysql_query("SELECT * FROM safetyquestions WHERE id='".$_GET['edit']."' AND year='".$config['FAIRYEAR']."'"); 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 year='".$config['FAIRYEAR']."' ORDER BY ord"); echo ""; while($r=mysql_fetch_object($q)) { echo ""; echo ""; echo ""; echo ""; echo ""; } echo "
".i18n("Question")."".i18n("Type")."".i18n("Required")."".i18n("Actions")."
$r->question$r->type$r->required"; echo "id\">"; echo "   "; echo "id\">"; echo "
"; send_footer(); ?>