diff --git a/register_participants_main.php b/register_participants_main.php
index 1c2f35f..ef88787 100644
--- a/register_participants_main.php
+++ b/register_participants_main.php
@@ -53,49 +53,53 @@ echo i18n("Student Information");
echo "";
echo "
";
//check to see if its complete
-$status=studentStatus();
-echo outputStatus($status);
+$statusstudent=studentStatus();
+echo outputStatus($statusstudent);
echo " | ";
//project information - project requires students, so only show the link if the students is complete
echo "";
-if($status=="complete")
+if($statusstudent=="complete")
echo "";
echo i18n("Project Information");
-if($status=="complete")
+if($statusstudent=="complete")
echo "";
echo " | ";
//check to see if its complete
-$status=projectStatus();
-echo outputStatus($status);
+$statusproject=projectStatus();
+echo outputStatus($statusproject);
echo " |
";
//mentor information
echo "";
echo "";
echo i18n("Mentor Information");
-if($status=="complete")
- echo "";
+echo "";
echo " | ";
//check to see if its complete
-$status=mentorStatus();
-echo outputStatus($status);
+$statusmentor=mentorStatus();
+echo outputStatus($statusmentor);
echo " |
";
//safety information
echo "";
echo "";
echo i18n("Safety Information");
-if($status=="complete")
- echo "";
+echo "";
echo " | ";
//check to see if its complete
-$status=safetyStatus();
-echo outputStatus($status);
+$statussafety=safetyStatus();
+echo outputStatus($statussafety);
echo " |
";
//signature page
-echo "".i18n("Signature Page")." | ";
+echo " |
";
+if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete")
+ echo "";
+echo i18n("Signature Page");
+if($statusstudent=="complete" && $statusproject=="complete" && $statusmentor=="complete" && $statussafety=="complete")
+ echo "";
+echo " | ";
//check to see if its complete
echo " |
";
diff --git a/register_participants_signature.php b/register_participants_signature.php
new file mode 100644
index 0000000..2819a18
--- /dev/null
+++ b/register_participants_signature.php
@@ -0,0 +1,205 @@
+
+ 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 registrations.id AS regid, students.id AS studentid, students.firstname FROM registrations,students ".
+ "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']);
+echo mysql_error();
+
+ if(mysql_num_rows($q)==0)
+ {
+ header("Location: register_participants.php");
+ exit;
+
+ }
+ $authinfo=mysql_fetch_object($q);
+
+ //END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
+
+ function loc($inch)
+ {
+ return $inch*72;
+ }
+
+ $pdf=pdf_new();
+ pdf_open_file($pdf,null);
+ //Letter size (8.5 x 11) is 612,792
+ pdf_begin_page($pdf,612,792);
+ pdf_set_parameter($pdf, "FontOutline", "Arial=/home/sfiab/www.sfiab.ca/sfiab/arial.ttf");
+ $arial=pdf_findfont($pdf,"Arial","host",1);
+ pdf_set_info($pdf,"Author","SFIAB");
+ pdf_set_info($pdf,"Creator","SFIAB");
+ pdf_set_info($pdf,"Title","SFIAB - Participant Signature Page");
+ pdf_set_info($pdf,"Subject","Signature Form");
+
+//The title of the fair
+ $yloc=10;
+ $height['title']=0.25;
+ $height['subtitle']=0.22;
+ $height['topbox']=0.8;
+ $height['exhibitortitle']=0.2;
+ $height['exhibitorbox']=1.1;
+ $height['exhibitorsigspace']=0.30;
+ $height['exhibitorsigtext']=0.13;
+ $height['parenttitle']=0.2;
+ $height['parentbox']=2.5;
+ $height['parentsigspace']=0.30;
+ $height['parentsigtext']=0.13;
+
+ pdf_setfont($pdf,$arial,18);
+ pdf_show_boxed($pdf,$config['fairname'] ,loc(0.75),loc($yloc),loc(7),loc($height['title']),"center",null);
+ $yloc-=$height['title'];
+
+ pdf_setfont($pdf,$arial,14);
+ pdf_show_boxed($pdf,i18n("Signature Form"),loc(0.75),loc($yloc),loc(7),loc($height['subtitle']),"center",null);
+ $yloc-=$height['subtitle'];
+
+ pdf_moveto($pdf,loc(0.5),loc($yloc));
+ pdf_lineto($pdf,loc(8),loc($yloc));
+ pdf_stroke($pdf);
+
+ //grab the project info
+ $q=mysql_query("SELECT * FROM projects WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
+ $projectinfo=mysql_fetch_object($q);
+
+ $q=mysql_query("SELECT * FROM students WHERE registrations_id='".$_SESSION['registration_id']."' AND year='".$config['FAIRYEAR']."'");
+ while($si=mysql_fetch_object($q))
+ $studentinfoarray[]=$si;
+
+ $topboxtext="Registration Number: ".$_SESSION['registration_number']."\n".
+ "Project Title: $projectinfo->title\n";
+ if(count($studentinfoarray)>1)
+ $plural="s";
+ else
+ $plural="";
+
+ $topboxtext.="Exhibitor$plural: ";
+ foreach($studentinfoarray AS $studentinfo)
+ {
+ $topboxtext.="$studentinfo->firstname $studentinfo->lastname, ";
+ }
+ //strip off the last comma
+ $topboxtext=substr($topboxtext,0,-2);
+ //add the newline
+ $topboxtext.="\n";
+
+ pdf_setfont($pdf,$arial,11);
+ pdf_set_value($pdf,"leading",15);
+
+ $yloc-=$height['topbox'];
+ pdf_show_boxed($pdf,$topboxtext, loc(0.5),loc($yloc),loc(7.5),loc($height['topbox']),"left",null);
+
+ pdf_moveto($pdf,loc(0.5),loc($yloc));
+ pdf_lineto($pdf,loc(8),loc($yloc));
+ pdf_stroke($pdf);
+
+
+ pdf_setfont($pdf,$arial,12);
+ $yloc-=$height['exhibitortitle'];
+ pdf_show_xy($pdf,"Exhibitor Declaration",loc(0.5),loc($yloc));
+
+ pdf_setfont($pdf,$arial,11);
+ pdf_set_value($pdf,"leading",15);
+
+ $studentbox="The following section is to be read and signed by the exhibitor$plural\n".
+ "I certify that:\n".
+ " - The preparation of this project is mainly my/our work\n".
+ " - I have read the rules and regulations and agree to abide by them\n".
+ " - I agree that the decision of the judges will be final\n";
+
+ $yloc-=$height['exhibitorbox'];
+ pdf_show_boxed($pdf,$studentbox, loc(0.5),loc($yloc),loc(7.5),loc($height['exhibitorbox']),"left",null);
+
+ foreach($studentinfoarray AS $studentinfo)
+ {
+ $yloc-=$height['exhibitorsigspace'];
+ //signature line
+ pdf_moveto($pdf,loc(1),loc($yloc));
+ pdf_lineto($pdf,loc(4.5),loc($yloc));
+ pdf_stroke($pdf);
+
+ //date line
+ pdf_moveto($pdf,loc(5),loc($yloc));
+ pdf_lineto($pdf,loc(7),loc($yloc));
+ pdf_stroke($pdf);
+
+ $yloc-=$height['exhibitorsigtext'];
+ //show their name
+ pdf_show_xy($pdf,"$studentinfo->firstname $studentinfo->lastname (signature)",loc(1.25),loc($yloc));
+
+ //show the Date text
+ pdf_show_xy($pdf,"Date",loc(5.25),loc($yloc));
+
+ }
+
+ $yloc-=3*$height['exhibitorsigtext'];
+ pdf_moveto($pdf,loc(0.5),loc($yloc));
+ pdf_lineto($pdf,loc(8),loc($yloc));
+ pdf_stroke($pdf);
+
+
+ //now for the parent/guardian signatures
+ pdf_setfont($pdf,$arial,12);
+ $yloc-=$height['parenttitle'];
+ pdf_show_xy($pdf,"Parent/Guardian Declaration",loc(0.5),loc($yloc));
+
+ pdf_setfont($pdf,$arial,11);
+ pdf_set_value($pdf,"leading",15);
+
+ $parentbox="The following is to be read and signed by the exhibitor$plural parent$plural/guardian$plural.\n".
+ " - As a parent/guardian I certify to the best of my knowledge and believe the information contained in this application is correct, and the project is the work of the student. I also understand that the material used in the project is the responsibility of the student and that neither the school, the teacher, nor the ".$_config['fairname']." can be held responsible for loss, damage, or theft, however caused. I further understand that all exhibits entered must be left on display until the end of the Fair. If my son/daughter does not remove the exhibit at the end of the Fair, the ".$config['fairname']." or the owner of the exhibition hall cannot be responsible for the disposal of the exhibit.\n\n".
+
+ " - If my son/daughter is awarded the honour of having his/her exhibit chosen for presentation at the Canada-Wide Science Fair, I consent to having him/her journey to the Fair, and will not hold the Fair responsible for any accident or mishap to the student or the exhibit.\n";
+
+ $yloc-=$height['parentbox'];
+ pdf_show_boxed($pdf,$parentbox, loc(0.5),loc($yloc),loc(7.5),loc($height['parentbox']),"left",null);
+
+
+ foreach($studentinfoarray AS $studentinfo)
+ {
+ $yloc-=$height['parentsigspace'];
+ //signature line
+ pdf_moveto($pdf,loc(1),loc($yloc));
+ pdf_lineto($pdf,loc(4.5),loc($yloc));
+ pdf_stroke($pdf);
+
+ //date line
+ pdf_moveto($pdf,loc(5),loc($yloc));
+ pdf_lineto($pdf,loc(7),loc($yloc));
+ pdf_stroke($pdf);
+
+ $yloc-=$height['parentsigtext'];
+ //show their name
+ pdf_show_xy($pdf,"Parent/Guardian of $studentinfo->firstname $studentinfo->lastname (signature)",loc(1.25),loc($yloc));
+
+ //show the Date text
+ pdf_show_xy($pdf,"Date",loc(5.25),loc($yloc));
+
+ }
+
+
+ pdf_end_page($pdf);
+ pdf_close($pdf);
+ $pdfdata=pdf_get_buffer($pdf);
+ header("Content-type: application/pdf");
+ header("Content-disposition: inline; filename=sfiab_sig_".$_SESSION['registration_id'].".pdf");
+ header("Content-length: ".strlen($pdfdata));
+ echo $pdfdata;
+?>