science-ation/admin/reports_judges.inc.php
dave 7b04204ede - Add judge and award type report generators (not nearly complete)
- Migrate generic code into reports.inc.php
2007-03-18 19:59:02 +00:00

151 lines
4.3 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_judges_fields = array(
'last_name' => array(
'name' => 'Last Name',
'header' => 'Judge -- Last Name',
'width' => 1.0,
'table' => 'judges.lastname' ),
'first_name' => array(
'name' => 'First Name',
'header' => 'Judge -- First Name',
'width' => 1.0,
'table' => 'judges.firstname' ),
'name' => array(
'name' => 'Judge -- Full Name (last, first)',
'header' => 'Name',
'width' => 1.75,
'table' => "CONCAT(judges.lastname, ', ', judges.firstname)",
'table_sort'=> 'judges.lastname' ),
'namefl' => array(
'name' => 'Judge -- Full Name (first last)',
'header' => 'Name',
'width' => 1.75,
'table' => "CONCAT(judges.firstname, ' ', judges.lastname)",
'table_sort'=> 'judges.lastname' ),
'email' => array(
'name' => 'Judge -- Email',
'header' => 'Email',
'width' => 1.5,
'table' => 'judges.email'),
'address' => array(
'name' => 'Judge -- Address Street',
'header' => 'Address',
'width' => 2.0,
'table' => "CONCAT(judges.address, ' ', judges.address2)"),
'city' => array(
'name' => 'Judge -- Address City',
'header' => 'City',
'width' => 1.5,
'table' => 'judges.city' ),
'province' => array(
'name' => 'Judge -- Address Province',
'header' => 'Province',
'width' => 0.75,
'table' => 'judges.province' ),
'postal' => array(
'name' => 'Judge -- Address Postal Code',
'header' => 'Postal',
'width' => 0.75,
'table' => 'judges.postalcode' ),
'phone_home' => array(
'name' => 'Judges -- Phone (Home)',
'header' => 'Phone(Home)',
'width' => 1,
'table' => 'judges.phonehome'),
'phone_work' => array(
'name' => 'Judges -- Phone (Work)',
'header' => 'Phone(Work)',
'width' => 1.25,
'table' => "CONCAT(judges.phonework, ' ', judges.phoneworkext)"),
'languages' => array(
'name' => 'Judges -- Languages (REQUIRES MySQL 5.0)',
'header' => 'Languages',
'width' => 0.75,
'table' => "GROUP_CONCAT(judges_languages.languages_lang ORDER BY judges_languages.languages_lang SEPARATOR ' ')",
'group_by' => array('judges.id')),
'complete' => array(
'name' => 'Judge -- Registration Complete',
'header' => 'Complete',
'width' => 0.5,
'table' => 'judges.complete',
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
);
function report_judges_fromwhere($report)
{
global $config, $report_judges_fields;
$fields = $report_judges_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_awards.id
AND award_types.id=award_awards.award_types_id
AND winners.year='$year'
AND 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 judges AS judges2
ON(judges2.registrations_id=judges.registrations_id
AND judges2.id != judges.id)";
}
*/
$q = " FROM
judges, judges_years
WHERE
judges_years.judges_id = judges.id
AND judges_years.year='$year'
";
return $q;
}
?>