2005-05-04 21:23:00 +00:00
|
|
|
<?
|
|
|
|
require("../common.inc.php");
|
|
|
|
auth_required('admin');
|
|
|
|
require("../lpdf.php");
|
|
|
|
require("../lcsv.php");
|
|
|
|
|
|
|
|
$type=$_GET['type'];
|
|
|
|
if(!$type) $type="pdf";
|
|
|
|
|
|
|
|
if($type=="pdf")
|
|
|
|
{
|
|
|
|
|
|
|
|
$rep=new lpdf( i18n($config['fairname']),
|
|
|
|
i18n("Awards Ceremony Script"),
|
|
|
|
$_SERVER['DOCUMENT_ROOT'].$config['SFIABDIRECTORY']."/data/logo-200.gif"
|
|
|
|
);
|
|
|
|
|
|
|
|
$rep->newPage();
|
|
|
|
$rep->setFontSize(11);
|
|
|
|
}
|
|
|
|
else if($type=="csv")
|
|
|
|
{
|
2006-10-15 21:33:32 +00:00
|
|
|
$rep=new lcsv(i18n("Awards Ceremony Script"));
|
2005-05-04 21:23:00 +00:00
|
|
|
}
|
|
|
|
$q=mysql_query("SELECT
|
|
|
|
award_awards.id,
|
|
|
|
award_awards.name,
|
2007-02-12 22:30:43 +00:00
|
|
|
award_awards.presenter,
|
2005-05-04 21:23:00 +00:00
|
|
|
award_awards.order AS awards_order,
|
|
|
|
award_types.type
|
|
|
|
FROM
|
|
|
|
award_awards,
|
|
|
|
award_types
|
|
|
|
WHERE
|
|
|
|
award_awards.year='".$config['FAIRYEAR']."'
|
2006-03-08 20:01:18 +00:00
|
|
|
AND award_types.year='".$config['FAIRYEAR']."'
|
2005-05-04 21:23:00 +00:00
|
|
|
AND award_awards.award_types_id=award_types.id
|
2006-02-01 05:06:48 +00:00
|
|
|
AND award_awards.excludefromac='0'
|
2005-05-04 21:23:00 +00:00
|
|
|
ORDER BY awards_order");
|
|
|
|
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
if(mysql_num_rows($q))
|
|
|
|
{
|
|
|
|
while($r=mysql_fetch_object($q))
|
|
|
|
{
|
|
|
|
$rep->heading("$r->name ($r->type)");
|
2007-02-12 22:30:43 +00:00
|
|
|
if($r->presenter)
|
|
|
|
$rep->addText(i18n("Presented by: %1",array($r->presenter)));
|
2005-05-04 21:23:00 +00:00
|
|
|
|
|
|
|
$pq=mysql_query("SELECT
|
|
|
|
award_prizes.prize,
|
|
|
|
award_prizes.number,
|
|
|
|
award_prizes.id,
|
|
|
|
award_prizes.cash,
|
|
|
|
award_prizes.scholarship,
|
|
|
|
winners.projects_id,
|
|
|
|
projects.projectnumber,
|
|
|
|
projects.title,
|
|
|
|
projects.registrations_id AS reg_id
|
|
|
|
FROM
|
|
|
|
award_prizes
|
|
|
|
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
|
|
|
|
LEFT JOIN projects ON projects.id=winners.projects_id
|
|
|
|
WHERE
|
|
|
|
award_awards_id='$r->id'
|
|
|
|
AND award_prizes.year='".$config['FAIRYEAR']."'
|
2006-02-01 05:06:48 +00:00
|
|
|
AND award_prizes.excludefromac='0'
|
2005-05-04 21:23:00 +00:00
|
|
|
ORDER BY
|
|
|
|
`order`");
|
|
|
|
echo mysql_error();
|
|
|
|
$prevprizeid=-1;
|
|
|
|
while($pr=mysql_fetch_object($pq))
|
|
|
|
{
|
|
|
|
if($prevprizeid!=$pr->id)
|
|
|
|
{
|
|
|
|
$prizetext=$pr->prize;
|
|
|
|
|
|
|
|
if($pr->cash || $pr->scholarship)
|
|
|
|
{
|
|
|
|
$prizetext.=" (";
|
|
|
|
if($pr->cash && $pr->scholarship)
|
|
|
|
$prizetext.="\$$pr->cash cash / \$$pr->scholarship scholarship";
|
|
|
|
else if($pr->cash)
|
|
|
|
$prizetext.= "\$$pr->cash cash";
|
|
|
|
else if($pr->scholarship)
|
|
|
|
$prizetext.= "\$$pr->scholarship scholarship";
|
|
|
|
$prizetext.= ")";
|
|
|
|
|
|
|
|
}
|
|
|
|
$rep->addText($prizetext);
|
|
|
|
|
|
|
|
$prevprizeid=$pr->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($pr->projectnumber)
|
|
|
|
{
|
|
|
|
$rep->addText( " ($pr->projectnumber) $pr->title");
|
|
|
|
|
|
|
|
$sq=mysql_query("SELECT students.firstname,
|
|
|
|
students.lastname,
|
|
|
|
students.schools_id,
|
|
|
|
schools.school
|
|
|
|
FROM
|
|
|
|
students,
|
|
|
|
schools
|
|
|
|
WHERE
|
|
|
|
students.registrations_id='$pr->reg_id'
|
|
|
|
AND students.schools_id=schools.id
|
|
|
|
");
|
|
|
|
|
|
|
|
$students=" Students: ";
|
|
|
|
$studnum=0;
|
|
|
|
while($studentinfo=mysql_fetch_object($sq))
|
|
|
|
{
|
|
|
|
if($studnum>0) $students.=", ";
|
|
|
|
$students.="$studentinfo->firstname $studentinfo->lastname";
|
|
|
|
$studnum++;
|
|
|
|
|
|
|
|
//we will assume that they are coming from the same school, so lets just grab the last students school
|
|
|
|
//and use it.
|
|
|
|
$school=$studentinfo->school;
|
|
|
|
}
|
|
|
|
$rep->addText($students);
|
|
|
|
$rep->addText(" School: $school");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$rep->addText(" Prize not awarded");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$rep->nextLine();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
$rep->output();
|
|
|
|
?>
|