- Reorder/Rename some of the judge columns for clarity

- Add an option to NOT filter a judge report by year if the report already
  includes a year filter.  This allows one to FITLER by judges.year!='0', and
  get every judge that has ever judged at the fair (should probably add a
  distinct(judges.name) or something, because a judge that has judged in two
  past years would appear twice in that list.
This commit is contained in:
dave 2007-12-22 22:16:12 +00:00
parent 0b782d467d
commit 60df636517

View File

@ -81,31 +81,44 @@ $report_judges_fields = array(
'table' => 'judges.postalcode' ),
'phone_home' => array(
'name' => 'Judges -- Phone (Home)',
'name' => 'Judge -- Phone (Home)',
'header' => 'Phone(Home)',
'width' => 1,
'table' => 'judges.phonehome'),
'phone_work' => array(
'name' => 'Judges -- Phone (Work)',
'name' => 'Judge -- Phone (Work)',
'header' => 'Phone(Work)',
'width' => 1.25,
'table' => "CONCAT(judges.phonework, ' ', judges.phoneworkext)"),
'organization' => array(
'name' => 'Judges -- Organization',
'name' => 'Judge -- Organization',
'header' => 'Organization',
'width' => 2,
'table' => 'judges.organization'),
'languages' => array(
'name' => 'Judges -- Languages (REQUIRES MySQL 5.0)',
'name' => 'Judge -- 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')),
'complete' => array(
'name' => 'Judge -- Registration Complete',
'header' => 'Complete',
'width' => 0.5,
'table' => 'judges.complete',
'value_map' => array ('no' => 'No', 'yes' => 'Yes')),
'year' => array(
'name' => 'Judge -- Year',
'header' => 'Year',
'width' => 0.5,
'table' => 'judges_years.year'),
'captain' => array(
'name' => 'Judge Team -- Captain?',
'header' => 'Cptn',
@ -128,13 +141,6 @@ $report_judges_fields = array(
'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')),
'project_pn' => array(
'name' => 'Project -- Number',
'header' => 'Number',
@ -247,6 +253,16 @@ $report_judges_fields = array(
$students_from = "LEFT JOIN students ON students.registrations_id=projects.registrations_id";
$students_where = "AND students.year='$year'";
}
/* Search the report for a filter based on judge year */
$year_where = "judges_years.year='$year'";
foreach($report['filter'] as $d) {
if($d['field'] == 'year') {
/* Don't interally filter on year, we'll do it
* externally */
$year_where = '1';
}
}
$q = " FROM judges
LEFT JOIN judges_years ON judges_years.judges_id = judges.id
@ -255,7 +271,7 @@ $report_judges_fields = array(
$projects_from
$students_from
WHERE
judges_years.year='$year'
$year_where
$teams_where
$projects_where
$students_where