- Update project information when save is pressed

- Add req_table and req_elecricity to required fields for 'complete' status
This commit is contained in:
james 2004-12-07 16:21:07 +00:00
parent cc1356b6cb
commit 75e0cd7731
2 changed files with 34 additions and 7 deletions

View File

@ -56,7 +56,7 @@ function studentStatus()
function projectStatus()
{
global $config;
$required_fields=array("title","projectcategories_id","projectdivisions_id","summary","language");
$required_fields=array("title","projectcategories_id","projectdivisions_id","summary","language","req_table","req_electricity");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");

View File

@ -30,10 +30,34 @@ echo mysql_error();
}
$authinfo=mysql_fetch_object($q);
//send the header
send_header("Participant Registration - Project Information");
if($_POST['action']=="save")
{
//first, lets make sure this project really does belong to them
$q=mysql_query("SELECT * FROM projects WHERE id='".$_POST['id']."' AND registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q)==1)
{
mysql_query("UPDATE projects SET ".
"title='".mysql_escape_string(stripslashes($_POST['title']))."', ".
"projectdivisions_id='".$_POST['projectdivisions_id']."', ".
"language='".mysql_escape_string(stripslashes($_POST['language']))."', ".
"req_table='".mysql_escape_string(stripslashes($_POST['req_table']))."', ".
"req_electricity='".mysql_escape_string(stripslashes($_POST['req_electricity']))."', ".
"req_special='".mysql_escape_string(stripslashes($_POST['req_special']))."', ".
"summary='".mysql_escape_string(stripslashes($_POST['summary']))."' ".
"WHERE id='".$_POST['id']."'");
echo mysql_error();
echo notice(i18n("Project information successfully updated"));
}
else
{
echo error(i18n("Invalid project to update"));
}
}
//now lets find out their MAX grade, so we can pre-set the Age Category
$q=mysql_query("SELECT MAX(grade) AS maxgrade FROM students WHERE registrations_id='".$_SESSION['registration_id']."'");
$gradeinfo=mysql_fetch_object($q);
@ -74,16 +98,18 @@ echo mysql_error();
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br />";
echo "<form method=\"post\" action=\"register_participants_project.php\">";
echo "<table>";
echo "<tr><td>".i18n("Project Title").": </td><td><input type=\"text\" name=\"title\" size=\"50\" value=\"$r->title\" /></td></tr>";
echo "<form method=\"post\" action=\"register_participants_project.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
echo "<input type=\"hidden\" name=\"id\" value=\"$projectinfo->id\">\n";
echo "<table>\n";
echo "<tr><td>".i18n("Project Title").": </td><td><input type=\"text\" name=\"title\" size=\"50\" value=\"$projectinfo->title\" /></td></tr>\n";
echo "<tr><td>".i18n("Age Category").": </td><td>";
echo i18n($agecategories[$projectcategories_id]['category']);
echo " (".i18n("Grades %1-%2",array($agecategories[$projectcategories_id]['mingrade'],$agecategories[$projectcategories_id]['maxgrade'])).")";
echo "</td></tr>";
echo "<tr><td>".i18n("Division").": </td><td>";
$q=mysql_query("SELECT * FROM projectdivisions ORDER BY division");
echo "<select name=\"projectdivision_id\">";
echo "<select name=\"projectdivisions_id\">";
echo "<option value=\"\">".i18n("Select a division")."</option>\n";
while($r=mysql_fetch_object($q))
{
@ -141,11 +167,12 @@ echo mysql_error();
echo "</td></tr>";
echo "<tr><td>".i18n("Summary").": </td><td><textarea cols=\"60\" rows=\"12\" name=\"summary\">$r->summary</textarea><br />";
echo "<tr><td>".i18n("Summary").": </td><td><textarea cols=\"60\" rows=\"12\" name=\"summary\">$projectinfo->summary</textarea><br />";
echo i18n("100 words maximum");
echo "</td></tr>";
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Save Project Information")."\" />\n";
echo "</form>";