forked from science-ation/science-ation
112 lines
3.0 KiB
PHP
112 lines
3.0 KiB
PHP
|
<?
|
||
|
/*
|
||
|
This file is part of the 'Science Fair In A Box' project
|
||
|
SFIAB Website: http://www.sfiab.ca
|
||
|
|
||
|
Copyright (C) 2007 Sci-Tech Ontario Inc <info@scitechontario.org>
|
||
|
Copyright (C) 2007 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.
|
||
|
*/
|
||
|
?>
|
||
|
<?
|
||
|
require("../common.inc.php");
|
||
|
auth_required('admin');
|
||
|
require("../lpdf.php");
|
||
|
require("../lcsv.php");
|
||
|
|
||
|
|
||
|
$type="pdf";
|
||
|
|
||
|
$reportname="Project Identification Labels";
|
||
|
|
||
|
if($type=="pdf")
|
||
|
{
|
||
|
$card_width=4;
|
||
|
$card_height=1;
|
||
|
$xspacer=0.08;
|
||
|
$yspacer=0.08;
|
||
|
$fontsize=12;
|
||
|
$rep=new lpdf( i18n($config['fairname']),
|
||
|
"$reportname",
|
||
|
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||
|
);
|
||
|
|
||
|
$rep->setPageStyle("labels");
|
||
|
$rep->newPage(8.5,11);
|
||
|
$rep->setLabelDimensions($card_width,$card_height,$xspacer,$yspacer,$fontsize);
|
||
|
}
|
||
|
else if($type=="csv") {
|
||
|
$rep=new lcsv(i18n("$reportname "));
|
||
|
}
|
||
|
|
||
|
$projq=mysql_query("SELECT
|
||
|
registrations.id AS reg_id,
|
||
|
registrations.num AS reg_num,
|
||
|
projects.id,
|
||
|
projects.title,
|
||
|
projects.projectnumber,
|
||
|
projects.projectdivisions_id,
|
||
|
projects.projectcategories_id,
|
||
|
projectdivisions.division,
|
||
|
projectcategories.category
|
||
|
FROM
|
||
|
registrations
|
||
|
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
|
||
|
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
|
||
|
LEFT JOIN projects on projects.registrations_id=registrations.id
|
||
|
|
||
|
WHERE
|
||
|
projects.year='".$config['FAIRYEAR']."'
|
||
|
AND projectdivisions.year='".$config['FAIRYEAR']."'
|
||
|
AND projectcategories.year='".$config['FAIRYEAR']."'
|
||
|
AND ( registrations.status='complete' OR registrations.status='paymentpending' )
|
||
|
ORDER BY
|
||
|
projects.projectnumber
|
||
|
");
|
||
|
echo mysql_error();
|
||
|
|
||
|
if($type=="csv")
|
||
|
{
|
||
|
$table=array();
|
||
|
$table['header'] = array(
|
||
|
i18n("Project Number"),
|
||
|
i18n("Project Title"),
|
||
|
i18n("Division"),
|
||
|
i18n("Category"));
|
||
|
}
|
||
|
|
||
|
while($proj=mysql_fetch_object($projq))
|
||
|
{
|
||
|
if($type=="pdf")
|
||
|
{
|
||
|
$rep->newLabel();
|
||
|
$rep->addLabelText(.05,$proj->projectnumber);
|
||
|
$rep->addLabelText(.300,$proj->category." / ".$proj->division);
|
||
|
$rep->addLabelText(.500,$proj->title);
|
||
|
|
||
|
}
|
||
|
else if($type=="csv")
|
||
|
{
|
||
|
$table['data'][]=array($proj->projectnumber,$proj->title,$proj->division,$proj->category);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
if($type=="csv")
|
||
|
$rep->addTable($table);
|
||
|
|
||
|
$rep->output();
|
||
|
?>
|