do { $st[] = $row_staff['uid']; } while ($row_staff = mysql_fetch_assoc($staff)); do { $o[] = $row_organizer['uid']; } while ($row_organizer = mysql_fetch_assoc($organizer)); $filename = str_replace(" ", "_", $_SESSION['contestName']) . "_BJCP_Points_Report.xml"; $output = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n"; $output .= "<OrgReport>\n"; $output .= "\t<CompData>\n"; $output .= "\t\t<CompID>" . $_SESSION['contestID'] . "</CompID>\n"; $output .= "\t\t<CompName>" . $_SESSION['contestName'] . "</CompName>\n"; $output .= "\t\t<CompDate>" . getTimeZoneDateTime($_SESSION['prefsTimeZone'], $row_judging['judgingDate'], $_SESSION['prefsDateFormat'], $_SESSION['prefsTimeFormat'], "system", "date-no-gmt") . "</CompDate>\n"; $output .= "\t\t<CompEntries>" . $total_entries . "</CompEntries>\n"; $output .= "\t\t<CompDays>" . $total_days . "</CompDays>\n"; $output .= "\t\t<CompSessions>" . total_sessions() . "</CompSessions>\n"; $output .= "\t\t<CompFlights>" . total_flights() . "</CompFlights>\n"; $output .= "\t</CompData>\n"; $output .= "\t<BJCPpoints>\n"; //$st_running_total[] = 0; // Judges with a properly formatted BJCP IDs in the system foreach (array_unique($j) as $uid) { $judge_info = explode("^", brewer_info($uid)); $judge_points = judge_points($uid, $judge_info['5']); if ($judge_points > 0) { $bos_judge = bos_points($uid); if ($bos_judge) { $assignment = "Judge+BOS"; } else { $assignment = "Judge"; }
function judge_points($uid, $bos) { include CONFIG . 'config.php'; mysql_select_db($database, $brewing); require INCLUDES . 'db_tables.inc.php'; require DB . 'judging_locations.db.php'; // Judges earn 0.5 points per session // *minimum* of 1.0 points per competition // *maximum* of 1.5 points per day $days = number_format(total_days(), 1); $sessions = number_format(total_sessions(), 1); do { $a[] = $row_judging['id']; } while ($row_judging = mysql_fetch_assoc($judging)); foreach (array_unique($a) as $location) { $query_assignments = sprintf("SELECT COUNT(*) as 'count' FROM %s WHERE bid='%s' AND assignLocation='%s' AND assignment='J'", $prefix . "judging_assignments", $uid, $location); $assignments = mysql_query($query_assignments, $brewing) or die(mysql_error()); $row_assignments = mysql_fetch_assoc($assignments); //if ($row_assignments['count'] > 1) $b[] = 1.0; //else $b[] = $row_assignments['count']; $b[] = $row_assignments['count'] * 0.5; } $points = array_sum($b); $max_comp_points = $sessions * 0.5; // Cannot exceed more than 1.5 points per day if ($points > $days) { $points = $days; } else { $points = $points; } if ($points > $max_comp_points) { $points = $max_comp_points; } else { $points = $points; } if ($points < 1) { $points = 1.0; } else { $points = $points; } return number_format($points, 1); }
<p>The points in this report are derived from the official BJCP Sanctioned Competition Requirements, available at <a href="http://www.bjcp.org/rules.php" target="_blank">http://www.bjcp.org/rules.php</a>.</p> <p><strong>BJCP Competition ID:</strong> <?php echo $_SESSION['contestID']; ?> </p> <p> <strong>Total Entries:</strong> <?php echo $total_entries; ?> <br /> <strong>Total Days:</strong> <?php echo total_days(); ?> <br /> <strong>Total Sessions:</strong> <?php echo total_sessions(); ?> <br /> <strong>Total Flights:</strong> <?php echo total_flights(); ?> (includes Best of Show)<br /> </p> <?php if (!empty($output_organizer)) { ?> <h2>Organizer</h2> <script type="text/javascript" language="javascript"> $(document).ready(function() { $('#sortable0').dataTable( { "bPaginate" : false,