science-ation/config/variables.php
dave 5ca11ae362 - Properly copy the config type in the config editor when copying -1 config values into
the current year
- Add 2 new config options.  
	- 'participant_student_tshirt_cost' allows the cost of each fair tshirt
	  to be set (vancouver charges $10 for tshirts, because not all
	  students want them), this also adds a 'none' option to the tshirt
	  selection box, and a note indicating the tshirt cost if the costs is
	  nonzero.
	- 'regfee_show_info' adds a "Registration Fee Information" to the main
	  student registration page, showing a breakdown of the registration
	  fee computation (including tshirts, per_student and per_project
	  registration, and indicates the total.
- Convert the tshirt field to VARCHAR(32) instead of enum so the "none" option
  described above works, also, some fairs may want to add more optoins, like
  female/male sizes.. so turn this into a text field for those fairs.  The next
  step would be to make a config option for the tshirt options. :)
2007-01-21 01:40:46 +00:00

123 lines
4.1 KiB
PHP

<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 James Grant <james@lightbox.org>
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.
*/
?>
<?
require("../common.inc.php");
require_once("../config_editor.inc.php");
auth_required('config');
send_header("Configuration - Variables");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Configuration")."</a><br />";
$q=mysql_query("SELECT * FROM config WHERE year='-1'");
while($r=mysql_fetch_object($q))
{
mysql_query("INSERT INTO config (var,val,category,type,type_values,ord,description,year) VALUES (
'".mysql_escape_string($r->var)."',
'".mysql_escape_string($r->val)."',
'".mysql_escape_string($r->category)."',
'".mysql_escape_string($r->type)."',
'".mysql_escape_string($r->type_values)."',
'".mysql_escape_string($r->ord)."',
'".mysql_escape_string($r->description)."',
'".$config['FAIRYEAR']."')");
}
//for the Special category
if($_POST['action']=="save")
{
if($_POST['specialconfig'])
{
foreach($_POST['specialconfig'] as $key=>$val)
{
mysql_query("UPDATE config SET val='".mysql_escape_string(stripslashes($val))."' WHERE year='0' AND var='$key'");
}
}
echo happy(i18n("Configuration successfully saved"));
}
//get the category, and if nothing is chosen, default to Global
if($_GET['category']) $category=$_GET['category'];
else if($_POST['category']) $category=$_POST['category'];
else $category="Global";
$q=mysql_query("SELECT DISTINCT(category) AS cat FROM config ORDER BY cat");
echo "<br />";
echo "<table width=\"90%\" align=\"center\" cellspacing=0 cellpadding=0 border=1>";
echo "<tr>";
while($r=mysql_fetch_object($q))
{
echo "<td align=\"center\">";
if($r->cat==$category)
echo "<b>$r->cat</b>";
else
echo "<a href=\"".$_SERVER['PHP_SELF']."?category=".urlencode($r->cat)."\">$r->cat</a>";
echo "</td>";
}
echo "</tr>";
echo "</table>";
echo "<hr />";
if($category)
{
if($category=="Special")
{
echo "<form method=\"post\" action=\"variables.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<input type=\"hidden\" name=\"category\" value=\"Special\">\n";
echo "<table cellpadding=\"3\">";
$q=mysql_query("SELECT * FROM config WHERE year=0 ORDER BY var");
echo "<tr><td colspan=\"2\"><h3>".i18n("Special Configuration Settings")."</h3></td></tr>";
echo "<tr><td colspan=\"2\">";
echo i18n("Warning, modifying values on this configuration variables page could cause your SFIAB to stop working. Only change anything on this page if you really know what you are doing");
echo "</td></tr>";
while($r=mysql_fetch_object($q))
{
if($r->var=="FAIRYEAR" || $r->var=="DBVERSION")
{
echo "<tr><td><b>$r->var</b> - ".i18n($r->description)."</td><td>$r->val</td></tr>";
}
else
{
echo "<tr><td><b>$r->var</b> - ".i18n($r->description)."</td><td><input type=\"text\" name=\"specialconfig[$r->var]\" value=\"$r->val\" /></td></tr>";
}
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Configuration")."\" />\n";
echo "</form>";
}
else
{
echo "<h3>".i18n("Configuration settings for fair year %1",array($config['FAIRYEAR']),array("fair year"))."</h3><br /><h3>".i18n($category)."</h3>";
config_editor($category, $config['FAIRYEAR'], "var", $_SERVER['PHP_SELF']);
}
}
else
{
echo i18n("Please choose a configuration category");
}
send_footer();
?>