forked from science-ation/science-ation
separate cat/div into categories and divisions
fully implement the age categories configuration add "back to configuration" links to each sub-config
This commit is contained in:
parent
f33be12001
commit
38638140b9
@ -1,10 +0,0 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Categories and Divisions");
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
}
|
||||
|
||||
send_footer();
|
||||
?>
|
122
config/categories.php
Normal file
122
config/categories.php
Normal file
@ -0,0 +1,122 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Categories and Divisions");
|
||||
echo "<a href=\"index.php\"><< ".i18n("Back to Configuration")."</a><br />";
|
||||
|
||||
if($_POST['action']=="edit")
|
||||
{
|
||||
if($_POST['id'] && $_POST['category'] && $_POST['mingrade'] && $_POST['maxgrade'])
|
||||
{
|
||||
$q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."'");
|
||||
if(mysql_num_rows($q) && $_POST['saveid']!=$_POST['id'])
|
||||
{
|
||||
echo error(i18n("Category ID %1 already exists",array($_POST['id'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("UPDATE projectcategories SET ".
|
||||
"id='".$_POST['id']."', ".
|
||||
"category='".mysql_escape_string(stripslashes($_POST['category']))."', ".
|
||||
"mingrade='".$_POST['mingrade']."', ".
|
||||
"maxgrade='".$_POST['maxgrade']."' ".
|
||||
"WHERE id='".$_POST['saveid']."'");
|
||||
echo happy(i18n("Category successfully saved"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo error(i18n("All fields are required"));
|
||||
}
|
||||
}
|
||||
|
||||
if($_POST['action']=="new")
|
||||
{
|
||||
if($_POST['id'] && $_POST['category'] && $_POST['mingrade'] && $_POST['maxgrade'])
|
||||
{
|
||||
$q=mysql_query("SELECT id FROM projectcategories WHERE id='".$_POST['id']."'");
|
||||
if(mysql_num_rows($q))
|
||||
{
|
||||
echo error(i18n("Category ID %1 already exists",array($_POST['id'])));
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_query("INSERT INTO projectcategories (id,category,mingrade,maxgrade) VALUES ( ".
|
||||
"'".$_POST['id']."', ".
|
||||
"'".mysql_escape_string(stripslashes($_POST['category']))."', ".
|
||||
"'".$_POST['mingrade']."', ".
|
||||
"'".$_POST['maxgrade']."')");
|
||||
echo happy(i18n("Category successfully added"));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo error(i18n("All fields are required"));
|
||||
}
|
||||
}
|
||||
|
||||
if($_GET['action']=="remove" && $_GET['remove'])
|
||||
{
|
||||
mysql_query("DELETE FROM projectcategories WHERE id='".$_GET['remove']."'");
|
||||
echo happy(i18n("Category successfully removed"));
|
||||
}
|
||||
|
||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||
echo "<h3>".i18n("Age Categories")."</h3>";
|
||||
|
||||
if(! ($_GET['action']=="edit" || $_GET['action']=="new") )
|
||||
echo "<a href=\"".$_SERVER['PHP_SELF']."?action=new\">".i18n("Add new age category")."</a>\n";
|
||||
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
echo "<th>".i18n("Category ID")."</th>\n";
|
||||
echo "<th>".i18n("Category Name")."</th>\n";
|
||||
echo "<th>".i18n("Minimum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Maximum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Actions")."</th>\n";
|
||||
echo "</tr>";
|
||||
|
||||
if($_GET['action']=="edit" || $_GET['action']=="new")
|
||||
{
|
||||
echo "<input type=\"hidden\" name=\"action\" value=\"".$_GET['action']."\">\n";
|
||||
if($_GET['action']=="edit")
|
||||
{
|
||||
echo "<input type=\"hidden\" name=\"saveid\" value=\"".$_GET['edit']."\">\n";
|
||||
$q=mysql_query("SELECT * FROM projectcategories WHERE id='".$_GET['edit']."'");
|
||||
$categoryr=mysql_fetch_object($q);
|
||||
$buttontext="Save";
|
||||
}
|
||||
else if($_GET['action']=="new")
|
||||
{
|
||||
$buttontext="Add";
|
||||
}
|
||||
echo "<tr>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"id\" value=\"$categoryr->id\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"20\" name=\"category\" value=\"$categoryr->category\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"mingrade\" value=\"$categoryr->mingrade\"></td>";
|
||||
echo " <td><input type=\"text\" size=\"3\" name=\"maxgrade\" value=\"$categoryr->maxgrade\"></td>";
|
||||
echo " <td><input type=\"submit\" value=\"".i18n($buttontext)."\"></td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo " <td>$r->id</td>";
|
||||
echo " <td>$r->category</td>";
|
||||
echo " <td>$r->mingrade</td>";
|
||||
echo " <td>$r->maxgrade</td>";
|
||||
echo " <td>";
|
||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=edit&edit=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\" border=0></a>";
|
||||
echo " ";
|
||||
echo "<a title=\"Remove\" onClick=\"return confirmClick('Are you sure you want to remove this age category?');\" href=\"".$_SERVER['PHP_SELF']."?module=$module&action=remove&remove=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0></a>";
|
||||
echo " </td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
send_footer();
|
||||
?>
|
43
config/divisions.php
Normal file
43
config/divisions.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Categories and Divisions");
|
||||
echo "<a href=\"index.php\"><< ".i18n("Back to Configuration")."</a><br />";
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
}
|
||||
|
||||
echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\">";
|
||||
echo "<h3>".i18n("Age Categories")."</h3>";
|
||||
$q=mysql_query("SELECT * FROM projectcategories ORDER BY mingrade");
|
||||
echo "<table class=\"summarytable\">";
|
||||
echo "<tr>";
|
||||
echo "<th>".i18n("Category ID")."</th>\n";
|
||||
echo "<th>".i18n("Category Name")."</th>\n";
|
||||
echo "<th>".i18n("Minimum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Maximum Grade")."</th>\n";
|
||||
echo "<th>".i18n("Actions")."</th>\n";
|
||||
echo "</tr>";
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
echo "<tr>";
|
||||
echo " <td>$r->id</td>";
|
||||
echo " <td>$r->category</td>";
|
||||
echo " <td>$r->mingrade</td>";
|
||||
echo " <td>$r->maxgrade</td>";
|
||||
echo " <td>";
|
||||
echo "<a title=\"Edit\" href=\"".$_SERVER['PHP_SELF']."?action=editcat&editcat=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/edit.".$config['icon_extension']."\" border=0></a>";
|
||||
echo " ";
|
||||
echo "<a title=\"Remove\" onClick=\"return confirmClick('Are you sure you want to remove this age category?');\" href=\"".$_SERVER['PHP_SELF']."?module=$module&action=remove&remove=$r->id\"><img src=\"".$config['SFIABDIRECTORY']."/images/16/button_cancel.".$config['icon_extension']."\" border=0></a>";
|
||||
echo " </td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</table>";
|
||||
echo "</form>";
|
||||
|
||||
echo "<h3>".i18n("Divisions")."</h3>";
|
||||
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY division");
|
||||
|
||||
|
||||
send_footer();
|
||||
?>
|
@ -4,7 +4,8 @@
|
||||
echo error(i18n("Note: this section will normally be password protected. It is left open for now for debugging and testing purposes"));
|
||||
|
||||
echo "<a href=\"variables.php\">Configuration Variables</a> <br />";
|
||||
echo "<a href=\"catdiv.php\">Categories and Divisions</a> <br />";
|
||||
echo "<a href=\"categories.php\">Project Age Categories</a> <br />";
|
||||
echo "<a href=\"divisions.php\">Project Divisons</a> <br />";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?
|
||||
require("../common.inc.php");
|
||||
send_header("Configuration - Variables");
|
||||
echo error(i18n("Note: this section will normally be password protected. It is left open for now for debugging and testing purposes"));
|
||||
echo "<a href=\"index.php\"><< ".i18n("Back to Configuration")."</a><br />";
|
||||
|
||||
if($_POST['action']=="save")
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user