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

View File

@ -56,6 +56,8 @@
<option value=\"csv\">CSV</option> <option value=\"csv\">CSV</option>
</select></td>"; </select></td>";
echo "</td></tr>\n";
echo "<tr>";
//list award subsets to output //list award subsets to output
echo "<td><b>".i18n("Award Type").":</b></td> <td> <select name=\"awardtype\" size=1>"; 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"); $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 "<option value=\"$r->type\">".i18n("$r->type")."</option>";
} }
echo "</select></td>"; echo "</select></td>";
echo "</td></tr>\n";
echo "<tr>";
//list award formats to output //list award formats to output
echo "<td> echo "<td>
@ -75,16 +79,16 @@
<option value=\"formatted\">Formatted</option> <option value=\"formatted\">Formatted</option>
</select></td></tr>"; </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 "<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 "<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 "<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 "<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>"; echo "<td>";
$q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id"); $q=mysql_query("SELECT * FROM projectcategories WHERE year='{$config['FAIRYEAR']}' ORDER BY id");
while($r=mysql_fetch_object($q)) { while($r=mysql_fetch_object($q)) {
@ -92,7 +96,6 @@
echo "".i18n($r->category)."<br />"; echo "".i18n($r->category)."<br />";
} }
echo "</table>"; echo "</table>";
echo "<input type=\"submit\" value=\"".i18n("Generate Script")."\" />"; echo "<input type=\"submit\" value=\"".i18n("Generate Script")."\" />";
echo "</form>"; echo "</form>";