create an include file to contain the status check functions

create the student registration page
add complete/incomplete css elements
perform student complete/incomplete check in main
This commit is contained in:
james 2004-12-02 19:40:43 +00:00
parent c17447ed70
commit 31a815877d
4 changed files with 97 additions and 2 deletions

View File

@ -0,0 +1,24 @@
<?
function studentStatus()
{
$required_fields=array("name","address","city","postalcode","phone","email","grade","age");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."'");
while($r=mysql_fetch_object($q))
{
foreach ($required_fields AS $req)
{
if(!$r->$req || $r->$req==0)
{
return "incomplete";
}
}
}
//if it made it through without returning incomplete, then we must be complete
return "complete";
}
?>

View File

@ -1,5 +1,6 @@
<?
require("common.inc.php");
include "register_participants.inc.php";
//authenticate based on email address and registration number from the SESSION
if(!$_SESSION['email'])
@ -30,7 +31,7 @@ echo mysql_error();
}
$r=mysql_fetch_object($q);
send_header("Participant Registration Summary");
send_header("Participant Registration - Summary");
echo i18n("Hello <b>%1</b>",array($r->name));
echo "<br />";
@ -43,7 +44,27 @@ echo mysql_error();
echo "<tr><th>".i18n("Registration Item")."</th><th>".i18n("Status")."</th></tr>";
//participant information
echo "<tr><td>".i18n("Student Information")."</td><td>";
echo "<tr><td>";
echo "<a href=\"register_participants_students.php\">";
echo i18n("Student Information");
echo "</a>";
echo "</td><td>";
$status=studentStatus();
switch($status)
{
case 'incomplete':
echo "<div class=\"incomplete\">";
echo i18n("Incomplete");
echo "</div>";
break;
case 'complete':
echo "<div class=\"complete\">";
echo i18n("Complete");
echo "</div>";
break;
default:
break;
}
//check to see if its complete
echo "</td></tr>";

View File

@ -0,0 +1,39 @@
<?
require("common.inc.php");
//authenticate based on email address and registration number from the SESSION
if(!$_SESSION['email'])
{
header("Location: register_participants.php");
exit;
}
if(!$_SESSION['registration_number'])
{
header("Location: register_participants.php");
exit;
}
$q=mysql_query("SELECT registrations.id AS regid, students.id AS studentid, students.name FROM registrations,students ".
"WHERE students.email='".$_SESSION['email']."' ".
"AND registrations.num='".$_SESSION['registration_number']."' ".
"AND registrations.id='".$_SESSION['registration_id']."' ".
"AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ".
"AND students.year=".$config['FAIRYEAR']);
echo mysql_error();
if(mysql_num_rows($q)==0)
{
header("Location: register_participants.php");
exit;
}
$r=mysql_fetch_object($q);
send_header("Participant Registration - Student Information");
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br /><br />";
send_footer();
?>

View File

@ -115,3 +115,14 @@ a {
padding: 4px;
}
.complete {
color: green;
font-weight: bold;
}
.incomplete {
color: red;
font-weight: bold;
}