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 .
*/
?>
2005-01-05 22:57:49 +00:00
< ?
2011-03-04 22:29:55 +00:00
require_once ( " ../common.inc.php " );
2007-11-21 17:02:09 +00:00
require_once ( " ../user.inc.php " );
2010-07-13 03:30:17 +00:00
user_auth_required ( 'admin' );
2011-03-04 22:29:55 +00:00
require_once ( " ../register_participants.inc.php " );
2005-01-05 22:57:49 +00:00
2007-12-11 19:44:18 +00:00
send_header ( " Input Received Signature Forms " ,
2007-11-18 23:50:23 +00:00
array ( 'Committee Main' => 'committee_main.php' ,
'Administration' => 'admin/index.php' ,
'Participant Registration' => 'admin/registration.php' )
);
2005-01-05 22:57:49 +00:00
echo " <br /> " ;
2005-01-06 04:56:33 +00:00
$showformatbottom = true ;
2005-01-05 22:57:49 +00:00
if ( $_POST [ 'action' ] == " received " && $_POST [ 'registration_number' ])
{
2010-11-01 15:24:59 +00:00
$q = mysql_query ( " SELECT * FROM registrations WHERE num=' " . $_POST [ 'registration_number' ] . " ' AND conferences_id=' " . $conference [ 'id' ] . " ' " );
2005-01-05 22:57:49 +00:00
if ( mysql_num_rows ( $q ) == 1 )
{
$r = mysql_fetch_object ( $q );
$reg_id = $r -> id ;
$reg_num = $r -> num ;
2005-01-07 04:45:17 +00:00
$reg_status = $r -> status ;
2005-01-05 22:57:49 +00:00
2011-03-04 22:29:55 +00:00
if ( $r -> status == 'new' ) {
2005-01-05 22:57:49 +00:00
echo error ( i18n ( " Invalid Registration Status (%1 is New). Cannot receive an empty form. " , array ( $_POST [ 'registration_number' ])));
}
else
{
//make sure all of the statuses are correct
2011-03-04 22:29:55 +00:00
$statusstudent = studentsStatus ( $reg_id );
2005-01-05 22:57:49 +00:00
$statusemergencycontact = emergencycontactStatus ( $reg_id );
$statusproject = projectStatus ( $reg_id );
2006-12-06 17:58:40 +00:00
if ( $config [ 'participant_mentor' ] == " yes " )
$statusmentor = mentorStatus ( $reg_id );
else
$statusmentor = " complete " ;
2005-01-05 22:57:49 +00:00
$statussafety = safetyStatus ( $reg_id );
2008-03-27 22:12:27 +00:00
$statusnamecheck = namecheckStatus ( $reg_id );
2005-01-05 22:57:49 +00:00
if (
$statusstudent == " complete " &&
$statusemergencycontact == " complete " &&
$statusproject == " complete " &&
$statusmentor == " complete " &&
2008-03-27 22:12:27 +00:00
$statussafety == " complete " &&
$statusnamecheck == " complete "
2005-01-05 22:57:49 +00:00
) {
$q = mysql_query ( " SELECT projects.title,
projectcategories . category ,
projectdivisions . division
FROM
projects , projectcategories , projectdivisions
WHERE
projects . registrations_id = '$reg_id'
AND
projects . projectcategories_id = projectcategories . id
AND
projects . projectdivisions_id = projectdivisions . id
" );
echo mysql_Error ();
$projectinfo = mysql_fetch_object ( $q );
2005-01-06 04:56:33 +00:00
echo " <table class= \" summarytable \" > " ;
echo " <tr><th colspan= \" 2 \" > " . i18n ( " Registration Summary for %1 " , array ( $reg_num )) . " </th></tr> " ;
2005-01-07 04:45:17 +00:00
switch ( $reg_status )
{
case " paymentpending " : $status_text = " Payment Pending " ; break ;
case " complete " : $status_text = " Complete " ; break ;
case " open " : $status_text = " Open " ; break ;
}
echo " <tr><td><b> " . i18n ( " Registration Status " ) . " </b></td><td> $status_text </td></tr> " ;
echo " <tr><td><b> " . i18n ( " Registration Number " ) . " </b></td><td> $reg_num </td></tr> " ;
echo " <tr><td><b> " . i18n ( " Project Title " ) . " </b></td><td> $projectinfo->title </td></tr> " ;
echo " <tr><td><b> " . i18n ( " Category / Division " ) . " </b></td><td> $projectinfo->category / $projectinfo->division </td></tr> " ;
2005-01-05 22:57:49 +00:00
2011-03-04 22:29:55 +00:00
$q = mysql_query ( " SELECT users.firstname,
users . lastname ,
2005-01-05 22:57:49 +00:00
schools . school
FROM
2011-03-04 22:29:55 +00:00
users , schools
2005-01-05 22:57:49 +00:00
WHERE
2011-03-04 22:29:55 +00:00
users . registrations_id = '$reg_id'
2005-01-05 22:57:49 +00:00
AND
2011-03-04 22:29:55 +00:00
users . schools_id = schools . id
2005-01-05 22:57:49 +00:00
" );
$studnum = 1 ;
while ( $studentinfo = mysql_fetch_object ( $q ))
{
2006-04-09 13:47:04 +00:00
echo " <tr><td><b> " . i18n ( " School %1 " , array ( $studnum )) . " </b></td><td> $studentinfo->school </td></tr> " ;
2005-01-05 22:57:49 +00:00
2005-01-07 04:45:17 +00:00
echo " <tr><td><b> " . i18n ( " Student %1 " , array ( $studnum )) . " </b></td><td> $studentinfo->firstname $studentinfo->lastname </td></tr> " ;
2006-04-09 13:47:04 +00:00
$studnum ++ ;
2005-01-05 22:57:49 +00:00
}
2007-03-12 02:05:40 +00:00
list ( $regfee , $regfeedata ) = computeRegistrationFee ( $reg_id );
echo " <tr><td><b> " . i18n ( " Registration Fee " ) . " </b></td><td> " . sprintf ( " $ %.02f " , $regfee ) . " </td></tr> " ;
2005-01-06 04:56:33 +00:00
echo " </table> \n " ;
2005-01-07 04:45:17 +00:00
echo " <br /> " ;
2011-03-04 22:29:55 +00:00
if ( $r -> status != 'complete' ) {
2005-01-07 04:45:17 +00:00
echo " <table style= \" margin-left: 30px; \" > " ;
echo " <tr><td colspan= \" 3 \" > " ;
echo i18n ( " Is this the correct form to register? " );
echo " </td></tr> " ;
echo " <tr> " ;
echo " <td> " ;
2005-01-06 04:56:33 +00:00
echo " <form method= \" post \" action= \" registration_receivedforms.php \" > " ;
echo " <input type= \" hidden \" name= \" registration_number \" value= \" $reg_num\ " /> " ;
echo " <input type= \" hidden \" name= \" action \" value= \" receivedno \" /> " ;
2011-03-04 22:29:55 +00:00
echo " <input type=submit value= \" " . i18n ( " No, this is the wrong form " ) . " \" style= \" width: 400px; height: 40px; margin: 10px; \" /> " ;
2005-01-06 04:56:33 +00:00
echo " </form> " ;
2011-03-04 22:29:55 +00:00
if ( $config [ 'regfee' ] > 0 ) {
2005-01-14 20:56:51 +00:00
echo " <form method= \" post \" action= \" registration_receivedforms.php \" > " ;
echo " <input type= \" hidden \" name= \" registration_number \" value= \" $reg_num\ " /> " ;
echo " <input type= \" hidden \" name= \" action \" value= \" receivedyes \" /> " ;
2011-03-04 22:29:55 +00:00
echo " <input type=submit value= \" " . i18n ( " Yes, right form with registration fee " ) . " \" style= \" width: 400px; height: 40px; margin: 10px; \" /> " ;
2005-01-14 20:56:51 +00:00
echo " </form> " ;
echo " <form method= \" post \" action= \" registration_receivedforms.php \" > " ;
echo " <input type= \" hidden \" name= \" registration_number \" value= \" $reg_num\ " /> " ;
echo " <input type= \" hidden \" name= \" action \" value= \" receivedyesnocash \" /> " ;
2011-03-04 22:29:55 +00:00
echo " <input type=submit value= \" " . i18n ( " Yes, right form without registration fee " ) . " \" style= \" width: 400px; height: 40px; margin: 10px; \" /> " ;
2005-01-14 20:56:51 +00:00
echo " </form> " ;
}
2011-03-04 22:29:55 +00:00
else {
2005-01-14 20:56:51 +00:00
echo " <form method= \" post \" action= \" registration_receivedforms.php \" > " ;
echo " <input type= \" hidden \" name= \" registration_number \" value= \" $reg_num\ " /> " ;
echo " <input type= \" hidden \" name= \" action \" value= \" receivedyes \" /> " ;
2011-03-04 22:29:55 +00:00
echo " <input type=submit value= \" " . i18n ( " Yes, this is the right form " ) . " \" style= \" width: 400px; height: 40px; margin: 10px; \" /> " ;
2005-01-14 20:56:51 +00:00
echo " </form> " ;
}
2005-01-07 04:45:17 +00:00
echo " <br /> " ;
echo " </td> \n " ;
echo " </tr> " ;
echo " </table> " ;
$showformatbottom = false ;
}
2011-03-04 22:29:55 +00:00
else {
2005-01-07 04:45:17 +00:00
echo i18n ( " This form has already been received. Registration is complete " );
echo " <br /> " ;
2008-03-20 01:19:35 +00:00
echo " <a href= \" registration_receivedforms.php?action=unregister®istration_number= $reg_num\ " > " .i18n( " Click here to unregister this project " ). " </ a > " ;
2005-01-07 04:45:17 +00:00
echo " <br /> " ;
echo " <hr /> " ;
}
2005-01-05 22:57:49 +00:00
}
2011-03-04 22:29:55 +00:00
else {
2005-01-07 04:45:17 +00:00
echo error ( i18n ( " All registration sections are not complete. Cannot register incomplete form " ));
2011-03-04 22:29:55 +00:00
$reg = getRegistration ( $reg_id );
echo " <table class= \" tableview \" > " ;
echo " <b>Registration Number: { $reg [ 'registration_number' ] } </b><br /> \n " ;
foreach ( $reg [ 'status' ] AS $k => $v ) {
echo " <tr><th> $k </td><td> " . outputStatus ( $v ) . " </td></tr> \n " ;
}
echo " </table> \n " ;
echo " <br /><br /> \n " ;
2005-01-05 22:57:49 +00:00
}
}
}
else
{
echo error ( i18n ( " Invalid Registration Number (%1) " , array ( $_POST [ 'registration_number' ])));
}
}
2006-08-20 00:02:31 +00:00
else if (( $_POST [ 'action' ] == " receivedyes " || $_POST [ 'action' ] == " receivedyesnocash " ) && $_POST [ 'registration_number' ]) {
2007-03-04 20:28:51 +00:00
$regnum = intval ( $_POST [ 'registration_number' ]);
$checkNumQuery = mysql_query ( " SELECT projectnumber
FROM projects , registrations
WHERE projects . registrations_id = registrations . id
AND num = '$regnum'
2010-11-01 15:24:59 +00:00
AND registrations . conferences_id = '{$conference[' id ']}' " );
2006-08-20 00:02:31 +00:00
$checkNumResults = mysql_fetch_object ( $checkNumQuery );
$projectnum = $checkNumResults -> projectnumber ;
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
2010-11-01 15:24:59 +00:00
$q = mysql_query ( " SELECT id FROM registrations WHERE num=' $regnum ' AND conferences_id=' { $conference [ 'id' ] } ' " );
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
$r = mysql_fetch_object ( $q );
$reg_id = $r -> id ;
2006-08-20 00:02:31 +00:00
if ( $projectnum == null )
{
2007-12-29 08:46:40 +00:00
list ( $projectnumber , $ps , $pns , $pss ) = generateProjectNumber ( $reg_id );
mysql_query ( " UPDATE projects SET projectnumber=' $projectnumber ',
projectsort = '$ps' , projectnumber_seq = '$pns' , projectsort_seq = '$pss'
2010-11-01 15:24:59 +00:00
WHERE registrations_id = '$reg_id' AND conferences_id = '{$conference[' id ']}' " );
2006-08-20 00:02:31 +00:00
echo happy ( i18n ( " Assigned Project Number: %1 " , array ( $projectnumber )));
}
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
else
$projectnumber = $projectnum ;
2007-10-30 22:37:18 +00:00
//get all students with this registration number
$recipients = getEmailRecipientsForRegistration ( $reg_id );
2011-03-04 22:29:55 +00:00
if ( $_POST [ 'action' ] == " receivedyes " ) {
2007-10-29 20:21:40 +00:00
//actually set it to 'complete'
2010-11-01 15:24:59 +00:00
mysql_query ( " UPDATE registrations SET status='complete' WHERE num=' $regnum ' AND conferences_id=' { $conference [ 'id' ] } ' " );
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
foreach ( $recipients AS $recip ) {
2010-01-28 08:34:33 +00:00
$subsub = array ();
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
$subbod = array (
" EMAIL " => $recip [ 'email' ],
" FIRSTNAME " => $recip [ 'firstname' ],
" LASTNAME " => $recip [ 'lastname' ],
2011-03-04 22:29:55 +00:00
" USERNAME " => $recip [ 'username' ],
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
" NAME " => $recip [ 'firstname' ] . " " . $recip [ 'lastname' ],
" REGNUM " => $regnum ,
" PROJECTNUMBER " => $projectnumber ,
);
2011-03-04 22:29:55 +00:00
$res = email_send ( " register_participants_received " , $recip [ 'email' ], $subsub , $subbod );
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
}
2007-10-29 20:21:40 +00:00
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
echo happy ( i18n ( " Registration of form %1 successfully completed " , array ( $regnum )));
2006-08-20 00:02:31 +00:00
}
else if ( $_POST [ 'action' ] == " receivedyesnocash " )
{
2007-10-29 20:21:40 +00:00
//actually set it to 'paymentpending'
2010-11-01 15:24:59 +00:00
mysql_query ( " UPDATE registrations SET status='paymentpending' WHERE num=' $regnum ' AND conferences_id=' { $conference [ 'id' ] } ' " );
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
foreach ( $recipients AS $recip ) {
2010-01-28 08:34:33 +00:00
$subsub = array ();
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
$subbod = array (
" EMAIL " => $recip [ 'email' ],
" FIRSTNAME " => $recip [ 'firstname' ],
" LASTNAME " => $recip [ 'lastname' ],
2011-03-04 22:29:55 +00:00
" USERNAME " => $recip [ 'username' ],
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
" NAME " => $recip [ 'firstname' ] . " " . $recip [ 'lastname' ],
" REGNUM " => $regnum ,
" PROJECTNUMBER " => $projectnumber ,
);
2011-03-04 22:29:55 +00:00
email_send ( " register_participants_paymentpending " , $recip [ 'email' ], $subsub , $subbod );
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
}
echo happy ( i18n ( " Registration of form %1 marked as payment pending " , array ( $regnum )));
2006-08-20 00:02:31 +00:00
}
2005-01-07 04:45:17 +00:00
}
2011-03-04 22:29:55 +00:00
else if ( $_POST [ 'action' ] == " receivedno " && $_POST [ 'registration_number' ]) {
Add an email address verification function so we dont need to keep duplicating the regex everywhere
Add a function to get the email recipients for a given registration id, for now, it just gets the students, but downt eh road it should check if teachers, parents, emergency contacts, mentors, etc should receive fair updates as well.
Implement the code/replacement tags for the two new emails, one for 'forms received, with payment' and the other for 'forms received, without payment'
2007-10-30 22:35:00 +00:00
echo notice ( i18n ( " Registration of form %1 cancelled " , array ( $_POST [ 'registration_number' ])));
2005-01-06 04:56:33 +00:00
}
2008-03-20 01:19:35 +00:00
else if ( $_GET [ 'action' ] == " unregister " && $_GET [ 'registration_number' ]) {
$reg_num = intval ( trim ( $_GET [ 'registration_number' ]));
2010-11-01 15:24:59 +00:00
$q = mysql_query ( " SELECT registrations.id AS reg_id, projects.id AS proj_id FROM projects,registrations WHERE projects.registrations_id=registrations.id AND registrations.conferences_id=' { $conference [ 'id' ] } ' AND registrations.num=' $reg_num ' " );
2008-03-20 01:19:35 +00:00
$r = mysql_fetch_object ( $q );
2010-11-01 15:24:59 +00:00
mysql_query ( " UPDATE projects SET projectnumber=null, projectsort=null, projectnumber_seq=0, projectsort_seq=0 WHERE id=' $r->proj_id ' AND conferences_id=' { $conference [ 'id' ] } ' " );
mysql_query ( " UPDATE registrations SET status='open' WHERE id=' $r->reg_id ' AND conferences_id=' { $conference [ 'id' ] } ' " );
2008-03-20 01:19:35 +00:00
echo happy ( i18n ( " Successfully unregistered project " ));
}
2005-01-06 04:56:33 +00:00
2011-03-04 22:29:55 +00:00
if ( $showformatbottom ) {
2007-03-13 21:34:24 +00:00
echo " <form id= \" inputform \" method= \" post \" action= \" registration_receivedforms.php \" > " ;
2005-01-06 04:56:33 +00:00
echo " <input type= \" hidden \" name= \" action \" value= \" received \" /> " ;
2007-12-11 19:44:18 +00:00
echo i18n ( " Enter the registration number from the signature form: " ) . " <br /> " ;
2007-03-13 21:34:24 +00:00
echo " <input id= \" registration_number \" type= \" text \" size= \" 15 \" name= \" registration_number \" /> " ;
2005-01-06 04:56:33 +00:00
echo " <input type= \" submit \" value= \" " . i18n ( " Lookup Registration Number " ) . " \" /> " ;
echo " </form> " ;
2007-03-13 21:34:24 +00:00
?>
< script type = " text/javascript " >
document . forms . inputform . registration_number . focus ();
</ script >
< ?
2005-01-06 04:56:33 +00:00
}
2005-01-05 22:57:49 +00:00
send_footer ();
?>