science-ation/admin/reports_school_mailing_labels.php
james e6ed1c35b0 Account for spacing between labels when generating mailing labels for the schools
Also shrink the c/o line to better accomodate long names
2006-09-12 18:03:46 +00:00

104 lines
2.5 KiB
PHP

<?
/*
This file is part of the 'Science Fair In A Box' project
SFIAB Website: http://www.sfiab.ca
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
Copyright (C) 2005 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");
if($type=="pdf")
{
$card_width=4.00;
$card_height=2.00;
$xspacer=0.125;
$yspacer=0.125;
$rep=new lpdf( i18n($config['fairname']),
"School Mailing Labels",
$_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);
$rep->setFontSize(11);
}
else if($type=="csv") {
$rep=new lcsv(i18n("School Mailing Labels"));
}
$q=mysql_query("SELECT
*
FROM
schools
WHERE
year='{$config['FAIRYEAR']}'
ORDER BY
school
");
if($type=="csv")
{
$table=array();
$table['header'] = array(
i18n("School Name"),
i18n("Address"),
i18n("City"),
i18n("Province"),
i18n("Postal Code"),
i18n("Science Head"));
}
while($r=mysql_fetch_object($q))
{
if($type=="pdf")
{
$rep->newLabel();
$rep->setFontSize(16);
$rep->addLabelText(0.05,$r->school);
$rep->setFontSize(14);
$rep->addLabelText(0.50,$r->address);
$rep->addLabelText(0.75,"$r->city, $r->province_code");
$rep->addLabelText(1.0,$r->postalcode);
$rep->setFontSize(10);
if($r->sciencehead)
$rep->addLabelText(1.25,"c/o $r->sciencehead OR Science Head");
else
$rep->addLabelText(1.25,"c/o Science Department Head");
}
else if($type=="csv")
{
$table['data'][]=array($r->school, $r->address, $r->city, $r->province_code, $r->postalcode, $r->sciencehead);
}
}
if($type=="csv")
{
$rep->addTable($table);
}
$rep->output();
?>