forked from science-ation/science-ation
Code style updates
Use odd/even row backgrounds to make each point easier to identify
This commit is contained in:
parent
7e250693af
commit
9756705aad
@ -4,7 +4,7 @@
|
|||||||
SFIAB Website: http://www.sfiab.ca
|
SFIAB Website: http://www.sfiab.ca
|
||||||
|
|
||||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
Copyright (C) 2009 James Grant <james@lightbox.org>
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or
|
This program is free software; you can redistribute it and/or
|
||||||
modify it under the terms of the GNU General Public
|
modify it under the terms of the GNU General Public
|
||||||
@ -26,13 +26,11 @@
|
|||||||
include "register_participants.inc.php";
|
include "register_participants.inc.php";
|
||||||
|
|
||||||
//authenticate based on email address and registration number from the SESSION
|
//authenticate based on email address and registration number from the SESSION
|
||||||
if(!$_SESSION['email'])
|
if(!$_SESSION['email']) {
|
||||||
{
|
|
||||||
header("Location: register_participants.php");
|
header("Location: register_participants.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if(!$_SESSION['registration_number'])
|
if(!$_SESSION['registration_number']) {
|
||||||
{
|
|
||||||
header("Location: register_participants.php");
|
header("Location: register_participants.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -46,11 +44,9 @@
|
|||||||
"AND students.year=".$config['FAIRYEAR']);
|
"AND students.year=".$config['FAIRYEAR']);
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
if(mysql_num_rows($q)==0)
|
if(mysql_num_rows($q)==0) {
|
||||||
{
|
|
||||||
header("Location: register_participants.php");
|
header("Location: register_participants.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
}
|
}
|
||||||
$authinfo=mysql_fetch_object($q);
|
$authinfo=mysql_fetch_object($q);
|
||||||
|
|
||||||
@ -60,81 +56,64 @@ echo mysql_error();
|
|||||||
echo "<a href=\"register_participants_main.php\"><< ".i18n("Back to Participant Registration Summary")."</a><br />";
|
echo "<a href=\"register_participants_main.php\"><< ".i18n("Back to Participant Registration Summary")."</a><br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
|
|
||||||
if($_POST['action']=="save")
|
if($_POST['action']=="save") {
|
||||||
{
|
if(registrationFormsReceived()) {
|
||||||
if(registrationFormsReceived())
|
|
||||||
{
|
|
||||||
echo error(i18n("Cannot make changes to forms once they have been received by the fair"));
|
echo error(i18n("Cannot make changes to forms once they have been received by the fair"));
|
||||||
}
|
}
|
||||||
else if(registrationDeadlinePassed())
|
else if(registrationDeadlinePassed()) {
|
||||||
{
|
|
||||||
echo error(i18n("Cannot make changes to forms after registration deadline"));
|
echo error(i18n("Cannot make changes to forms after registration deadline"));
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
|
//first we will delete all their old answer, its easier to delete and re-insert in this case then it would be to find the corresponding answers and update them
|
||||||
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
mysql_query("DELETE FROM safety WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
|
||||||
if(is_array($_POST['safety']))
|
if(is_array($_POST['safety'])) {
|
||||||
{
|
|
||||||
$safetyids=array_keys($_POST['safety']);
|
$safetyids=array_keys($_POST['safety']);
|
||||||
foreach($safetyids AS $key=>$val)
|
foreach($safetyids AS $key=>$val) {
|
||||||
{
|
|
||||||
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,year,answer) VALUES (".
|
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,year,answer) VALUES (".
|
||||||
"'".$_SESSION['registration_id']."', ".
|
"'".$_SESSION['registration_id']."', ".
|
||||||
"'$val', ".
|
"'$val', ".
|
||||||
"'".$config['FAIRYEAR']."', ".
|
"'".$config['FAIRYEAR']."', ".
|
||||||
"'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')");
|
"'".mysql_escape_string(stripslashes($_POST['safety'][$val]))."')");
|
||||||
echo mysql_error();
|
echo mysql_error();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//output the current status
|
//output the current status
|
||||||
$newstatus=safetyStatus();
|
$newstatus=safetyStatus();
|
||||||
if($newstatus!="complete")
|
if($newstatus!="complete") {
|
||||||
{
|
|
||||||
echo error(i18n("Safety Information Incomplete. You must agree to / answer all required safety questions!"));
|
echo error(i18n("Safety Information Incomplete. You must agree to / answer all required safety questions!"));
|
||||||
}
|
}
|
||||||
else if($newstatus=="complete")
|
else if($newstatus=="complete") {
|
||||||
{
|
|
||||||
echo happy(i18n("Safety Information Complete"));
|
echo happy(i18n("Safety Information Complete"));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$_SESSION['registration_id']."'");
|
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$_SESSION['registration_id']."'");
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q)) {
|
||||||
{
|
|
||||||
$safetyanswers[$r->safetyquestions_id]=$r->answer;
|
$safetyanswers[$r->safetyquestions_id]=$r->answer;
|
||||||
}
|
}
|
||||||
|
|
||||||
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
|
$q=mysql_query("SELECT * FROM safetyquestions WHERE year='".$config['FAIRYEAR']."' ORDER BY ord");
|
||||||
if(mysql_num_rows($q))
|
if(mysql_num_rows($q)) {
|
||||||
{
|
|
||||||
echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer");
|
echo i18n("Please agree to / answer the following safety questions by checking the box next to the question, or choosing the appropriate answer");
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
echo "<form method=\"post\" action=\"register_participants_safety.php\">\n";
|
echo "<form method=\"post\" action=\"register_participants_safety.php\">\n";
|
||||||
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
|
||||||
echo "<table>\n";
|
echo "<table class=\"tableedit\">\n";
|
||||||
$num=1;
|
$num=1;
|
||||||
while($r=mysql_fetch_object($q))
|
while($r=mysql_fetch_object($q)) {
|
||||||
{
|
$trclass=($num%2==0?"odd":"even");
|
||||||
echo "<tr><td><b>$num</b>. </td><td>";
|
echo "<tr class=\"$trclass\"><td><b>$num</b>. </td><td>";
|
||||||
if($r->required=="yes") echo REQUIREDFIELD;
|
if($r->required=="yes") echo REQUIREDFIELD;
|
||||||
echo i18n($r->question)."</td>";
|
echo i18n($r->question)."</td>";
|
||||||
echo "<td>";
|
echo "<td>";
|
||||||
if($r->type=="check")
|
if($r->type=="check") {
|
||||||
{
|
|
||||||
if($safetyanswers[$r->id]=="checked") $ch="checked=\"checked\""; else $ch="";
|
if($safetyanswers[$r->id]=="checked") $ch="checked=\"checked\""; else $ch="";
|
||||||
echo "<input $ch type=\"checkbox\" name=\"safety[$r->id]\" value=\"checked\" />";
|
echo "<input $ch type=\"checkbox\" name=\"safety[$r->id]\" value=\"checked\" />";
|
||||||
}
|
}
|
||||||
else if($r->type=="yesno")
|
else if($r->type=="yesno") {
|
||||||
{
|
|
||||||
echo "<nobr>";
|
echo "<nobr>";
|
||||||
if($safetyanswers[$r->id]=="yes") $ch="checked=\"checked\""; else $ch="";
|
if($safetyanswers[$r->id]=="yes") $ch="checked=\"checked\""; else $ch="";
|
||||||
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"yes\" />";
|
echo "<input $ch type=\"radio\" name=\"safety[$r->id]\" value=\"yes\" />";
|
||||||
@ -152,7 +131,6 @@ else if($newstatus=="complete")
|
|||||||
echo "</table>";
|
echo "</table>";
|
||||||
echo "<input type=\"submit\" value=\"".i18n("Save Safety Information")."\" />\n";
|
echo "<input type=\"submit\" value=\"".i18n("Save Safety Information")."\" />\n";
|
||||||
echo "</form>";
|
echo "</form>";
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
echo notice(i18n("There are no safety questions to be answered"));
|
echo notice(i18n("There are no safety questions to be answered"));
|
||||||
|
Loading…
Reference in New Issue
Block a user