Some adjustments to student status, and make the old "main" page start to work again

This commit is contained in:
james 2011-03-03 20:52:17 +00:00
parent bd4eb9a9cc
commit 39dd0e6897
5 changed files with 48 additions and 41 deletions

View File

@ -326,11 +326,13 @@ function saveProjectData($data){
mysql_query("DELETE FROM safety WHERE registrations_id='{$_SESSION['registration_id']}' AND conferences_id='{$conference['id']}'");
//and add them back
foreach($data['safetyquestions'] AS $q) {
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,answer,conferences_id) VALUES (
'{$_SESSION['registration_id']}',
'{$q['id']}',
'".mysql_real_escape_string($q['answer'])."',
'{$conference['id']}')");
if($q['id']) {
mysql_query("INSERT INTO safety (registrations_id,safetyquestions_id,answer,conferences_id) VALUES (
'{$_SESSION['registration_id']}',
'{$q['id']}',
'".mysql_real_escape_string($q['answer'])."',
'{$conference['id']}')");
}
}
}

View File

@ -25,42 +25,31 @@
require_once("common.inc.php");
require_once("register_participants.inc.php");
require_once("projects.inc.php");
$q = mysql_query("SELECT registrations.status AS status, registrations.id AS regid, users.id AS studentid, users.firstname FROM registrations, users " .
"WHERE users.id = {$_SESSION['users_id']} AND users.registrations_id = registrations.id");
user_auth_required("participant");
echo mysql_error();
$u=user_load($_SESSION['users_id']);
$reg=getRegistration($u['registrations_id']);
if(mysql_num_rows($q)==0)
{
header("Location: register_participants.php?action=logout");
exit;
}
$r=mysql_fetch_object($q);
send_header("Participant Registration - Summary");
echo nl2br(print_r($reg,true));
//only display the named greeting if we have their name
if($r->firstname)
{
echo i18n("Hello <b>%1</b>",array($r->firstname));
if($u['firstname']) {
echo i18n("Hello <b>%1</b>",array($u['firstname']));
echo "<br />";
}
echo "<br />";
if(registrationFormsReceived())
{
if(registrationFormsReceived()) {
//now select their project number
$q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='".$conference['id']."'");
$q=mysql_query("SELECT projectnumber FROM projects WHERE registrations_id='".$u['registrations_id']."' AND conferences_id='".$conference['id']."'");
$projectinfo=mysql_fetch_object($q);
if($r->status=="complete")
{
if($reg['status']=="complete") {
echo i18n("Congratulations, you are successfully registered for the %1. No further changes may be made to any of your forms.",array($config['fairname']));
}
else if($r->status=="paymentpending")
{
else if($reg['status']=="paymentpending") {
echo i18n("We have received your forms but are missing your registration fee. You are NOT registered for the fair until your registration fee has been received");
}
@ -69,8 +58,7 @@ echo mysql_error();
echo "&nbsp; <span style=\"font-size: 2.0em; font-weight: bold\">$projectinfo->projectnumber</span>";
}
else
{
else {
echo i18n("Please use the checklist below to complete your registration. Click on an item in the table to edit that information. When you have entered all information, the <b>Status</b> field will change to <b>Complete</b>");
}
echo "<br />";
@ -88,7 +76,7 @@ echo "<table><tr><td>";
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statusstudent=studentStatus();
$statusstudent=studentsStatus();
echo outputStatus($statusstudent);
echo "</td></tr>";
@ -118,8 +106,7 @@ echo "<table><tr><td>";
echo outputStatus($statusproject);
echo "</td></tr>";
if($config['participant_mentor']=="yes")
{
if($config['participant_mentor']=="yes") {
//mentor information
echo "<tr><td>";
echo "<a href=\"register_participants_mentor.php\">";
@ -131,8 +118,7 @@ echo "<table><tr><td>";
echo outputStatus($statusmentor);
echo "</td></tr>";
}
else
{
else {
//if mentorship isnt required, then assume its complete so the checks below will still work properly
$statusmentor="complete";
}
@ -169,7 +155,7 @@ echo "<table><tr><td>";
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statusnamecheck=namecheckStatus($_SESSION['registration_id']);
$statusnamecheck=namecheckStatus($u['registrations_id']);
echo outputStatus($statusnamecheck);
echo "</td></tr>";
@ -263,7 +249,7 @@ echo "<table><tr><td>";
}
}
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND conferences_id='{$conference['id']}'");
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$u['registrations_id']."' AND conferences_id='{$conference['id']}'");
$project=mysql_fetch_object($q);
$nominatedawards=getSpecialAwardsNominatedForProject($project->id);
$num=count($nominatedawards);
@ -320,7 +306,7 @@ echo "<table><tr><td>";
{
echo "<h3>".i18n("Registration Fee Information")."</h3>";
list($regfee, $rfeedata) = computeRegistrationFee($_SESSION['registration_id']);
list($regfee, $rfeedata) = computeRegistrationFee($u['registrations_id']);
$extra_after = "";
echo "<table>";

View File

@ -99,7 +99,15 @@ function user_load($users_id, $accounts_id = false)
// get a list of all fields relevant to this user
$fieldDat = user_get_fields(array_keys($u['roles']));
// we need to separate the fields that are in the users table from those in separate tables
$fields = array_unique(array_merge(array_keys($fieldDat), array('id', 'accounts_id', 'conferences_id')));
//if its a participant, we want the registrations_id as well
if(array_key_exists('participant', $u['roles'])){
$startfields=array('id', 'accounts_id', 'conferences_id','registrations_id');
}
else {
$startfields=array('id', 'accounts_id', 'conferences_id');
}
$fields = array_unique(array_merge(array_keys($fieldDat), $startfields));
$userFields = array();
$q = mysql_query("DESCRIBE users");
while($row = mysql_fetch_assoc($q)){
@ -113,7 +121,7 @@ function user_load($users_id, $accounts_id = false)
accounts.email
FROM users JOIN accounts ON accounts.id=users.accounts_id
WHERE `users`.`id`='$users_id'";
// echo $query=$query;
// echo "query=$query";
$q = mysql_query($query);
echo mysql_error();
@ -722,7 +730,7 @@ function user_save(&$u)
$fields = array('salutation','firstname','lastname',
'phonehome','phonework','phonecell','fax','organization',
'address','address2','city','province','postalcode','sex',
'firstaid', 'cpr', 'lang', 'notes');
'firstaid', 'cpr', 'lang', 'notes','birthdate');
/* Merge fields as necessary, build a big list of fields to save */
foreach($new_roles as $r) {
@ -1373,6 +1381,7 @@ $user_fields_map = array(
'phonehome' => array('phonehome'),
'phonecell' => array('phonecell'),
'birthdate' => array('birthdate'),
'grade' => array('grade'),
'lang' => array('lang'),
'address' => array('address', 'address2', 'postalcode'),
'city' => array('city'),
@ -1393,6 +1402,8 @@ function user_fields_enabled($role)
global $config, $user_fields_map;
$ret = array('firstname','lastname');
$fields = $config["{$role}_personal_fields"];
//for participants, grade is required
if($role=="participant") $ret[]="grade";
if($fields != '') {
$fields = explode(',', $fields);
foreach($fields as $f) {
@ -1411,6 +1422,8 @@ function user_fields_required($role)
global $config, $user_fields_map;
$ret = array('firstname','lastname');
$required = $config["{$role}_personal_required"];
//for participants, grade is required
if($role=="participant") $ret[]="grade";
if($required != '') {
$fields = explode(',', $required);
foreach($fields as $f) {

View File

@ -125,10 +125,14 @@ function user_personal_info_status(&$u)
$our_fields = array('salutation', 'firstname','lastname','address',
'address2','city','province','postalcode',
'phonehome','phonecell','language','sex',
'firstaid','cpr');
'firstaid','cpr','birthdate','grade');
$required = array_intersect($our_fields, $required);
foreach($required as $r) {
if($r=="birthdate") {
if($u[$r]=="0000-00-00" || !$u[$r])
return "incomplete";
}
if(trim($u[$r]) == '') return 'incomplete';
}
/* FIXME: somehow call the $role _status_update() function to update

View File

@ -51,7 +51,7 @@ foreach(array_keys($u['roles']) as $r) {
$our_fields = array('salutation', 'firstname','lastname','address',
'address2','city','province','postalcode',
'phonehome','phonecell','language','sex',
'firstaid','cpr');
'firstaid','cpr','birthdate','grade');
$fields = array_intersect($our_fields, $fields);
$required = array_intersect($our_fields, $required);
@ -173,6 +173,8 @@ if(count($u['roles']) > 1) {
<tr><?=user_edit_item($u, 'Gender', 'sex', 'sex')?></tr>
<tr><?=user_edit_item($u, 'First Aid Training', 'firstaid', 'yesno')?></tr>
<tr><?=user_edit_item($u, 'CPR Training', 'cpr', 'yesno')?></tr>
<tr><?=user_edit_item($u, 'Birth Date', 'birthdate')?></tr>
<tr><?=user_edit_item($u, 'Grade', 'grade')?></tr>
</table>