2007-03-18 19:59:02 +00:00
|
|
|
<?
|
|
|
|
/*
|
|
|
|
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',
|
2007-03-18 21:48:36 +00:00
|
|
|
'header' => 'Award Name',
|
|
|
|
'width' => 3.0,
|
2007-03-18 19:59:02 +00:00
|
|
|
'table' => 'award_awards.name' ),
|
|
|
|
|
2007-03-22 14:55:24 +00:00
|
|
|
'criteria' => array(
|
|
|
|
'name' => 'Award -- Criteria',
|
|
|
|
'header' => 'Award Criteria',
|
|
|
|
'width' => 3.0,
|
|
|
|
'table' => 'award_awards.criteria' ),
|
|
|
|
|
|
|
|
'presenter' => array(
|
|
|
|
'name' => 'Award -- Presenter',
|
|
|
|
'header' => 'Award Presenter',
|
|
|
|
'width' => 1.5,
|
|
|
|
'table' => 'award_awards.presenter' ),
|
|
|
|
|
|
|
|
'order' => array(
|
|
|
|
'name' => 'Award -- Order',
|
|
|
|
'header' => 'Award Order',
|
|
|
|
'width' => 0.5,
|
|
|
|
'table' => 'award_awards.order' ),
|
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
'cwsfaward' => array(
|
|
|
|
'name' => 'Award -- CWSF Award',
|
|
|
|
'header' => 'CWSF',
|
|
|
|
'width' => 0.5,
|
|
|
|
'table' => 'award_awards.cwsfaward',
|
|
|
|
'value_map' => array ('0' => 'No', '1' => 'Yes')),
|
|
|
|
|
2007-03-18 21:48:36 +00:00
|
|
|
'type' => array(
|
|
|
|
'name' => 'Award -- Type',
|
|
|
|
'header' => 'Award Type',
|
|
|
|
'width' => 1.0,
|
|
|
|
'table' => 'award_types.type' ),
|
|
|
|
|
2007-12-13 19:56:44 +00:00
|
|
|
'sponsor_organization' => array(
|
|
|
|
'name' => 'Sponsor -- Organization',
|
|
|
|
'header' => 'Sponsor Organization',
|
|
|
|
'width' => 2.0,
|
|
|
|
'table' => 'award_sponsors.organization' ),
|
|
|
|
|
|
|
|
'sponsor_phone' => array(
|
|
|
|
'name' => 'Sponsor -- Phone',
|
|
|
|
'header' => 'Sp. Phone',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'award_sponsors.phone' ),
|
|
|
|
|
|
|
|
'sponsor_fax' => array(
|
|
|
|
'name' => 'Sponsor -- Fax',
|
|
|
|
'header' => 'Sp. Fax',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'award_sponsors.fax' ),
|
|
|
|
|
|
|
|
'sponsor_address' => array(
|
|
|
|
'name' => 'Sponsor -- Street Address',
|
|
|
|
'header' => 'Sponsor Address',
|
|
|
|
'width' => 2.0,
|
|
|
|
'table' => 'award_sponsors.address'),
|
|
|
|
|
|
|
|
'sponsor_city' => array(
|
|
|
|
'name' => 'Sponsor -- City',
|
|
|
|
'header' => 'Sp. City',
|
|
|
|
'width' => 1.5,
|
|
|
|
'table' => 'award_sponsors.city' ),
|
|
|
|
|
|
|
|
'sponsor_province' => array(
|
|
|
|
'name' => 'Sponsor -- Province',
|
|
|
|
'header' => 'Sp. Province',
|
|
|
|
'width' => 0.75,
|
|
|
|
'table' => 'award_sponsors.province_code' ),
|
|
|
|
|
|
|
|
'sponsor_postal' => array(
|
|
|
|
'name' => 'Sponsor -- Postal Code',
|
|
|
|
'header' => 'Sp. Postal',
|
|
|
|
'width' => 0.75,
|
|
|
|
'table' => 'award_sponsors.postalcode' ),
|
|
|
|
|
|
|
|
'sponsor_notes' => array(
|
|
|
|
'name' => 'Sponsor -- Notes',
|
|
|
|
'header' => 'Sponsor Notes',
|
|
|
|
'width' => 3,
|
|
|
|
'table' => 'award_sponsors.notes' ),
|
|
|
|
|
|
|
|
'sponsor_confirmed' => array(
|
|
|
|
'name' => 'Sponsor -- Confirmed',
|
|
|
|
'header' => 'Sp. Confirmed',
|
|
|
|
'width' => .5,
|
|
|
|
'table' => 'award_sponsors.confirmed',
|
|
|
|
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
|
|
|
|
|
2007-12-13 21:23:29 +00:00
|
|
|
'pcontact_salutation' => array(
|
|
|
|
'name' => 'Primary Contact -- Salutation',
|
|
|
|
'header' => 'Cnct. Salutation',
|
|
|
|
'width' => 1.0,
|
|
|
|
'table' => 'PRIMARYCONTACT.salutation' ),
|
|
|
|
|
|
|
|
'pcontact_last_name' => array(
|
|
|
|
'name' => 'Primary Contact -- Last Name',
|
|
|
|
'header' => 'Cnct. Last Name',
|
|
|
|
'width' => 1.0,
|
|
|
|
'table' => 'PRIMARYCONTACT.lastname' ),
|
|
|
|
|
|
|
|
'pcontact_first_name' => array(
|
|
|
|
'name' => 'Primary Contact -- First Name',
|
|
|
|
'header' => 'Cnct. First Name',
|
|
|
|
'width' => 1.0,
|
|
|
|
'table' => 'PRIMARYCONTACT.firstname' ),
|
|
|
|
|
|
|
|
'pcontact_name' => array(
|
|
|
|
'name' => 'Primary Contact -- Full Name (last, first)',
|
|
|
|
'header' => 'Contact Name',
|
|
|
|
'width' => 1.75,
|
|
|
|
'table' => "CONCAT(PRIMARYCONTACT.lastname, ', ', PRIMARYCONTACT.firstname)",
|
|
|
|
'table_sort'=> 'PRIMARYCONTACT.lastname' ),
|
|
|
|
|
|
|
|
'pcontact_namefl' => array(
|
|
|
|
'name' => 'Primary Contact -- Full Name (salutation first last)',
|
|
|
|
'header' => 'Contact Name',
|
|
|
|
'width' => 1.75,
|
|
|
|
'table' => "CONCAT(PRIMARYCONTACT.salutation, ' ', PRIMARYCONTACT.firstname, ' ', PRIMARYCONTACT.lastname)",
|
|
|
|
'table_sort'=> 'PRIMARYCONTACT.lastname' ),
|
|
|
|
|
|
|
|
'pcontact_position' => array(
|
|
|
|
'name' => 'Primary Contact -- Position',
|
|
|
|
'header' => 'Cnct. Position',
|
|
|
|
'width' => 1.25,
|
|
|
|
'table' => 'PRIMARYCONTACT.position'),
|
|
|
|
|
|
|
|
'pcontact_email' => array(
|
|
|
|
'name' => 'Primary Contact -- Email',
|
|
|
|
'header' => 'Cnct. Email',
|
|
|
|
'width' => 2.0,
|
|
|
|
'table' => 'PRIMARYCONTACT.email'),
|
|
|
|
|
|
|
|
'pcontact_hphone' => array(
|
|
|
|
'name' => 'Primary Contact -- Home Phone',
|
|
|
|
'header' => 'Cnct. Home',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'PRIMARYCONTACT.phonehome' ),
|
|
|
|
|
|
|
|
'pcontact_wphone' => array(
|
|
|
|
'name' => 'Primary Contact -- Work Phone',
|
|
|
|
'header' => 'Cnct. Work',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'PRIMARYCONTACT.phonework' ),
|
|
|
|
|
|
|
|
'pcontact_cphone' => array(
|
|
|
|
'name' => 'Primary Contact -- Cell Phone',
|
|
|
|
'header' => 'Cnct. Cell',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'PRIMARYCONTACT.phonecell' ),
|
|
|
|
|
|
|
|
'pcontact_fax' => array(
|
|
|
|
'name' => 'Primary Contact -- Fax',
|
|
|
|
'header' => 'Cnct. Fax',
|
|
|
|
'width' => 1,
|
|
|
|
'table' => 'PRIMARYCONTACT.fax' ),
|
|
|
|
|
|
|
|
'pcontact_notes' => array(
|
|
|
|
'name' => 'Primary Contact -- Notes',
|
|
|
|
'header' => 'Contact Notes',
|
|
|
|
'width' => 3,
|
|
|
|
'table' => 'PRIMARYCONTACT.notes' ),
|
|
|
|
|
2007-03-18 21:48:36 +00:00
|
|
|
'judgeteamname' => array(
|
2007-12-13 21:23:29 +00:00
|
|
|
'components' => array('judgingteam'),
|
2007-03-18 21:48:36 +00:00
|
|
|
'name' => 'Judging Team -- Name',
|
|
|
|
'header' => 'Judging Team',
|
|
|
|
'width' => 3.0,
|
|
|
|
'table' => 'judges_teams.name'),
|
|
|
|
|
|
|
|
'judgeteamnum' => array(
|
2007-12-13 21:23:29 +00:00
|
|
|
'components' => array('judgingteam'),
|
2007-03-18 21:48:36 +00:00
|
|
|
'name' => 'Judging Team -- Number',
|
2007-03-19 00:13:12 +00:00
|
|
|
'header' => 'Team',
|
2007-03-18 21:48:36 +00:00
|
|
|
'width' => 0.5,
|
|
|
|
'table' => 'judges_teams.num'),
|
|
|
|
|
|
|
|
'judgeteammembers' => array(
|
2007-12-13 21:23:29 +00:00
|
|
|
'components' => array('judgingteam'),
|
2007-03-18 21:48:36 +00:00
|
|
|
'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') ),
|
|
|
|
|
|
|
|
|
2007-03-18 19:59:02 +00:00
|
|
|
);
|
|
|
|
|
2007-03-26 01:54:18 +00:00
|
|
|
function report_awards_fromwhere($report, $components)
|
2007-03-18 19:59:02 +00:00
|
|
|
{
|
|
|
|
global $config, $report_awards_fields;
|
|
|
|
|
|
|
|
$fields = $report_awards_fields;
|
|
|
|
$year = $report['year'];
|
|
|
|
|
2007-03-18 21:48:36 +00:00
|
|
|
|
|
|
|
$judges_join = '';
|
|
|
|
$judges_where = '';
|
2007-12-13 21:23:29 +00:00
|
|
|
|
|
|
|
if(in_array('judgingteam', $components)) {
|
|
|
|
$judges_join = ', judges_teams_awards_link, judges_teams,
|
|
|
|
judges_teams_link, judges';
|
|
|
|
$judges_where = 'AND judges_teams_awards_link.award_awards_id=award_awards.id
|
|
|
|
AND judges_teams.id=judges_teams_awards_link.judges_teams_id
|
|
|
|
AND judges_teams_link.id=judges_teams.id
|
2007-03-18 21:48:36 +00:00
|
|
|
AND judges.id=judges_teams_link.judges_id';
|
2007-03-18 19:59:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
$q = " FROM
|
2007-12-13 21:23:29 +00:00
|
|
|
award_awards LEFT JOIN award_sponsors ON (
|
|
|
|
award_sponsors.id=award_awards.award_sponsors_id
|
|
|
|
AND award_sponsors.year=award_awards.year)
|
|
|
|
LEFT JOIN award_contacts AS PRIMARYCONTACT ON (
|
|
|
|
PRIMARYCONTACT.award_sponsors_id=award_sponsors.id
|
|
|
|
AND PRIMARYCONTACT.year=award_awards.year
|
|
|
|
AND PRIMARYCONTACT.`primary`='yes'),
|
2007-03-18 21:48:36 +00:00
|
|
|
award_types
|
|
|
|
$judges_join
|
2007-03-18 19:59:02 +00:00
|
|
|
WHERE
|
2007-03-18 21:48:36 +00:00
|
|
|
award_awards.year='$year'
|
|
|
|
AND award_types.id=award_types_id
|
|
|
|
AND award_types.year='$year'
|
2007-12-13 21:23:29 +00:00
|
|
|
$judges_where
|
2007-03-18 19:59:02 +00:00
|
|
|
";
|
|
|
|
|
|
|
|
return $q;
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|