2005-05-04 21:23:00 +00:00
|
|
|
<?
|
|
|
|
require("../common.inc.php");
|
2007-11-21 17:02:09 +00:00
|
|
|
require_once("../user.inc.php");
|
2007-11-18 23:50:23 +00:00
|
|
|
user_auth_required('committee', 'admin');
|
2005-05-04 21:23:00 +00:00
|
|
|
require("../lpdf.php");
|
|
|
|
require("../lcsv.php");
|
|
|
|
|
2007-11-15 20:25:05 +00:00
|
|
|
if($_GET['year']) $foryear=$_GET['year'];
|
|
|
|
else $foryear=$config['FAIRYEAR'];
|
|
|
|
|
2007-12-17 23:20:21 +00:00
|
|
|
if($_GET['awardtype']=="All") $awardtype="";
|
|
|
|
else if($_GET['awardtype']) $awardtype=" AND award_types.type='".mysql_escape_string($_GET['awardtype'])."'";
|
2007-11-15 20:25:05 +00:00
|
|
|
else $awardtype="";
|
|
|
|
|
2007-12-17 23:20:21 +00:00
|
|
|
if($_GET['show_unawarded_awards']=="on") $show_unawarded_awards="yes";
|
|
|
|
else $show_unawarded_awards="no";
|
|
|
|
|
|
|
|
if($_GET['show_unawarded_prizes']=="on") $show_unawarded_prizes="yes";
|
|
|
|
else $show_unawarded_prizes="no";
|
|
|
|
|
2008-02-29 07:10:08 +00:00
|
|
|
$show_pronunciation= ($_GET['show_pronunciation'] == 'on') ? TRUE : FALSE;
|
2009-03-30 20:09:48 +00:00
|
|
|
$use_total_order = ($_GET['use_total_order'] == 'on') ? TRUE : FALSE;
|
2008-02-29 07:10:08 +00:00
|
|
|
|
|
|
|
if(is_array($_GET['show_category'])) {
|
|
|
|
$show_category = array();
|
|
|
|
foreach($_GET['show_category'] as $id=>$val) {
|
|
|
|
$show_category[] = "projects.projectcategories_id='$id'";
|
|
|
|
}
|
|
|
|
$and_categories = join(' OR ', $show_category);
|
|
|
|
} else {
|
|
|
|
$and_categories = '1';
|
|
|
|
}
|
|
|
|
|
2005-05-04 21:23:00 +00:00
|
|
|
$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
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
|
|
|
|
if($show_unawarded_awards!="no") {
|
|
|
|
$and_categories .= " OR projects.projectcategories_id IS NULL";
|
|
|
|
}
|
|
|
|
|
|
|
|
$order = ($use_total_order == TRUE) ? 'GLOBAL_ORDER' : ' awards_order,award_prizes.order';
|
|
|
|
|
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,
|
2007-11-23 21:21:37 +00:00
|
|
|
award_awards.description,
|
2005-05-04 21:23:00 +00:00
|
|
|
award_awards.order AS awards_order,
|
2007-11-15 20:25:05 +00:00
|
|
|
award_types.type,
|
2009-03-30 20:09:48 +00:00
|
|
|
sponsors.organization,
|
|
|
|
award_prizes.prize,
|
|
|
|
award_prizes.number,
|
|
|
|
award_prizes.id AS PRIZE_ID,
|
|
|
|
award_prizes.cash,
|
|
|
|
award_prizes.scholarship,
|
|
|
|
winners.projects_id,
|
|
|
|
projects.projectnumber,
|
|
|
|
projects.title,
|
|
|
|
projects.projectcategories_id,
|
|
|
|
projects.registrations_id AS reg_id,
|
|
|
|
award_awards.order + award_prizes.order AS GLOBAL_ORDER
|
2005-05-04 21:23:00 +00:00
|
|
|
FROM
|
2009-03-30 20:09:48 +00:00
|
|
|
award_awards
|
|
|
|
LEFT JOIN award_types ON award_awards.award_types_id=award_types.id
|
|
|
|
LEFT JOIN sponsors ON award_awards.sponsors_id=sponsors.id
|
|
|
|
LEFT JOIN award_prizes ON award_prizes.award_awards_id=award_awards.id
|
|
|
|
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
|
|
|
|
LEFT JOIN projects ON projects.id=winners.projects_id
|
2005-05-04 21:23:00 +00:00
|
|
|
WHERE
|
2007-11-15 20:25:05 +00:00
|
|
|
award_awards.year='$foryear'
|
|
|
|
AND award_types.year='$foryear'
|
2006-02-01 05:06:48 +00:00
|
|
|
AND award_awards.excludefromac='0'
|
2007-11-15 20:25:05 +00:00
|
|
|
$awardtype
|
2009-03-30 20:09:48 +00:00
|
|
|
AND award_prizes.year='$foryear'
|
|
|
|
AND award_prizes.excludefromac='0'
|
|
|
|
AND ($and_categories)
|
|
|
|
ORDER BY $order");
|
2005-05-04 21:23:00 +00:00
|
|
|
|
|
|
|
echo mysql_error();
|
|
|
|
|
2009-03-30 20:09:48 +00:00
|
|
|
if(!mysql_num_rows($q)) {
|
|
|
|
$rep->output();
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
|
|
|
$last_award_id = -1;
|
|
|
|
$prevprizeid=-1;
|
|
|
|
while($r=mysql_fetch_object($q))
|
2005-05-04 21:23:00 +00:00
|
|
|
{
|
2009-03-30 20:09:48 +00:00
|
|
|
|
|
|
|
if($last_award_id != $r->id) {
|
2007-12-17 17:35:19 +00:00
|
|
|
$rep->heading("$r->name ($r->type)");
|
|
|
|
if($r->type!="Divisional")
|
|
|
|
$rep->addText(i18n("Sponsored by: %1",array($r->organization)));
|
|
|
|
if($r->presenter)
|
|
|
|
$rep->addText(i18n("Presented by: %1",array($r->presenter)));
|
|
|
|
if($r->description)
|
|
|
|
$rep->addText(i18n("Description: %1",array($r->description)));
|
2009-03-30 20:09:48 +00:00
|
|
|
$last_award_id = $r->id;
|
2007-12-17 17:35:19 +00:00
|
|
|
$prevprizeid=-1;
|
2009-03-30 20:09:48 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if($r->projectnumber || $show_unawarded_prizes=="yes")
|
|
|
|
{
|
|
|
|
if($prevprizeid!=$r->PRIZE_ID)
|
|
|
|
{
|
|
|
|
$prizetext=$r->prize;
|
|
|
|
|
|
|
|
if($r->cash || $r->scholarship)
|
|
|
|
{
|
|
|
|
$prizetext.=" (";
|
|
|
|
if($r->cash && $r->scholarship)
|
|
|
|
$prizetext.="\$$r->cash cash / \$$r->scholarship scholarship";
|
|
|
|
else if($r->cash)
|
|
|
|
$prizetext.= "\$$r->cash cash";
|
|
|
|
else if($r->scholarship)
|
|
|
|
$prizetext.= "\$$r->scholarship scholarship";
|
|
|
|
$prizetext.= ")";
|
|
|
|
|
|
|
|
}
|
|
|
|
$rep->addText($prizetext);
|
|
|
|
$prevprizeid=$r->PRIZE_ID;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($r->projectnumber)
|
2007-12-17 17:35:19 +00:00
|
|
|
{
|
2009-03-30 20:09:48 +00:00
|
|
|
$rep->addText( " ($r->projectnumber) $r->title\n");
|
|
|
|
|
|
|
|
$sq=mysql_query("SELECT students.firstname,
|
|
|
|
students.lastname,
|
|
|
|
students.pronunciation,
|
|
|
|
students.schools_id,
|
|
|
|
schools.school
|
|
|
|
FROM
|
|
|
|
students,
|
|
|
|
schools
|
|
|
|
WHERE
|
|
|
|
students.registrations_id='$r->reg_id'
|
|
|
|
AND students.schools_id=schools.id
|
|
|
|
");
|
|
|
|
|
|
|
|
// $students=" Students: ";
|
|
|
|
$studnum=0;
|
|
|
|
$pronounce = false;
|
|
|
|
|
|
|
|
$sdata = array();
|
|
|
|
|
|
|
|
while($studentinfo=mysql_fetch_object($sq))
|
2005-05-04 21:23:00 +00:00
|
|
|
{
|
2009-03-30 20:09:48 +00:00
|
|
|
$sdata[$studnum]['student'] = "$studentinfo->firstname $studentinfo->lastname";
|
|
|
|
$sdata[$studnum]['pronounce'] = "{$studentinfo->pronunciation}";
|
|
|
|
if(trim($studentinfo->pronunciation) != '') $pronounce = TRUE;
|
2005-05-04 21:23:00 +00:00
|
|
|
|
2009-03-30 20:09:48 +00:00
|
|
|
|
|
|
|
if($studnum != 0) {
|
|
|
|
$sdata[$studnum]['student'] = ' , '.$sdata[$studnum]['student'];
|
|
|
|
$sdata[$studnum]['pronounce'] = ' , '.$sdata[$studnum]['pronounce'];
|
2007-12-17 17:35:19 +00:00
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
|
|
|
|
$sdata[$studnum]['width'] = $rep->stringWidth($sdata[$studnum]['student'])/72;
|
|
|
|
$w = $rep->stringWidth($sdata[$studnum]['pronounce'])/72;
|
|
|
|
if($w > $sdata[$studnum]['width']) $sdata[$studnum]['width'] = $w;
|
|
|
|
|
|
|
|
$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;
|
|
|
|
}
|
|
|
|
$nextx = 1.5;
|
|
|
|
$rep->addText("School: $school", 'left', $nextx);
|
|
|
|
$rep->yloc -= 10/72;
|
|
|
|
|
|
|
|
foreach($sdata as $x=>$s) {
|
|
|
|
$rep->addTextX($s['student'], $nextx);
|
|
|
|
$nextx += $s['width'];
|
|
|
|
}
|
|
|
|
$rep->nextLine();
|
|
|
|
|
|
|
|
if($show_pronunciation == TRUE && $pronounce == TRUE) {
|
|
|
|
$nextx = 1.45;
|
|
|
|
$rep->addTextX('(', $nextx);
|
|
|
|
$nextx = 1.5;
|
|
|
|
foreach($sdata as $x=>$s) {
|
|
|
|
$rep->addTextX($s['pronounce'], $nextx);
|
|
|
|
$nextx += $s['width'];
|
2005-05-04 21:23:00 +00:00
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
$rep->addTextX(')', $nextx);
|
|
|
|
$rep->nextLine();
|
2005-05-04 21:23:00 +00:00
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$rep->addText(" Prize not awarded");
|
2005-05-04 21:23:00 +00:00
|
|
|
}
|
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
$rep->nextLine();
|
2005-05-04 21:23:00 +00:00
|
|
|
}
|
2009-03-30 20:09:48 +00:00
|
|
|
|
2005-05-04 21:23:00 +00:00
|
|
|
$rep->output();
|
|
|
|
?>
|