science-ation/admin/reports_projects_details.php

168 lines
4.9 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");
require_once("../user.inc.php");
user_auth_required('admin');
require("../lpdf.php");
require("../lcsv.php");
require("judges.inc.php");
$type=$_GET['type'];
if($type=="pdf") {
$rep=new lpdf( i18n($config['fairname']),
i18n("Project Details"),
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/{$conference['id']}-logo-200.gif"
);
$rep->newPage();
$rep->setFontSize(11);
}
else if($type=="csv")
{
$rep=new lcsv(i18n("Project Details"));
}
// $regstatus=" AND ( registrations.status='complete' OR registrations.status='paymentpending' ) ";
$regstatus="";
$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,
projects.summary,
projects.req_electricity,
projects.req_table,
projects.req_special,
projects.language,
projectdivisions.division,
projectcategories.category
FROM
registrations
LEFT JOIN projects on projects.registrations_id=registrations.id
LEFT JOIN projectdivisions ON projectdivisions.id=projects.projectdivisions_id
LEFT JOIN projectcategories ON projectcategories.id=projects.projectcategories_id
WHERE
projects.conferences_id='".$conference['id']."'
AND projectdivisions.conferences_id='".$conference['id']."'
AND projectcategories.conferences_id='".$conference['id']."'
$regstatus
ORDER BY
projects.projectnumber
");
echo mysql_error();
$totalprojects=mysql_num_rows($projq);
$projectcount=0;
while($proj=mysql_fetch_object($projq))
{
$projectcount++;
$sq=mysql_query("SELECT users.firstname,
users.lastname
FROM
users
WHERE
users.registrations_id='$proj->reg_id'
");
$students="";
$studnum=0;
while($studentinfo=mysql_fetch_object($sq))
{
if($studnum>0) $students.=", ";
$students.="$studentinfo->firstname $studentinfo->lastname";
$studnum++;
}
$rep->heading(i18n("Project Information"));
$table=array();
// $table['header']=array(i18n("Timeslot"),i18n("Judging Team"));
$table['widths']=array( 1.25, 4.75);
$table['dataalign']=array("left","left");
$table['data'][]=array(i18n("Project Number"),$proj->projectnumber);
$table['data'][]=array(i18n("Project Title"),$proj->title);
$table['data'][]=array(i18n("Age Category"),$proj->category);
$table['data'][]=array(i18n("Division"),$proj->division);
$table['data'][]=array(i18n("Students"),$students);
$table['data'][]=array(i18n("Table?"),$proj->req_table);
$table['data'][]=array(i18n("Electricity?"),$proj->req_electricity);
$table['data'][]=array(i18n("Special Requests"),$proj->req_special);
$table['data'][]=array(i18n("Language"),$proj->language);
$rep->addTable($table);
unset($table);
$q=mysql_query("SELECT * FROM mentors WHERE registrations_id='".$proj->reg_id."'");
$rep->heading(i18n("Mentor Information"));
if(mysql_num_rows($q)) {
while($r=mysql_fetch_object($q))
{
$rep->addText(i18n("%1 %2 from %3",array($r->firstname,$r->lastname,$r->organization)));
$rep->addText(i18n("Phone: %1 Email: %2",array($r->phone,$r->email)));
}
}
else {
$rep->addText(i18n("No mentors"));
}
$rep->nextline();
$rep->heading(i18n("Project Summary"));
$rep->addText($proj->summary);
$q=mysql_query("SELECT safetyquestions.question,
safety.answer
FROM safetyquestions
JOIN safety ON safetyquestions.id=safety.safetyquestions_id
WHERE safety.registrations_id='".$proj->reg_id."'
ORDER BY safetyquestions.ord");
$rep->nextline();
$rep->heading(i18n("Safety Questions"));
$table=array();
// $table['header']=array(i18n("Timeslot"),i18n("Judging Team"));
$table['widths']=array( 6.25, 0.5);
$table['dataalign']=array("left","left");
while($r=mysql_fetch_object($q)) {
$table['data'][]=array(i18n($r->question),$r->answer);
}
$rep->addTable($table);
unset($table);
if($projectcount!=$totalprojects)
$rep->newPage();
}
$rep->output();
?>