Add support to omit unawarded awards and prizes from the awards ceremony script. Resolves RFE 136.

-Note: currently adds two configuration variables and a new category, they didn't seem to fit elsewhere.
This commit is contained in:
justin 2007-12-17 17:35:19 +00:00
parent 4043df2e66
commit 30072d182d
3 changed files with 79 additions and 57 deletions

View File

@ -56,14 +56,6 @@
{
while($r=mysql_fetch_object($q))
{
$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)));
$pq=mysql_query("SELECT
award_prizes.prize,
award_prizes.number,
@ -85,64 +77,93 @@
ORDER BY
`order`");
echo mysql_error();
if($config['reports_show_unawarded_awards']==no)
{
$skipAward=true;
while($pr=mysql_fetch_object($pq))
{
if($pr->projectnumber)
{
$skipAward=false;
break;
}
}
if($skipAward)
{
continue;
}
mysql_data_seek($pq, 0);
}
$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)));
$prevprizeid=-1;
while($pr=mysql_fetch_object($pq))
{
if($prevprizeid!=$pr->id)
if($pr->projectnumber || $config['reports_show_unawarded_prizes']==yes)
{
$prizetext=$pr->prize;
if($pr->cash || $pr->scholarship)
if($prevprizeid!=$pr->id)
{
$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.= ")";
$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;
}
$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($pr->projectnumber)
{
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( " ($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->addText($students);
$rep->addText(" School: $school");
}
else
{
$rep->addText(" Prize not awarded");
}
}
$rep->nextLine();

View File

@ -1 +1 @@
81
82

1
db/db.update.82.sql Normal file
View File

@ -0,0 +1 @@
INSERT INTO `config` ( `var` , `val` , `category` , `type` , `ord` , `description` , `year`) VALUES ( 'reports_show_unawarded_awards', 'yes', 'Reports', 'yesno', 100, 'Display awards that were not awarded in the Award Ceremony script.', -1), ('reports_show_unawarded_prizes', 'yes', 'Reports', 'yesno', 200, 'Display prizes that were not awarded in the Award Ceremony script.', -1);