</div> <div class="settings_group"> <div class="settings_group_image"> <img src="img/settings-gold-medal.png"/> </div> <div class="settings_group_settings"> <p> <input id="n-den" name="n-den-trophies" type="number" min="0" max="20" data-enhanced="true" value="<?php echo read_raceinfo('n-den-trophies', 3); ?> "/> <label for="n-den">Number of trophies per <?php echo group_label_lc(); ?> </label> </p> <p> <input id="n-pack" name="n-pack-trophies" type="number" min="0" max="20" data-enhanced="true" value="<?php echo read_raceinfo('n-pack-trophies', 3); ?> "/> <label for="n-pack">Number of trophies for the <?php echo supergroup_label_lc(); ?> </label> </p> <p>
$sql = 'SELECT racerid, carnumber, lastname, firstname, class' . ' FROM RegistrationInfo' . ' INNER JOIN Classes' . ' ON Classes.classid = RegistrationInfo.classid' . ' WHERE passedinspection = 1 AND exclude = 0' . ' ORDER BY carnumber'; $racers = array(); $stmt = $db->query($sql); foreach ($stmt as $rs) { $racerid = $rs['racerid']; $racers[$racerid] = array('racerid' => $racerid, 'carnumber' => $rs['carnumber'], 'lastname' => $rs['lastname'], 'firstname' => $rs['firstname'], 'class' => $rs['class'], 'awards' => array()); } $stmt->closeCursor(); $n_den_trophies = read_raceinfo('n-den-trophies', 3); $n_pack_trophies = read_raceinfo('n-pack-trophies', 3); require_once 'inc/ordinals.inc'; $speed_trophies = top_finishers_by_class($n_den_trophies); foreach ($speed_trophies as $classid => $den_trophies) { for ($place = 0; $place < count($den_trophies); ++$place) { $racerid = $den_trophies[$place]; $racers[$racerid]['awards'][] = ordinal(1 + $place) . ' in ' . group_label_lc(); } } $pack_trophies = top_finishers_overall($n_pack_trophies); for ($place = 0; $place < count($pack_trophies); ++$place) { $racerid = $pack_trophies[$place]; $racers[$racerid]['awards'][] = ordinal(1 + $place) . ' in ' . supergroup_label_lc(); } $sql = 'SELECT awardname, racerid' . ' FROM Awards' . ' ORDER BY sort'; $stmt = $db->query($sql); foreach ($stmt as $rs) { $racerid = $rs['racerid']; if (isset($racers[$racerid])) { $racers[$racerid]['awards'][] = $rs['awardname']; } }