- 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.)
This commit is contained in:
dave 2007-12-22 23:28:14 +00:00
parent 60df636517
commit 8ef21626f2
5 changed files with 179 additions and 10 deletions

View File

@ -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)

View File

@ -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;
}

View File

@ -179,8 +179,16 @@ echo "<table><tr><td>";
$statustour = "complete";
}
//name check
echo "<tr><td>";
echo "<a href=\"register_participants_namecheck.php\">";
echo i18n("Double Check your Name");
echo "</a>";
echo "</td><td>";
//check to see if its complete
$statusnamecheck=namecheckStatus();
echo outputStatus($statusnamecheck);
echo "</td></tr>";
//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 "<table><tr><td>";
$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 "<tr><td>";
if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete" && $statusemergencycontact=="complete" && $statustour=="complete")
if($all_complete == true)
{
if($sigfile)
echo "<a href=\"$sigfile\">";
@ -200,7 +212,7 @@ echo "<table><tr><td>";
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 "</a>";
else
echo "<br /><font color=\"red\">(".i18n("Available when ALL above sections are \"Complete\"").")</font>";

View File

@ -0,0 +1,131 @@
<?
/*
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>
Copyright (C) 2008 David Grant <dave@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.
*/
?>
<?
require("common.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 id='{$_SESSION['students_id']}'");
echo mysql_error();
if(mysql_num_rows($q)==0)
{
header("Location: register_participants.php");
exit;
}
$s=mysql_fetch_object($q);
$student_display_name = "{$s->firstname} {$s->lastname}";
//send the header
send_header("Participant Registration - Check Your Name");
echo "<a href=\"register_participants_main.php\">&lt;&lt; ".i18n("Back to Participant Registration Summary")."</a><br />";
echo "<br />";
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 '<br /><br />';
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 '<br /><br />';
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(
'<a href="register_participants_studnets.php">', '</a>'));
echo '<br /><br />';
echo "<table class=\"summarytable\"><tr><td><span style=\"font-size: 4.0em; font-weight: bold\">&nbsp;$student_display_name&nbsp;</span></td></tr></table>";
echo '<br /><br />';
echo i18n('Please confirm that:');
echo '<br />';
echo '<br />';
echo "<form method=\"post\" action=\"register_participants_namecheck.php\">\n";
echo "<input type=\"hidden\" name=\"action\" value=\"save\">\n";
$ch = ($s->namecheck_complete == 'yes') ? 'checked="checked"' : '';
echo "<input type=\"checkbox\" name=\"spelling\" value=\"yes\" $ch /> ".i18n('My name is spelt correctly');
echo '<br />';
echo "<input type=\"checkbox\" name=\"caps\" value=\"yes\" $ch /> ".i18n('The correct letters are capitalized and in lower-case.');
echo '<br />';
echo "<input type=\"checkbox\" name=\"punc\" value=\"yes\" $ch /> ".i18n('Any required punctuation and accents are present and correct.');
echo '<br />';
echo '<br />';
echo "<input type=\"submit\" value=\"".i18n("My Name is Correct")."\" />\n";
echo "</form>";
send_footer();
?>

View File

@ -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").": <b>#{$t['num']}: ".i18n($t['name'])."</b><br />";
echo '<span style="font-size: 0.8em;">'.i18n($t['description'])."</span><br /><br />";
continue;