forked from science-ation/science-ation
efc7ae411d
- Overhauled the report generator.. It's more versatile now - Added 'filter' option to the generator, so you can filter any column by (=, <=, >=, <, >, IS, IS NOT, LIKE, NOT LIKE). It doesn't support AND or OR combinations, but that should cover what we need for now. Example: We can filter "Award Name" LIKE "%Gold%" to generate a report of just the Gold medal projects. - Wipe out the report database, and create it again from scratch. update.48.sql contains an example of how to add additional reports to the system without knowing the report_ids, because after regions start adding their own reports, we won't be able to just wipe out the whole report system to add one. - We handle more reports now, specifically nametags and table labels, so remove those files, and update the reports.php file to link the old links to the new report generator (so people don't get too confused in this transition). - Beginnings of moving the report generator to proper LEFT JOIN style constructs instead of just one big massive EQUALS JOIN.
185 lines
4.9 KiB
PHP
185 lines
4.9 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.
|
|
*/
|
|
|
|
/* Components: languages, teams */
|
|
|
|
$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)"),
|
|
|
|
'organization' => array(
|
|
'name' => 'Judges -- Organization',
|
|
'header' => 'Organization',
|
|
'width' => 2,
|
|
'table' => 'judges.organization'),
|
|
|
|
'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'),
|
|
'components' => array('languages')),
|
|
|
|
'captain' => array(
|
|
'name' => 'Judge Team -- Captain?',
|
|
'header' => 'Cptn',
|
|
'width' => 0.5,
|
|
'table' => 'judges_teams_link.captain',
|
|
'value_map' => array ('no' => 'No', 'yes' => 'Yes'),
|
|
'components' => array('teams')),
|
|
|
|
'team' => array(
|
|
'name' => 'Judge Team -- Name',
|
|
'header' => 'Team Name',
|
|
'width' => 3.0,
|
|
'table' => 'judges_teams.name',
|
|
'components' => array('teams')),
|
|
|
|
'teamnum' => array(
|
|
'name' => 'Judge Team -- Team Number',
|
|
'header' => 'Team',
|
|
'width' => 0.5,
|
|
'table' => 'judges_teams.num',
|
|
'components' => array('teams')),
|
|
|
|
'complete' => array(
|
|
'name' => 'Judge -- Registration Complete',
|
|
'header' => 'Complete',
|
|
'width' => 0.5,
|
|
'table' => 'judges.complete',
|
|
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
|
|
|
|
'static_text' => array(
|
|
'name' => 'Static Text (useful for labels)',
|
|
'header' => '',
|
|
'width' => 0.1,
|
|
'table' => "CONCAT(' ')"),
|
|
|
|
);
|
|
|
|
function report_judges_fromwhere($report, $components)
|
|
{
|
|
global $config, $report_judges_fields;
|
|
|
|
$fields = $report_judges_fields;
|
|
$year = $report['year'];
|
|
|
|
$languages_from = '';
|
|
$languages_where = '';
|
|
if(in_array('languages', $components)) {
|
|
$languages_from = ', judges_languages';
|
|
$languages_where = 'AND judges_languages.judges_id=judges.id';
|
|
}
|
|
|
|
$teams_from = '';
|
|
$teams_where = '';
|
|
if(in_array('teams', $components)) {
|
|
$teams_from = ",judges_teams_link, judges_teams";
|
|
$teams_where = "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'";
|
|
}
|
|
|
|
$q = " FROM
|
|
judges, judges_years
|
|
$teams_from
|
|
$languages_from
|
|
WHERE
|
|
judges_years.judges_id = judges.id
|
|
AND judges_years.year='$year'
|
|
$teams_where
|
|
$languages_where
|
|
";
|
|
|
|
return $q;
|
|
}
|
|
|
|
?>
|