Formatting cleanups and style cleanups

Also moved the school to be beside the first students name instead of beside the project title -- i was seeing a LOT of projects with long titles overlapping with the school name.
This commit is contained in:
james 2010-03-23 17:30:19 +00:00
parent ea58b4b6a8
commit a28b0e8444
2 changed files with 50 additions and 58 deletions

View File

@ -38,20 +38,17 @@
$scriptformat=$_GET['scriptformat'];
if(!$scriptformat) $scriptformat="default";
if($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();
if($scriptformat=="default") $rep->setFontSize(11);
if($scriptformat=="default") $rep->setFontSize(12);
if($scriptformat=="formatted") $rep->setFontSize(14);
}
else if($type=="csv")
{
else if($type=="csv") {
$rep=new lcsv(i18n("Awards Ceremony Script"));
}
$q=mysql_query("SELECT
@ -78,11 +75,11 @@ if(!$scriptformat) $scriptformat="default";
echo mysql_error();
if(mysql_num_rows($q))
{
while($r=mysql_fetch_object($q))
{
if($scriptformat=="formatted") $rep->newPage();
if(mysql_num_rows($q)) {
while($r=mysql_fetch_object($q)) {
if($scriptformat=="formatted")
$rep->newPage();
$pq=mysql_query("SELECT
award_prizes.prize,
award_prizes.number,
@ -104,29 +101,26 @@ if(!$scriptformat) $scriptformat="default";
AND award_prizes.excludefromac='0'
AND ($and_categories)
ORDER BY
`order`,projects.projectnumber");
`order`,
projects.projectnumber");
echo mysql_error();
if($show_unawarded_awards=="no")
{
if($show_unawarded_awards=="no") {
$skipAward=true;
while($pr=mysql_fetch_object($pq))
{
if($pr->projectnumber)
{
while($pr=mysql_fetch_object($pq)) {
if($pr->projectnumber) {
$skipAward=false;
break;
}
}
if($skipAward)
{
if($skipAward) {
continue;
}
mysql_data_seek($pq, 0);
}
if($scriptformat=="default") $rep->heading("$r->name ($r->type)");
if($scriptformat=="formatted")
{
if($scriptformat=="default")
$rep->heading("$r->name ($r->type)");
if($scriptformat=="formatted") {
$rep->setFontBold();
$rep->addText("$r->name ($r->type)");
$rep->setFontNormal();
@ -143,16 +137,12 @@ if(!$scriptformat) $scriptformat="default";
if($scriptformat=="formatted") $rep->nextline();
$prevprizeid=-1;
while($pr=mysql_fetch_object($pq))
{
if($pr->projectnumber || $show_unawarded_prizes=="yes")
{
if($prevprizeid!=$pr->id)
{
while($pr=mysql_fetch_object($pq)) {
if($pr->projectnumber || $show_unawarded_prizes=="yes") {
if($prevprizeid!=$pr->id) {
$prizetext=$pr->prize;
if($pr->cash || $pr->scholarship)
{
if($pr->cash || $pr->scholarship) {
$prizetext.=" (";
if($pr->cash && $pr->scholarship)
$prizetext.="\$$pr->cash cash / \$$pr->scholarship scholarship";
@ -163,9 +153,9 @@ if(!$scriptformat) $scriptformat="default";
$prizetext.= ")";
}
if($scriptformat=="default") $rep->addText($prizetext);
if($scriptformat=="formatted")
{
if($scriptformat=="default")
$rep->addText($prizetext);
if($scriptformat=="formatted") {
$rep->setFontBold();
$rep->addText($prizetext);
$rep->setFontNormal();
@ -175,9 +165,9 @@ if(!$scriptformat) $scriptformat="default";
$prevprizeid=$pr->id;
}
if($pr->projectnumber)
{
if($scriptformat=="default") $rep->addText( " ($pr->projectnumber) $pr->title");
if($pr->projectnumber) {
if($scriptformat=="default")
$rep->addText( " ($pr->projectnumber) $pr->title");
$sq=mysql_query("SELECT students.firstname,
students.lastname,
@ -195,8 +185,7 @@ if(!$scriptformat) $scriptformat="default";
$students=" Students: ";
$studnum=0;
$pronounce = "";
while($studentinfo=mysql_fetch_object($sq))
{
while($studentinfo=mysql_fetch_object($sq)) {
if($studnum>0) $students.=", ";
$students.="$studentinfo->firstname $studentinfo->lastname";
@ -212,35 +201,35 @@ if(!$scriptformat) $scriptformat="default";
$school=$studentinfo->school;
}
if($scriptformat=="default")
{
if($scriptformat=="default") {
$rep->addText($students);
if(trim($pronounce) != '' && $show_pronunciation == TRUE)
$rep->addText("Pronunciation: $pronounce");
$rep->addText(" School: $school");
}
if($scriptformat=="formatted")
{
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("$school",5.5);
if($show_pronunciation == TRUE && $student_win_pronunc[0])
$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($show_pronunciation == TRUE && $student_win_pronunc[1])
$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
{
else {
$rep->addText(" Prize not awarded");
}
}

View File

@ -56,6 +56,8 @@
<option value=\"csv\">CSV</option>
</select></td>";
echo "</td></tr>\n";
echo "<tr>";
//list award subsets to output
echo "<td><b>".i18n("Award Type").":</b></td> <td> <select name=\"awardtype\" size=1>";
$results = mysql_query("SELECT type FROM award_types WHERE year=".$config['FAIRYEAR']." ORDER BY type");
@ -64,6 +66,8 @@
echo "<option value=\"$r->type\">".i18n("$r->type")."</option>";
}
echo "</select></td>";
echo "</td></tr>\n";
echo "<tr>";
//list award formats to output
echo "<td>
@ -75,16 +79,16 @@
<option value=\"formatted\">Formatted</option>
</select></td></tr>";
echo "<tr><td colspan=3><b>".i18n("Show awards without winners").":</b></td>";
echo "<tr><td ><b>".i18n("Show awards without winners").":</b></td>";
echo "<td><input name=\"show_unawarded_awards\" type=\"checkbox\" ".($config['reports_show_unawarded_awards'] == 'yes' ? "checked" : "")."/></td></tr>";
echo "<tr><td colspan=3><b>".i18n("Show prizes without winners").":</b></td>";
echo "<tr><td ><b>".i18n("Show prizes without winners").":</b></td>";
echo "<td><input name=\"show_unawarded_prizes\" type=\"checkbox\" ".($config['reports_show_unawarded_prizes'] == 'yes' ? "checked" : "")."/></td></tr>";
echo "<tr><td colspan=3><b>".i18n("Show criteria for each award").":</b></td>";
echo "<tr><td ><b>".i18n("Show criteria for each award").":</b></td>";
echo "<td><input name=\"show_criteria\" type=\"checkbox\" ".($config['reports_show_criteria'] == 'yes' ? "checked" : "")." value=\"on\"/></td></tr>";
echo "<tr><td colspan=3><b>".i18n("Show student name pronunciation").":</b></td>";
echo "<tr><td ><b>".i18n("Show student name pronunciation").":</b></td>";
echo "<td><input name=\"show_pronunciation\" type=\"checkbox\" /></td></tr>";
echo "<tr><td colspan=\"3\"><b>".i18n("Include the following age categories").":</b></td>";
echo "<tr><td><b>".i18n("Include the following age categories").":</b></td>";
echo "<td>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
while($r=mysql_fetch_object($q)) {
@ -92,7 +96,6 @@
echo "".i18n($r->category)."<br />";
}
echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Generate Script")."\" />";
echo "</form>";