}; </script> <script type="text/javascript" src="js/update.js"></script> <title>Race Schedule</title> <?php require 'inc/stylesheet.inc'; ?> </head> <body> <?php $banner_title = 'Racing Heats'; require 'inc/banner.inc'; running_round_header($now_running); require_once 'inc/rounds.inc'; $groups = all_schedule_groups(); $sql = 'SELECT' . ' Classes.class, round, heat, lane, finishtime, resultid, completed, ' . ($use_master_sched ? 'round' : 'Rounds.roundid') . ' as racinggroup,' . ($use_master_sched ? 'masterheat' : 'heat') . ' as seq,' . ' RegistrationInfo.carnumber, RegistrationInfo.firstname, RegistrationInfo.lastname,' . ' Classes.classid, Rounds.roundid, RaceChart.racerid' . ' FROM ' . inner_join('RaceChart', 'RegistrationInfo', 'RegistrationInfo.racerid = RaceChart.racerid', 'Roster', 'Roster.racerid = RegistrationInfo.Racerid', 'Rounds', 'Rounds.roundid = Roster.roundid', 'Classes', 'Rounds.classid = Classes.classid') . ' WHERE Rounds.roundid = RaceChart.roundid' . ' ORDER BY ' . ($use_master_sched ? 'round, masterheat, lane' : (schema_version() >= 2 ? 'Classes.sortorder, ' : '') . 'class, round, heat, lane'); $stmt = $db->query($sql); if ($stmt === FALSE) { $info = $db->errorInfo(); echo '<h2>Error: ' . $info[2] . '</h2>' . "\n"; } ?> <table class="main_table"> <?php function byes($n) { $result = ''; while ($n > 0) { $result .= '<td>Bye</td>'; --$n; }
<style> .scroll-bounding-rect { overflow: hidden; } </style> </head> <body> <?php $banner_title = 'Results By Racer'; require 'inc/banner.inc'; $nlanes = get_lane_count_from_results(); $now_running = get_running_round(); running_round_header($now_running, TRUE); require_once 'inc/rounds.inc'; $rounds = all_rounds(); $sql = 'SELECT RegistrationInfo.racerid,' . ' Classes.class, round, heat, lane, finishtime, resultid,' . ' carnumber, RegistrationInfo.firstname, RegistrationInfo.lastname,' . ' Classes.classid, Rounds.roundid' . ' FROM ' . inner_join('RaceChart', 'RegistrationInfo', 'RegistrationInfo.racerid = RaceChart.racerid', 'Roster', 'Roster.racerid = RegistrationInfo.racerid', 'Rounds', 'Rounds.roundid = Roster.roundid', 'Classes', 'Rounds.classid = Classes.classid') . ' WHERE Rounds.roundid = RaceChart.roundid' . (isset($_GET['racerid']) ? ' AND RaceChart.racerid = ' . $_GET['racerid'] : '') . ' ORDER BY ' . (schema_version() >= 2 ? 'Classes.sortorder, ' : '') . 'class, round, lastname, firstname, carnumber, resultid, lane'; $stmt = $db->query($sql); if ($stmt === FALSE) { $info = $db->errorInfo(); echo '<h2>Error: ' . $info[2] . '</h2>' . "\n"; } ?> <div class="scroll-bounding-rect"> <table class="main_table"> <?php function byes($n) { $result = ''; while ($n > 0) { $result .= '<td>--</td>'; --$n;
?> </th> <th>First Name</th> <th>Car Name</th> <th>Passed?</th> <?php if ($xbs) { echo '<th>' . $xbs_award_name . '</th>'; } ?> </tr> </thead> <tbody> <?php $sql = 'SELECT racerid, carnumber, lastname, firstname, carname, imagefile,' . (schema_version() < 2 ? "class" : "Classes.sortorder") . ' AS class_sort,' . ' RegistrationInfo.classid, class, RegistrationInfo.rankid, rank, passedinspection, exclude,' . ' EXISTS(SELECT 1 FROM RaceChart WHERE RaceChart.racerid = RegistrationInfo.racerid) AS scheduled,' . ' EXISTS(SELECT 1 FROM RaceChart WHERE RaceChart.classid = RegistrationInfo.classid) AS denscheduled,' . ' EXISTS(SELECT 1 FROM Awards WHERE Awards.awardname = \'' . addslashes($xbs_award_name) . '\' AND' . ' Awards.racerid = RegistrationInfo.racerid) AS xbs' . ' FROM ' . inner_join('RegistrationInfo', 'Classes', 'RegistrationInfo.classid = Classes.classid', 'Ranks', 'RegistrationInfo.rankid = Ranks.rankid') . ' ORDER BY ' . ($order == 'car' ? 'carnumber, lastname, firstname' : ($order == 'den' ? 'class_sort, lastname, firstname' : 'lastname, firstname')); $stmt = $db->query($sql); $n = 1; foreach ($stmt as $rs) { checkin_table_row($rs, $xbs, $use_subgroups, $n); ++$n; } ?> </tbody> </table> <?php if (have_permission(REGISTER_NEW_RACER_PERMISSION)) { ?> <div class="block_buttons"> <input type="button" value="New Racer" data-enhanced="true" onclick='show_new_racer_form();'/>
$awards[] = array('bin_key' => $key, 'classid' => @$classid, 'rankid' => @$rankid, 'awardkey' => 'speed-' . $place . (isset($classid) ? '-' . $classid : ''), 'awardname' => nth_fastest($place, $label), 'awardtype' => 'Speed Trophy', 'awardtypeid' => 5, 'sort' => $place, 'firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'carnumber' => $row['carnumber']); } } // Collect speed awards foreach (final_standings() as $row) { // Can be BOTH for_group and for_supergroup if ($row['for_supergroup']) { add_speed_award($row, null, null, $n_pack_trophies, supergroup_label()); } if ($row['for_group']) { add_speed_award($row, @$row['classid'], null, $n_den_trophies, $classes[$row['classid']]['class']); } // TODO Speed awards by rank, as well as by class? } // TODO Break ties for award sorting according to class and rank ordering foreach ($db->query('SELECT awardid, awardname, awardtype,' . ' Awards.awardtypeid, Awards.classid, Awards.rankid, sort,' . ' firstname, lastname, carnumber' . ' FROM ' . inner_join('Awards', 'AwardTypes', 'Awards.awardtypeid = AwardTypes.awardtypeid', 'RegistrationInfo', 'Awards.racerid = RegistrationInfo.racerid') . ' ORDER BY sort, lastname, firstname') as $row) { $awards[] = array('bin_key' => bin_key(@$row['classid'], @$row['rankid']), 'classid' => @$row['classid'], 'rankid' => @$row['rankid'], 'awardkey' => 'award-' . $row['awardid'], 'awardname' => $row['awardname'], 'awardtype' => $row['awardtype'], 'awardtypeid' => $row['awardtypeid'], 'sort' => $row['sort'], 'firstname' => $row['firstname'], 'lastname' => $row['lastname'], 'carnumber' => $row['carnumber']); } function compare_by_sort(&$lhs, &$rhs) { return $lhs['sort'] == $rhs['sort'] ? 0 : $lhs['sort'] < $rhs['sort'] ? -1 : 1; } usort($awards, 'compare_by_sort'); ?> <div class="block_buttons"> <div class="center-select"> <select id="awardtype-select"> <option selected="Selected">All Awards</option> <?php
<?php @session_start(); require_once 'inc/data.inc'; require_once 'inc/authorize.inc'; header('Content-Type: text/csv; charset=utf-8'); header('Content-Disposition: attachment; filename="derbynet-' . date('Y-m-d') . '.csv"'); echo "Class,Round,Heat,Lane,FirstName,LastName,CarNumber,FinishTime,FinishPlace,Completed\r\n"; $stmt = $db->query('SELECT class, round, heat, lane,' . ' firstname, lastname, carnumber, finishtime, finishplace, completed' . ' FROM ' . inner_join('RaceChart', 'RegistrationInfo', 'RaceChart.racerid = RegistrationInfo.racerid', 'Rounds', 'RaceChart.roundid = Rounds.roundid', 'Classes', 'Rounds.classid = Classes.classid') . ' ORDER BY completed, heat, lane'); if ($stmt === FALSE) { $info = $db->errorInfo(); echo '<error msg="' . htmlspecialchars($info[2], ENT_QUOTES, 'UTF-8') . '" query="' . $sql . '"/>' . "\n"; } $output = fopen("php://output", "w"); try { foreach ($stmt as $row) { fputcsv($output, array($row['class'], $row['round'], $row['heat'], $row['lane'], $row['firstname'], $row['lastname'], $row['carnumber'], $row['finishtime'], $row['finishplace'], $row['completed'])); } } catch (Exception $e) { echo '<error msg="' . htmlspecialchars($e->getMessage(), ENT_QUOTES, 'UTF-8') . '"/>' . "\n"; } // finally clause syntax is recognized only in PHP 5.5 and later fclose($output);