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");
|
2024-12-17 06:34:35 +00:00
|
|
|
require_once('helper.inc.php');
|
2005-05-12 21:05:21 +00:00
|
|
|
|
|
|
|
send_header("Winners");
|
|
|
|
|
2024-12-13 15:38:18 +00:00
|
|
|
if(get_value_from_array($_GET, 'edit')) $edit=$_GET['edit'];
|
|
|
|
if(get_value_from_array($_POST, 'edit')) $edit=$_POST['edit'];
|
2005-05-12 21:05:21 +00:00
|
|
|
|
2024-12-13 15:38:18 +00:00
|
|
|
if(get_value_from_array($_GET, 'action')) $action=$_GET['action'];
|
|
|
|
if(get_value_from_array($_POST, 'action')) $action=$_POST['action'];
|
2005-05-12 21:05:21 +00:00
|
|
|
|
2024-12-13 15:38:18 +00:00
|
|
|
if(get_value_from_array($_GET, 'year') && get_value_from_array($_GET, 'type')) {
|
2010-04-14 14:10:47 +00:00
|
|
|
$show_unawarded_awards="no";
|
|
|
|
$show_unawarded_prizes="no";
|
2011-02-23 22:59:42 +00:00
|
|
|
$year=intval($_GET['year']);
|
2024-12-11 00:40:23 +00:00
|
|
|
$type=$_GET['type'];
|
2010-04-14 14:10:47 +00:00
|
|
|
|
2011-02-23 22:59:42 +00:00
|
|
|
echo "<h2>".i18n("%1 ".$type." Award Winners",array($_GET['year']))."</h2>";
|
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']) {
|
2024-12-11 00:40:23 +00:00
|
|
|
$q=$pdo->prepare("SELECT (NOW()>'".$config['dates']['postwinners']."') AS test");
|
|
|
|
$q->execute();
|
|
|
|
$r=$q->fetch(PDO::FETCH_OBJ);
|
2007-10-05 19:20:09 +00:00
|
|
|
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
|
|
|
{
|
|
|
|
|
2024-12-11 00:40:23 +00:00
|
|
|
$q=$pdo->prepare("SELECT
|
2005-05-12 21:05:21 +00:00
|
|
|
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
|
2011-02-23 22:59:42 +00:00
|
|
|
AND award_types.type='$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");
|
|
|
|
|
2024-12-17 06:34:35 +00:00
|
|
|
show_pdo_errors_if_any($pdo);
|
2005-05-12 21:05:21 +00:00
|
|
|
|
2024-12-11 00:40:23 +00:00
|
|
|
if($q->rowCount())
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
|
|
|
echo "<a href=\"winners.php\">".i18n("Back to Winners main page")."</a>";
|
|
|
|
echo "<br />";
|
2024-12-11 00:40:23 +00:00
|
|
|
while($r=$q->fetch(PDO::FETCH_OBJ))
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
2024-12-11 00:40:23 +00:00
|
|
|
$pq=$pdo->prepare("SELECT
|
2005-05-12 21:05:21 +00:00
|
|
|
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`");
|
2024-12-11 00:40:23 +00:00
|
|
|
$pq->execute();
|
|
|
|
echo $pdo->errorInfo();
|
2010-04-14 14:10:47 +00:00
|
|
|
$awarded_count = 0;
|
|
|
|
if($show_unawarded_awards=="no")
|
|
|
|
{
|
2024-12-11 00:40:23 +00:00
|
|
|
while($pr=$pq->fetch(PDO::FETCH_OBJ))
|
2010-04-14 14:10:47 +00:00
|
|
|
{
|
|
|
|
if($pr->projectnumber)
|
|
|
|
{
|
|
|
|
$awarded_count++;
|
|
|
|
}
|
|
|
|
}
|
2024-12-11 00:40:23 +00:00
|
|
|
// Still have to find the PDO equivalent
|
2024-12-12 21:24:45 +00:00
|
|
|
//mysql_data_seek($pq, 0);
|
|
|
|
$pq->fetch(PDO::FETCH_ORI_ABS(0));
|
2010-04-14 14:10:47 +00:00
|
|
|
}
|
|
|
|
if($show_unawarded_awards=="yes" || $awarded_count > 0)
|
|
|
|
{
|
|
|
|
echo "<h3>".i18n($r->name)."</h3> \n";
|
|
|
|
}
|
|
|
|
|
2005-05-12 21:05:21 +00:00
|
|
|
$prevprizeid=-1;
|
2024-12-11 00:40:23 +00:00
|
|
|
while($pr=$pq->fetch(PDO::FETCH_OBJ))
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
2010-04-14 14:10:47 +00:00
|
|
|
if(!($pr->projectnumber) && $show_unawarded_prizes=="no")
|
|
|
|
{
|
|
|
|
continue;
|
|
|
|
}
|
2005-05-12 21:05:21 +00:00
|
|
|
if($prevprizeid!=$pr->id)
|
|
|
|
{
|
|
|
|
echo " ";
|
|
|
|
echo " ";
|
|
|
|
echo "<b>";
|
2009-03-31 15:20:48 +00:00
|
|
|
echo i18n($pr->prize);
|
2007-12-22 05:11:42 +00:00
|
|
|
if(($pr->cash || $pr->scholarship) && $config['winners_show_prize_amounts'] == 'yes')
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
|
|
|
echo " (";
|
|
|
|
if($pr->cash && $pr->scholarship)
|
2009-03-31 15:20:48 +00:00
|
|
|
echo i18n("\$%1 cash / \$%2 scholarship",array($pr->cash,$pr->scholarship),array("Cash dollar value","Scholarship dollar value"));
|
2005-05-12 21:05:21 +00:00
|
|
|
else if($pr->cash)
|
2009-03-31 15:20:48 +00:00
|
|
|
echo i18n("\$%1 cash",array($pr->cash),array("Cash dollar value"));
|
2005-05-12 21:05:21 +00:00
|
|
|
else if($pr->scholarship)
|
2009-03-31 15:20:48 +00:00
|
|
|
echo i18n("\$%1 scholarship",array($pr->scholarship),array("Scholarship dollar value"));
|
2005-05-12 21:05:21 +00:00
|
|
|
echo ")";
|
|
|
|
|
|
|
|
}
|
|
|
|
echo "</b>";
|
|
|
|
echo "<br />";
|
|
|
|
$prevprizeid=$pr->id;
|
|
|
|
}
|
|
|
|
|
|
|
|
if($pr->projectnumber)
|
|
|
|
{
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "  ";
|
2013-03-10 21:28:31 +00:00
|
|
|
echo "($pr->projectnumber) ".htmlspecialchars($pr->title);
|
2005-05-12 21:23:50 +00:00
|
|
|
|
2024-12-11 00:40:23 +00:00
|
|
|
$sq=$pdo->prepare("SELECT students.firstname,
|
2005-05-12 21:23:50 +00:00
|
|
|
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
|
|
|
|
");
|
2024-12-11 00:40:23 +00:00
|
|
|
$sq->execute();
|
2005-05-12 21:23:50 +00:00
|
|
|
|
|
|
|
$studnum=0;
|
2005-05-12 21:25:12 +00:00
|
|
|
$students="";
|
2009-04-14 18:36:34 +00:00
|
|
|
$schools=array();
|
2024-12-11 00:40:23 +00:00
|
|
|
while($studentinfo=$sq->fetch([PDO::FETCH_OBJ]))
|
2005-05-12 21:23:50 +00:00
|
|
|
{
|
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.
|
2009-04-14 18:36:34 +00:00
|
|
|
if(!in_array($studentinfo->school,$schools))
|
|
|
|
$schools[]=$studentinfo->school;
|
|
|
|
|
|
|
|
// $school=$studentinfo->school;
|
2005-05-12 21:23:50 +00:00
|
|
|
}
|
|
|
|
echo "<br />";
|
|
|
|
echo "  ";
|
|
|
|
echo "  ";
|
2007-12-22 05:11:42 +00:00
|
|
|
if($studnum > 1)
|
2013-03-10 21:28:31 +00:00
|
|
|
echo i18n("Students").": ".htmlspecialchars($students);
|
2007-12-22 05:11:42 +00:00
|
|
|
else
|
2013-03-10 21:28:31 +00:00
|
|
|
echo i18n("Student").": ".htmlspecialchars($students);
|
2007-12-22 05:11:42 +00:00
|
|
|
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "<br />";
|
|
|
|
echo "  ";
|
|
|
|
echo "  ";
|
2009-04-14 18:36:34 +00:00
|
|
|
echo i18n("School").": ";
|
|
|
|
$schoollist="";
|
|
|
|
foreach($schools AS $school) $schoollist.=$school.", ";
|
|
|
|
$schoollist=substr($schoollist,0,-2);
|
|
|
|
echo $schoollist;
|
2005-05-12 21:05:21 +00:00
|
|
|
echo "<br />";
|
|
|
|
}
|
2010-04-14 14:10:47 +00:00
|
|
|
else
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
2005-05-12 21:23:50 +00:00
|
|
|
echo "  ";
|
2009-03-31 15:20:48 +00:00
|
|
|
echo i18n("Prize not awarded");
|
2005-05-12 21:23:50 +00:00
|
|
|
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
|
2024-11-25 23:06:33 +00:00
|
|
|
{ $q = $pdo->query("SELECT
|
2005-05-12 21:05:21 +00:00
|
|
|
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");
|
2024-11-25 23:06:33 +00:00
|
|
|
|
2005-05-12 21:05:21 +00:00
|
|
|
$first=true;
|
2024-11-25 23:06:33 +00:00
|
|
|
if($q->rowCount())
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
2024-12-11 00:40:23 +00:00
|
|
|
while($r=$q->fetch(PDO::FETCH_OBJ))
|
2005-05-12 21:05:21 +00:00
|
|
|
{
|
|
|
|
if($first && $r->year != $config['FAIRYEAR'])
|
|
|
|
{
|
2012-02-09 17:52:17 +00:00
|
|
|
list($d,$t)=explode(" ",$config['dates']['postwinners']);
|
2005-05-12 21:05:21 +00:00
|
|
|
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
2008-08-28 22:02:06 +00:00
|
|
|
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t)));
|
2008-09-02 17:53:29 +00:00
|
|
|
echo "<br />\n";
|
|
|
|
echo "<br />\n";
|
2005-05-12 21:05:21 +00:00
|
|
|
$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.
|
|
|
|
//
|
2024-12-11 00:40:23 +00:00
|
|
|
$tq=$pdo->prepare("SELECT
|
2005-05-12 21:05:21 +00:00
|
|
|
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
|
|
|
|
");
|
2024-12-11 00:40:23 +00:00
|
|
|
$tq->execute();
|
2024-12-17 06:34:35 +00:00
|
|
|
$errorInfo = $pdo->errorInfo();
|
|
|
|
if ($errorInfo[0] != '00000') {
|
|
|
|
// If there's an error (the SQLSTATE isn't '00000', which means no error)
|
|
|
|
echo "Error: " . $errorInfo[2]; // The third element contains the error message
|
|
|
|
}
|
2024-12-11 00:40:23 +00:00
|
|
|
while($tr=$tq->fetch(PDO::FETCH_OBJ)) {
|
2011-03-18 18:45:22 +00:00
|
|
|
echo " <a href=\"winners.php?year=$r->year&type=$tr->type\">".i18n("%1 $tr->type award winners",array($r->year))."</a><br />";
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
2007-06-01 19:52:58 +00:00
|
|
|
echo "<br />";
|
|
|
|
$first=false;
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2012-02-09 17:52:17 +00:00
|
|
|
list($d,$t)=explode(" ",$config['dates']['postwinners']);
|
2005-05-12 21:05:21 +00:00
|
|
|
echo "<h2>".i18n("%1 Winners",array($config['FAIRYEAR']))."</h2>";
|
2008-08-28 22:02:06 +00:00
|
|
|
echo i18n("Winners of the %1 %2 will be posted here on %3 at %4",array($config['FAIRYEAR'],$config['fairname'],format_date($d),format_time($t)));
|
2005-05-12 21:05:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
send_footer();
|
|
|
|
|
|
|
|
?>
|