change all status checker functions to accept a registration id as an optional parameter

all a spot for 'instructions text' on the main participant registration page
This commit is contained in:
james 2005-01-07 04:46:52 +00:00
parent 691cd9152f
commit 2caf3a6678
2 changed files with 35 additions and 12 deletions

View File

@ -1,11 +1,14 @@
<?
function studentStatus()
function studentStatus($reg_id="")
{
global $config;
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","tshirt");
$q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
//if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minstudentsperproject'])
@ -26,17 +29,20 @@ function studentStatus()
return "complete";
}
function emergencycontactStatus()
function emergencycontactStatus($reg_id="")
{
global $config;
$required_fields=array("firstname","lastname","relation","phone1");
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
$numstudents=mysql_num_rows($sq);
while($sr=mysql_fetch_object($sq))
{
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'");
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."' AND students_id='$sr->id'");
$r=mysql_fetch_object($q);
@ -53,12 +59,15 @@ function emergencycontactStatus()
return "complete";
}
function projectStatus()
function projectStatus($reg_id="")
{
global $config;
$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']."'");
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
//if we dont have a project entry yet, return empty
if(!mysql_num_rows($q))
@ -80,19 +89,21 @@ function projectStatus()
}
function mentorStatus()
function mentorStatus($reg_id="")
{
global $config;
$required_fields=array("firstname","lastname","phone","email","organization","description");
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
//first check the registrations table to see if 'nummentors' is set, or if its null
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT nummentors FROM registrations WHERE id='$rid' AND year='".$config['FAIRYEAR']."'");
$r=mysql_fetch_object($q);
if($r->nummentors==null)
return "incomplete";
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND year='".$config['FAIRYEAR']."'");
//if we dont have the minimum, return incomplete
if(mysql_num_rows($q)<$config['minmentorserproject'])
@ -114,10 +125,13 @@ function mentorStatus()
}
function safetyStatus()
function safetyStatus($reg_id="")
{
if($reg_id) $rid=$reg_id;
else $rid=$_SESSION['registration_id'];
//grab all of their answers
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='".$_SESSION['registration_id']."'");
$q=mysql_query("SELECT * FROM safety WHERE registrations_id='$rid'");
while($r=mysql_fetch_object($q))
{
$safetyanswers[$r->safetyquestions_id]=$r->answer;

View File

@ -124,9 +124,18 @@ echo "</td></tr>";
echo "</table>";
echo "<br /><br />";
echo "<h3>".i18n("Registration Instructions")."</h3>";
//now get the text of special instructions for the bottom of this page:
$q=mysql_query("SELECT * FROM pagetext WHERE textname='register_participants_main_instructions'");
$r=mysql_fetch_object($q);
echo nl2br(i18n($r->text));
echo "<br /><br />";
echo "<a href=\"register_participants.php?action=logout\">".i18n("Logout")."</a>";