This now prompts for which fields to display in the name tag (pdf).

This commit is contained in:
jesse 2007-02-24 20:24:22 +00:00
parent 5edba483e3
commit 4c08f9c517

View File

@ -1,5 +1,5 @@
<? <?
/* /*
This file is part of the 'Science Fair In A Box' project This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca SFIAB Website: http://www.sfiab.ca
@ -26,8 +26,84 @@
auth_required('admin'); auth_required('admin');
require("../lpdf.php"); require("../lpdf.php");
require("../lcsv.php"); require("../lcsv.php");
$type=$_GET['type']; $type=$_POST['type'];
if($type == "")
{
$type = $_GET['type'];
}
$title=$_POST['title'];
$projectnumber=$_POST['projectnumber'];
$firstname=$_POST['firstname'];
$lastname=$_POST['lastname'];
$category=$_POST['category'];
$division=$_POST['division'];
if($title == "" && $projectnumber == "" && $firstname == "" && $lastnmae == "" && $category == "" && $division == "")
{
send_header("Administration - Reports");
echo "<a href=\"index.php\">&lt;&lt; ".i18n("Back to Administration")."</a>&nbsp;&nbsp;";
echo "<a href=\"reports.php\">&lt;&lt; ".i18n("Back to Reports")."</a><br />";
echo "<br />";
echo "<table><tr><td>";
echo i18n("Day of Fair Registration/Checkin Forms").": ";
echo "</td>";
/*
We need to prompt them for the fields. We will display check boxes for
every field. By default all of the fields are checked.
*/
echo "\n\n";
echo "<form action=\"reports_nametags_students.php\" method=\"post\">\n";
echo "<input type=\"hidden\" value=\"" . $type . "\" name=\"type\">\n";
echo "<table>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"title\" checked> Project Title\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"projectnumber\" checked> Project Number\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"firstname\" checked> Student's First Name\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"lastname\" checked> Student's Surname Name\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"category\" checked> Project Category\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"checkbox\" name=\"division\" checked> Project Division\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td>\n";
echo "<input type=\"submit\" value=\"Continue\">\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "</form>\n";
send_footer();
}
else
{
if($type=="pdf") if($type=="pdf")
{ {
$card_width=4; $card_width=4;
@ -42,12 +118,12 @@
$rep->newPage(8.5,11); $rep->newPage(8.5,11);
$rep->setNametagDimensions($card_width,$card_height); $rep->setNametagDimensions($card_width,$card_height);
$rep->setFontSize(11); $rep->setFontSize(11);
} }
else if($type=="csv") else if($type=="csv")
{ {
$rep=new lcsv(i18n("Student Nametags")); $rep=new lcsv(i18n("Student Nametags"));
} }
$q=mysql_query("SELECT $q=mysql_query("SELECT
registrations.id AS reg_id, registrations.id AS reg_id,
registrations.num AS reg_num, registrations.num AS reg_num,
projects.id, projects.id,
@ -67,15 +143,15 @@
LEFT JOIN students ON students.registrations_id=registrations.id LEFT JOIN students ON students.registrations_id=registrations.id
WHERE WHERE
projects.year='".$config['FAIRYEAR']."' projects.year='".$config['FAIRYEAR']."'
AND projectdivisions.year='".$config['FAIRYEAR']."' AND projectdivisions.year='".$config['FAIRYEAR']."'
AND projectcategories.year='".$config['FAIRYEAR']."' AND projectcategories.year='".$config['FAIRYEAR']."'
AND ( registrations.status='complete' OR registrations.status='paymentpending' ) AND ( registrations.status='complete' OR registrations.status='paymentpending' )
ORDER BY ORDER BY
projects.projectnumber projects.projectnumber
"); ");
// echo mysql_error(); // echo mysql_error();
// //
/* /*
this is 4x3" on my screen, so i'll use it to figure this is 4x3" on my screen, so i'll use it to figure
out what it should look like in a semi-proporational out what it should look like in a semi-proporational
@ -117,7 +193,7 @@ on the page we have tagnum layout like this:
5 6 5 6
*/ */
if($type=="csv") if($type=="csv")
{ {
$table=array(); $table=array();
$table['header'] = array(i18n("First Name"),i18n("Last Name"),i18n("Project Title"),i18n("Category"),i18n("Division"),i18n("Project Number")); $table['header'] = array(i18n("First Name"),i18n("Last Name"),i18n("Project Title"),i18n("Category"),i18n("Division"),i18n("Project Number"));
@ -129,13 +205,40 @@ on the page we have tagnum layout like this:
{ {
$rep->newNametag(); $rep->newNametag();
$rep->setFontSize(18); $rep->setFontSize(18);
$rep->addNametagText(0.0,"$r->firstname $r->lastname"); $studentName = " ";
if($firstname && $lastname)
$studentName = "$r->firstname $r->lastname";
else if($firstname)
$studentName = "$r->firstname";
else if($lastname)
$studentName = "$r->lastname";
$rep->addNametagText(0.0,"$studentName");
$rep->setFontSize(14); $rep->setFontSize(14);
$rep->addNametagText(0.75,"$r->title");
if($title)
$rep->addNametagText(0.75,"$r->title");
else
$rep->addNametagText(0.75," ");
$rep->setFontSize(12); $rep->setFontSize(12);
$rep->addNametagText(1.5,$r->category." - ".$r->division);
$categoryDivision = " ";
if($category && $division)
$categoryDivision = $r->category." - ".$r->division;
else if($category)
$categoryDivision = $r->category;
else if($division)
$categoryDivision = $r->division;
$rep->addNametagText(1.5,$categoryDivision);
$rep->setFontSize(16); $rep->setFontSize(16);
$rep->addNametagText(1.75,"# $r->projectnumber"); if($projectnumber)
$rep->addNametagText(1.75,"# $r->projectnumber");
else
$rep->addNametagText(1.75," ");
} }
else if($type=="csv") else if($type=="csv")
{ {
@ -143,11 +246,13 @@ on the page we have tagnum layout like this:
} }
} }
if($type=="csv") if($type=="csv")
{ {
$rep->addTable($table); $rep->addTable($table);
} }
$rep->output(); $rep->output();
} // Close the if-statement that governs whether or not to display the fields
?> ?>