forked from science-ation/science-ation
Moved participant registration completion checks into participant.inc.php, and added the participant_status_update function to call them all and find get the total status.
Updated judge.inc.php and volunteer.inc.php - they were previously putting the complete status for a role into the user object as a separate value (eg. $user['judge_status'] = 'complete';). Updated that to put it in the user's role list directly (eg. $user['roles']['judge']['status'] = 'complete'). Updated register_participants_namecheck.php to use the user table and check the session against the normal user_auth_required.
This commit is contained in:
parent
d10d5f3835
commit
2eeff8d688
@ -439,7 +439,7 @@ function getEmailRecipientsForRegistration($reg_id)
|
||||
);
|
||||
}
|
||||
|
||||
$sq=mysql_query("SELECT * FROM students WHERE registrations_id='$reg_id' AND conferences_id='{$conference['id']}'");
|
||||
$sq=mysql_query("SELECT users.firstname, users.lastname, accounts.email FROM users JOIN accounts ON users.accounts_id = accounts.id WHERE users.registrations_id='$reg_id' AND users.conferences_id='{$conference['id']}'");
|
||||
$ret=array();
|
||||
while($sr=mysql_fetch_object($sq)) {
|
||||
if($sr->email && isEmailAddress($sr->email)) {
|
||||
|
@ -119,11 +119,11 @@ function judge_status_update(&$u)
|
||||
&& judge_status_other($u) == 'complete'
|
||||
&& judge_status_availability($u) == 'complete'
|
||||
&& judge_status_special_awards($u) == 'complete')
|
||||
$u['judge_complete'] = 'yes';
|
||||
$u['roles']['judge']['complete'] = 'yes';
|
||||
else
|
||||
$u['judge_complete'] = 'no';
|
||||
$u['roles']['judge']['complete'] = 'no';
|
||||
|
||||
return ($u['judge_complete'] == 'yes') ? 'complete' : 'incomplete';
|
||||
return ($u['roles']['judge']['complete'] == 'yes') ? 'complete' : 'incomplete';
|
||||
}
|
||||
|
||||
|
||||
|
336
participant.inc.php
Normal file
336
participant.inc.php
Normal file
@ -0,0 +1,336 @@
|
||||
<?
|
||||
/*
|
||||
This file is part of the 'Science Fair In A Box' project
|
||||
SFIAB Website: http://www.sfiab.ca
|
||||
|
||||
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||||
Copyright (C) 2005 James Grant <james@lightbox.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public
|
||||
License as published by the Free Software Foundation, version 2.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; see the file COPYING. If not, write to
|
||||
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
|
||||
function registrationFormsReceived($reg_id="")
|
||||
{
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
$q=mysql_query("SELECT status FROM registrations WHERE id='$rid'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->status=="complete" || $r->status=="paymentpending")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
function registrationDeadlinePassed()
|
||||
{
|
||||
global $config;
|
||||
$q=mysql_query("SELECT (NOW()<'".$config['dates']['regclose']."') AS datecheck");
|
||||
$datecheck=mysql_fetch_object($q);
|
||||
if($datecheck->datecheck==1)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function studentStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
if($config['participant_student_personal']=="yes")
|
||||
$required_fields=array("firstname","lastname","address","city","postalcode","phonehome","grade","dateofbirth","schools_id","sex");
|
||||
else
|
||||
$required_fields=array("firstname","lastname","grade","schools_id");
|
||||
|
||||
if($config['participant_student_tshirt']=="yes")
|
||||
$required_fields[]="tshirt";
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM users WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have the minimum, return incomplete
|
||||
if(mysql_num_rows($q)<$config['minstudentsperproject'])
|
||||
return "incomplete";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if($req=="dateofbirth")
|
||||
{
|
||||
if($r->$req=="0000-00-00" || !$r->$req)
|
||||
return "incomplete";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$r->$req)
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
||||
function emergencycontactStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
$required_fields=array("firstname","lastname","relation","phone1");
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$returnval = 'complete';
|
||||
while($sr=mysql_fetch_object($sq))
|
||||
{
|
||||
$u = user_load($sr->id);
|
||||
if(!array_key_exists('emergencycontacts', $u)){
|
||||
$returnval = 'incomplete';
|
||||
break;
|
||||
}
|
||||
$oneValid = false;
|
||||
foreach($u['emergencycontacts'] as $contact){
|
||||
$valid = true;
|
||||
foreach($rquired_fields AS $req){
|
||||
if(!$contact[$req]) $valid = false;
|
||||
break;
|
||||
}
|
||||
$oneValid |= $valid;
|
||||
}
|
||||
if(!$oneValid){
|
||||
$returval = 'incomplete';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $returnval;
|
||||
}
|
||||
|
||||
function projectStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","summarycountok");
|
||||
|
||||
if($config['participant_short_title_enable'] == 'yes')
|
||||
$required_fields[] = 'shorttitle';
|
||||
if($config['participant_project_summary_wordmin'] > 0)
|
||||
$required_fields[] = 'summary';
|
||||
if($config['participant_project_table'] == 'yes')
|
||||
$requiredFields[] = 'req_table';
|
||||
if($config['participant_project_electricity'] == 'yes')
|
||||
$requiredFields[] = 'req_electricity';
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have a project entry yet, return empty
|
||||
if(!mysql_num_rows($q))
|
||||
return "empty";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if(!$r->$req) {
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
||||
|
||||
function mentorStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
$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='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->nummentors==null)
|
||||
return "incomplete";
|
||||
|
||||
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have the minimum, return incomplete
|
||||
if(mysql_num_rows($q)<$config['minmentorserproject'])
|
||||
return "incomplete";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if(!$r->$req)
|
||||
{
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
|
||||
}
|
||||
|
||||
function safetyStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
|
||||
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='$rid'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$safetyanswers[$r->safetyquestions_id]=$r->answer;
|
||||
}
|
||||
|
||||
//now grab all the questions
|
||||
$q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->required=="yes" && !$safetyanswers[$r->id])
|
||||
{
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
return "complete";
|
||||
|
||||
}
|
||||
|
||||
function spawardStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid'");
|
||||
$project=mysql_fetch_object($q);
|
||||
|
||||
/* We want this query to get any awards with a NULL award_awards_id */
|
||||
$awardsq=mysql_query("SELECT
|
||||
projects.id AS projects_id
|
||||
FROM
|
||||
project_specialawards_link,
|
||||
projects
|
||||
WHERE
|
||||
project_specialawards_link.projects_id='".$project->id."'
|
||||
AND projects.conferences_id='".$conference['id']."'
|
||||
");
|
||||
|
||||
if(mysql_num_rows($awardsq))
|
||||
return "complete";
|
||||
else
|
||||
return "incomplete";
|
||||
}
|
||||
|
||||
function tourStatus($reg_id="")
|
||||
{
|
||||
/************************************************************************
|
||||
FIXME
|
||||
This function depends on the tours_choice table, which currently links to the students table.
|
||||
tours_choice needs to be updated to link to users.id instead (and the conferences_id column
|
||||
can be dropped after all).
|
||||
It's not getting used this year anyway, so meh.
|
||||
The next line here should then be removed, and the code modified accordingly.
|
||||
************************************************************************/
|
||||
return 'complete'; // delete me
|
||||
|
||||
|
||||
global $config, $conference;
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
/* Get the students for this project */
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$num_found = mysql_num_rows($q);
|
||||
|
||||
$ret = "complete";
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
//grab all of their tour prefs
|
||||
$sid = $s->id;
|
||||
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and conferences_id='{$conference['id']}' ORDER BY rank");
|
||||
|
||||
$n_tours = mysql_num_rows($qq);
|
||||
if($n_tours > 0) {
|
||||
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
|
||||
$i = mysql_fetch_object($qq);
|
||||
if($i->rank == 0) {
|
||||
/* Yes, there is, no matter what, this student's tour
|
||||
* selection is complete. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Else, they haven't been assigned a tour, see if they've made
|
||||
* the appropraite selection(s) */
|
||||
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
|
||||
continue;
|
||||
}
|
||||
$ret = "incomplete";
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function namecheckStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q = mysql_query("SELECT namecheck_complete FROM users WHERE registrations_id = $rid AND conferences_id = '{$conference['id']}'");
|
||||
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
if($s->namecheck_complete == 'no') {
|
||||
return 'incomplete';
|
||||
}
|
||||
}
|
||||
return 'complete';
|
||||
}
|
||||
|
||||
function participant_status_update(&$u){
|
||||
$regId = $u['registrations_id'];
|
||||
if( namecheckStatus($regId) == 'complete' &&
|
||||
tourStatus($regId) == 'complete' &&
|
||||
spawardStatus($regId) == 'complete' &&
|
||||
safetyStatus($regId) == 'complete' &&
|
||||
mentorStatus($regId) == 'complete' &&
|
||||
projectStatus($regId) == 'complete' &&
|
||||
emergencycontactStatus($regId) == 'complete' &&
|
||||
studentStatus($regId) == 'complete' &&
|
||||
registrationFormsReceived($regId) // <-- returns true/false, not text
|
||||
){
|
||||
$u['roles']['participant']['complete'] = 'yes';
|
||||
}else{
|
||||
$u['roles']['participant']['complete'] = 'no';
|
||||
}
|
||||
return ($u['roles']['participant']['complete'] == 'yes') ? 'complete' : 'incomplete';
|
||||
}
|
@ -22,285 +22,9 @@
|
||||
*/
|
||||
?>
|
||||
<?
|
||||
function registrationFormsReceived($reg_id="")
|
||||
{
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
$q=mysql_query("SELECT status FROM registrations WHERE id='$rid'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->status=="complete" || $r->status=="paymentpending")
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
|
||||
}
|
||||
function registrationDeadlinePassed()
|
||||
{
|
||||
global $config;
|
||||
$q=mysql_query("SELECT (NOW()<'".$config['dates']['regclose']."') AS datecheck");
|
||||
$datecheck=mysql_fetch_object($q);
|
||||
if($datecheck->datecheck==1)
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
function studentStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
if($config['participant_student_personal']=="yes")
|
||||
$required_fields=array("firstname","lastname","address","city","postalcode","phone","email","grade","dateofbirth","schools_id","sex");
|
||||
else
|
||||
$required_fields=array("firstname","lastname","email","grade","schools_id");
|
||||
|
||||
if($config['participant_student_tshirt']=="yes")
|
||||
$required_fields[]="tshirt";
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have the minimum, return incomplete
|
||||
if(mysql_num_rows($q)<$config['minstudentsperproject'])
|
||||
return "incomplete";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if($req=="dateofbirth")
|
||||
{
|
||||
if($r->$req=="0000-00-00" || !$r->$req)
|
||||
return "incomplete";
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!$r->$req)
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
||||
function emergencycontactStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
$required_fields=array("firstname","lastname","relation","phone1");
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$sq=mysql_query("SELECT id FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$numstudents=mysql_num_rows($sq);
|
||||
|
||||
while($sr=mysql_fetch_object($sq))
|
||||
{
|
||||
$q=mysql_query("SELECT * FROM emergencycontact WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."' AND students_id='$sr->id'");
|
||||
|
||||
$r=mysql_fetch_object($q);
|
||||
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if(!$r->$req)
|
||||
{
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
||||
function projectStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
$required_fields=array("title","projectcategories_id","projectdivisions_id","language","req_table","req_electricity","summarycountok");
|
||||
|
||||
if($config['participant_short_title_enable'] == 'yes')
|
||||
$required_fields[] = 'shorttitle';
|
||||
|
||||
if($config['participant_project_summary_wordmin'] > 0)
|
||||
$required_fields[] = 'summary';
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have a project entry yet, return empty
|
||||
if(!mysql_num_rows($q))
|
||||
return "empty";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if(!$r->$req) {
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
}
|
||||
|
||||
|
||||
function mentorStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
$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='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$r=mysql_fetch_object($q);
|
||||
if($r->nummentors==null)
|
||||
return "incomplete";
|
||||
|
||||
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
|
||||
//if we dont have the minimum, return incomplete
|
||||
if(mysql_num_rows($q)<$config['minmentorserproject'])
|
||||
return "incomplete";
|
||||
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
foreach ($required_fields AS $req)
|
||||
{
|
||||
if(!$r->$req)
|
||||
{
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//if it made it through without returning incomplete, then we must be complete
|
||||
return "complete";
|
||||
|
||||
}
|
||||
|
||||
function safetyStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
|
||||
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='$rid'");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$safetyanswers[$r->safetyquestions_id]=$r->answer;
|
||||
}
|
||||
|
||||
//now grab all the questions
|
||||
$q=mysql_query("SELECT * FROM safetyquestions WHERE conferences_id='".$conference['id']."' ORDER BY ord");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
if($r->required=="yes" && !$safetyanswers[$r->id])
|
||||
{
|
||||
return "incomplete";
|
||||
}
|
||||
}
|
||||
return "complete";
|
||||
|
||||
}
|
||||
|
||||
function spawardStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
$q=mysql_query("SELECT * FROM projects WHERE registrations_id='$rid'");
|
||||
$project=mysql_fetch_object($q);
|
||||
|
||||
/* We want this query to get any awards with a NULL award_awards_id */
|
||||
$awardsq=mysql_query("SELECT
|
||||
projects.id AS projects_id
|
||||
FROM
|
||||
project_specialawards_link,
|
||||
projects
|
||||
WHERE
|
||||
project_specialawards_link.projects_id='".$project->id."'
|
||||
AND projects.conferences_id='".$conference['id']."'
|
||||
");
|
||||
|
||||
if(mysql_num_rows($awardsq))
|
||||
return "complete";
|
||||
else
|
||||
return "incomplete";
|
||||
}
|
||||
|
||||
function tourStatus($reg_id="")
|
||||
{
|
||||
global $config, $conference;
|
||||
|
||||
if($reg_id) $rid=$reg_id;
|
||||
else $rid=$_SESSION['registration_id'];
|
||||
|
||||
/* Get the students for this project */
|
||||
$q=mysql_query("SELECT * FROM students WHERE registrations_id='$rid' AND conferences_id='".$conference['id']."'");
|
||||
$num_found = mysql_num_rows($q);
|
||||
|
||||
$ret = "complete";
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
//grab all of their tour prefs
|
||||
$sid = $s->id;
|
||||
$qq=mysql_query("SELECT * FROM tours_choice WHERE students_id='$sid' and conferences_id='{$conference['id']}' ORDER BY rank");
|
||||
|
||||
$n_tours = mysql_num_rows($qq);
|
||||
if($n_tours > 0) {
|
||||
/* See if there's a rank 0 tour (rank 0 == their tour assignment) */
|
||||
$i = mysql_fetch_object($qq);
|
||||
if($i->rank == 0) {
|
||||
/* Yes, there is, no matter what, this student's tour
|
||||
* selection is complete. */
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
/* Else, they haven't been assigned a tour, see if they've made
|
||||
* the appropraite selection(s) */
|
||||
if( ($n_tours >= $config['tours_choices_min']) && ($n_tours <= $config['tours_choices_max']) ){
|
||||
continue;
|
||||
}
|
||||
$ret = "incomplete";
|
||||
break;
|
||||
}
|
||||
return $ret;
|
||||
}
|
||||
function namecheckStatus($reg_id="")
|
||||
{
|
||||
global $conference;
|
||||
|
||||
if($reg_id) {
|
||||
$q=mysql_query("SELECT * FROM students WHERE
|
||||
registrations_id='$reg_id'
|
||||
AND conferences_id='".$conference['id']."'");
|
||||
} else {
|
||||
$q=mysql_query("SELECT * FROM students WHERE
|
||||
id='{$_SESSION['students_id']}'");
|
||||
}
|
||||
|
||||
/* Get the students for this project */
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
if($s->namecheck_complete == 'no') {
|
||||
return 'incomplete';
|
||||
}
|
||||
}
|
||||
return 'complete';
|
||||
}
|
||||
|
||||
// legacy - functions previously included here have been split off into participants.inc.php,
|
||||
// but expected in this file by other code
|
||||
require_once("participant.inc.php");
|
||||
|
||||
function generateProjectNumber($registration_id)
|
||||
{
|
||||
@ -521,16 +245,16 @@ This section is for project/registration related functions **/
|
||||
|
||||
function saveProjectData($data){
|
||||
global $conference, $config;
|
||||
$requiredFields = array('project_id', 'summary', 'title', 'projectdivisions_id', 'language');
|
||||
if($config['participant_short_title_enable'] == 'yes'){
|
||||
$requiredFields = array('project_id', 'title', 'projectdivisions_id', 'language');
|
||||
if($config['participant_short_title_enable'] == 'yes')
|
||||
$requiredFields[] = 'shorttitle';
|
||||
}
|
||||
if($config['participant_project_table'] == 'yes'){
|
||||
if($config['participant_project_summary_wordmin'] > 0)
|
||||
$required_fields[] = 'summary';
|
||||
if($config['participant_project_table'] == 'yes')
|
||||
$requiredFields[] = 'req_table';
|
||||
}
|
||||
if($config['participant_project_electricity'] == 'yes'){
|
||||
if($config['participant_project_electricity'] == 'yes')
|
||||
$requiredFields[] = 'req_electricity';
|
||||
}
|
||||
|
||||
$missingFields = array();
|
||||
foreach($requiredFields as $field){
|
||||
if(!array_key_exists($field, $data)){
|
||||
|
@ -25,26 +25,9 @@
|
||||
require("common.inc.php");
|
||||
include "register_participants.inc.php";
|
||||
include "projects.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'] && $_SESSION['registration_id']))
|
||||
{
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
}
|
||||
$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");
|
||||
|
||||
$q=mysql_query("SELECT registrations.status AS status, registrations.id AS regid, students.id AS studentid, students.firstname 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.conferences_id=".$conference['id']." ".
|
||||
"AND students.conferences_id=".$conference['id']);
|
||||
echo mysql_error();
|
||||
|
||||
if(mysql_num_rows($q)==0)
|
||||
|
@ -24,32 +24,27 @@
|
||||
?>
|
||||
<?
|
||||
require("common.inc.php");
|
||||
require_once("user.inc.php");
|
||||
include "register_participants.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 * FROM students WHERE registrations_id='{$_SESSION['registration_id']}'");
|
||||
/* Ensure they're logged in as a participant */
|
||||
user_auth_required('participant');
|
||||
$u = user_load($_SESSION['users_id']);
|
||||
|
||||
if(!array_key_exists('registrations_id', $u) || $u['registrations_id'] == null){
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
}
|
||||
$q = mysql_query("SELECT firstname, lastname FROM users WHERE registrations_id='{$u['registrations_id']}'");
|
||||
echo mysql_error();
|
||||
|
||||
if(mysql_num_rows($q)==0) {
|
||||
header("Location: register_participants.php");
|
||||
exit;
|
||||
}
|
||||
|
||||
while($s=mysql_fetch_object($q)) {
|
||||
$student_display_name[]="{$s->firstname} {$s->lastname}";
|
||||
}
|
||||
|
||||
|
||||
|
||||
//send the header
|
||||
send_header("Participant Registration - Check Your Name");
|
||||
|
||||
@ -66,9 +61,9 @@
|
||||
$pu = ($_POST['punc'] == 'yes') ? true : false;
|
||||
|
||||
if($sp && $ca && $pu) {
|
||||
$q=mysql_query("UPDATE students SET namecheck_complete='yes' WHERE registrations_id='{$_SESSION['registration_id']}'");
|
||||
$q=mysql_query("UPDATE users SET namecheck_complete='yes' WHERE registrations_id='{$_SESSION['registration_id']}'");
|
||||
} else if($s->namecheck_complete!='no') {
|
||||
$q=mysql_query("UPDATE students SET namecheck_complete='no' WHERE registrations_id='{$_SESSION['registration_id']}'");
|
||||
$q=mysql_query("UPDATE users SET namecheck_complete='no' WHERE registrations_id='{$_SESSION['registration_id']}'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,11 +25,12 @@
|
||||
<?
|
||||
include_once('account.inc.php');
|
||||
|
||||
//we need these for the <type>_status_update() functions, to determine who's complete and who's isnt
|
||||
//we need these for the <type>_status_update() functions, to determine who's complete and who isn't
|
||||
//these are called on user_save for each role, if the function exists. The functions themselves
|
||||
//shoudlnt change anything, just return the results, the user_save does the updating
|
||||
//shoudln't change anything, just return the results, the user_save does the updating
|
||||
require_once('judge.inc.php');
|
||||
require_once('volunteer.inc.php');
|
||||
require_once('participant.inc.php');
|
||||
|
||||
function user_valid_role($role)
|
||||
{
|
||||
|
@ -44,11 +44,11 @@ function volunteer_status_update(&$u)
|
||||
|
||||
if( user_personal_info_status($u) == 'complete'
|
||||
&& volunteer_status_position($u) == 'complete' )
|
||||
$u['volunteer_complete'] = 'yes';
|
||||
$u['roles']['volunteer']['complete'] = 'yes';
|
||||
else
|
||||
$u['volunteer_complete'] = 'no';
|
||||
$u['roles']['volunteer']['complete'] = 'no';
|
||||
|
||||
return ($u['volunteer_complete'] == 'yes') ? 'complete' : 'incomplete';
|
||||
return ($u['roles']['volunteer']['complete'] == 'yes') ? 'complete' : 'incomplete';
|
||||
}
|
||||
|
||||
?>
|
||||
|
Loading…
Reference in New Issue
Block a user