<th class="dialog"><?php echo $strAthlete; ?> </th> <td class="forms"> <form action='meeting_entry_add.php' method='post' name='athleteSearch'> <input name='arg' type='hidden' value='change_athlete' /> <?php $dropdown = new GUI_Select('athleteSearch', 1, "document.athleteSearch.submit()"); $sql_athlets = "SELECT lastname, firstname, license FROM base_athlete " . $searchparam; $result_a = mysql_query($sql_athlets); if (mysql_num_rows($result_a) > 0) { while ($row_athlets = mysql_fetch_row($result_a)) { $name_athlete = $row_athlets[0] . " " . $row_athlets[1]; $dropdown->addOption($name_athlete, $row_athlets[2]); } $dropdown->selectOption($athleteSearch); $dropdown->addOptionNone(); $dropdown->printList(); } else { $search_occurred = true; $search_match; } ?> </form> </td> <?php } ?>
/** * Form to add additional athlete/relay * ------------------------------------ */ function AA_heats_printNewStart($event, $round, $action) { include './config.inc.php'; $mergedRounds = AA_getMergedRounds($round); if ($mergedRounds != '') { $SqlRounds = " IN " . $mergedRounds; } else { $SqlRounds = " = " . $round; } // set up key list containing this round's starts $result = mysql_query("SELECT ss.xStart" . " FROM runde AS r" . ", serie AS s" . ", serienstart AS ss" . " WHERE r.xRunde " . $SqlRounds . " AND s.xRunde = r.xRunde" . " AND ss.xSerie = s.xSerie"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $keys = ""; $sep = ""; while ($row = mysql_fetch_row($result)) { $keys = $keys . $sep . $row[0]; $sep = ","; } mysql_free_result($result); } $relay = AA_checkRelay($event); $mergedEvents = AA_getMergedEventsFromEvent($event); if ($mergedEvents != '') { $SqlEvents = " IN " . $mergedEvents; } else { $SqlEvents = " = " . $event; } // get athletes entered for this event but not qualified for this round if ($relay == FALSE) { // single event $title = $GLOBALS['strAthlete']; $query = "SELECT st.xStart" . ", CONCAT(a.Startnummer, ' ', at.Name , ' ', at.Vorname" . ", ', ', at.Jahrgang, ', ', v.Name)" . " FROM start AS st" . ", anmeldung AS a" . ", athlet AS at" . ", verein AS v" . " WHERE st.xWettkampf " . $SqlEvents . " AND st.xStart NOT IN (" . $keys . ") AND a.xAnmeldung = st.xAnmeldung" . " AND at.xAthlet = a.xAthlet" . " AND v.xVerein = at.xVerein" . " ORDER BY at.Name, at.Vorname"; } else { // relay event $title = $GLOBALS['strRelay']; $query = "SELECT st.xStart" . ", CONCAT(sf.Name, ', ', v.Name)" . " FROM start AS st" . ", staffel AS sf" . ", verein AS v" . " WHERE st.xWettkampf " . $SqlEvents . " AND st.xStart NOT IN (" . $keys . ") AND sf.xStaffel = st.xStaffel" . " AND v.xVerein = sf.xVerein" . " ORDER BY sf.Name"; } $result = mysql_query($query); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (mysql_num_rows($result) > 0) { ?> <form action='<?php echo $action; ?> ' method='post'> <table> <tr> <th class='dialog'><?php echo $GLOBALS['strNew']; ?> </th> <td class='dialog'> <input name='arg' type='hidden' value='add_start' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <?php echo $title; ?> :</td> <td class='forms'> <?php // print drop down list of athletes $dd = new GUI_Select('start', 1); $dd->addOptionNone(); while ($row = mysql_fetch_row($result)) { $dd->addOption($row[1], $row[0]); } $dd->printList(); ?> </td> <td class='dialog'><?php echo $GLOBALS['strHeat']; ?> :</td> <?php // print drop down list of heats $dd = new GUI_HeatDropDown($round); ?> <td class='dialog'><?php echo $GLOBALS['strPosition']; ?> :</td> <td class='forms'> <input class='nbr' name='pos' type='text' maxlength='4' value='0' /> </td> <td class='forms'> <td class='forms'> <button type='submit'> <?php echo $GLOBALS['strAdd']; ?> </button> </td> </tr> </table> </form> <?php } // ET athletes found mysql_free_result($result); } // ET DB error }
function AA_results_Track($round, $layout, $autoRank = '') { require './lib/cl_gui_button.lib.php'; require './lib/cl_gui_dropdown.lib.php'; require './lib/cl_gui_select.lib.php'; require './config.inc.php'; require './lib/common.lib.php'; require './lib/heats.lib.php'; require './lib/results.lib.php'; require './lib/utils.lib.php'; require './lib/timing.lib.php'; $presets = AA_results_getPresets($round); // read GET/POST variables $relay = AA_checkRelay($presets['event']); // check, if this is a relay event $svm = AA_checkSVM(0, $round); // decide whether to show club or team name // $flagMain=AA_getMainRound($round); // if ($flagMain) { // // terminate result processing // if ($_GET['arg'] == 'results_done') { $eval = AA_results_getEvaluationType($round); $combined = AA_checkCombined(0, $round); $eventType = AA_getEventTypes($round); mysql_query("\r\n\t\tLOCK TABLES\r\n\t\t\trundentyp READ\r\n\t\t\t, runde READ\r\n\t\t\t, serie READ\r\n\t\t\t, resultat READ\r\n\t\t\t, wettkampf READ\r\n\t\t\t, start WRITE\r\n\t\t\t, serienstart WRITE\r\n\t"); if ($eval == $cfgEvalType[$strEvalTypeAll] || $eval == $cfgEvalType[$strEvalTypeHeat] && isset($eventType['club'])) { // eval all heats together $heatorder = ""; } else { // default: rank results per heat $heatorder = "serie.xSerie, "; } $nextRound = AA_getNextRound($presets['event'], $round); // if this is a combined event, rank all rounds togheter $roundSQL = ""; if ($combined) { $roundSQL = "WHERE serie.xRunde IN ("; $res_c = mysql_query("SELECT xRunde FROM runde WHERE xWettkampf = " . $presets['event']); while ($row_c = mysql_fetch_array($res_c)) { $roundSQL .= $row_c[0] . ","; } $roundSQL = substr($roundSQL, 0, -1) . ")"; } else { $roundSQL = "WHERE serie.xRunde = {$round}"; } /*$result = mysql_query(" SELECT resultat.Leistung , serienstart.xSerienstart , serienstart.xSerie , serienstart.xStart , serie.Wind FROM resultat , serienstart , serie WHERE resultat.xSerienstart = serienstart.xSerienstart AND serienstart.xSerie = serie.xSerie $roundSQL ORDER BY $heatorder resultat.Leistung ASC "); */ $sql = "SELECT DISTINCT \r\n\t\t\t\t resultat.Leistung, \r\n\t\t\t\t serienstart.xSerienstart, \r\n\t\t\t\t serienstart.xSerie, \r\n\t\t\t\t serienstart.xStart, \r\n\t\t\t\t serie.Wind \r\n\t\t\t FROM resultat \r\n\t\t LEFT JOIN serienstart USING(xSerienstart) \r\n\t\t LEFT JOIN serie USING(xSerie) \r\n\t\t\t " . $roundSQL . " \r\n\t\t ORDER BY " . $heatorder . "\r\n\t\t\t\t resultat.Leistung ASC;"; $result = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $heat = 0; $perf = 0; $i = 0; $rank = 0; while ($row = mysql_fetch_row($result)) { // check on codes < 0 if ($row[0] < 0) { mysql_query("UPDATE serienstart SET" . " Rang = 0" . " WHERE xSerienstart = " . $row[1]); } else { if (!($eval == $cfgEvalType[$strEvalTypeHeat] && isset($eventType['club']))) { if ($eval != $cfgEvalType[$strEvalTypeAll] && $heat != $row[2]) { $i = 0; // restart ranking (not SVM with single heat) $perf = 0; } } $i++; // increment ranking if ($perf < $row[0]) { // compare with previous performance $rank = $i; // next rank (only if not same performance) } mysql_query("UPDATE serienstart SET" . " Rang = " . $rank . " WHERE xSerienstart = " . $row[1]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // keep performance for information (heat seeding) if ($nextRound > 0) { mysql_query("\r\n\t\t\t\t\t\tUPDATE start SET\r\n\t\t\t\t\t\t\tstart.Bestleistung = {$row['0']}\r\n\t\t\t\t\t\tWHERE start.xStart = {$row['3']}\r\n\t\t\t\t\t"); } if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $heat = $row[2]; // keep current heat ID $perf = $row[0]; // keep current performance } } mysql_free_result($result); } mysql_query("UNLOCK TABLES"); AA_results_setNotStarted($round); // update athletes with no result AA_utils_changeRoundStatus($round, $cfgRoundStatus['results_done']); if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } AA_results_resetQualification($round); } // ET terminate results // // Qualify athletes after ranks are set // if ($_GET['arg'] == 'results_done' || $_POST['arg'] == 'save_rank' || $_POST['arg'] == 'set_qual') { // read qualification criteria $qual_top = 0; $qual_perf = 0; $result = mysql_query("SELECT QualifikationSieger" . ", QualifikationLeistung" . " FROM runde" . " WHERE xRunde = " . $round); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (($row = mysql_fetch_row($result)) == TRUE) { } $qual_top = $row[0]; $qual_perf = $row[1]; mysql_free_result($result); } // ET DB error // qualify top athletes for next round if ($qual_top > 0) { mysql_query("LOCK TABLES serie READ, serienstart WRITE"); // get athletes by qualifying rank (random order if same rank) $result = mysql_query("SELECT serienstart.xSerienstart" . ", serienstart.xSerie" . ", serienstart.Rang" . " FROM serienstart" . ", serie" . " WHERE serienstart.Rang > 0" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round . " AND serienstart.Qualifikation = 0" . " ORDER BY serienstart.xSerie" . ", serienstart.Rang ASC" . ", RAND()"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $h = 0; unset($heats); // clear array containing heats while ($row = mysql_fetch_row($result)) { if ($h != $row[1]) { // new heat if (count($starts) > 0) { // count athletes $heats[] = $starts; // keep athletes per heat } unset($starts); $c = 0; } $starts[$row[0]] = $row[2]; // keep athlete's rank $h = $row[1]; // keep heat } $heats[] = $starts; // keep remaining athletes mysql_free_result($result); foreach ($heats as $starts) { $rankcount = array_count_values($starts); // count athletes/rank $q = 0; foreach ($starts as $id => $rank) { // check if more athletes per rank than qualifying spots if ($rankcount[$rank] > $qual_top - $rank + 1) { $qual = $cfgQualificationType['top_rand']['code']; } else { $qual = $cfgQualificationType['top']['code']; } if ($q < $qual_top) { mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $qual . " WHERE xSerienstart = " . $id); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $q++; // count nbr of qualified athletes } } } // END loop every heat } // ET DB error mysql_query("UNLOCK TABLES"); } // ET top athletes // qualify top performing athletes for next round if ($qual_perf > 0) { mysql_query("LOCK TABLES resultat READ, serie READ, serienstart WRITE"); // get remaining athletes by performance (random order if equal performance) /* other possible criteria to order equal performances: * - ranking within heat (not implemented) * - wind (not implemented) */ $result = mysql_query("SELECT serienstart.xSerienstart" . ", resultat.Leistung" . ", serienstart.Qualifikation" . " FROM resultat" . ", serienstart" . ", serie" . " WHERE resultat.xSerienstart = serienstart.xSerienstart" . " AND resultat.Leistung > 0" . " AND (serienstart.Qualifikation = 0 " . " OR serienstart.Qualifikation = " . $cfgQualificationType['waived']['code'] . ")" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round . " ORDER BY resultat.Leistung ASC" . ", RAND()"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $i = 1; $perf = 0; $cWaived = 0; while ($row = mysql_fetch_row($result)) { // count waived qualifyings if ($row[2] == $cfgQualificationType['waived']['code']) { $cWaived++; continue; } if ($i > $qual_perf) { // terminate if enough top performers found if ($perf != $row[1]) { // last perf. worse than last qualified $perf = 0; } break; } // if athletes waived on qualifying, set random code for next best athletes $code = $cfgQualificationType['perf']['code']; if ($i + $cWaived > $qual_perf) { $code = $cfgQualificationType['perf_rand']['code']; } mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $code . " WHERE xSerienstart = " . $row[0]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $i++; $perf = $row[1]; // keep performance } // reset performance if enough qualifing spots if (mysql_num_rows($result) <= $qual_perf) { $perf = 0; } mysql_free_result($result); // Change qualification type to "perf_rand" for athletes with same // performance as the 1st unqualified athlete if ($perf != 0) { $result = mysql_query("SELECT serienstart.xSerienstart" . " FROM resultat" . ", serienstart" . ", serie" . " WHERE resultat.xSerienstart = serienstart.xSerienstart" . " AND resultat.Leistung = " . $perf . " AND serienstart.Qualifikation > 0" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { while ($row = mysql_fetch_row($result)) { mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $cfgQualificationType['perf_rand']['code'] . " WHERE xSerienstart = " . $row[0]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } mysql_free_result($result); } } // ET unqualified athlete } // ET DB error qualified by performance mysql_query("UNLOCK TABLES"); } // ET top performances } // // calculate ranking points if needed // if ($_GET['arg'] == 'results_done' || $_POST['arg'] == 'save_rank') { AA_utils_calcRankingPoints($round); // only for SVM with heat single --> set back the ranks per heat if ($eval == $cfgEvalType[$strEvalTypeHeat] && isset($eventType['club'])) { mysql_query("\r\n\t\tLOCK TABLES\r\n\t\t\trundentyp READ\r\n\t\t\t, runde READ\r\n\t\t\t, serie READ\r\n\t\t\t, resultat READ \r\n\t\t\t, serienstart WRITE\r\n\t"); // if this is a combined event, rank all rounds togheter $heatorder = "serie.xSerie, "; $roundSQL = ""; if ($combined) { $roundSQL = "AND serie.xRunde IN ("; $res_c = mysql_query("SELECT xRunde FROM runde WHERE xWettkampf = " . $presets['event']); while ($row_c = mysql_fetch_array($res_c)) { $roundSQL .= $row_c[0] . ","; } $roundSQL = substr($roundSQL, 0, -1) . ")"; } else { $roundSQL = "AND serie.xRunde = {$round}"; } $result = mysql_query("\r\n\t\tSELECT \r\n\t\t\tresultat.Leistung\r\n\t\t\t, serienstart.xSerienstart\r\n\t\t\t, serienstart.xSerie\r\n\t\t\t, serienstart.xStart\r\n\t\t\t, serie.Wind\r\n\t\t\t, serienstart.Rang\t\t\t\r\n\t\tFROM\r\n\t\t\tresultat\r\n\t\t\t, serienstart\r\n\t\t\t, serie\r\n\t\tWHERE resultat.xSerienstart = serienstart.xSerienstart\r\n\t\t\r\n\t\tAND serienstart.xSerie = serie.xSerie\r\n\t\t{$roundSQL}\r\n\t\tORDER BY\r\n\t\t\t{$heatorder}\r\n\t\t\tresultat.Leistung ASC\r\n\t"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $heat = 0; $perf = 0; $i = 0; $rank = 0; while ($row = mysql_fetch_row($result)) { // check on codes < 0 if ($row[0] < 0) { mysql_query("UPDATE serienstart SET" . " Rang = 0" . " WHERE xSerienstart = " . $row[1]); } else { if ($eval != $cfgEvalType[$strEvalTypeAll] && $heat != $row[2]) { $i = 0; // restart ranking $perf = 0; } if ($row[5] != 0) { // rank $i++; // increment ranking if ($perf < $row[0]) { // compare with previous performance $rank = $i; // next rank (only if not same performance) } mysql_query("UPDATE serienstart SET" . " Rang = " . $rank . " WHERE xSerienstart = " . $row[1]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } $heat = $row[2]; // keep current heat ID $perf = $row[0]; // keep current performance } } mysql_free_result($result); } mysql_query("UNLOCK TABLES"); } // end: only for SVM with heat single --> set back the ranks per heat } if ($autoRank) { // automatic ranking returns to event monitor return; } // // get results from timing system // - save directly in database // if ($_GET['arg'] == "time_measurement") { AA_timing_getResultsManual($round); } // // print HTML page header // AA_results_printHeader($presets['category'], $presets['event'], $round); $mergedMain = AA_checkMainRound($round); if ($mergedMain != 1) { // read round data if ($round > 0) { $status = AA_getRoundStatus($round); // No action yet if ($status == $cfgRoundStatus['open'] || $status == $cfgRoundStatus['enrolement_done'] || $status == $cfgRoundStatus['heats_in_progress']) { AA_printWarningMsg($strHeatsNotDone); } else { if ($status == $cfgRoundStatus['enrolement_pending']) { AA_printWarningMsg($strEnrolementNotDone); } else { if ($status >= $cfgRoundStatus['heats_done']) { AA_heats_printNewStart($presets['event'], $round, "event_results.php"); $nextRound = AA_getNextRound($presets['event'], $round); // show qualification form if another round follows if ($nextRound > 0) { $result = mysql_query("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tQualifikationSieger\r\n\t\t\t\t\t, QualifikationLeistung\r\n\t\t\t\tFROM\r\n\t\t\t\t\trunde\r\n\t\t\t\tWHERE xRunde = {$round}\r\n\t\t\t"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (($row = mysql_fetch_row($result)) == TRUE) { } ?> <p/> <table class='dialog'> <tr> <form action='event_results.php' method='post' name='qualification'> <td class='dialog'> <input type='hidden' name='arg' value='set_qual' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <?php echo $strQualification . " " . $strQualifyTop; ?> </td> <td class='dialog'> <input class='nbr' name='qual_top' type='text' maxlength='4' value='<?php echo $row[0]; ?> ' /></td> <td class='dialog'> <?php echo $strQualification . " " . $strQualifyPerformance; ?> </td> <td class='dialog'> <input class='nbr' name='qual_perf' type='text' maxlength='4' value='<?php echo $row[1]; ?> ' /></td> <td> <button type='submit'> <?php echo $strChange; ?> </button> </td> </form> </tr> </table> <p/> <?php $printed = TRUE; // qualification parameters printed // ET round found mysql_free_result($result); } // ET DB error } // ET next round // check if round is final $sql_r = "SELECT \r\n rt.Typ\r\n FROM\r\n runde as r\r\n LEFT JOIN rundentyp as rt USING (xRundentyp)\r\n WHERE\r\n r.xRunde=" . $round; $res_r = mysql_query($sql_r); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $order = "ASC"; if (mysql_num_rows($res_r) == 1) { $row_r = mysql_fetch_row($res_r); if ($row_r[0] == 'F') { $order = "DESC"; } } // display all athletes if ($relay == FALSE) { // single event $query = "SELECT r.Bahnen" . ", rt.Name" . ", rt.Typ" . ", s.xSerie" . ", s.Bezeichnung" . ", s.Wind" . ", s.Film" . ", an.Bezeichnung" . ", ss.xSerienstart" . ", ss.Position" . ", ss.Rang" . ", ss.Qualifikation" . ", a.Startnummer" . ", at.Name" . ", at.Vorname" . ", at.Jahrgang" . ", if('" . $svm . "', t.Name, IF(a.Vereinsinfo = '', v.Name, a.Vereinsinfo))" . ", LPAD(s.Bezeichnung,5,'0') as heatid" . ", s.Handgestoppt" . ", at.Land" . ", ss.Bemerkung" . ", at.xAthlet" . " FROM runde AS r" . ", serie AS s" . ", serienstart AS ss" . ", start AS st" . ", anmeldung AS a" . ", athlet AS at" . ", verein AS v" . " LEFT JOIN team AS t ON(a.xTeam = t.xTeam)" . " LEFT JOIN rundentyp AS rt" . " ON rt.xRundentyp = r.xRundentyp" . " LEFT JOIN anlage AS an" . " ON an.xAnlage = s.xAnlage" . " WHERE r.xRunde = " . $round . " AND s.xRunde = r.xRunde" . " AND ss.xSerie = s.xSerie" . " AND st.xStart = ss.xStart" . " AND a.xAnmeldung = st.xAnmeldung" . " AND at.xAthlet = a.xAthlet" . " AND v.xVerein = at.xVerein" . " ORDER BY heatid " . $order . ", ss.Position"; } else { // relay event $query = "SELECT r.Bahnen" . ", rt.Name" . ", rt.Typ" . ", s.xSerie" . ", s.Bezeichnung" . ", s.Wind" . ", s.Film" . ", an.Bezeichnung" . ", ss.xSerienstart" . ", ss.Position" . ", ss.Rang" . ", ss.Qualifikation" . ", sf.Name" . ", if('" . $svm . "', t.Name, v.Name)" . ", LPAD(s.Bezeichnung,5,'0') as heatid" . ", s.Handgestoppt" . ", ss.Bemerkung" . " FROM runde AS r" . ", serie AS s" . ", serienstart AS ss" . ", start AS st" . ", staffel AS sf" . ", verein AS v" . " LEFT JOIN team AS t ON(sf.xTeam = t.xTeam)" . " LEFT JOIN rundentyp AS rt" . " ON rt.xRundentyp = r.xRundentyp" . " LEFT JOIN anlage AS an" . " ON an.xAnlage = s.xAnlage" . " WHERE r.xRunde = " . $round . " AND s.xRunde = r.xRunde" . " AND ss.xSerie = s.xSerie" . " AND st.xStart = ss.xStart" . " AND sf.xStaffel = st.xStaffel" . " AND v.xVerein = sf.xVerein" . " ORDER BY heatid " . $order . ", ss.Position"; } $result = mysql_query($query); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { AA_results_printMenu($round, $status, $prog_mode, 'track'); // initialize variables $h = 0; // heat counter $p = 0; // position counter (to evaluate empty heats $i = 0; // input counter (an individual id is assigned to each // input field, focus is then moved to the next input // field by calling $i+1) $rowclass = 'odd'; $tracks = 0; $btn = new GUI_Button('', ''); // create button object ?> <p/> <table class='dialog'> <?php while ($row = mysql_fetch_row($result)) { $p++; // increment position counter /* * Heat headerline */ if ($h != $row[3]) { $tracks = $row[0]; // keep nbr of planned tracks // fill previous heat with empty tracks if ($p > 1) { printEmptyTracks($p, $tracks, 5 + $c); } $h = $row[3]; // keep heat ID $p = 1; // start with track one if (is_null($row[1])) { // only one round $title = "{$strFinalround}"; } else { // more than one round $title = "{$row['1']}"; } // increment colspan to include ranking and qualification $c = 0; if ($status == $cfgRoundStatus['results_done']) { $c++; if ($nextRound > 0) { $c++; } } ?> <tr> <form action='event_results.php#heat_<?php echo $row[4]; ?> ' method='post' name='heat_id_<?php echo $h; ?> '> <th class='dialog' colspan='3'> <?php echo $title; ?> <input type='hidden' name='arg' value='change_heat_name' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[3]; ?> ' /> <input class='nbr' type='text' name='id' maxlength='2' value='<?php echo $row[4]; ?> ' onChange='document.heat_id_<?php echo $h; ?> .submit()' /> <a name='heat_<?php echo $row[4]; ?> ' /> </th> </form> <?php if ($status != $cfgRoundStatus['results_done']) { ?> <form action='controller.php' method='post' name='filmheat_<?php echo $row[4]; ?> ' target='controller'> <th class='dialog' colspan='2'> <?php echo $strFilm; ?> <input type='hidden' name='act' value='saveFilm' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[3]; ?> ' /> <input class='nbr' type='text' name='film' id='in_<?php echo $i; ?> ' maxlength='3' value='<?php echo $row[6]; ?> ' onChange="submitForm(document.filmheat_<?php echo $row[4]; ?> , 'in_<?php echo $i + 1; ?> ')" /> </th> </form> <?php $i++; // next element } else { // results done ?> <th class='dialog' colspan='2'> <?php echo $strFilm . " " . $row[6]; ?> </th> <?php } // track discipline with wind if ($layout == $cfgDisciplineType[$strDiscTypeTrack]) { if ($status != $cfgRoundStatus['results_done']) { ?> <form action='controller.php' method='post' name='windheat_<?php echo $row[4]; ?> ' target='controller'> <th class='dialog' colspan='<?php echo 1 + $c; ?> '> <?php echo $strWind; ?> <input type='hidden' name='act' value='saveWind' /> <input type='hidden' name='obj' value='windheat_<?php echo $row[4]; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[3]; ?> ' /> <input class='nbr' type='text' name='wind' id='in_<?php echo $i; ?> ' maxlength='5' value='<?php echo $row[5]; ?> ' onChange="submitForm(document.windheat_<?php echo $row[4]; ?> , 'in_<?php echo $i + 1; ?> ')" /> </th> </form> <?php $i++; // next element } else { // results done ?> <th class='dialog' colspan='2'> <?php echo $strWind . " " . $row[5]; ?> </th> <?php } } else { ?> <th class='dialog' colspan='<?php echo 1 + $c; ?> ' /> <?php } // ET track discipline with wind // can set "hand taken time" if ($row[18] == 1 && $relay == false) { $handstopped = "checked"; } elseif ($row[15] == 1 && $relay == true) { $handstopped = "checked"; } else { $handstopped = ""; } if ($status != $cfgRoundStatus['results_done']) { ?> <form action='controller.php' method='post' name='handstopped_<?php echo $row[4]; ?> ' target='controller'> <th class='dialog'><?php echo $strHandStopped; ?> <input type='hidden' name='act' value='saveHandStopped' /> <input type='hidden' name='obj' value='handstopped_<?php echo $row[4]; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[3]; ?> ' /> <input type="checkbox" name="handstopped" id='in_<?php echo $i; ?> ' onChange="submitForm(document.handstopped_<?php echo $row[4]; ?> , 'in_<?php echo $i + 1; ?> ')" <?php echo $handstopped; ?> > </th> </form> <?php $i++; // next element } else { ?> <th class='dialog'><?php echo $strHandStopped; ?> <input type="checkbox" name="handstopped" <?php echo $handstopped; ?> disabled> </th> <?php } ?> </tr> <?php /* * Column header */ if ($relay == FALSE) { // athlete display ?> <tr> <th class='dialog'><?php echo $strPositionShort; ?> </th> <th class='dialog' colspan='2'><?php echo $strAthlete; ?> </th> <th class='dialog'><?php echo $strYearShort; ?> </th> <th class='dialog'><?php echo $strCountry; ?> </th> <th class='dialog'><?php if ($svm) { echo $strTeam; } else { echo $strClub; } ?> </th> <th class='dialog'><?php echo $strPerformance; ?> </th> <?php } else { // relay display ?> <tr> <th class='dialog'><?php echo $strPositionShort; ?> </th> <th class='dialog'><?php echo $strRelay; ?> </th> <th class='dialog'><?php if ($svm) { echo $strTeam; } else { echo $strClub; } ?> </th> <th class='dialog'><?php echo $strPerformance; ?> </th> <?php } if ($status == $cfgRoundStatus['results_done']) { ?> <th class='dialog'><?php echo $strRank; ?> </th> <?php if ($nextRound > 0) { ?> <th class='dialog'><?php echo $strQualification; ?> </th> <?php } } ?> <th class='dialog'><?php echo $strResultRemark; ?> </th> </tr> <?php } // ET new heat /* * Empty tracks */ if ($layout == $cfgDisciplineType[$strDiscTypeTrack] || $layout == $cfgDisciplineType[$strDiscTypeTrackNoWind] || $layout == $cfgDisciplineType[$strDiscTypeRelay]) { // current track and athlete's position not identical if ($p < $row[9]) { $p = printEmptyTracks($p, $row[9] - 1, 5 + $c); } } // ET empty tracks /* * Athlete data lines */ $p = $row[9]; // keep position if ($p % 2 == 0) { // even row numer $rowclass = 'even'; } else { // odd row number $rowclass = 'odd'; } if ($relay == FALSE) { ?> <tr class='<?php echo $rowclass; ?> '> <td class='forms_right'><?php echo $row[9]; /* position */ ?> </td> <td class='forms_right'><?php echo $row[12]; /* start nbr */ ?> </td> <td><?php echo $row[13] . " " . $row[14]; /* name */ ?> </td> <td class='forms_ctr'><?php echo AA_formatYearOfBirth($row[15]); ?> </td> <td><?php echo $row[19] != '' && $row[19] != '-' ? $row[19] : ' '; ?> </td> <td><?php echo $row[16]; /* club */ ?> </td> <?php } else { // relay ?> <tr class='<?php echo $rowclass; ?> '> <td class='forms_right'><?php echo $row[9]; /* position */ ?> </td> <td><?php echo $row[12]; /* relay name */ ?> </td> <td><?php echo $row[13]; /* club */ ?> </td> <?php } $sql = "SELECT rs.xResultat, \r\n\t\t\t\t\t\t\t rs.Leistung, \r\n\t\t\t\t\t\t\t rs.Info, \r\n\t\t\t\t\t\t\t d.Strecke \r\n\t\t\t\t\t\t FROM resultat AS rs \r\n\t\t\t\t\t LEFT JOIN serienstart AS ss USING(xSerienstart) \r\n\t\t\t\t\t LEFT JOIN serie AS se USING(xSerie) \r\n\t\t\t\t\t LEFT JOIN runde AS ru USING(xRunde) \r\n\t\t\t\t\t LEFT JOIN wettkampf AS w USING(xWettkampf) \r\n\t\t\t\t\t LEFT JOIN disziplin AS d USING(xDisziplin) \r\n\t\t\t\t\t\t WHERE rs.xSerienstart = " . $row[8] . " \r\n\t\t\t\t\t ORDER BY rs.Leistung ASC;"; $res = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $perf = ''; $resrow = mysql_fetch_array($res); if ($resrow != NULL) { // result found /*$secflag = false; if(substr($resrow[1],0,2) >= 60){ $secflag = true; }*/ $secflag = intval($resrow['Strecke']) <= 400; $perf = AA_formatResultTime($resrow[1], false, $secflag); } if ($status != $cfgRoundStatus['results_done']) { ?> <form action='controller.php' method='post' name='perf_<?php echo $i; ?> ' target='controller'> <td> <input type='hidden' name='act' value='saveResult' /> <input type='hidden' name='obj' value='perf_<?php echo $i; ?> ' /> <input type='hidden' name='type' value='<?php echo $layout; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[8]; ?> ' /> <input type='hidden' name='item' value='<?php echo $resrow[0]; ?> ' /> <input class='perftime' type='text' name='perf' id='in_<?php echo $i; ?> ' maxlength='12' value='<?php echo $perf; ?> ' onChange="submitForm(document.perf_<?php echo $i; ?> , 'in_<?php echo $i + 1; ?> ')" /> </td> </form> <form action='controller.php' method='post' name='remark_<?php echo $i; ?> ' target='controller'> <td> <input type='hidden' name='act' value='saveResult' /> <input type='hidden' name='obj' value='perf_<?php echo $i; ?> ' /> <input type='hidden' name='type' value='<?php echo $layout; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[8]; ?> ' /> <input type='hidden' name='item' value='<?php echo $resrow[0]; ?> ' /> <input type='hidden' name='xAthlete' value='<?php echo $row[21]; ?> ' /> <input class='textshort' type='text' name='remark' id='in_<?php echo $i; ?> ' maxlength='5' value='<?php if ($relay) { echo $row[16]; } else { echo $row[20]; } ?> ' onChange="submitForm(document.remark_<?php echo $i; ?> , 'in_<?php echo $i + 1; ?> ')" /> </td> </form> <?php $i++; // next element } else { // results done ?> <td class='forms_right'><?php echo $perf; ?> </td> <?php } mysql_free_result($res); if ($status == $cfgRoundStatus['results_done']) { if ($row[10] > 0) { ?> <form action='event_results.php' method='post' name='rank_<?php echo $i; ?> '> <td> <input type='hidden' name='arg' value='save_rank' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='focus' value='rank_<?php echo $i; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[8]; ?> ' /> <input class='nbr' type='text' name='rank' maxlength='3' value='<?php echo $row[10]; ?> ' onChange='document.rank_<?php echo $i; ?> .submit()' /> </td> </form> <?php $i++; // next element if ($nextRound > 0) { ?> <form action='event_results.php' method='post' name='qual_<?php echo $i; ?> '> <td> <input type='hidden' name='arg' value='change_qual' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='focus' value='qual_<?php echo $i; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[8]; ?> ' /> <input type='hidden' name='oldqual' value='<?php echo $row[11]; ?> ' /> <input type='hidden' name='heat' value='<?php echo $row[3]; ?> ' /> <?php $dropdown = new GUI_Select('qual', 1, "document.qual_{$i}.submit()"); $dropdown->addOptionNone(); foreach ($cfgQualificationType as $type) { $dropdown->addOption($type['text'], $type['code']); if ($type['code'] == $row[11]) { $dropdown->selectOption($type['code']); } } $dropdown->printList(); ?> </td> </form> <?php $i++; // next element } // qualification info } else { // no rank ?> <td /> <?php } // ET no rank ?> <td class='perftime'><?php if ($relay) { echo $row[16]; } else { echo $row[20]; } ?> </td> <?php } // ET 'results_done' ?> <td> <?php $btn->set("event_results.php?arg=del_start&item={$row['8']}&round={$round}", $strDelete); $btn->printButton(); ?> </td> <?php } // ET DB error } // Fill last heat with empty tracks for disciplines run in // individual tracks if ($layout == $cfgDisciplineType[$strDiscTypeTrack] || $layout == $cfgDisciplineType[$strDiscTypeTrackNoWind] || $layout == $cfgDisciplineType[$strDiscTypeRelay]) { if ($p > 0) { // heats set up $p++; printEmptyTracks($p, $tracks, 5 + $c); } } // ET track disciplines ?> </table> <?php mysql_free_result($result); } // ET DB error } } } } // ET round selected if (!empty($presets['focus'])) { ?> <script type="text/javascript"> <!-- if(<?php echo $presets['focus']; ?> .rank) { <?php echo $presets['focus']; ?> .rank.focus(); <?php echo $presets['focus']; ?> .rank.select(); window.scrollBy(0,200); } else if(<?php echo $presets['focus']; ?> .qual) { <?php echo $presets['focus']; ?> .qual.focus(); window.scrollBy(0,200); } //--> </script> <?php } ?> </body> </html> <?php } else { AA_printErrorMsg($strErrMergedRound); } }
echo $row[0]; ?> ' /> <td class='forms' colspan="3"> <?php // check on firstheat // athlete can be a "first heat runner" on max 2 disciplines // flag is set on start for event $resFh = mysql_query("SELECT \r\n s.xStart\r\n , s.Erstserie\r\n , d.Kurzname\r\n , w.Info\r\n FROM\r\n start as s\r\n , wettkampf as w\r\n , disziplin as d\r\n WHERE\r\n s.xAnmeldung = {$row['0']}\r\n AND w.xWettkampf = s.xWettkampf\r\n AND d.xDisziplin = w.xDisziplin"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $s1 = new GUI_Select("firstheat1", 1, "document.firstheat.submit()"); $s2 = new GUI_Select("firstheat2", 1, "document.firstheat.submit()"); $s1->addOption("-", 0); $s2->addOption("-", 0); // show max 2 select boxes with each discipline $c = 0; while ($rowFh = mysql_fetch_array($resFh)) { $s1->addOption("{$rowFh['2']} ({$rowFh['3']})", $rowFh[0]); $s2->addOption("{$rowFh['2']} ({$rowFh['3']})", $rowFh[0]); if ($rowFh[1] == "y") { if ($c == 0) { $s1->selectOption($rowFh[0]); $c++; } elseif ($c == 1) { $s2->selectOption($rowFh[0]); $c++; } } }
?> .submit()"/> <?php } else { if ($fix_disc) { ?> <input type="hidden" name="formula" value="<?php echo $row[4]; ?> "/> <?php echo $row[4]; } else { $dropdown = new GUI_Select('formula', 1, "document.event_{$row['0']}.submit()"); foreach ($cvtFormulas[$row[3]] as $key => $value) { $dropdown->addOption($key, $key); if ($row[4] == $key) { $dropdown->selectOption($key); } } $dropdown->printList(); } } ?> </td> <?php $check = ""; $check1 = ""; $check2 = ""; $checkLast = ""; // measure wind
<input name='event' type='hidden' value='<?php echo $row[8]; ?> ' /> <input name='team' type='hidden' value='<?php echo $row[10]; ?> ' /> <input name='relay' type='hidden' value='<?php echo $row[5]; ?> ' /> <?php // Drop down list of all athletes in team $dropdown = new GUI_Select("athlete", 1); $dropdown->addOption($strAllRegisteredRelayTeam, 0); while ($ath_row = mysql_fetch_row($res)) { $dropdown->addOption($ath_row[1], $ath_row[0]); } mysql_free_result($res); $dropdown->printList(false); ?> </td> <td class='forms'><input name='position' class='nbr' type='text' maxlength='2' value='' onchange='this.form.submit()'/> </td> </form> <?php } // ET DB Error (unassigned athletes) ?>
?> " title="<?php echo $strBackupOK; ?> "/> </td> <td><?php echo $strBackupInfo; ?> </tr> </tr> <tr> <td> <?php $dropdown = new GUI_Select('xMeeting', 1, ''); $dropdown->addOption($strAllMeetings, "-"); $dropdown->addOptionsFromDB("select xMeeting, Name from meeting order by DatumVon, DatumBis"); $dropdown->selectOption("-"); $dropdown->printList(); ?> </td> </tr> <tr> <td><input type="checkbox" value="included" name="base" checked="checked" /><?php echo $strBasdataIncluded; ?> </tr> </tr> <tr class="even"> <td> <button name='backup' type='submit'><?php
function AA_results_Tech($round, $layout) { require './lib/cl_gui_button.lib.php'; require './config.inc.php'; require './lib/common.lib.php'; require './lib/heats.lib.php'; require './lib/results.lib.php'; require './lib/utils.lib.php'; require './lib/cl_wind.lib.php'; $presets = AA_results_getPresets($round); // read GET/POST variables $nextRound = AA_getNextRound($presets['event'], $round); $svm = AA_checkSVM(0, $round); // decide whether to show club or team name $prog_mode = AA_results_getProgramMode(); // // terminate result processing // if ($_GET['arg'] == 'results_done' || $prog_mode == 2 && $_GET['arg'] != 'change_results' && $_GET['arg'] != 'del_results') { $eval = AA_results_getEvaluationType($round); $combined = AA_checkCombined(0, $round); mysql_query("LOCK TABLES r READ, s READ, ss READ, runde READ"); // if this is a combined event, rank all rounds togheter $roundSQL = ""; $roundSQL2 = ""; if ($combined) { $roundSQL = " s.xRunde IN ("; $roundSQL2 = " s.xRunde IN ("; $res_c = mysql_query("SELECT xRunde FROM runde WHERE xWettkampf = " . $presets['event']); while ($row_c = mysql_fetch_array($res_c)) { $roundSQL .= $row_c[0] . ","; $roundSQL2 .= $row_c[0] . ","; } $roundSQL = substr($roundSQL, 0, -1) . ")"; $roundSQL2 = substr($roundSQL2, 0, -1) . ")"; } else { $roundSQL = " s.xRunde = {$round}"; $roundSQL2 = " s.xRunde = {$round}"; } // number of athletes $sql = "SELECT \r\n ss.xSerienstart \r\n FROM \r\n runde AS r\r\n LEFT JOIN serie AS s ON (s.xRunde = r.xRunde)\r\n LEFT JOIN serienstart AS ss ON (ss.xSerie = s.xSerie)\r\n LEFT JOIN start AS st ON (st.xStart = ss.xStart)\r\n LEFT JOIN anmeldung AS a ON (a.xAnmeldung = st.xAnmeldung)\r\n LEFT JOIN athlet AS at ON (at.xAthlet = a.xAthlet)\r\n WHERE r.xRunde = " . $round . "\r\n "; $res = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $count_athlete = mysql_num_rows($res); } // evaluate max. nbr of results entered $r = 0; if ($prog_mode == 2) { // create array for calculate field focus $sql_r = "SELECT \r\n ru.Versuche, \r\n LPAD(s.Bezeichnung,5,'0') as heatid, \r\n if (ss.Position2 > 0, if (ss.Position3 > 0, ss.Position3, ss.Position2) , ss.Position ) as posOrder \r\n , ss.Position\r\n , ss.Position2\r\n , ss.Position3 \r\n , ss.xSerienstart\r\n , ss.Rang\r\n , s.MaxAthlet\r\n , s.xSerie \r\n , r.Leistung \r\n FROM \r\n resultat AS r\r\n LEFT JOIN serienstart AS ss ON (r.xSerienstart = ss.xSerienstart)\r\n LEFT JOIN serie AS s ON (ss.xSerie = s.xSerie )\r\n LEFT JOIN runde AS ru ON (s.xRunde = ru.xRunde) \r\n WHERE " . $roundSQL2 . " \r\n ORDER BY posOrder, r.xResultat "; $result_r = mysql_query($sql_r); $heatStart = ''; $arr_perfAthlete = array(); $arr_perfAthleteValids = array(); $c = 0; $h = 0; $pos2 = 0; // calculate attempts of athletes while ($row_r = mysql_fetch_row($result_r)) { if ($heatStart != $row_r[6]) { // new heat start if (!empty($heatStart)) { $arr_perfAthlete[$h] = $c; if ($c > 0) { $arr_perfAthleteValids[$h] = $c; } $h++; if ($h >= $row_r[8] && $row_r[4] > 0) { // maxAthlete reached by second/third Position break; } } $c = 0; if ($row_r[10] > 0 || $row_r[10] < $cfgInvalidResult['DSQ']['code']) { $c++; } elseif ($row_r[10] == $cfgInvalidResult['DNS']['code']) { $c = $cfgInvalidResult['DNS']['code']; } elseif ($row_r[10] == $cfgInvalidResult['DNF']['code']) { $c = $cfgInvalidResult['DNF']['code']; } elseif ($row_r[10] == $cfgInvalidResult['DSQ']['code']) { $c = $cfgInvalidResult['DSQ']['code']; } } else { if ($row_r[10] > 0 || $row_r[10] < $cfgInvalidResult['DSQ']['code']) { $c++; } elseif ($row_r[10] == $cfgInvalidResult['DNS']['code']) { $c = $cfgInvalidResult['DNS']['code']; } elseif ($row_r[10] == $cfgInvalidResult['DNF']['code']) { $c = $cfgInvalidResult['DNF']['code']; } elseif ($row_r[10] == $cfgInvalidResult['DSQ']['code']) { $c = $cfgInvalidResult['DSQ']['code']; } } $heatStart = $row_r[6]; $maxAthlete = $row_r[8]; $pos2 = $row_r[4]; } // last athlete if ($h >= $maxAthlete && $pos2 > 0) { } else { $arr_perfAthlete[$h] = $c; if ($c > 0) { $arr_perfAthleteValids[$h] = $c; } } $p1 = 0; $p2 = 0; //calculate doing new position foreach ($arr_perfAthlete as $key => $val) { if ($val == 3 || $val < 0) { $p1++; } elseif ($val == 5 || $val < 0) { $p2++; } } if (count($arr_perfAthlete) == $p1) { AA_rankingForNewPosition($round, 2); AA_newPosition($round, 2); } elseif (count($arr_perfAthlete) == $p2) { AA_rankingForNewPosition($round, 3); AA_newPosition($round, 3); } $sql = "SELECT \r\n COUNT(*), \r\n ru.Versuche, \r\n LPAD(s.Bezeichnung,5,'0') as heatid, \r\n if (ss.Position2 > 0, if (ss.Position3 > 0, ss.Position3, ss.Position2) , ss.Position ) as posOrder \r\n , ss.Position\r\n , ss.Position2\r\n , ss.Position3 \r\n , ss.xSerienstart\r\n , ss.Rang\r\n , s.MaxAthlet\r\n , s.xSerie \r\n , r.Leistung\r\n \r\n FROM \r\n resultat AS r\r\n LEFT JOIN serienstart AS ss ON (r.xSerienstart = ss.xSerienstart)\r\n LEFT JOIN serie AS s ON (ss.xSerie = s.xSerie )\r\n LEFT JOIN runde AS ru ON (s.xRunde = ru.xRunde) \r\n WHERE " . $roundSQL2 . " \r\n GROUP BY r.xSerienstart\r\n ORDER BY posOrder "; $result = mysql_query($sql); } else { $result = mysql_query("SELECT COUNT(*), ru.Versuche" . " FROM resultat AS r" . " LEFT JOIN serienstart AS ss ON (r.xSerienstart = ss.xSerienstart)" . " LEFT JOIN serie AS s ON (ss.xSerie = s.xSerie)" . " LEFT JOIN runde AS ru ON (s.xRunde = ru.xRunde)" . " WHERE " . " {$roundSQL2} " . " GROUP BY r.xSerienstart" . " ORDER BY 1 DESC"); } if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if ($prog_mode == 2) { // decentral with ranking $z = 0; $pass = 0; $arr_attAthlete = array(); $maxAthlete = 0; while ($row = mysql_fetch_row($result)) { if ($z == 0) { // first row $maxatt = $row[1]; $maxAthlete = $row[9]; $xSerie = $row[10]; } if ($row[11] != $cfgInvalidResult['DNS']['code']) { $arr_attAthlete[] = $row[0]; } $keep_rank = $row[8]; $z++; } if ($count_athlete < $maxAthlete) { $maxAthlete = $count_athlete; // update max athlete in serie AA_setMaxAthlete($xSerie, $maxAthlete); } $maxAthleteAtt = max($arr_attAthlete); $minAthleteAtt = min($arr_attAthlete); $onlyMaxAthlete = false; if ($count_athlete > $cfgMaxAthlete) { if ($maxAthleteAtt == $minAthleteAtt && $minAthleteAtt == $cfgAfterAttempts1) { $onlyMaxAthlete = true; } elseif ($maxAthleteAtt > $cfgAfterAttempts1) { $onlyMaxAthlete = true; } } if ($onlyMaxAthlete && $count_athlete > $cfgMaxAthlete) { $c = 0; $arr_attAthlete_new = array(); foreach ($arr_attAthlete as $key => $val) { $c++; $arr_attAthlete_new[] = $val; if ($c >= $maxAthlete) { break; } } $arr_attAthlete = $arr_attAthlete_new; $maxAthleteAtt = max($arr_attAthlete); $minAthleteAtt = min($arr_attAthlete); } $r = $maxAthleteAtt; $first_row = false; $maxAthleteAtt = max($arr_perfAthleteValids); $minAthleteAtt = min($arr_perfAthleteValids); if ($maxAthleteAtt == $cfgAfterAttempts1 && $maxAthleteAtt == $minAthleteAtt) { $pass = 2; } elseif ($maxAthleteAtt == $cfgAfterAttempts2 && $maxAthleteAtt == $minAthleteAtt) { $pass = 3; } elseif ($maxAthleteAtt > $cfgAfterAttempts1 && $maxAthleteAtt < $cfgAfterAttempts2 + 1) { $pass = 2; } elseif ($maxAthleteAtt == $cfgAfterAttempts2 + 1) { $pass = 3; } elseif ($maxAthleteAtt == $minAthleteAtt && $z == $count_athlete) { $first_row = true; $maxAthleteAtt++; } $fieldFocus = 1; } else { $row = mysql_fetch_row($result); $r = $row[0]; } mysql_free_result($result); } $minPerfAthl = min($arr_perfAthleteValids); $maxPerfAthl = max($arr_perfAthleteValids); $keep_val = ''; $keep_key = ''; foreach ($arr_perfAthlete as $key => $val) { if (empty($keep_val) && !empty($val)) { $fieldFocus = $maxatt + 1 + $maxPerfAthl; } $keep_key = $key; if ($keep_val > $val) { if ($val == $cfgInvalidResult['DNS']['code'] || $val == $cfgInvalidResult['DNF']['code'] || $val == $cfgInvalidResult['DSQ']['code']) { continue; } $fieldFocus = $key * ($maxatt + 1) + $maxPerfAthl; break; } $keep_val = $val; } if ($pos2 == 0) { if ($count_athlete > count($arr_perfAthlete)) { $fieldFocus = ($keep_key + 1) * ($maxatt + 1) + $maxPerfAthl; } elseif ($count_athlete == count($arr_perfAthlete) && $minPerfAthl == $maxPerfAthl) { $fieldFocus = $maxPerfAthl + 1; } } else { if ($minPerfAthl == $maxPerfAthl) { $fieldFocus = $maxPerfAthl + 1; } } if ($r > 0) { mysql_query("DROP TABLE IF EXISTS tempresult"); // temporary table if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { mysql_query("\r\n LOCK TABLES\r\n resultat READ\r\n , serie READ\r\n , wettkampf READ\r\n , serienstart WRITE\r\n , tempresult WRITE\r\n "); // Set up a temporary table to hold all results for ranking. // The number of result columns varies according to the maximum // number of results per athlete. $qry = "\r\n CREATE TABLE tempresult (\r\n xSerienstart int(11)\r\n , xSerie int(11)"; for ($i = 1; $i <= $r; $i++) { $qry = $qry . ", Res" . $i . " int(9) default '0'"; $qry = $qry . ", Wind" . $i . " char(5) default '0'"; } $qry = $qry . ") TYPE=HEAP"; mysql_query($qry); // create temporary table if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // reset rank to 0 first $sql = " SELECT\r\n r.Leistung\r\n , r.Info\r\n , ss.xSerienstart\r\n , ss.xSerie\r\n FROM\r\n resultat as r\r\n LEFT JOIN serienstart as ss ON (r.xSerienstart = ss.xSerienstart)\r\n LEFT JOIN serie AS s ON (ss.xSerie = s.xSerie)\r\n WHERE \r\n {$roundSQL}\r\n AND r.Leistung <= 0\r\n ORDER BY\r\n ss.xSerienstart\r\n ,r.Leistung DESC"; $result = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { while ($row = mysql_fetch_row($result)) { mysql_query("\r\n UPDATE serienstart SET\r\n Rang = 0\r\n WHERE xSerienstart = {$row['2']}\r\n "); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } $result = mysql_query("\r\n SELECT\r\n r.Leistung\r\n , r.Info\r\n , ss.xSerienstart\r\n , ss.xSerie\r\n FROM\r\n resultat as r\r\n LEFT JOIN serienstart as ss ON (r.xSerienstart = ss.xSerienstart)\r\n LEFT JOIN serie AS s ON (ss.xSerie = s.xSerie)\r\n WHERE \r\n {$roundSQL}\r\n AND r.Leistung >= 0\r\n ORDER BY\r\n ss.xSerienstart\r\n ,r.Leistung DESC\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $ss = 0; $i = 0; // process every result while ($row = mysql_fetch_row($result)) { if ($ss != $row[2]) { // add one row per athlete to temp table if ($ss != 0) { for (; $i < $r; $i++) { // fill remaining result cols. $qry = $qry . ",0,''"; } mysql_query($qry . ")"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } // (re)set SQL statement $qry = "INSERT INTO tempresult VALUES({$row['2']},{$row['3']}"; $i = 0; } $qry = $qry . ",{$row['0']},'{$row['1']}'"; // add current result to query $ss = $row[2]; // keep athlete's ID $i++; // count nbr of results } mysql_free_result($result); // insert last pending data in temp table if ($ss != 0) { for (; $i < $r; $i++) { // fill remaining result cols. $qry = $qry . ",0,''"; } mysql_query($qry . ")"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } if ($eval == $cfgEvalType[$strEvalTypeHeat]) { // eval per heat $qry = "\r\n SELECT\r\n *\r\n FROM\r\n tempresult\r\n ORDER BY\r\n xSerie"; for ($i = 1; $i <= $r; $i++) { $qry = $qry . ", Res" . $i . " DESC"; } } else { // default: rank results from all heats together $qry = "\r\n SELECT\r\n *\r\n FROM\r\n tempresult\r\n ORDER BY "; $comma = ""; // order by available result columns for ($i = 1; $i <= $r; $i++) { $qry = $qry . $comma . "Res" . $i . " DESC"; $comma = ", "; } } $result = mysql_query($qry); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $heat = 0; $perf_old[] = ''; $j = 0; $rank = 0; // set rank for every athlete while ($row = mysql_fetch_row($result)) { for ($i = 0; $i <= $r; $i++) { $perf[$i] = $row[2 * $i + 2]; $wind[$i] = $row[2 * $i + 3]; } if ($eval == $cfgEvalType[$strEvalTypeHeat] && $heat != $row[1]) { $j = 0; // restart ranking $perf_old[] = ''; } $j++; // increment ranking if ($perf_old != $perf) { // compare performances $rank = $j; // next rank (only if not same performance) } mysql_query("\r\n UPDATE serienstart SET\r\n Rang = {$rank}\r\n WHERE xSerienstart = {$row['0']}\r\n "); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $heat = $row[1]; // keep current heat ID $perf_old = $perf; } mysql_free_result($result); } mysql_query("DROP TABLE IF EXISTS tempresult"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } // ET DB error (create temp table) mysql_query("UNLOCK TABLES"); } // ET DB error (drop temp table) } // ET any results found AA_results_setNotStarted($round); // update athletes with no result if ($_GET['arg'] == 'results_done') { AA_utils_changeRoundStatus($round, $cfgRoundStatus['results_done']); } if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } AA_results_resetQualification($round); } // // calculate ranking points if needed // if ($_GET['arg'] == 'results_done' || $_POST['arg'] == 'save_rank' || $prog_mode == 2 && $_GET['arg'] != 'change_results' && $_GET['arg'] != 'del_results') { AA_utils_calcRankingPoints($round); } // // Qualify athletes after ranks are set // if ($_GET['arg'] == 'results_done' || $_POST['arg'] == 'save_rank' || $_POST['arg'] == 'set_qual' || $prog_mode == 2 && $_GET['arg'] != 'change_results' && $_GET['arg'] != 'del_results') { // read qualification criteria $qual_top = 0; $qual_perf = 0; $result = mysql_query("SELECT QualifikationSieger" . ", QualifikationLeistung" . " FROM runde" . " WHERE xRunde = " . $round); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (($row = mysql_fetch_row($result)) == TRUE) { } $qual_top = $row[0]; $qual_perf = $row[1]; mysql_free_result($result); } // ET DB error // qualify top athletes for next round if ($qual_top > 0) { mysql_query("LOCK TABLES serie READ, serienstart WRITE"); // get athletes by qualifying rank (random order if same rank) $result = mysql_query("SELECT serienstart.xSerienstart" . ", serienstart.xSerie" . ", serienstart.Rang" . " FROM serienstart" . ", serie" . " WHERE serienstart.Rang > 0" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round . " AND serienstart.Qualifikation = 0" . " ORDER BY serienstart.xSerie" . ", serienstart.Rang ASC" . ", RAND()"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $h = 0; unset($heats); // clear array containing heats while ($row = mysql_fetch_row($result)) { if ($h != $row[1]) { // new heat if (count($starts) > 0) { // count athletes $heats[] = $starts; // keep athletes per heat } unset($starts); $c = 0; } $starts[$row[0]] = $row[2]; // keep athlete's rank $h = $row[1]; // keep heat } $heats[] = $starts; // keep remaining athletes mysql_free_result($result); foreach ($heats as $starts) { $rankcount = array_count_values($starts); // count athletes/rank $q = 0; foreach ($starts as $id => $rank) { // check if more athletes per rank than qualifying spots if ($rankcount[$rank] > $qual_top - $rank + 1) { $qual = $cfgQualificationType['top_rand']['code']; } else { $qual = $cfgQualificationType['top']['code']; } if ($q < $qual_top) { mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $qual . " WHERE xSerienstart = " . $id); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $q++; // count nbr of qualified athletes } } } // END loop every heat } // ET DB error mysql_query("UNLOCK TABLES"); } // ET top athletes // qualify top performing athletes for next round if ($qual_perf > 0) { mysql_query("LOCK TABLES resultat READ, serie READ, serienstart WRITE"); // get remaining athletes by performance (random order if equal performance) /* other possible criteria to order equal performances: * - ranking within heat (not implemented) * - wind (not implemented) */ $result = mysql_query("SELECT serienstart.xSerienstart" . ", resultat.Leistung" . ", serienstart.Qualifikation" . " FROM resultat" . ", serienstart" . ", serie" . " WHERE resultat.xSerienstart = serienstart.xSerienstart" . " AND resultat.Leistung > 0" . " AND (serienstart.Qualifikation = 0 " . " OR serienstart.Qualifikation = " . $cfgQualificationType['waived']['code'] . ")" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round . " ORDER BY resultat.Leistung DESC" . ", RAND()"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $i = 1; $perf = 0; $cWaived = 0; while ($row = mysql_fetch_row($result)) { // count waived qualifyings if ($row[2] == $cfgQualificationType['waived']['code']) { $cWaived++; continue; } if ($i > $qual_perf) { // terminate if enough top performers found if ($perf != $row[1]) { // last perf. worse than last qualified $perf = 0; } break; } // if athletes waived on qualifying, set random code for next best athletes $code = $cfgQualificationType['perf']['code']; if ($i + $cWaived > $qual_perf) { $code = $cfgQualificationType['perf_rand']['code']; } mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $code . " WHERE xSerienstart = " . $row[0]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } $i++; $perf = $row[1]; // keep performance } // reset performance if enough qualifing spots if (mysql_num_rows($result) <= $qual_perf) { $perf = 0; } mysql_free_result($result); // Change qualification type to "perf_rand" for athletes with same // performance as the 1st unqualified athlete if ($perf != 0) { $result = mysql_query("SELECT serienstart.xSerienstart" . " FROM resultat" . ", serienstart" . ", serie" . " WHERE resultat.xSerienstart = serienstart.xSerienstart" . " AND resultat.Leistung = " . $perf . " AND serienstart.Qualifikation > 0" . " AND serienstart.xSerie = serie.xSerie" . " AND serie.xRunde = " . $round); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { while ($row = mysql_fetch_row($result)) { mysql_query("UPDATE serienstart SET" . " Qualifikation = " . $cfgQualificationType['perf_rand']['code'] . " WHERE xSerienstart = " . $row[0]); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } mysql_free_result($result); } } // ET unqualified athlete } // ET DB error qualified by performance mysql_query("UNLOCK TABLES"); } // ET top performances } // // print HTML page header // AA_results_printHeader($presets['category'], $presets['event'], $round); $mergedMain = AA_checkMainRound($round); if ($mergedMain != 1) { // read round data if ($round > 0) { $status = AA_getRoundStatus($round); // No action yet if ($status == $cfgRoundStatus['open'] || $status == $cfgRoundStatus['enrolement_done'] || $status == $cfgRoundStatus['heats_in_progress']) { AA_printWarningMsg($strHeatsNotDone); } else { if ($status == $cfgRoundStatus['enrolement_pending']) { AA_printWarningMsg($strEnrolementNotDone); } else { if ($status >= $cfgRoundStatus['heats_done']) { // get program mode $prog_mode = AA_results_getProgramMode(); AA_heats_printNewStart($presets['event'], $round, "event_results.php"); if ($pass == 2) { $fieldPos = "ss.Position2"; $order = "posOrder"; } elseif ($pass == 3) { $fieldPos = "ss.Position3"; $order = "ss.Rang DESC"; } else { $fieldPos = "ss.Position"; $order = "posOrder"; } // display all athletes $sql = "SELECT rt.Name" . ", rt.Typ" . ", s.xSerie" . ", s.Bezeichnung" . ", s.Wind" . ", an.Bezeichnung" . ", ss.xSerienstart" . ", ss.Position" . ", ss.Rang" . ", a.Startnummer" . ", at.Name" . ", at.Vorname" . ", at.Jahrgang" . ", if('" . $svm . "', t.Name, IF(a.Vereinsinfo = '', v.Name, a.Vereinsinfo))" . ", LPAD(s.Bezeichnung,5,'0') as heatid" . ", r.Versuche" . ", ss.Qualifikation" . ", at.Land" . ", r.nurBestesResultat" . ", ss.Bemerkung" . ", at.xAthlet" . ", if (ss.Position2 > 0, if (ss.Position3 > 0, ss.Position3, ss.Position2) , ss.Position ) as posOrder " . " FROM runde AS r" . ", serie AS s" . ", serienstart AS ss" . ", start AS st" . ", anmeldung AS a" . ", athlet AS at" . ", verein AS v" . " LEFT JOIN team AS t ON(a.xTeam = t.xTeam)" . " LEFT JOIN rundentyp AS rt" . " ON rt.xRundentyp = r.xRundentyp" . " LEFT JOIN anlage AS an" . " ON an.xAnlage = s.xAnlage" . " WHERE r.xRunde = " . $round . " AND s.xRunde = r.xRunde" . " AND ss.xSerie = s.xSerie" . " AND st.xStart = ss.xStart" . " AND a.xAnmeldung = st.xAnmeldung" . " AND at.xAthlet = a.xAthlet" . " AND v.xVerein = at.xVerein" . " ORDER BY heatid, posOrder"; $result = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $sum_athlet = mysql_num_rows($result); AA_results_printMenu($round, $status, $prog_mode, 'tech'); // initialize variables $h = 0; $i = 0; $r = 0; $rowclass = 'odd'; $r_rem = 0; $nextRound = AA_getNextRound($presets['event'], $round); // show qualification form if another round follows if ($nextRound > 0) { // next round $sql = "SELECT QualifikationSieger, \r\n QualifikationLeistung \r\n FROM runde \r\n WHERE xRunde = " . $round . ";"; $result2 = mysql_query($sql); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $row2 = mysql_fetch_row($result2); if ($row2 == true) { // round found ?> <p/> <form name="qualification" action="event_results.php" method="post"> <input type="hidden" name="arg" value="set_qual"/> <input type="hidden" name="round" value="<?php echo $round; ?> "/> <table class="dialog"> <tr> <td class="dialog"><?php echo $strQualification; ?> <?php echo $strQualifyTop; ?> </td> <td class="dialog"><input type="text" name="qual_top" class="nbr" maxlength="4" value="<?php echo $row2[0]; ?> "/></td> <td class='dialog'><?php echo $strQualification; ?> <?php echo $strQualifyPerformance; ?> </td> <td class='dialog'><input type="text" name="qual_perf" class="nbr" maxlength="4" value="<?php echo $row2[1]; ?> "/></td> <td><button type="submit"><?php echo $strChange; ?> </button></td> </tr> </table> </form> <form name="frmQual" action="event_results.php" method="post"> <input type="hidden" name="arg" value="change_qual"/> <input type="hidden" name="round" value="<?php echo $round; ?> "/> <input type="hidden" name="focus" value="qual_0"/> <input type="hidden" name="item" value="0"/> <input type="hidden" name="oldqual" value="0"/> <input type="hidden" name="heat" value="0"/> <input type="hidden" name="qual" value="0"/> </form> <script type="text/javascript"> function changequal(valFocus, valItem, valOldQual, valHeat, valQual){ var obj = document.frmQual; obj.focus.value = valFocus; obj.item.value = valItem; obj.oldqual.value = valOldQual; obj.heat.value = valHeat; obj.qual.value = valQual; obj.submit(); } </script> <p/> <?php } // ET round found } // ET DB error } // ET next round ?> <p/> <table class='dialog'> <?php $btn = new GUI_Button('', ''); // create button object while ($row = mysql_fetch_row($result)) { // // get entered number of attempts // $maxatt = $row[15]; if ($maxatt != 0) { $cfgProgramMode[$prog_mode]['tech_res'] = $maxatt; } /* * Heat headerline */ if ($h != $row[2]) { $h = $row[2]; // keep heat ID if (is_null($row[0])) { // only one round $title = "{$strFinalround}"; } else { // more than one round $title = "{$row['0']}"; } $c = 0; if ($status == $cfgRoundStatus['results_done'] || $prog_mode == 2) { $c++; // increment colspan to include ranking } ?> <tr> <form action='event_results.php#heat_<?php echo $row[3]; ?> ' method='post' name='heat_id_<?php echo $h; ?> '> <th class='dialog' colspan=' <?php echo 5 + $cfgProgramMode[$prog_mode]['tech_res'] + $c; ?> '> <?php echo $title; ?> <input type='hidden' name='arg' value='change_heat_name' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[2]; ?> ' /> <input class='nbr' type='text' name='id' maxlength='2' value='<?php echo $row[3]; ?> ' onChange='document.heat_id_<?php echo $h; ?> .submit()' /> <a name='heat_<?php echo $row[3]; ?> ' /> </th> </form> </tr> <tr> <th class='dialog'><?php echo $strPositionShort; ?> </th> <th class='dialog' colspan='2'><?php echo $strAthlete; ?> </th> <th class='dialog'><?php echo $strYearShort; ?> </th> <th class='dialog'><?php echo $strCountry; ?> </th> <th class='dialog'><?php if ($svm) { echo $strTeam; } else { echo $strClub; } ?> </th> <?php if ($status == $cfgRoundStatus['results_done'] || $prog_mode == 2) { ?> <th class='dialog'><?php echo $strRank; ?> </th> <?php if ($nextRound > 0) { ?> <th class='dialog'><?php echo $strQualification; ?> </th> <?php } } if ($cfgProgramMode[$prog_mode]['tech_res'] <= 1) { ?> <th class='dialog'><?php echo $strPerformance; ?> </th> <?php } else { for ($c = 1; $c <= $cfgProgramMode[$prog_mode]['tech_res']; $c++) { ?> <th class='dialog'><?php echo $c . "."; ?> </th> <?php } ?> <th class='dialog'><?php echo $strResultRemark; ?> </th> <?php } ?> </tr> <?php } // ET new heat /* * Athlete data lines */ $i++; if ($row[7] % 2 == 0) { // even row numer $rowclass = 'odd'; } else { // odd row number $rowclass = 'even'; } ?> <tr class='<?php echo $rowclass; ?> '> <td class='forms_right'><?php echo $row[7]; /* position */ ?> </td> <td class='forms_right'><?php echo $row[9]; /* start nbr */ ?> </td> <td nowrap><?php echo $row[10] . " " . $row[11]; /* name */ ?> </td> <td class='forms_ctr'><?php echo AA_formatYearOfBirth($row[12]); ?> </td> <td><?php echo $row[17] != '' && $row[17] != '-' ? $row[17] : ' '; ?> </td> <td nowrap><?php echo $row[13]; /* club */ ?> </td> <?php $res = mysql_query("SELECT rs.xResultat" . ", rs.Leistung" . ", rs.Info" . " FROM resultat AS rs" . " WHERE rs.xSerienstart = " . $row[6] . "\r\n ORDER BY rs.xResultat"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // Show rank if ($status == $cfgRoundStatus['results_done'] || $prog_mode == 2) { $disField = ($maxatt + 1) * $maxAthlete; // attempts * 8 (first 8 athletes) if ($pass >= 2 && $r + 1 > $disField) { $dis = 'disabled=" disabled"'; } else { $dis = ''; } ?> <form action='event_results.php' method='post' name='rank_<?php echo $r; ?> '> <td> <input type='hidden' name='arg' value='save_rank' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[6]; ?> ' /> <input type='hidden' name='focus' value='rank_<?php echo $r; ?> ' /> <input class='nbr' type='text' name='rank' maxlength='3' <?php echo $dis; ?> value='<?php echo $row[8]; ?> ' onChange='document.rank_<?php echo $r; ?> .submit()' /> </td> <?php if ($status == $cfgRoundStatus['results_done'] || $prog_mode == 2) { if ($nextRound > 0) { ?> <form name="qual_<?php echo $i; ?> " action="event_results.php" method="post"> <td> <input type="hidden" name="arg" value="change_qual"/> <input type="hidden" name="round" value="<?php echo $round; ?> "/> <input type="hidden" name="focus" value="qual_<?php echo $i; ?> "/> <input type="hidden" name="item" value="<?php echo $row[6]; ?> "/> <input type="hidden" name="oldqual" value="<?php echo $row[16]; ?> "/> <input type="hidden" name="heat" value="<?php echo $row[2]; ?> "/> <?php $dropdown = new GUI_Select('qual', 1, 'changequal("qual_' . $i . '", ' . $row[6] . ', ' . $row[16] . ', ' . $row[2] . ', this.value)'); $dropdown->addOptionNone(); foreach ($cfgQualificationType as $type) { $dropdown->addOption($type['text'], $type['code']); if ($type['code'] == $row[16]) { $dropdown->selectOption($type['code']); } } $dropdown->printList(); ?> </td> </form> <?php $i++; // next element } // qualification info } else { // no rank ?> <td /> <?php if ($nextRound > 0) { ?> <td /> <?php } } // ET valid rank ?> </form> <?php } $disField = ($maxatt + 1) * $maxAthlete; // attempts * 8 (first 8 athletes) for ($c = 1; $c <= $cfgProgramMode[$prog_mode]['tech_res']; $c++) { // Result focus: // - Backoffice mode: same athlete, next result // - Field mode: next athlete, same result $r++; // increment result form counter if ($cfgProgramMode[$prog_mode]['name'] == $strProgramModeBackoffice) { if ($row[18] == 'y') { // only best result --> focus next line $focus = "perf_" . ($r + $cfgProgramMode[$prog_mode]['tech_res'] + 1); if (mysql_num_rows($result) == $i) { // no more athletes if ($c == $cfgProgramMode[$prog_mode]['tech_res']) { // last result $focus = "perf_" . ($r + 1); // keep focus on this athlete } else { $focus = "perf_" . ($c + 1); // focus to next result of first athlete } } } else { if ($c == $cfgProgramMode[$prog_mode]['tech_res']) { // last result of this line if (mysql_num_rows($result) == $i) { // no more athletes $focus = "perf_" . $r; // keep focus on last athlete } else { $focus = "perf_" . ($r + 2); // focus to next line result } } else { $focus = "perf_" . ($r + 1); // focus to next result } } } else { // field mode $focus = "perf_" . ($r + $cfgProgramMode[$prog_mode]['tech_res'] + 1); if (mysql_num_rows($result) == $i) { // no more athletes if ($c == $cfgProgramMode[$prog_mode]['tech_res']) { // last result $focus = "perf_" . $r; // keep focus on this athlete } else { $focus = "perf_" . ($c + 1); // focus to next result of first athlete } } } // ET program mode $item = ''; $perf = ''; $info = ''; if ($resrow = mysql_fetch_row($res)) { $item = $resrow[0]; $perf = AA_formatResultMeter($resrow[1]); $info = $resrow[2]; } if ($status != $cfgRoundStatus['results_done'] || $prog_mode == 2) { ?> <form action='controller.php' method='post' name='perf_<?php echo $r; ?> ' target='controller'> <td nowrap> <input type='hidden' name='act' value='saveResult' /> <input type='hidden' name='obj' value='perf_<?php echo $r; ?> ' /> <input type='hidden' name='type' value='<?php echo $layout; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[6]; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input type='hidden' name='row_col' value='<?php echo $r . "_" . $c; ?> ' /> <input type='hidden' name='maxatt' value='<?php echo $maxatt; ?> ' /> <input type='hidden' name='heat' value='<?php echo $row[2]; ?> ' /> <?php // technical disciplines with wind if ($layout == $cfgDisciplineType[$strDiscTypeJump]) { ?> <input class='perfmeter' type='text' id='perf_<?php echo $r; ?> ' name='perf' maxlength='6' <?php echo $dis; ?> value='<?php echo $perf; ?> ' onChange='checkSubmit(document.perf_<?php echo $r; ?> , <?php echo $focus; ?> )' /> <input class='nbr' type='text' name='wind' maxlength='5' value='<?php echo $info; ?> ' onChange='submitResult(document.perf_<?php echo $r; ?> , <?php echo $focus; ?> )' /> <?php } else { ?> <input class='perfmeter' type='text' id='perf_<?php echo $r; ?> ' name='perf' maxlength='6' <?php echo $dis; ?> value='<?php echo $perf; ?> ' onChange='submitResult(document.perf_<?php echo $r; ?> , <?php echo $focus; ?> )' /> <?php } ?> </td> </form> <?php if ($c == $cfgProgramMode[$prog_mode]['tech_res']) { $r++; if (mysql_num_rows($result) != $i) { // more athletes $focus = "perf_" . ($c + $r + 1); } else { $focus = "perf_" . $r; } ?> <form action='controller.php' method='post' name='perf_<?php echo $r; ?> ' target='controller'> <td> <input type='hidden' name='act' value='saveResult' /> <input type='hidden' name='obj' value='perf_<?php echo $r; ?> ' /> <input type='hidden' name='type' value='<?php echo $layout; ?> ' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[6]; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input type='hidden' name='xAthlete' value='<?php echo $row[20]; ?> ' /> <input class='textshort' type='text' name='remark' maxlength='5' <?php echo $dis; ?> value='<?php echo $row[19]; ?> ' onChange='submitResult(document.perf_<?php echo $r; ?> , <?php echo $focus; ?> )' /> </td> </form> <?php } ?> <?php } else { // results done ?> <td nowrap> <?php // technical disciplines with wind if ($layout == $cfgDisciplineType[$strDiscTypeJump]) { echo "{$perf} ( {$info} )"; } else { echo "{$perf}"; } ?> </td> <?php if ($c == $cfgProgramMode[$prog_mode]['tech_res']) { ?> <td nowrap><?php echo $row[19]; ?> </td> <?php } } // ET results done } // end loop every tech result acc. programm mode ?> <td> <?php $btn->set("event_results.php?arg=del_start&item={$row['6']}&round={$round}", $strDelete); $btn->printButton(); ?> </td> <?php } // ET DB error } ?> </table> <?php mysql_free_result($result); } // ET DB error } } } } // ET round selected if (!empty($presets['focus'])) { ?> <script type="text/javascript"> <!-- if(document.<?php echo $presets['focus']; ?> ) { document.<?php echo $presets['focus']; ?> .rank.focus(); document.<?php echo $presets['focus']; ?> .rank.select(); window.scrollBy(0,200); } //--> </script> <?php } else { ?> <script type="text/javascript"> <!-- document.perf_<?php echo $fieldFocus; ?> .elements['perf_<?php echo $fieldFocus; ?> '].focus(); //--> </script> <?php } ?> </body> </html> <?php } else { AA_printErrorMsg($strErrMergedRound); } }
<input name='event' type='hidden' value='<?php echo $row[8]; ?> ' /> <input name='team' type='hidden' value='<?php echo $row[10]; ?> ' /> <input name='relay' type='hidden' value='<?php echo $row[5]; ?> ' /> <?php // Drop down list of all athletes in team $dropdown = new GUI_Select("athlete", 1); $dropdown->addOption($strAllRegisteredRelayTeam, 0); $dropdown->addOptionsFromDB(" SELECT\r\n a.xAnmeldung\r\n , CONCAT( at.Name,' ', at.Vorname) \r\n , a.Startnummer\r\n , at.Jahrgang \r\n FROM\r\n anmeldung AS a\r\n LEFT JOIN athlet AS at ON (a.xAthlet = at.xAthlet)\r\n WHERE \r\n a.xMeeting = " . $_COOKIE['meeting_id'] . " AND a.xTeam = " . $row[10] . " \r\n AND a.xTeam > 0 \r\n ORDER BY at.Name, at.Vorname", true); if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } $dropdown->printList(false); ?> </td> <td class='forms'><input name='position' class='nbr' type='text' maxlength='2' value='' onchange='this.form.submit()'/> </td> </form> <?php ?>
echo $row['Nummer']; ?> " onchange='document.change_def.submit()' <?php echo $dis; ?> /></td> <td></td> <th class='dialog'><?php echo $strProgramMode; ?> </th> <td class='forms'><?php $dropdown = new GUI_Select('mode', 1, "document.change_def.submit()"); foreach ($cfgProgramMode as $key => $value) { $dropdown->addOption($value['name'], $key); if ($row['ProgrammModus'] == $key) { $dropdown->selectOption($key); } } $dropdown->printList(); ?> </td> <td></td> <td class='forms'> </td> <td class='forms'> </td> </tr> </table> </form>
<tr> <form action="meeting_teamsm.php" method="POST" name="teamsm_add3"> <input type="hidden" name="arg" value="add_athlete"> <input type="hidden" name="item" value="<?php echo $_POST['item']; ?> "> <input type="hidden" name="event" value="<?php echo $event; ?> "> <td class="forms" colspan="4"> <?php // athletes who are in the right club $dropdown = new GUI_Select("athlete", 4, "", "multiple"); $dropdown->addOption($strAllRegisteredAthletes, 0); $dropdown->addOptionsFromDB("\r\n\t\t\tSELECT\r\n\t\t\t\ta.xAnmeldung\r\n\t\t\t\t, CONCAT(a.Startnummer, '. ', at.Name, ' ', at.Vorname, ' ( ' , at.Jahrgang, ' )')\r\n\t\t\tFROM\r\n\t\t\t\tanmeldung AS a\r\n\t\t\t\t, athlet AS at\r\n\t\t\t\tLEFT JOIN teamsmathlet AS tsa ON (tsa.xAnmeldung = a.xAnmeldung\r\n\t\t\t\t\tAND tsa.xTeamsm = " . $_POST['item'] . ")\r\n\t\t\tWHERE\r\n\t\t\t\ttsa.xTeamsm IS NULL\r\n\t\t\tAND\tat.xAthlet = a.xAthlet\r\n\t\t\tAND\ta.xMeeting = " . $_COOKIE['meeting_id'] . "\r\n\t\t\tORDER BY\r\n\t\t\t\tat.Name\r\n\t\t\t\t, at.Vorname\r\n\t\t"); if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } $dropdown->printList(); ?> <br/> </td> <td class="forms_bottom" > <input type="button" value="<?php echo $strAdd; ?> "
?> <form action='meeting_definition_event_add.php' method='post' name='add_event'> <table class='dialog' id="properties"> <tr> <th class='dialog'><?php echo $strCategory; ?> </th> <td class='forms'> <input name='arg' type='hidden' value='add_event' /> <?php $dropdown = new GUI_Select('cat', 1, "check(\"category\")"); $dropdown->addOptionNone(); while ($row = mysql_fetch_row($result)) { $dropdown->addOption($row[1], $row[0]); } $dropdown->addOptionNew(); $dropdown->selectOption($category); $dropdown->printList(); ?> </td> <td> <input type="button" onclick="create_combined()" value="<?php echo $strCreateCombined; ?> "> </td> </tr> <tr>