forked from science-ation/science-ation
add judges CSV report (it would be waaaaay too wide to make into a PDF)
update lcsv to send content-type: text/x-csv reduce duplicate code by using same variable for both kinds of reports, then $rep->addTable and $rep->output are the same for both pdf and csv
This commit is contained in:
parent
353835d402
commit
6d58c108c0
@ -43,6 +43,8 @@ while($catr=mysql_fetch_object($catq))
|
||||
echo "</tr>";
|
||||
echo "</table>";
|
||||
|
||||
echo i18n("Judges List").": ";
|
||||
echo "<a href=\"reports_judges.php?type=csv\">Judge List (CSV)</a> ";
|
||||
|
||||
send_footer();
|
||||
?>
|
||||
|
@ -35,17 +35,17 @@ if($catr=mysql_fetch_object($catq))
|
||||
if($type=="pdf")
|
||||
{
|
||||
|
||||
$pdf=new lpdf( i18n($config['fairname']),
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Checkin List")." - ".i18n($catr->category),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
);
|
||||
|
||||
$pdf->newPage();
|
||||
$pdf->setFontSize(11);
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(11);
|
||||
}
|
||||
else if($type=="csv")
|
||||
{
|
||||
$csv=new lcsv(i18n("Checkin List")." - ".i18n($catr->category));
|
||||
$rep=new lcsv(i18n("Checkin List")." - ".i18n($catr->category));
|
||||
}
|
||||
$q=mysql_query("SELECT registrations.id AS reg_id,
|
||||
registrations.num AS reg_num,
|
||||
@ -120,15 +120,7 @@ if($catr=mysql_fetch_object($catq))
|
||||
|
||||
}
|
||||
|
||||
if($type=="pdf")
|
||||
{
|
||||
$pdf->addTable($table);
|
||||
$pdf->output();
|
||||
}
|
||||
else if($type=="csv")
|
||||
{
|
||||
$csv->addTable($table);
|
||||
$csv->output();
|
||||
}
|
||||
$rep->addTable($table);
|
||||
$rep->output();
|
||||
}
|
||||
?>
|
||||
|
110
admin/reports_judges.php
Normal file
110
admin/reports_judges.php
Normal file
@ -0,0 +1,110 @@
|
||||
<?
|
||||
/*
|
||||
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(!$_GET['type']) $type="csv";
|
||||
else $type=$_GET['type'];
|
||||
|
||||
if($type=="pdf")
|
||||
{
|
||||
$rep=new lpdf( i18n($config['fairname']),
|
||||
i18n("Judge List"),
|
||||
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
||||
);
|
||||
|
||||
$rep->newPage();
|
||||
$rep->setFontSize(11);
|
||||
}
|
||||
else if($type=="csv")
|
||||
{
|
||||
$rep=new lcsv(i18n("Judge List"));
|
||||
}
|
||||
|
||||
$table=array();
|
||||
$table['header']=array( i18n("Last Name"),
|
||||
i18n("First Name"),
|
||||
i18n("Email"),
|
||||
i18n("Phone Home"),
|
||||
i18n("Phone Work"),
|
||||
i18n("Phone Work Ext"),
|
||||
i18n("Phone Cell"),
|
||||
i18n("Organization"),
|
||||
i18n("Address 1"),
|
||||
i18n("Address 2"),
|
||||
i18n("City"),
|
||||
i18n("Province"),
|
||||
i18n("Postal Code"),
|
||||
i18n("Cat Pref"),
|
||||
i18n("Div Pref"),
|
||||
i18n("Highest PSD"),
|
||||
i18n("Professional Quals"),
|
||||
i18n("Years School"),
|
||||
i18n("Years Regional"),
|
||||
i18n("Years National"),
|
||||
i18n("Willing Chair"),
|
||||
i18n("Attending Lunch"),
|
||||
i18n("Expertise Other"));
|
||||
|
||||
//fill these in if we ever make this PDFable
|
||||
$table['widths']=array();
|
||||
$table['dataalign']=array();
|
||||
|
||||
$q=mysql_query("SELECT judges.* FROM judges,judges_years WHERE judges_years.year='".$config['FAIRYEAR']."' AND judges.id=judges_years.judges_id ORDER BY lastname,firstname");
|
||||
while($r=mysql_fetch_object($q))
|
||||
{
|
||||
$table['data'][]=array(
|
||||
$r->lastname,
|
||||
$r->firstname,
|
||||
$r->email,
|
||||
$r->phonehome,
|
||||
$r->phonework,
|
||||
$r->phoneworkext,
|
||||
$r->phonecell,
|
||||
$r->organization,
|
||||
$r->address1,
|
||||
$r->address2,
|
||||
$r->city,
|
||||
$r->province,
|
||||
$r->postalcode,
|
||||
$r->catpref,
|
||||
$r->divpref,
|
||||
$r->highest_psd,
|
||||
$r->professional_quals,
|
||||
$r->years_school,
|
||||
$r->years_regional,
|
||||
$r->years_national,
|
||||
$r->willing_chair,
|
||||
$r->attending_lunch,
|
||||
$r->expertise_other
|
||||
);
|
||||
}
|
||||
|
||||
$rep->addTable($table);
|
||||
$rep->output();
|
||||
|
||||
?>
|
2
lcsv.php
2
lcsv.php
@ -94,7 +94,7 @@ class lcsv
|
||||
if($this->csvdata)
|
||||
{
|
||||
//header("Content-type: application/csv");
|
||||
header("Content-type: application/csv");
|
||||
header("Content-type: text/x-csv");
|
||||
header("Content-disposition: inline; filename=sfiab_".$this->page_subtitle.".csv");
|
||||
header("Content-length: ".strlen($this->csvdata));
|
||||
echo $this->csvdata;
|
||||
|
Loading…
Reference in New Issue
Block a user