forked from science-ation/science-ation
7b04204ede
- Migrate generic code into reports.inc.php
81 lines
2.4 KiB
PHP
81 lines
2.4 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' => 'Name',
|
|
'width' => 2.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')),
|
|
|
|
);
|
|
|
|
function report_awards_fromwhere($report)
|
|
{
|
|
global $config, $report_awards_fields;
|
|
|
|
$fields = $report_awards_fields;
|
|
$year = $report['year'];
|
|
|
|
/*
|
|
$awards_join = '';
|
|
$awards_where = '';
|
|
|
|
if(in_array('awards', $report['col']) || in_array('pn_awards', $report['col'])
|
|
|| in_array('awards', $report['group']) || in_array('pn_awards', $report['group']) ) {
|
|
/* This requires some extra gymnastics
|
|
$awards_join = "LEFT JOIN winners ON(winners.projects_id = projects.id),award_prizes,award_awards,award_types";
|
|
$awards_where = " AND winners.awards_prizes_id=award_prizes.id
|
|
AND award_prizes.award_awards_id=award_award_awards.id
|
|
AND award_types.id=award_award_awards.award_types_id
|
|
AND winners.year='$year'
|
|
AND award_award_awards.year='$year'
|
|
AND award_prizes.year='$year'
|
|
AND award_types.year='$year' ";
|
|
}
|
|
|
|
$partner_join = '';
|
|
if(in_array('bothnames', $report['col']) || in_array('partner', $report['col'])) {
|
|
$partner_join = "LEFT JOIN awards AS awards2
|
|
ON(awards2.registrations_id=award_awards.registrations_id
|
|
AND awards2.id != award_awards.id)";
|
|
}
|
|
*/
|
|
$q = " FROM
|
|
award_awards
|
|
WHERE
|
|
awards_years.year='$year'
|
|
";
|
|
|
|
return $q;
|
|
}
|
|
|
|
?>
|