From e077912d9ee5fd4120ce1876cd9d52fc63180006 Mon Sep 17 00:00:00 2001 From: james Date: Wed, 10 Feb 2010 18:52:45 +0000 Subject: [PATCH] Clarify some fields, add 3 more: captain name, all team members, all team members except captain. --- admin/reports_judges.inc.php | 72 +++++++++++++++++++++++++++++++++++- 1 file changed, 70 insertions(+), 2 deletions(-) diff --git a/admin/reports_judges.inc.php b/admin/reports_judges.inc.php index 59d3ba3..330f276 100644 --- a/admin/reports_judges.inc.php +++ b/admin/reports_judges.inc.php @@ -142,7 +142,7 @@ function report_judges_div_exp(&$report, $field, $text) { /* Field is 'div_exp_x', users_id is passed in $text */ $div_id = substr($field, 8); - $year = $report['year']; + $year = $report['year']; $users_id = $text; $divprefs = unserialize($text); @@ -166,7 +166,42 @@ function report_judges_cat_pref(&$report, $field, $text) return i18n($prefs[$catprefs[$cat_id]]); } +function report_judges_team_members(&$report, $field, $text) +{ + $year = $report['year']; + $judges_teams_id = $text; + $q = mysql_query("SELECT * FROM judges_teams_link + LEFT JOIN users ON judges_teams_link.users_id=users.id + WHERE judges_teams_link.year='$year'"); + $ret = ''; + while( ($m = mysql_fetch_assoc($q))) { + $add = false; + switch($field) { + case 'team_captain': + if($m['captain'] == 'yes') $add = true; + break; + + case 'team_members_all_except_this': + /* Not implemented, need to pass teams_id AND users_id in here */ + break; + case 'team_members_all_except_captain': + if($m['captain'] == 'no') $add = true; + break; + + case 'team_members_all': + $add = true; + break; + } + + if($add) { + if($ret != '') $ret .= ', '; + $ret .= "{$m['firstname']} {$m['lastname']}"; + } + } + return $ret; + +} /* Components: languages, teams */ @@ -506,7 +541,7 @@ $report_judges_fields = array( 'table' => 'users.year'), 'captain' => array( - 'name' => 'Judge Team -- Captain?', + 'name' => 'Judge Team -- Team Captain? (Is the judge the captain? Yes/No)', 'header' => 'Cptn', 'width' => 0.5, 'table' => 'judges_teams_link.captain', @@ -527,6 +562,39 @@ $report_judges_fields = array( 'table' => 'judges_teams.num', 'components' => array('teams')), +/* Fixme, this requires passing 2 args to the function, can't do that yet + 'team_members_all_except_this' => array( + 'name' => 'Judge Team -- All other team members', + 'header' => 'Members', + 'width' => 2, + 'table' => 'judges_teams.id', + 'exec_function' => 'report_judges_team_members', + 'components' => array('teams')), +*/ + 'team_captain' => array( + 'name' => 'Judge Team -- Name of the Team Captain', + 'header' => 'Captain', + 'width' => 1.75, + 'table' => 'judges_teams.id', + 'exec_function' => 'report_judges_team_members', + 'components' => array('teams')), + + 'team_members_all_except_captain' => array( + 'name' => 'Judge Team -- All team members, except the Captain', + 'header' => 'Members', + 'width' => 2, + 'table' => 'judges_teams.id', + 'exec_function' => 'report_judges_team_members', + 'components' => array('teams')), + + 'team_members_all' => array( + 'name' => 'Judge Team -- All team members including the Captain', + 'header' => 'Members', + 'width' => 2, + 'table' => 'judges_teams.id', + 'exec_function' => 'report_judges_team_members', + 'components' => array('teams')), + 'project_pn' => array( 'name' => 'Project -- Number', 'header' => 'Number',