science-ation/admin/registration_receivedforms.php
james ebeadd6470 Registraiton list
Fix received forms to accept paid/not paid
2005-01-07 04:45:17 +00:00

207 lines
6.3 KiB
PHP

<?
require("../common.inc.php");
require("../register_participants.inc.php");
send_header("Participant Registration - Received Forms");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>";
echo " &nbsp; ";
echo "<a href=\"registration.php\">&lt;&lt; ".i18n("Back to Registration")."</a>";
echo "<br />";
echo "<br />";
$showformatbottom=true;
if($_POST['action']=="received" && $_POST['registration_number'])
{
$q=mysql_query("SELECT * FROM registrations WHERE num='".$_POST['registration_number']."' AND year='".$config['FAIRYEAR']."'");
if(mysql_num_rows($q)==1)
{
$r=mysql_fetch_object($q);
$reg_id=$r->id;
$reg_num=$r->num;
$reg_status=$r->status;
if($r->status=='new')
{
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
$statusstudent=studentStatus($reg_id);
$statusemergencycontact=emergencycontactStatus($reg_id);
$statusproject=projectStatus($reg_id);
$statusmentor=mentorStatus($reg_id);
$statussafety=safetyStatus($reg_id);
if(
$statusstudent == "complete" &&
$statusemergencycontact == "complete" &&
$statusproject == "complete" &&
$statusmentor == "complete" &&
$statussafety == "complete"
) {
$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);
echo "<table class=\"summarytable\">";
echo "<tr><th colspan=\"2\">".i18n("Registration Summary for %1",array($reg_num))."</th></tr>";
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>";
$q=mysql_query("SELECT students.firstname,
students.lastname,
schools.school
FROM
students,schools
WHERE
students.registrations_id='$reg_id'
AND
students.schools_id=schools.id
");
$studnum=1;
while($studentinfo=mysql_fetch_object($q))
{
if($studnum==1)
echo "<tr><td><b>".i18n("School")."</b></td><td>$studentinfo->school </td></tr>";
echo "<tr><td><b>".i18n("Student %1",array($studnum))."</b></td><td>$studentinfo->firstname $studentinfo->lastname </td></tr>";
}
echo "</table>\n";
echo "<br />";
if($r->status!='complete')
{
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>";
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\" />";
echo "<input type=submit value=\"".i18n("No, this is the wrong form")."\" style=\"width: 400px;\"/>";
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=\"receivedyes\" />";
echo "<input type=submit value=\"".i18n("Yes, right form with registration fee")."\" style=\"width: 400px;\"/>";
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\" />";
echo "<input type=submit value=\"".i18n("Yes, right form without registration fee")."\" style=\"width: 400px;\"/>";
echo "</form>";
echo "<br />";
echo "</td>\n";
echo "</tr>";
echo "</table>";
$showformatbottom=false;
}
else
{
echo i18n("This form has already been received. Registration is complete");
echo "<br />";
echo "<br />";
echo "<hr />";
}
}
else
{
echo error(i18n("All registration sections are not complete. Cannot register incomplete form"));
}
}
}
else
{
echo error(i18n("Invalid Registration Number (%1)",array($_POST['registration_number'])));
}
}
else if($_POST['action']=="receivedyes" && $_POST['registration_number'])
{
//actually set it to 'closed'
mysql_query("UPDATE registrations SET status='complete' WHERE num='".$_POST['registration_number']."'");
//FIXME: assign the project number here as well!
echo happy(i18n("Registration of form %1 successfully completed",array($registration_number)));
}
else if($_POST['action']=="receivedyesnocash" && $_POST['registration_number'])
{
//actually set it to 'closed'
mysql_query("UPDATE registrations SET status='paymentpending' WHERE num='".$_POST['registration_number']."'");
echo happy(i18n("Registration of form %1 marked as payment pending",array($registration_number)));
}
else if($_POST['action']=="receivedno" && $_POST['registration_number'])
{
echo notice(i18n("Registration of form %1 cancelled",array($registration_number)));
}
if($showformatbottom)
{
echo "<h3>".i18n("Input Received Form")."</h3>";
echo "<form method=\"post\" action=\"registration_receivedforms.php\">";
echo "<input type=\"hidden\" name=\"action\" value=\"received\" />";
echo i18n("Enter the registration number from the form: ")."<br />";
echo "<input type=\"text\" size=\"15\" name=\"registration_number\" />";
echo "<input type=\"submit\" value=\"".i18n("Lookup Registration Number")."\" />";
echo "</form>";
}
send_footer();
?>