2005-01-24 18:00:03 +00:00
< ?
/*
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 .
*/
?>
2004-11-30 23:18:35 +00:00
< ?
require ( " common.inc.php " );
2004-12-02 19:40:43 +00:00
include " register_participants.inc.php " ;
2005-05-11 21:39:39 +00:00
include " projects.inc.php " ;
2004-11-30 23:18:35 +00:00
//authenticate based on email address and registration number from the SESSION
if ( ! $_SESSION [ 'email' ])
{
header ( " Location: register_participants.php " );
exit ;
}
2004-12-02 23:15:42 +00:00
if ( ! ( $_SESSION [ 'registration_number' ] && $_SESSION [ 'registration_id' ]))
2004-11-30 23:18:35 +00:00
{
header ( " Location: register_participants.php " );
exit ;
}
2005-01-13 18:50:07 +00:00
$q = mysql_query ( " SELECT registrations.status AS status, registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students " .
2004-11-30 23:18:35 +00:00
" 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.year= " . $config [ 'FAIRYEAR' ] . " " .
" AND students.year= " . $config [ 'FAIRYEAR' ]);
2004-11-30 23:38:13 +00:00
echo mysql_error ();
2004-11-30 23:18:35 +00:00
if ( mysql_num_rows ( $q ) == 0 )
{
2004-12-07 05:33:26 +00:00
header ( " Location: register_participants.php?action=logout " );
2004-11-30 23:18:35 +00:00
exit ;
}
$r = mysql_fetch_object ( $q );
2004-12-02 19:40:43 +00:00
send_header ( " Participant Registration - Summary " );
2004-12-02 19:03:53 +00:00
2004-12-07 16:33:14 +00:00
//only display the named greeting if we have their name
if ( $r -> firstname )
{
echo i18n ( " Hello <b>%1</b> " , array ( $r -> firstname ));
echo " <br /> " ;
}
2004-12-02 19:03:53 +00:00
echo " <br /> " ;
2005-01-13 18:50:07 +00:00
if ( registrationFormsReceived ())
{
2006-09-17 16:26:12 +00:00
//now select their project number
$q = mysql_query ( " SELECT projectnumber FROM projects WHERE registrations_id=' " . $_SESSION [ 'registration_id' ] . " ' AND year=' " . $config [ 'FAIRYEAR' ] . " ' " );
$projectinfo = mysql_fetch_object ( $q );
2005-01-13 18:50:07 +00:00
if ( $r -> status == " complete " )
{
2005-01-18 03:33:37 +00:00
echo i18n ( " Congratulations, You are successfully registered for the %1. No further changes may be made to any of your forms. " , array ( $config [ 'fairname' ]));
2005-01-13 18:50:07 +00:00
}
else if ( $r -> 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 " );
}
2006-09-17 16:26:12 +00:00
echo " <br /> " ;
echo i18n ( " Your project number is: " );
echo " <span style= \" font-size: 2.0em; font-weight: bold \" > $projectinfo->projectnumber </span> " ;
2005-01-13 18:50:07 +00:00
}
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> " );
}
2004-12-02 19:03:53 +00:00
echo " <br /> " ;
echo " <br /> " ;
2005-05-11 04:13:27 +00:00
echo " <table><tr><td> " ;
echo " <table class= \" summarytable \" > " ;
echo " <tr><th> " . i18n ( " Registration Item " ) . " </th><th> " . i18n ( " Status " ) . " </th></tr> " ;
//participant information
echo " <tr><td> " ;
echo " <a href= \" register_participants_students.php \" > " ;
echo i18n ( " Student Information " );
2005-01-05 15:05:32 +00:00
echo " </a> " ;
2005-05-11 04:13:27 +00:00
echo " </td><td> " ;
//check to see if its complete
$statusstudent = studentStatus ();
echo outputStatus ( $statusstudent );
echo " </td></tr> " ;
//participant emergency contact information
echo " <tr><td> " ;
if ( $statusstudent == " complete " )
echo " <a href= \" register_participants_emergencycontact.php \" > " ;
echo i18n ( " Emergency Contact Information " );
if ( $statusstudent == " complete " )
echo " </a> " ;
echo " </td><td> " ;
//check to see if its complete
$statusemergencycontact = emergencycontactStatus ();
echo outputStatus ( $statusemergencycontact );
echo " </td></tr> " ;
//project information - project requires students, so only show the link if the students is complete
echo " <tr><td> " ;
if ( $statusstudent == " complete " )
echo " <a href= \" register_participants_project.php \" > " ;
echo i18n ( " Project Information " );
if ( $statusstudent == " complete " )
echo " </a> " ;
echo " </td><td> " ;
//check to see if its complete
$statusproject = projectStatus ();
echo outputStatus ( $statusproject );
echo " </td></tr> " ;
2006-12-06 17:58:40 +00:00
if ( $config [ 'participant_mentor' ] == " yes " )
{
//mentor information
echo " <tr><td> " ;
echo " <a href= \" register_participants_mentor.php \" > " ;
echo i18n ( " Mentor Information " );
echo " </a> " ;
echo " </td><td> " ;
//check to see if its complete
$statusmentor = mentorStatus ();
echo outputStatus ( $statusmentor );
echo " </td></tr> " ;
}
else
{
//if mentorship isnt required, then assume its complete so the checks below will still work properly
$statusmentor = " complete " ;
}
2005-05-11 04:13:27 +00:00
//safety information
echo " <tr><td> " ;
echo " <a href= \" register_participants_safety.php \" > " ;
echo i18n ( " Safety Information " );
2004-12-14 14:56:34 +00:00
echo " </a> " ;
2005-05-11 04:13:27 +00:00
echo " </td><td> " ;
//check to see if its complete
$statussafety = safetyStatus ();
echo outputStatus ( $statussafety );
echo " </td></tr> " ;
2007-01-09 19:05:23 +00:00
if ( $config [ 'tours_enable' ] == " yes " ) {
echo " <tr><td> " ;
echo " <a href= \" register_participants_tours.php \" > " ;
echo i18n ( " Tour Selection " );
echo " </a> " ;
echo " </td><td> " ;
//check to see if its complete
$statustour = tourStatus ();
echo outputStatus ( $statustour );
echo " </td></tr> " ;
} else {
$statustour = " complete " ;
}
2006-12-18 20:55:30 +00:00
//FIXME: this should be a global detection so we can use the results elsewhere, especially for all the reports!
if ( function_exists ( " pdf_new " ))
$sigfile = " register_participants_signature.php " ;
else if ( file_exists ( " tcpdf/tcpdf.php " ))
$sigfile = " register_participants_signature_tcpdf.php " ;
else
$sigfile = " " ;
2005-05-11 04:13:27 +00:00
//signature page
echo " <tr><td> " ;
2007-03-04 16:26:04 +00:00
if ( $statusstudent == " complete " && $statusproject == " complete " && $statusmentor == " complete " && $statussafety == " complete " && $statusemergencycontact == " complete " && $statustour == " complete " )
2006-12-18 20:55:30 +00:00
{
if ( $sigfile )
echo " <a href= \" $sigfile\ " > " ;
else
echo error ( i18n ( " No PDF generation library detected " ), true );
}
2005-05-11 04:13:27 +00:00
echo i18n ( " Signature Page " );
2007-03-04 16:26:04 +00:00
if ( $statusstudent == " complete " && $statusproject == " complete " && $statusmentor == " complete " && $statussafety == " complete " && $statusemergencycontact == " complete " && $statustour == " complete " )
2005-05-11 04:13:27 +00:00
echo " </a> " ;
2007-03-05 02:26:56 +00:00
else
echo " <br /><font color= \" red \" >( " . i18n ( " Available when ALL above sections are \" Complete \" " ) . " )</font> " ;
2005-05-11 04:13:27 +00:00
echo " </td><td> " ;
echo i18n ( " Print " );
//check to see if its complete
echo " </td></tr> " ;
//received information
echo " <tr><td> " . i18n ( " Signature Page Received " ) . " </td><td> " ;
if ( registrationFormsReceived ())
echo outputStatus ( " complete " );
else
echo outputStatus ( " incomplete " );
//check to see if its complete
echo " </td></tr> " ;
echo " </table> " ;
echo " </td> " ;
echo " <td align= \" left \" width= \" 50% \" > " ;
2006-01-16 18:38:32 +00:00
if ( $config [ 'specialawardnomination' ] != " none " )
2005-05-11 04:13:27 +00:00
{
echo " <table class= \" summarytable \" > " ;
echo " <tr><th> " . i18n ( " Special Award Nominations " ) . " </th></tr> " ;
2005-05-12 15:47:21 +00:00
2007-03-05 02:26:56 +00:00
$sp_proj_ok = true ;
if ( $statusstudent == " incomplete " || $statusproject == " incomplete " ) {
$sp_proj_ok = false ;
}
2007-01-21 05:45:36 +00:00
$special_awards_open = false ;
if ( $config [ 'specialawardnomination_aftersignatures' ] == " no " ) {
$special_awards_open = true ;
} else {
$special_awards_open = ( registrationFormsReceived ()) ? true : false ;
}
if ( $special_awards_open == true )
2005-05-11 04:13:27 +00:00
{
2006-01-16 18:38:32 +00:00
if ( $config [ 'specialawardnomination' ] == " date " )
2005-05-12 15:47:21 +00:00
{
2006-01-16 18:38:32 +00:00
$q = mysql_query ( " SELECT (NOW()>' " . $config [ 'dates' ][ 'specawardregopen' ] . " ' AND NOW()<' " . $config [ 'dates' ][ 'specawardregclose' ] . " ') AS datecheck " );
$r = mysql_fetch_object ( $q );
//this will return 1 if its between the dates, 0 otherwise.
if ( $r -> datecheck == 1 )
{
echo " <tr><td><a href= \" register_participants_spawards.php \" > " . i18n ( " Self-nominate for special awards " ) . " </a></td></tr> " ;
}
else
{
echo " <tr><td> " . error ( i18n ( " Special award self-nomination is only available from %1 to %2 " , array ( $config [ 'dates' ][ 'specawardregopen' ], $config [ 'dates' ][ 'specawardregclose' ])), " inline " ) . " </td></tr> " ;
}
2005-05-12 15:47:21 +00:00
}
2006-01-16 18:38:32 +00:00
else if ( $config [ 'specialawardnomination' ] == " registration " )
2005-05-12 15:47:21 +00:00
{
2007-03-05 02:26:56 +00:00
if ( $sp_proj_ok == false ) {
echo " <tr><td><font color= \" red \" >( " . i18n ( " Available when your Student Information and Project Information is \" Complete \" " ) . " )</font></td></tr> " ;
} else {
echo " <tr><td><a href= \" register_participants_spawards.php \" > " . i18n ( " Self-nominate for special awards " ) . " </a></td></tr> " ;
}
2005-05-12 15:47:21 +00:00
}
2005-05-11 21:39:39 +00:00
$q = mysql_query ( " SELECT * FROM projects WHERE registrations_id=' " . $_SESSION [ 'registration_id' ] . " ' " );
$project = mysql_fetch_object ( $q );
2005-05-12 15:47:21 +00:00
$nominatedawards = getSpecialAwardsNominatedForProject ( $project -> id );
2005-05-11 21:39:39 +00:00
$num = count ( $nominatedawards );
2007-03-05 04:27:44 +00:00
$noawards = getNominatedForNoSpecialAwardsForProject ( $project -> id );
echo " <tr><td> " ;
2005-05-11 21:39:39 +00:00
if ( $num )
{
echo happy ( i18n ( " You are nominated for %1 awards " , array ( $num )), " inline " );
echo " </td></tr> " ;
echo " <tr><td> " ;
$c = 1 ;
foreach ( $nominatedawards AS $na )
{
echo $c . " . " . $na [ 'name' ] . " <br /> " ;
$c ++ ;
}
}
2007-03-05 04:27:44 +00:00
else if ( $noawards == true )
{
echo happy ( i18n ( " You are nominated for 0 awards " ), " inline " );
}
2005-05-11 21:39:39 +00:00
else
{
echo error ( i18n ( " You are nominated for 0 awards " ), " inline " );
}
echo " </td></tr> " ;
2005-05-11 04:13:27 +00:00
}
else
{
2006-02-02 02:32:24 +00:00
echo " <tr><td> " . error ( i18n ( " We must receive your signature form before you can nominate yourself for special awards " )) . " </td></tr> " ;
2005-05-11 04:13:27 +00:00
}
2005-05-12 15:47:21 +00:00
2005-05-11 04:13:27 +00:00
echo " </table> " ;
}
2004-12-02 19:03:53 +00:00
2005-05-11 04:13:27 +00:00
echo " </td></tr> " ;
2004-12-02 19:03:53 +00:00
echo " </table> " ;
2005-05-11 04:13:27 +00:00
2005-01-07 04:46:52 +00:00
echo " <br /><br /> " ;
2007-01-31 07:30:43 +00:00
function regfee_line ( $item , $unit , $qty , $tot , $extra )
2007-01-21 01:40:46 +00:00
{
echo " <tr><td> " . i18n ( $item ) . " </td> " ;
echo " <td>( $ " . sprintf ( " %.02f " , $unit ) . " </td> " ;
echo " <td>* $qty )</td> " ;
echo " <td> $ " . sprintf ( " %.02f " , $tot ) . " </td> " ;
2007-01-31 07:30:43 +00:00
echo " <td><font size=-1> " . i18n ( $extra ) . " </font></td> " ;
2007-01-21 01:40:46 +00:00
echo " </tr> " ;
}
2007-02-20 18:37:38 +00:00
if ( $config [ 'regfee_show_info' ] == 'yes' )
{
2007-01-21 01:40:46 +00:00
echo " <h3> " . i18n ( " Registration Fee Information " ) . " </h3> " ;
$regfee = 0 ;
$q = mysql_query ( " SELECT * FROM students WHERE registrations_id=' " . $_SESSION [ 'registration_id' ] . " ' AND year=' " . $config [ 'FAIRYEAR' ] . " ' " );
$n_students = mysql_num_rows ( $q );
$n_tshirts = 0 ;
while ( $s = mysql_fetch_object ( $q )) {
if ( $s -> tshirt != 'none' ) $n_tshirts ++ ;
}
echo " <table> " ;
if ( $config [ 'regfee_per' ] == 'student' ) {
$f = $config [ 'regfee' ] * $n_students ;
2007-01-31 07:30:43 +00:00
regfee_line ( " Fair Registration (per student) " , $config [ 'regfee' ], $n_students , $f , '' );
2007-01-21 01:40:46 +00:00
$regfee += $f ;
} else {
2007-01-31 07:30:43 +00:00
regfee_line ( " Fair Registration (per project) " , $config [ 'regfee' ], 1 , $config [ 'regfee' ], '' );
2007-01-21 01:40:46 +00:00
$regfee += $config [ 'regfee' ];
}
2007-01-31 07:30:43 +00:00
$extra_after = " " ;
2007-01-21 01:40:46 +00:00
if ( $config [ 'participant_student_tshirt' ] == 'yes' ) {
$tsc = floatval ( $config [ 'participant_student_tshirt_cost' ]);
if ( $tsc != 0.0 ) {
$f = $n_tshirts * $tsc ;
$regfee += $f ;
2007-01-31 07:30:43 +00:00
if ( $n_tshirts != 0 ) {
$ex = " * " ;
$extra_after = " * If you do not wish to order a T-Shirt, please select your T-Shirt size as 'None' on the Student Information Page " ;
regfee_line ( " T-Shirts " , $tsc , $n_tshirts , $f , $ex );
}
2007-01-21 01:40:46 +00:00
}
}
2007-01-31 07:30:43 +00:00
echo " <tr><td align=right colspan=3> " . i18n ( " Total (including all taxes) " ) . " </td><td><b> $ " . sprintf ( " %.02f " , $regfee ) . " </b></td><td></td></tr> " ;
2007-01-21 01:40:46 +00:00
echo " </table><br /> " ;
2007-01-31 07:30:43 +00:00
echo i18n ( $extra_after );
2007-03-05 02:26:56 +00:00
2007-01-31 07:30:43 +00:00
echo " <br /> " ;
echo " <br /> " ;
echo " <br /> " ;
2007-01-21 01:40:46 +00:00
}
2005-01-07 04:46:52 +00:00
echo " <h3> " . i18n ( " Registration Instructions " ) . " </h3> " ;
//now get the text of special instructions for the bottom of this page:
2005-11-21 19:36:48 +00:00
output_page_text ( " register_participants_main_instructions " );
2004-12-02 19:03:53 +00:00
2005-11-21 19:36:48 +00:00
echo " <br /><br /> " ;
2004-11-30 23:18:35 +00:00
2005-01-07 04:46:52 +00:00
2004-12-02 23:15:42 +00:00
echo " <a href= \" register_participants.php?action=logout \" > " . i18n ( " Logout " ) . " </a> " ;
2004-11-30 23:18:35 +00:00
send_footer ();
?>