added nicely formatted output option for awards script

This commit is contained in:
idziak 2010-03-22 02:22:04 +00:00
parent b5c795b317
commit 10f41e00f9

View File

@ -35,6 +35,9 @@
$type=$_GET['type'];
if(!$type) $type="pdf";
$scriptformat=$_GET['scriptformat'];
if(!$scriptformat) $scriptformat="default";
if($type=="pdf")
{
@ -44,7 +47,8 @@
);
$rep->newPage();
$rep->setFontSize(11);
if($scriptformat=="default") $rep->setFontSize(11);
if($scriptformat=="formatted") $rep->setFontSize(14);
}
else if($type=="csv")
{
@ -78,6 +82,7 @@
{
while($r=mysql_fetch_object($q))
{
if($scriptformat=="formatted") $rep->newPage();
$pq=mysql_query("SELECT
award_prizes.prize,
award_prizes.number,
@ -99,7 +104,7 @@
AND award_prizes.excludefromac='0'
AND ($and_categories)
ORDER BY
`order`");
`order`,projects.projectnumber");
echo mysql_error();
if($show_unawarded_awards=="no")
@ -119,7 +124,13 @@
}
mysql_data_seek($pq, 0);
}
$rep->heading("$r->name ($r->type)");
if($scriptformat=="default") $rep->heading("$r->name ($r->type)");
if($scriptformat=="formatted")
{
$rep->setFontBold();
$rep->addText("$r->name ($r->type)");
$rep->setFontNormal();
}
if($r->type!="Divisional")
$rep->addText(i18n("Sponsored by: %1",array($r->organization)));
if($r->presenter)
@ -129,6 +140,8 @@
if($show_criteria)
$rep->addText(i18n("Criteria: %1",array($r->criteria)));
if($scriptformat=="formatted") $rep->nextline();
$prevprizeid=-1;
while($pr=mysql_fetch_object($pq))
{
@ -150,14 +163,21 @@
$prizetext.= ")";
}
$rep->addText($prizetext);
if($scriptformat=="default") $rep->addText($prizetext);
if($scriptformat=="formatted")
{
$rep->setFontBold();
$rep->addText($prizetext);
$rep->setFontNormal();
$rep->nextline();
}
$prevprizeid=$pr->id;
}
if($pr->projectnumber)
{
$rep->addText( " ($pr->projectnumber) $pr->title");
if($scriptformat=="default") $rep->addText( " ($pr->projectnumber) $pr->title");
$sq=mysql_query("SELECT students.firstname,
students.lastname,
@ -183,6 +203,8 @@
if($studnum>0) $pronounce .= ", ";
$pronounce .= "\"{$studentinfo->pronunciation}\"";
$student_winner[$studnum] = "$studentinfo->firstname $studentinfo->lastname";
$student_win_pronunc[$studnum] = "$studentinfo->pronunciation";
$studnum++;
//we will assume that they are coming from the same school, so lets just grab the last students school
@ -190,10 +212,32 @@
$school=$studentinfo->school;
}
$rep->addText($students);
if(trim($pronounce) != '' && $show_pronunciation == TRUE)
$rep->addText("Pronunciation: $pronounce");
$rep->addText(" School: $school");
if($scriptformat=="default")
{
$rep->addText($students);
if(trim($pronounce) != '' && $show_pronunciation == TRUE)
$rep->addText("Pronunciation: $pronounce");
$rep->addText(" School: $school");
}
if($scriptformat=="formatted")
{
$rep->addTextX("$pr->projectnumber",0.5);
$rep->addTextX("$student_winner[0]",1.4);
if($show_pronunciation == TRUE) $rep->addTextX("($student_win_pronunc[0])",4.0);
if($type=="pdf") $rep->nextline();
if($studnum==2)
{
$rep->addTextX("$student_winner[1]",1.4);
if($show_pronunciation == TRUE) $rep->addTextX("($student_win_pronunc[1])",4.0);
if($type=="pdf") $rep->nextline();
}
if(($studnum==1) && ($type == "csv")) $rep->addTextX("");
if(($studnum==1) && ($type == "csv")) $rep->addTextX("");
$rep->addTextX("$pr->title",1.4);
$rep->addTextX("$school",5.5);
if($type=="pdf") $rep->nextline();
$rep->nextline();
}
}
else
{