From 8ef21626f20cac4b7ef53697faffa8d482c17d26 Mon Sep 17 00:00:00 2001 From: dave Date: Sat, 22 Dec 2007 23:28:14 +0000 Subject: [PATCH] - Add a participant name check page for students to double check their name. - Fix a bug in tour printing after tours have been assigned (it would show both students in a pair project on the same tour, always.) --- register_participants.inc.php | 21 +++++ register_participants.php | 1 + register_participants_main.php | 20 ++++- register_participants_namecheck.php | 131 ++++++++++++++++++++++++++++ register_participants_tours.php | 16 ++-- 5 files changed, 179 insertions(+), 10 deletions(-) create mode 100644 register_participants_namecheck.php diff --git a/register_participants.inc.php b/register_participants.inc.php index 896dfad0..1de351a9 100644 --- a/register_participants.inc.php +++ b/register_participants.inc.php @@ -272,6 +272,27 @@ function tourStatus($reg_id="") } return $ret; } +function namecheckStatus($reg_id="") +{ + global $config; + + if($reg_id) { + $q=mysql_query("SELECT * FROM students WHERE + registrations_id='$reg_id' + AND year='".$config['FAIRYEAR']."'"); + } 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'; +} function generateProjectNumber($registration_id) diff --git a/register_participants.php b/register_participants.php index f5dfc28b..03b322fd 100644 --- a/register_participants.php +++ b/register_participants.php @@ -69,6 +69,7 @@ $r=mysql_fetch_object($q); $_SESSION['registration_number']=$r->regnum; $_SESSION['registration_id']=$r->regid; + $_SESSION['students_id']=$r->studentid; header("Location: register_participants_main.php"); exit; } diff --git a/register_participants_main.php b/register_participants_main.php index da5d85ca..bc402dcd 100644 --- a/register_participants_main.php +++ b/register_participants_main.php @@ -179,8 +179,16 @@ echo ""; //FIXME: this should be a global detection so we can use the results elsewhere, especially for all the reports! if(function_exists("pdf_new")) @@ -191,8 +199,12 @@ echo "
"; $statustour = "complete"; } - - + //name check + echo "
"; + echo ""; + echo i18n("Double Check your Name"); + echo ""; + echo ""; + //check to see if its complete + $statusnamecheck=namecheckStatus(); + echo outputStatus($statusnamecheck); + echo "
"; $sigfile=""; //signature page + if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete" && $statusnamecheck=="complete") + $all_complete = true; + else + $all_complete = false; echo "
"; - if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete") + if($all_complete == true) { if($sigfile) echo ""; @@ -200,7 +212,7 @@ echo "
"; echo error(i18n("No PDF generation library detected"),true); } echo i18n("Signature Page"); - if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete") + if($all_complete == true) echo ""; else echo "
(".i18n("Available when ALL above sections are \"Complete\"").")"; diff --git a/register_participants_namecheck.php b/register_participants_namecheck.php new file mode 100644 index 00000000..e3cf4fbb --- /dev/null +++ b/register_participants_namecheck.php @@ -0,0 +1,131 @@ + + Copyright (C) 2005 James Grant + Copyright (C) 2008 David Grant + + 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. +*/ +?> +firstname} {$s->lastname}"; + + //send the header + send_header("Participant Registration - Check Your Name"); + + echo "<< ".i18n("Back to Participant Registration Summary")."
"; + echo "
"; + + if($_POST['action']=="save") + { + if(registrationDeadlinePassed()) { + echo error(i18n("Cannot make changes after registration deadline.")); + } else { + $sp = ($_POST['spelling'] == 'yes') ? true : false; + $ca = ($_POST['caps'] == 'yes') ? true : false; + $pu = ($_POST['punc'] == 'yes') ? true : false; + + if($sp && $ca && $pu) { + if($s->namecheck_complete!='yes') { + $q=mysql_query("UPDATE students SET namecheck_complete='yes' WHERE id='{$_SESSION['students_id']}'"); + $s->namecheck_complete = 'yes'; + } + } else if($s->namecheck_complete!='no') { + $q=mysql_query("UPDATE students SET namecheck_complete='no' WHERE id='{$_SESSION['students_id']}'"); + $s->namecheck_complete = 'no'; + } + } + } + +//output the current status +$newstatus=namecheckStatus(); +if($newstatus!="complete") +{ + echo error(i18n("Name Check Incomplete. Please check your name and check all the boxes below")); +} +else if($newstatus=="complete") +{ + echo happy(i18n("Name Check Complete")); +} + + echo i18n('Every year there is one participant who realizes that his/her name + is spelt wrong after certificates are printed and plaques are engraved. This + page has been created in an effort to ensure you are not that student. It is + difficult to re-print certificates and even harder to re-engrave a plaque.'); + echo '

'; + echo i18n('Your name is in the box below. (If you have a partner, your + partner can view his/her name by logging in to the participant registration + using his/her email address and the same registration number). This is + EXACTLY how your name will appear on any certificates, awards, or + engraving.'); + echo '

'; + echo i18n('Just to clarify, EXACTLY means EXACTLY. We will not add upper-case + letters if you typed your name in all lower-case. We will not change letters + to lower-case if you typed your name in all capitals. And we will not fix + any spelling if there is a typo. If your name appears incorrect, please visit + the %1Student Information%2 page and correct it. ', array( + '', '')); + echo '

'; + echo "
 $student_display_name 
"; + echo '

'; + echo i18n('Please confirm that:'); + echo '
'; + echo '
'; + echo "
\n"; + echo "\n"; + + $ch = ($s->namecheck_complete == 'yes') ? 'checked="checked"' : ''; + + echo " ".i18n('My name is spelt correctly'); + echo '
'; + echo " ".i18n('The correct letters are capitalized and in lower-case.'); + echo '
'; + echo " ".i18n('Any required punctuation and accents are present and correct.'); + echo '
'; + echo '
'; + + echo "\n"; + echo "
"; + + send_footer(); +?> diff --git a/register_participants_tours.php b/register_participants_tours.php index 98197bdf..873f32db 100644 --- a/register_participants_tours.php +++ b/register_participants_tours.php @@ -75,7 +75,10 @@ echo mysql_error(); 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 - mysql_query("DELETE FROM tours_choice WHERE registrations_id='{$_SESSION['registration_id']}' AND year='{$config['FAIRYEAR']}' AND rank!='0'"); + mysql_query("DELETE FROM tours_choice + WHERE registrations_id='{$_SESSION['registration_id']}' + AND year='{$config['FAIRYEAR']}' + AND rank!='0'"); if(is_array($_POST['toursel'])) { foreach($_POST['toursel'] AS $students_id=>$ts) @@ -109,6 +112,7 @@ echo mysql_error(); } } +/* if($_POST['action']=="volunteer") { $vname = mysql_escape_string(stripslashes($_POST['vname'])); $vemail = mysql_escape_string(stripslashes($_POST['vemail'])); @@ -120,7 +124,7 @@ echo mysql_error(); echo happy(i18n("Tour volunteer added. They will be contacted soon.")); } - +*/ //output the current status $newstatus=tourStatus(); @@ -135,11 +139,11 @@ else if($newstatus=="complete") } - $assigned_tour = 0; + $assigned_tour = array(); $q=mysql_query("SELECT * FROM tours_choice WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'"); while($r=mysql_fetch_object($q)) { - if($r->rank == 0) $assigned_tour = $r->tour_id; + if($r->rank == 0) $assigned_tour[$r->students_id] = $r->tour_id; $tour_choice[$r->students_id][$r->rank] = $r->tour_id; } @@ -184,9 +188,9 @@ else if($newstatus=="complete") continue; } - if($assigned_tour > 0) { + if(array_key_exists($r->id, $assigned_tour)) { echo happy(i18n('You have been assigned to a tour. Tour selection is disabled.')); - $t = $tours[$assigned_tour]; + $t = $tours[$assigned_tour[$r->id]]; echo i18n("Your Tour").": #{$t['num']}: ".i18n($t['name'])."
"; echo ''.i18n($t['description'])."

"; continue;