forked from science-ation/science-ation
101 lines
2.7 KiB
PHP
101 lines
2.7 KiB
PHP
<?
|
|
/*
|
|
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.
|
|
*/
|
|
|
|
$report_awards_fields = array(
|
|
'name' => array(
|
|
'name' => 'Award -- Name',
|
|
'header' => 'Award Name',
|
|
'width' => 3.0,
|
|
'table' => 'award_awards.name' ),
|
|
|
|
'cwsfaward' => array(
|
|
'name' => 'Award -- CWSF Award',
|
|
'header' => 'CWSF',
|
|
'width' => 0.5,
|
|
'table' => 'award_awards.cwsfaward',
|
|
'value_map' => array ('0' => 'No', '1' => 'Yes')),
|
|
|
|
'type' => array(
|
|
'name' => 'Award -- Type',
|
|
'header' => 'Award Type',
|
|
'width' => 1.0,
|
|
'table' => 'award_types.type' ),
|
|
|
|
'judgeteamname' => array(
|
|
'name' => 'Judging Team -- Name',
|
|
'header' => 'Judging Team',
|
|
'width' => 3.0,
|
|
'table' => 'judges_teams.name'),
|
|
|
|
'judgeteamnum' => array(
|
|
'name' => 'Judging Team -- Number',
|
|
'header' => 'Num',
|
|
'width' => 0.5,
|
|
'table' => 'judges_teams.num'),
|
|
|
|
'judgeteammembers' => array(
|
|
'name' => 'Judging Team -- Members (REQUIRES MySQL 5.0)',
|
|
'header' => 'Team Members',
|
|
'width' => 3.0,
|
|
'table' => "GROUP_CONCAT(judges.firstname)",
|
|
'group_by' => array('judges_teams.num') ),
|
|
|
|
|
|
);
|
|
|
|
function report_awards_fromwhere($report)
|
|
{
|
|
global $config, $report_awards_fields;
|
|
|
|
$fields = $report_awards_fields;
|
|
$year = $report['year'];
|
|
|
|
|
|
$judges_join = '';
|
|
$judges_where = '';
|
|
|
|
if(in_array('judgeteammembers', $report['col'])
|
|
|| in_array('judgeteammembers', $report['group']) ) {
|
|
$judges_join = ', judges_teams_link, judges';
|
|
$judges_where = 'AND judges_teams_link.id=judges_teams.id
|
|
AND judges.id=judges_teams_link.judges_id';
|
|
}
|
|
|
|
$q = " FROM
|
|
award_awards, judges_teams_awards_link, judges_teams,
|
|
award_types
|
|
$judges_join
|
|
WHERE
|
|
award_awards.year='$year'
|
|
AND judges_teams_awards_link.award_awards_id=award_awards.id
|
|
AND judges_teams.id=judges_teams_awards_link.judges_teams_id
|
|
AND award_types.id=award_types_id
|
|
AND award_types.year='$year'
|
|
$judges_where
|
|
";
|
|
|
|
return $q;
|
|
}
|
|
|
|
?>
|