forked from science-ation/science-ation
184 lines
5.2 KiB
PHP
184 lines
5.2 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' => 'Judge -- Last Name',
|
|
'header' => 'Last Name',
|
|
'width' => 1.0,
|
|
'table' => 'judges.lastname' ),
|
|
|
|
'first_name' => array(
|
|
'name' => 'Judge -- First Name',
|
|
'header' => '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' => 2.0,
|
|
'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' => 'Lang',
|
|
'width' => 0.75,
|
|
'table' => "GROUP_CONCAT(judges_languages.languages_lang ORDER BY judges_languages.languages_lang SEPARATOR ' ')",
|
|
'group_by' => array('judges.id')),
|
|
|
|
'captain' => array(
|
|
'name' => 'Judge Team -- Captain?',
|
|
'header' => 'Cptn',
|
|
'width' => 0.5,
|
|
'table' => 'judges_teams_link.captain',
|
|
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
|
|
|
|
'team' => array(
|
|
'name' => 'Judge Team -- Name',
|
|
'header' => 'Team Name',
|
|
'width' => 3.0,
|
|
'table' => 'judges_teams.name'),
|
|
|
|
'teamnum' => array(
|
|
'name' => 'Judge Team -- Team Number',
|
|
'header' => 'Team',
|
|
'width' => 0.5,
|
|
'table' => 'judges_teams.num'),
|
|
|
|
'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'];
|
|
|
|
$languages_from = '';
|
|
$languages_where = '';
|
|
if(in_array('languages', $report['col'])) {
|
|
$languages_from = ', judges_languages';
|
|
$languages_where = 'AND judges_languages.judges_id=judges.id';
|
|
}
|
|
|
|
|
|
/*
|
|
$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, judges_teams_link, judges_teams
|
|
$languages_from
|
|
WHERE
|
|
judges_years.judges_id = judges.id
|
|
AND judges_years.year='$year'
|
|
AND judges_teams_link.judges_id=judges.id
|
|
AND judges_teams_link.year='$year'
|
|
AND judges_teams.id=judges_teams_link.judges_teams_id
|
|
AND judges_teams.year='$year'
|
|
$languages_where
|
|
";
|
|
|
|
return $q;
|
|
}
|
|
|
|
?>
|