Add a preview option to the signature page config.

This commit is contained in:
james 2008-01-28 23:01:41 +00:00
parent 414a85ccb2
commit a7ca82ff23
2 changed files with 28 additions and 3 deletions

View File

@ -46,6 +46,7 @@
echo happy(i18n("Signature page text successfully saved"));
}
echo "<a href=\"../register_participants_signature.php?sample=true\">Preview your signature form as a PDF (as a student would see it)</a><br />";
$q=mysql_query("SELECT * FROM signaturepage WHERE name='exhibitordeclaration'");
$r=mysql_fetch_object($q);

View File

@ -26,6 +26,12 @@
include "register_participants.inc.php";
require("lpdf.php");
//anyone can access a sample, we dont need to be authenticated or anything for that
if($_GET['sample']) {
$registration_number=12345;
$registration_id=0;
}
else {
//authenticate based on email address and registration number from the SESSION
if(!$_SESSION['email'])
{
@ -45,6 +51,10 @@
"AND students.registrations_id=registrations.id ".
"AND registrations.year=".$config['FAIRYEAR']." ".
"AND students.year=".$config['FAIRYEAR']);
$registration_number=$_SESSION['registration_number'];
$registration_id=$_SESSION['registration_id'];
echo mysql_error();
if(mysql_num_rows($q)==0)
@ -55,10 +65,11 @@ echo mysql_error();
}
$authinfo=mysql_fetch_object($q);
}
//END OF AUTH, now lets try to generate a PDF using only PHP :) this should be fun!
$pdf=new lpdf( i18n($config['fairname']),
i18n("Participant Signature Page (".$_SESSION['registration_number'].")"),
i18n("Participant Signature Page (".$registration_number.")"),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
);
@ -81,6 +92,16 @@ $pdf->newPage();
*/
if($_GET['sample']) {
$projectinfo->title="Sample Project Title";
$studentinfo->firstname="SampleFirst";
$studentinfo->lastname="SampleLast";
$studentinfo->grade="10";
$studentinfoarray[]=$studentinfo;
$rr->school="SampleSchool";
}
else
{
//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);
@ -88,8 +109,9 @@ $pdf->newPage();
$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".
$topboxtext="Registration Number: ".$registration_number."\n".
"Project Title: $projectinfo->title\n";
if(count($studentinfoarray)>1)
$plural="s";
@ -104,8 +126,10 @@ $pdf->newPage();
foreach($studentinfoarray AS $studentinfo)
{
if(!$_GET['sample']) {
$qq = mysql_query("SELECT school FROM schools WHERE id={$studentinfo->schools_id}");
$rr = mysql_fetch_object($qq);
}
$pdf->addTextX("$studentinfo->firstname $studentinfo->lastname, Grade {$studentinfo->grade}, {$rr->school}", 1.5);
$pdf->nextline();
@ -250,7 +274,7 @@ $pdf->newPage();
$pdf->heading(i18n("Registration Fee Summary"));
$pdf->nextLine();
list($regfee, $rfeedata) = computeRegistrationFee($_SESSION['registration_id']);
list($regfee, $rfeedata) = computeRegistrationFee($registration_id);
$pdf->addTextX(i18n('Item'), 3.5);
$pdf->addTextX(i18n('Unit'), 5.1);