2005-05-12 21:05:21 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
This file is part of the 'Science Fair In A Box' project
|
|
|
|
SFIAB Website: http://www.sfiab.ca
|
|
|
|
|
|
|
|
Copyright (C) 2005 Sci-Tech Ontario Inc <info@scitechontario.org>
|
|
|
|
Copyright (C) 2005 James Grant <james@lightbox.org>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or
|
|
|
|
modify it under the terms of the GNU General Public
|
|
|
|
License as published by the Free Software Foundation, version 2.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; see the file COPYING. If not, write to
|
|
|
|
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
|
|
Boston, MA 02111-1307, USA.
|
|
|
|
*/
|
|
|
|
?>
|
|
|
|
<?
|
|
|
|
require("common.inc.php");
|
|
|
|
require("projects.inc.php");
|
|
|
|
|
|
|
|
send_header("Winners");
|
|
|
|
|
|
|
|
if($_GET['edit']) $edit=$_GET['edit'];
|
|
|
|
if($_POST['edit']) $edit=$_POST['edit'];
|
|
|
|
|
|
|
|
if($_GET['action']) $action=$_GET['action'];
|
|
|
|
if($_POST['action']) $action=$_POST['action'];
|
|
|
|
|
|
|
|
if($_GET['year'] && $_GET['type'])
|
|
|
|
{
|
|
|
|
echo "<h2>".i18n("%1 %2 Award Winners",array($_GET['year'],$_GET['type']))."</h2>";
|
2007-06-01 19:52:58 +00:00
|
|
|
$year=$_GET['year'];
|
2005-05-12 21:05:21 +00:00
|
|
|
|
2007-10-05 19:20:09 +00:00
|
|
|
$ok=true;
|
2005-05-12 21:05:21 +00:00
|
|
|
//first, lets make sure someone isnt tryint to see something that they arent allowed to!
|
2007-10-05 19:20:09 +00:00
|
|
|
//but only if the year they want is the FAIRYEAR. If they want a past year, thats cool
|
|
|
|
if($_GET['year']>=$config['FAIRYEAR']) {
|
|
|
|
$q=mysql_query("SELECT (NOW()>'".$config['dates']['postwinners']."') AS test");
|
|
|
|
$r=mysql_fetch_object($q);
|
|
|
|
if($r->test!=1)
|
|
|
|
{
|
|
|
|
echo error(i18n("Crystal ball says future is very hard to see!"));
|
|
|
|
$ok=false;
|
|
|
|
}
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
2007-10-05 19:20:09 +00:00
|
|
|
|
|
|
|
if($ok)
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
|
|
|
|
|
|
|
$q=mysql_query("SELECT
|
|
|
|
award_awards.id,
|
|
|
|
award_awards.name,
|
|
|
|
award_awards.order AS awards_order,
|
|
|
|
award_types.type
|
|
|
|
FROM
|
|
|
|
award_awards,
|
|
|
|
award_types
|
|
|
|
WHERE
|
2007-06-01 19:52:58 +00:00
|
|
|
award_awards.year='$year'
|
2005-05-12 21:05:21 +00:00
|
|
|
AND award_awards.award_types_id=award_types.id
|
|
|
|
AND award_types.type='".$_GET['type']."'
|
2007-06-01 19:52:58 +00:00
|
|
|
AND award_types.year='$year'
|
2005-05-12 21:05:21 +00:00
|
|
|
ORDER BY
|
|
|
|
awards_order");
|
|
|
|
|
|
|
|
echo mysql_error();
|
|
|
|
|
|
|
|
if(mysql_num_rows($q))
|
|
|
|
{
|
|
|
|
echo "<a href=\"winners.php\">".i18n("Back to Winners main page")."</a>";
|
|
|
|
echo "<br />";
|
|
|
|
while($r=mysql_fetch_object($q))
|
|
|
|
{
|
|
|
|
echo "<h3>$r->name</h3> \n";
|
|
|
|
|
|
|
|
$pq=mysql_query("SELECT
|
|
|
|
award_prizes.prize,
|
|
|
|
award_prizes.number,
|
|
|
|
award_prizes.id,
|
|
|
|
award_prizes.cash,
|
|
|
|
award_prizes.scholarship,
|
|
|
|
winners.projects_id,
|
|
|
|
projects.projectnumber,
|
2005-05-12 21:23:50 +00:00
|
|
|
projects.title,
|
|
|
|
projects.registrations_id AS reg_id
|
2005-05-12 21:05:21 +00:00
|
|
|
FROM
|
|
|
|
award_prizes
|
|
|
|
LEFT JOIN winners ON winners.awards_prizes_id=award_prizes.id
|
|
|
|
LEFT JOIN projects ON projects.id=winners.projects_id
|
|
|
|
WHERE
|
|
|
|
award_awards_id='$r->id'
|
2007-06-01 19:52:58 +00:00
|
|
|
AND award_prizes.year='$year'
|
2005-05-12 21:05:21 +00:00
|
|
|
ORDER BY
|
|
|
|
`order`");
|
|
|
|
echo mysql_error();
|
|
|
|
$prevprizeid=-1;
|
|
|
|
while($pr=mysql_fetch_object($pq))
|
|
|
|
{
|
|
|
|
if($prevprizeid!=$pr->id)
|
|
|
|
{
|
|
|
|
echo " ";
|
|
|
|
echo " ";
|
|
|
|
echo "<b>";
|
|
|
|
echo "$pr->prize";
|
|
|
|
if($pr->cash || $pr->scholarship)
|
|
|
|
{
|
|
|
|
echo " (";
|
|
|
|
if($pr->cash && $pr->scholarship)
|
|
|
|
echo "\$$pr->cash cash / \$$pr->scholarship scholarship";
|
|
|
|
else if($pr->cash)
|
|
|
|
echo "\$$pr->cash cash";
|
|
|
|
else if($pr->scholarship)
|
|
|
|
echo "\$$pr->scholarship scholarship";
|
|
|
|
echo ")";
|
|
|
|
|
|
|
|
}
|
|
|
|
echo "</b>";
|
|
|
|
echo "<br />";
|
|
|
|
$prevprizeid=$pr->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($pr->projectnumber)
|
|
|
|
{
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "  ";
|
2005-05-12 21:05:21 +00:00
|
|
|
echo "($pr->projectnumber) $pr->title";
|
2005-05-12 21:23:50 +00:00
|
|
|
|
|
|
|
$sq=mysql_query("SELECT students.firstname,
|
|
|
|
students.lastname,
|
|
|
|
students.schools_id,
|
2007-03-31 01:10:08 +00:00
|
|
|
students.webfirst,
|
|
|
|
students.weblast,
|
|
|
|
students.webphoto,
|
2005-05-12 21:23:50 +00:00
|
|
|
schools.school
|
|
|
|
FROM
|
|
|
|
students,
|
|
|
|
schools
|
|
|
|
WHERE
|
|
|
|
students.registrations_id='$pr->reg_id'
|
|
|
|
AND students.schools_id=schools.id
|
|
|
|
");
|
|
|
|
|
|
|
|
$studnum=0;
|
2005-05-12 21:25:12 +00:00
|
|
|
$students="";
|
2005-05-12 21:23:50 +00:00
|
|
|
while($studentinfo=mysql_fetch_object($sq))
|
|
|
|
{
|
2007-03-31 01:10:08 +00:00
|
|
|
if($studnum>0 && $prev) $students.=", ";
|
|
|
|
|
|
|
|
if($studentinfo->webfirst=="yes")
|
|
|
|
$students.="$studentinfo->firstname ";
|
|
|
|
if($studentinfo->weblast=="yes")
|
|
|
|
$students.="$studentinfo->lastname ";
|
|
|
|
if($r->studentinfo->webfirst=="yes" || $studentinfo->weblast=="yes")
|
|
|
|
$prev=true;
|
|
|
|
else
|
|
|
|
$prev=false;
|
|
|
|
|
2007-04-03 20:10:00 +00:00
|
|
|
// $students.="$studentinfo->firstname $studentinfo->lastname";
|
2005-05-12 21:23:50 +00:00
|
|
|
$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;
|
|
|
|
}
|
|
|
|
echo "<br />";
|
|
|
|
echo "  ";
|
|
|
|
echo "  ";
|
|
|
|
echo "Students: $students";
|
|
|
|
echo "<br />";
|
|
|
|
echo "  ";
|
|
|
|
echo "  ";
|
|
|
|
echo "School: $school";
|
2005-05-12 21:05:21 +00:00
|
|
|
echo "<br />";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "  ";
|
|
|
|
echo "Prize not awarded";
|
|
|
|
echo "<br />";
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "<br />";
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$q=mysql_query("SELECT
|
|
|
|
DISTINCT(winners.year) AS year,
|
|
|
|
dates.date
|
|
|
|
FROM
|
|
|
|
winners,
|
|
|
|
dates
|
|
|
|
WHERE
|
|
|
|
winners.year=dates.year
|
|
|
|
AND dates.name='postwinners'
|
|
|
|
AND dates.date<=NOW()
|
|
|
|
ORDER BY
|
|
|
|
year DESC");
|
|
|
|
$first=true;
|
|
|
|
if(mysql_num_rows($q))
|
|
|
|
{
|
|
|
|
while($r=mysql_fetch_object($q))
|
|
|
|
{
|
|
|
|
if($first && $r->year != $config['FAIRYEAR'])
|
|
|
|
{
|
|
|
|
list($d,$t)=split(" ",$config['dates']['postwinners']);
|
|
|
|
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
|
|
|
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],$d,$t));
|
|
|
|
$first=false;
|
|
|
|
}
|
|
|
|
//get the "winnersposted" date for the year, and make
|
|
|
|
echo "<h2>".i18n("%1 Winners",array($r->year))."</h2>";
|
|
|
|
|
|
|
|
//do this each time, because each year the names of the award types could change, along with what is actually given out.
|
|
|
|
//
|
|
|
|
$tq=mysql_query("SELECT
|
|
|
|
DISTINCT(award_types.type) AS type
|
|
|
|
FROM
|
|
|
|
winners,
|
|
|
|
award_types,
|
|
|
|
award_awards,
|
|
|
|
award_prizes
|
|
|
|
WHERE
|
|
|
|
award_awards.award_types_id=award_types.id
|
|
|
|
AND winners.awards_prizes_id=award_prizes.id
|
|
|
|
AND award_prizes.award_awards_id=award_awards.id
|
|
|
|
AND winners.year='$r->year'
|
|
|
|
ORDER BY
|
|
|
|
award_types.order
|
|
|
|
");
|
|
|
|
echo mysql_error();
|
|
|
|
while($tr=mysql_fetch_object($tq))
|
|
|
|
{
|
|
|
|
echo " <a href=\"winners.php?year=$r->year&type=$tr->type\">".i18n("%1 %2 award winners",array($r->year,$tr->type))."</a><br />";
|
|
|
|
}
|
2007-06-01 19:52:58 +00:00
|
|
|
echo "<br />";
|
|
|
|
$first=false;
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
list($d,$t)=split(" ",$config['dates']['postwinners']);
|
|
|
|
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
|
|
|
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],$d,$t));
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
send_footer();
|
|
|
|
|
|
|
|
?>
|