} } } } } // // Process del-request // if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES serienstart READ, start WRITE, anmeldung WRITE, athlet WRITE"); // check if start data still used $result = mysql_query("SELECT xStart FROM start" . " WHERE xAnmeldung=" . $_GET['item']); $rc = 0; // row counter while ($row = mysql_fetch_row($result)) { $rc = $rc + AA_checkReference("serienstart", "xStart", $row[0]); } mysql_free_result($result); // OK: not used anymore if ($rc == 0) { // Delete starts mysql_query("DELETE FROM start WHERE xAnmeldung=" . $_GET['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // get xAthlet $res = mysql_query("SELECT xAthlet FROM anmeldung WHERE xAnmeldung=" . $_GET['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $row = mysql_fetch_array($res);
$row_activ = $row[1]; } mysql_query("\r\n\t\t\t UPDATE disziplin SET \r\n\t\t\t\t Kurzname=\"" . strtoupper($_POST['short']) . "\"\r\n\t\t\t\t , Name=\"" . $_POST['name'] . "\"\r\n\t\t\t\t , Anzeige=" . $_POST['order'] . "\r\n\t\t\t\t , Seriegroesse=" . $_POST['heat'] . "\r\n\t\t\t\t , Staffellaeufer=" . $_POST['relay'] . "\r\n\t\t\t\t , Typ=" . $_POST['type'] . "\r\n\t\t\t\t , Appellzeit=SEC_TO_TIME(" . $_POST['time'] * 60 . ")\r\n\t\t\t\t , Stellzeit=SEC_TO_TIME(" . $_POST['mtime'] * 60 . ")\r\n , aktiv='" . $row_activ . "' \r\n\t\t\t WHERE xDisziplin=" . $_POST['item']); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } } } } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES wettkampf READ, disziplin WRITE"); // Check if not used anymore if (AA_checkReference("wettkampf", "xDisziplin", $_GET['item']) == 0) { mysql_query("DELETE FROM disziplin WHERE xDisziplin=" . $_GET['item']); } else { AA_printErrorMsg($strDiscipline . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // // Display current data // $page = new GUI_Page('admin_disciplines', TRUE);
// store selected group $group = $_POST['group']; } // // add team // if ($_POST['arg'] == "add") { $name = $_POST['name']; // Error: Empty fields if (empty($_POST['name']) || empty($_POST['category']) || empty($_POST['club']) || empty($_POST['event'])) { AA_printErrorMsg($strErrEmptyFields); } else { mysql_query("LOCK TABLES\r\n\t\t\t\tteamsm WRITE\r\n\t\t\t\t, wettkampf READ\r\n\t\t\t\t, kategorie READ\r\n , anmeldung READ\r\n , staffel READ\r\n , start as s READ\r\n , runde as r READ \r\n , runde WRITE \r\n , wettkampf as w READ \r\n\t\t\t\t, verein READ"); if (AA_checkReference("kategorie", "xKategorie", $_POST['category']) == 0) { AA_printErrorMsg($strCategory . $strErrNotValid); } elseif (AA_checkReference("wettkampf", "xWettkampf", $_POST['event']) == 0) { AA_printErrorMsg($strEvent . $strErrNotValid); } else { // check startnumber $lastnbr = AA_getLastStartnbrTeamsm(); $nbr = $_POST['startnumber']; if ($nbr > 0) { $res = mysql_query("SELECT * FROM teamsm \r\n WHERE Startnummer = {$nbr} \r\n AND xMeeting = " . $_COOKIE['meeting_id']); if (mysql_num_rows($res) > 0) { $nbr = $lastnbr; $nbr++; } //mysql_free_result($res); // // check if startnumber is used for athletes $res = mysql_query("SELECT * FROM anmeldung \r\n WHERE Startnummer = {$nbr} \r\n AND xMeeting = " . $_COOKIE['meeting_id']);
$sql = "SELECT xAthlet \r\n\t\t\t FROM athlet;"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $num = AA_checkReference('anmeldung', 'xAthlet', $row['xAthlet']); if ($num > 0) { $errors = true; break; } } if (!$errors) { $sql = "SELECT xVerein \r\n\t\t\t\t FROM verein;"; $query = mysql_query($sql); while ($row = mysql_fetch_assoc($query)) { $num = AA_checkReference('team', 'xVerein', $row['xVerein']); $num2 = AA_checkReference('teamsm', 'xVerein', $row['xVerein']); $num3 = AA_checkReference('staffel', 'xVerein', $row['xVerein']); if ($num > 0 || $num2 > 0 || $num3 > 0) { $errors = true; break; } } } if ($errors) { echo $strEmptyCacheReference; die; } else { // reset athletes mysql_query("TRUNCATE TABLE athlet"); if (mysql_errno > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else {
AA_printErrorMsg($strErrEmptyFields); } } elseif ($_POST['arg'] == "change") { if (!empty($_POST['name']) && !empty($_POST['display']) && !empty($_POST['sortvalue']) && !empty($_POST['item'])) { mysql_query("UPDATE region SET\r\n\t\t\t\t\tName = '" . $_POST['name'] . "'\r\n\t\t\t\t\t, Anzeige = '" . $_POST['display'] . "'\r\n\t\t\t\t\t, Sortierwert = '" . $_POST['sortvalue'] . "'\r\n\t\t\t\tWHERE xRegion = " . $_POST['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } else { AA_printErrorMsg($strErrEmptyFields); } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES athlet READ, region WRITE"); // Still in use? $rows = AA_checkReference("athlet", "xRegion", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM region WHERE xRegion=" . $_GET['item']); } else { AA_printErrorMsg($strRegion . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // // Display current data
} else { mysql_query("\r\n\t\t\tLOCK TABLES\r\n\t\t\t\tteam WRITE\r\n\t\t"); mysql_query("\r\n\t\t\tUPDATE team SET\r\n\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\tWHERE xTeam=" . $_POST['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } mysql_query("UNLOCK TABLES"); } } // // Process del-request // if ($_GET['arg'] == "del") { mysql_query("\r\n\t\tLOCK TABLES\r\n\t\t\tanmeldung READ\r\n\t\t\t, team WRITE\r\n\t"); // Still in use? if (AA_checkReference("anmeldung", "xTeam", $_GET['item']) > 0) { AA_printErrorMsg($strTeam . $strErrStillUsed); } else { // delete team events mysql_query("\r\n\t\t\tDELETE FROM team\r\n\t\t\tWHERE xTeam = " . $_GET['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } // ET DB error (still in use) mysql_query("UNLOCK TABLES"); $_POST['item'] = $_GET['item']; // show empty form after delete } // // display data
/** * change installations * -------------------- */ function AA_heats_changeInstallation($round) { require './lib/common.lib.php'; if ($_POST['arg'] == 'change_inst' && empty($_POST['item'])) { AA_printErrorMsg($GLOBALS['strErrEmptyFields']); } else { mysql_query("LOCK TABLES anlage READ, serie WRITE"); $installation = $_POST['installation']; if (AA_checkReference("anlage", "xAnlage", $installation) == 0) { $installation = 0; } if ($_POST['arg'] == 'change_inst') { // only for one heat $clause = " WHERE xSerie=" . $_POST['item']; } else { // all heats $clause = " WHERE xRunde=" . $round; } mysql_query("UPDATE serie SET" . " xAnlage = {$installation}" . $clause); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } mysql_query("UNLOCK TABLES"); } }
} else { if ($_POST['arg'] == "add") { mysql_query("\r\n\t\t\tINSERT INTO verein SET\r\n\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\t\t, Sortierwert=\"" . $_POST['sortvalue'] . "\"\r\n\t\t"); } else { if ($_POST['arg'] == "change") { mysql_query("\r\n\t\t\tUPDATE verein SET\r\n\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\t\t, Sortierwert=\"" . $_POST['sortvalue'] . "\"\r\n\t\t\tWHERE xVerein=" . $_POST['item']); } } } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES athlet READ, staffel READ, team READ, verein WRITE"); // Still in use? $rows = AA_checkReference("athlet", "xVerein", $_GET['item']); $rows = $rows + AA_checkReference("staffel", "xVerein", $_GET['item']); $rows = $rows + AA_checkReference("team", "xVerein", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM verein WHERE xVerein=" . $_GET['item']); } else { AA_printErrorMsg($strClub . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // // Display current data
function AA_meeting_deleteEvent() { require './lib/common.lib.php'; mysql_query("LOCK TABLES runde READ, start READ, wettkampf WRITE"); // Still in use? $rows = AA_checkReference("runde", "xWettkampf", $_POST['item']); $rows = $rows + AA_checkReference("start", "xWettkampf", $_POST['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM wettkampf WHERE xWettkampf=" . $_POST['item']); } else { AA_printErrorMsg($GLOBALS['strEvent'] . $GLOBALS['strErrStillUsed']); } mysql_query("UNLOCK TABLES"); return; }
} } ?> <tr> <td>team</td> <td><?php echo $items; ?> </td> </tr> <?php $items = 0; $sql = "SELECT * \r\n\t\t\t FROM staffel;"; $query = mysql_query($sql); while ($staffel = mysql_fetch_assoc($query)) { $ref = AA_checkReference('meeting', 'xMeeting', $staffel['xMeeting']); if ($ref == 0) { $sql2 = "DELETE FROM staffel \r\n\t\t\t\t\t\t WHERE xStaffel = " . $staffel['xStaffel'] . ";"; $query2 = mysql_query($sql2); if ($query2 && mysql_affected_rows() == 1) { $items++; } } } ?> <tr> <td>staffel</td> <td><?php echo $items; ?> </td>
$idcounter = "001"; } else { $idcounter = substr($biggestId, 6, 3); $idcounter++; $idcounter = sprintf("%03d", $idcounter); } $xTeamSQL = ", xTeam = " . $eventnr . $idcounter . ", Athleticagen ='y' "; } } if (AA_checkReference("kategorie", "xKategorie", $category) == 0) { AA_printErrorMsg($strCategory . $strErrNotValid); } else { if (AA_checkReference("meeting", "xMeeting", $_COOKIE['meeting_id']) == 0) { AA_printErrorMsg($strMeeting . $strErrNotValid); } else { if (AA_checkReference("verein", "xVerein", $_POST['club']) == 0) { AA_printErrorMsg($strClub . $strErrNotValid); } else { if (!empty($_POST['id'])) { // svm is added from base $xTeamSQL = ", xTeam = " . $_POST['id'] . ", Athleticagen ='n' "; } mysql_query("\r\n\t\t\t\t\t\tINSERT INTO team SET \r\n\t\t\t\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\t\t\t\t\t, xMeeting=" . $_COOKIE['meeting_id'] . "\r\n\t\t\t\t\t\t\t, xKategorie = " . $category . "\r\n\t\t\t\t\t\t\t, xVerein=" . $_POST['club'] . " \r\n , xKategorie_svm = '" . $category_svm . "'" . $xTeamSQL); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $xTeam = mysql_insert_id(); // get new ID } } // ET Club valid; add or change
} } else { // in other language without name and short name mysql_query("\r\n UPDATE rundentyp_it SET\r\n Typ=\"" . $_POST['type'] . "\" \r\n , Wertung=" . $_POST['valtype'] . "\r\n WHERE xRundentyp=" . $_POST['item']); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } } } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES runde READ, rundentyp_de WRITE, rundentyp_fr WRITE, rundentyp_it WRITE"); // Still in use? $rows = AA_checkReference("runde", "xRundentyp", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM rundentyp_de WHERE xRundentyp=" . $_GET['item']); mysql_query("DELETE FROM rundentyp_fr WHERE xRundentyp=" . $_GET['item']); mysql_query("DELETE FROM rundentyp_it WHERE xRundentyp=" . $_GET['item']); } else { AA_printErrorMsg($strRoundtype . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); }
mysql_query("UPDATE athlet SET " . "xVerein='" . $_POST['club'] . "' WHERE xAthlet=" . $_POST['item']); // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } else { AA_printErrorMsg($strErrClubChange); } mysql_query("UNLOCK TABLES"); } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES anmeldung READ, staffelathlet READ, athlet WRITE"); // Still in use? $rows = AA_checkReference("anmeldung", "xAthlet", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM athlet WHERE xAthlet=" . $_GET['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } else { AA_printErrorMsg($strAthlete . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } } } //
} } } else { AA_printErrorMsg($strErrInvalidResult); } } } } else { if ($_GET['arg'] == "del") { mysql_query("DELETE FROM wertungstabelle_punkte WHERE xWertungstabelle_Punkte = " . $_GET['item']); header('Location: admin_scoretables.php?xw=' . $_GET['xw'] . '&disc=' . $_GET['disc']); exit; } else { if ($_GET['arg'] == "deltbl") { // Check if not used anymore if (AA_checkReference("wettkampf", "Punktetabelle", $_GET['item']) == 0) { mysql_query("DELETE FROM wertungstabelle_punkte WHERE xWertungstabelle = " . $_GET['item']); mysql_query("DELETE FROM wertungstabelle WHERE xWertungstabelle = " . $_GET['item']); header('Location: admin_scoretables.php'); exit; } else { AA_printErrorMsg($strScoreTable . $strErrStillUsed); } } } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } //
if (AA_checkReference("verein", "xVerein", $_POST['club']) == 0) { AA_printErrorMsg($strClub . $strErrNotValid); } else { // Team selected if (!empty($_POST['team']) && AA_checkReference("team", "xTeam", $_POST['team']) == 0) { AA_printErrorMsg($strTeam . $strErrNotValid); } else { if (AA_checkReference("wettkampf", "xWettkampf", $_POST['event']) == 0) { AA_printErrorMsg($strEvent . $strErrNotValid); } else { $startcheck = TRUE; $c = 0; if ($_POST['starts'] > 0) { foreach ($_POST['starts'] as $start) { // position or athlete not valid if ($_POST['positions'][$c] > 0 && AA_checkReference("start", "xStart", $start) == 0) { $startcheck = FALSE; } $c++; } } // ET any athletes if ($startcheck == FALSE) { AA_printErrorMsg($strAthlete . $strErrNotValid); } else { // check startnumber $lastnbr = AA_getLastStartnbrRelay(); $nbr = $_POST['startnumber']; if ($nbr > 0) { $res = mysql_query("SELECT * FROM staffel \r\n\t\t\t\t\t\t\t\t\t\t\t\tWHERE Startnummer = {$nbr} \r\n\t\t\t\t\t\t\t\t\t\t\t\tAND xMeeting = " . $_COOKIE['meeting_id']); if (mysql_num_rows($res) > 0) {
$perf = 0; } mysql_query("\r\n\t\t\tUPDATE start SET\r\n\t\t\t\tBestleistung = {$perf}\r\n\t\t WHERE xStart = " . $_POST['start']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } mysql_query("UNLOCK TABLES"); } else { if ($_POST['arg'] == "change_team") { mysql_query("\r\n\t\tLOCK TABLES\r\n\t\t\tstaffelathlet READ\r\n\t\t\t, team READ\r\n\t\t\t, start WRITE\r\n\t\t\t, staffel WRITE"); $res = mysql_query("\r\n\t\t\t\tSELECT\r\n\t\t\t\t\tstaffelathlet.xAthletenstart\r\n\t\t\t\tFROM\r\n\t\t\t\t\tstaffelathlet\r\n\t\t\t\t\t, start AS start\r\n\t\t\t\tWHERE\r\n\t\t\t\t\tstart.xStaffel = " . $_POST['item'] . "\r\n\t\t\t\t\tAND staffelathlet.xStaffelstart = start.xStart\r\n\t\t\t"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (!empty($_POST['team']) && AA_checkReference("team", "xTeam", $_POST['team']) == 0) { AA_printErrorMsg($strTeam . $strErrNotValid); } else { // relay data mysql_query("\r\n\t\t\tUPDATE staffel SET\r\n\t\t\t\txTeam = " . $_POST['team'] . "\r\n\t\t\t WHERE xStaffel = " . $_POST['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } mysql_query("UNLOCK TABLES"); } else { if ($_POST['arg'] == "change_pos") { // Error: Empty fields if (empty($_POST['item']) || empty($_POST['relay']) || empty($_POST['athlete']) || empty($_POST['round'])) { AA_printErrorMsg($strErrEmptyFields);
// set checked automatic } else { AA_printErrorMsg($strMergeRoundsErr); } } } mysql_query("UNLOCK TABLES"); } } elseif ($_POST['arg'] == "merge_del") { if (!empty($_POST['mainRound']) && !empty($_POST['round']) && !empty($_POST['roundSet'])) { //mysql_query("LOCK TABLES rundenset WRITE, serie READ"); mysql_query("LOCK TABLES rundenset WRITE, rundenset as rs READ,serie READ, runde AS r Read, Wettkampf AS w READ, meeting READ "); $mr = $_POST['mainRound']; $r = $_POST['round']; $rs = $_POST['roundSet']; if (AA_checkReference("serie", "xRunde", $mr) != 0 || AA_checkReference("serie", "xRunde", $r) != 0) { $GLOBALS['AA_ERROR'] = $strErrHeatsAlreadySeeded; } else { // remove round from set mysql_query("DELETE FROM rundenset WHERE\r\n\t\t\t\t\txRundenset = {$rs}\r\n\t\t\t\t\tAND xMeeting = " . $_COOKIE['meeting_id'] . "\r\n\t\t\t\t\tAND xRunde = {$r}"); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } else { // check if there are no more rounds in set $res = mysql_query("SELECT * FROM rundenset WHERE\r\n\t\t\t\t\t\t\txRundenset = {$rs}"); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } else { if (mysql_num_rows($res) == 1) { // mainround only mysql_query("DELETE FROM rundenset WHERE\r\n\t\t\t\t\t\t\txRundenset = {$rs}\r\n\t\t\t\t\t\t\tAND xMeeting = " . $_COOKIE['meeting_id']);
} else { if ($_POST['arg'] == "change") { mysql_query("\r\n\t\t\t\tUPDATE anlage SET \r\n\t\t\t\t\tBezeichnung=\"" . $_POST['name'] . "\"\r\n\t\t\t\t\t, xStadion = {$stadium_id}\r\n\t\t\t\t\t, Homologiert = '{$h**o}'\r\n\t\t\t\tWHERE xAnlage=" . $_POST['item']); } } } if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } mysql_query("UNLOCK TABLES"); } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES serie READ, anlage WRITE"); // Check if not used anymore if (AA_checkReference("serie", "xAnlage", $_GET['item']) == 0) { mysql_query("DELETE FROM anlage WHERE xAnlage=" . $_GET['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } else { AA_printErrorMsg($strInstallation . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // get stadium name $result = mysql_query("\r\n\tSELECT\r\n\t\tName\r\n\tFROM\r\n\t\tstadion\r\n\tWHERE xStadion = {$stadium_id}\r\n"); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); $stadium_name = "";
WHERE start.xWettkampf = wettkampf.xWettkampf AND wettkampf.xKategorie = $cCat AND wettkampf.Mehrkampfcode = $cCode AND wettkampf.xMeeting = ".$_COOKIE['meeting_id']." AND start.xAnmeldung='" . $_GET['entry'] . "' ");*/ $sql = "UPDATE\r\n\t\t\t\t\t\t\tstart\r\n\t\t\t\t\t\tLEFT JOIN \r\n\t\t\t\t\t\t\twettkampf USING(xWettkampf)\r\n\t\t\t\t\t\tSET \r\n\t\t\t\t\t\t\tstart.Anwesend = '" . $present . "' \t\t\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE\r\n\t\t\t\t\t\t\twettkampf.xKategorie = " . $cCat . "\r\n\t\t\t\t\t\tAND\t\r\n\t\t\t\t\t\t\twettkampf.Mehrkampfcode = " . $cCode . "\r\n\t\t\t\t\t\tAND\t\r\n\t\t\t\t\t\t\twettkampf.xMeeting = " . $_COOKIE['meeting_id'] . "\r\n\t\t\t\t\t\tAND\t\r\n\t\t\t\t\t\t\tstart.xAnmeldung='" . $_GET['entry'] . "';"; mysql_query($sql); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } } else { // single normal event if (AA_checkReference("serienstart", "xStart", $_GET['item']) != 0) { AA_printErrorMsg($strErrAthleteSeeded); } else { $sql = "UPDATE start SET \r\n\t\t\t\t\t\tAnwesend='{$present}'\t\t\t\t\t\t\r\n\t\t\t\t\t\tWHERE xStart='" . $_GET['item'] . "'"; mysql_query($sql); /* // relay: set present to start record from relay if ($relay){ $sql = "SELECT DISTINCT s.xStaffel FROM staffel AS st LEFT JOIN start AS s USING(xStaffel) LEFT JOIN verein AS v ON(st.xVerein = v.xVerein) LEFT JOIN staffelathlet AS stat ON(stat.xStaffelstart = s.xStart) LEFT JOIN start AS s2 ON(s2.xStart = stat.xAthletenstart)
function AA_results_update($performance, $info, $points = 0) { require './lib/common.lib.php'; if ($performance != NULL) { if (!empty($_POST['item'])) { if (AA_checkReference("resultat", "xResultat", $_POST['item']) == 0) { AA_printErrorMsg($GLOBALS['strErrAthleteNotInHeat']); } else { mysql_query("\r\n\t\t\t\t\tUPDATE resultat SET\r\n\t\t\t\t\t\tLeistung = {$performance}\r\n\t\t\t\t\t\t, Info = '{$info}'\r\n\t\t\t\t\t\t, Punkte = {$points}\r\n\t\t\t\t\tWHERE xResultat = " . $_POST['item']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } AA_StatusChanged($_POST['item']); } } else { mysql_query("\r\n\t\t\t\tINSERT INTO resultat SET\r\n\t\t\t\t\tLeistung = {$performance}\r\n\t\t\t\t\t, Info= '{$info}'\r\n\t\t\t\t\t, Punkte = {$points}\r\n\t\t\t\t\t, xSerienstart = " . $_POST['start']); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } AA_StatusChanged(mysql_insert_id()); } // ET add or change } // ET valid data provided }
$GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } mysql_query("UNLOCK TABLES"); } } } } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES anmeldung READ, staffel READ, team WRITE," . " wettkampf WRITE, kategorie WRITE"); // Still in use? $rows = AA_checkReference("anmeldung", "xKategorie", $_GET['item']); $rows = $rows + AA_checkReference("staffel", "xKategorie", $_GET['item']); $rows = $rows + AA_checkReference("team", "xKategorie", $_GET['item']); $rows = $rows + AA_checkReference("wettkampf", "xKategorie", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM kategorie WHERE xKategorie=" . $_GET['item']); } else { AA_printErrorMsg($strCategory . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // // Display current data
function AA_results_High($round, $layout, $singleRound) { $zaehler = 0; $max = 0; foreach ($_POST as $key => $val) { $arr_key = explode('_', $key); if ($arr_key[0] == 'hight') { $max = $arr_key[1]; } } if ($max > 0) { $max++; } else { $max = $GLOBALS['cfgCountHeight']; } 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_performance.lib.php'; $presets = AA_results_getPresets($round); // read GET/POST variables $performance = 0; // initialize $svm = AA_checkSVM(0, $round); // decide whether to show club or team name $prog_mode = AA_results_getProgramMode(); if ($singleRound > 0) { $single_svm = AA_checkSVM(0, $singleRound); // decide whether to show club or team name } $click = true; // true = User clicks at this athlete false = user save athlete before // // update result(s) // if ($_POST['arg'] == 'save_res') { $click = false; // check if athlet valid if (AA_checkReference("serienstart", "xSerienstart", $_POST['start']) == 0) { AA_printErrorMsg($strErrAthleteNotInHeat); } else { AA_utils_changeRoundStatus($round, $cfgRoundStatus['results_in_progress']); if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } mysql_query("\r\n LOCK TABLES\r\n disziplin READ\r\n , runde READ\r\n , runde AS r READ \r\n , serienstart WRITE\r\n , wettkampf READ\r\n , wettkampf AS w READ \r\n , resultat WRITE\r\n , wertungstabelle READ\r\n , wertungstabelle_punkte READ\r\n , meeting READ\r\n "); // validate result if ($_POST['attempts'] < 0) { $perf = new PerformanceAttempt($_POST['attempts']); $performance = $perf->getPerformance(); } else { $perf = new PerformanceAttempt($_POST['perf']); $performance = $perf->getPerformance(); } // validate attempts if ($performance > 0) { $info = strtoupper($_POST['attempts']); $info = strtr($info, '0', 'O'); $info = str_replace("OOO", "O", $info); $info = str_replace("OO", "O", $info); if (in_array($info, $cfgResultsHigh) == false) { $info = NULL; } } else { // negative or zero result $info = $cfgResultsHighOut; } // check on failed attempts (not more than 3 X in a row, it doesent matter on which hights) $res = mysql_query("SELECT Leistung, Info FROM \r\n resultat\r\n WHERE\r\n xSerienstart = " . $_POST['start'] . "\r\n ORDER BY\r\n Leistung ASC"); $Xcount = 0; while ($row = mysql_fetch_array($res)) { if (strpos($row[1], strtoupper("o")) === false) { preg_match_all("[X]", $row[1], $m); $Xcount += count($m[0]); } else { $Xcount = 0; } } if (strpos($info, strtoupper("o")) === false) { // count X for last entered attempt preg_match_all("[X]", $info, $m); $Xcount += count($m[0]); } else { $Xcount = 0; } if ($info == $cfgResultsHighOut || $Xcount >= 3) { // last attempt if ($cfgProgramMode[$prog_mode]['name'] == $strProgramModeBackoffice) { $_POST['athlete'] = $_POST['athlete'] + 1; // next athlete } $points = 0; } else { /*$sql_sex = "SELECT Geschlecht FROM athlet LEFT JOIN anmeldung USING(xAthlet) LEFT JOIN start USING(xAnmeldung) LEFT JOIN serienstart USING(xStart) WHERE xSerienstart = ".$_POST['start'].";";*/ $sql_sex = "SELECT Geschlecht \r\n FROM kategorie \r\n LEFT JOIN wettkampf USING(xKategorie) \r\n LEFT JOIN start USING(xWettkampf) \r\n LEFT JOIN serienstart USING(xStart) \r\n WHERE xSerienstart = " . $_POST['start'] . ";"; $query_sex = mysql_query($sql_sex); if ($_POST['attempts'] == '-') { $points = 0; } else { if ($single_svm) { $single_presets = AA_results_getPresets($singleRound); // read GET/POST variables $points = AA_utils_calcPoints($single_presets['event'], $performance, 0, mysql_result($query_sex, 0, 'Geschlecht')); } else { $points = AA_utils_calcPoints($presets['event'], $performance, 0, mysql_result($query_sex, 0, 'Geschlecht')); } } } if (!empty($info)) { AA_results_update($performance, $info, $points); } else { $_POST['athlete']--; } } // ET Athlete valid mysql_query("UNLOCK TABLES"); // set ranks after every new result in mode = decentral with ranking // ****************************************************************** if ($prog_mode == 2) { $eval = AA_results_getEvaluationType($round); $combined = AA_checkCombined(0, $round); 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 serie READ\r\n , wettkampf READ\r\n , resultat WRITE\r\n , serienstart WRITE\r\n , tempresult WRITE\r\n "); // clean ranks, set all to 0 mysql_query("UPDATE \r\n serienstart\r\n , serie\r\n SET\r\n serienstart.Rang = 0\r\n WHERE\r\n serienstart.xSerie = serie.xSerie\r\n AND serie.xRunde = {$round}"); // Set up a temporary table to hold all results for ranking. mysql_query("\r\n CREATE TABLE tempresult (\r\n xSerienstart int(11)\r\n , xSerie int(11)\r\n , Leistung int(9)\r\n , TopX int(1)\r\n , TotalX int(2)\r\n )\r\n TYPE=HEAP \r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // if this is a combined event, rank all rounds togheter $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}"; } // read all valid results (per athlet) $result = mysql_query("\r\n SELECT\r\n resultat.Leistung\r\n , resultat.Info\r\n , serienstart.xSerienstart\r\n , serienstart.xSerie\r\n FROM\r\n resultat\r\n , serienstart\r\n , serie\r\n WHERE resultat.xSerienstart = serienstart.xSerienstart\r\n AND serienstart.xSerie = serie.xSerie\r\n {$roundSQL}\r\n AND resultat.Leistung != 0\r\n ORDER BY\r\n serienstart.xSerienstart\r\n ,resultat.Leistung DESC\r\n "); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $leistung = 0; $serienstart = 0; $serie = 0; $topX = 0; $totX = 0; $ss = 0; // athlete's ID $tt = FALSE; // top result check // process every result while ($row = mysql_fetch_row($result)) { // new athlete: save last athlete's data if ($ss != $row[2] && $ss != 0) { if ($leistung != 0) { // add one row per athlete to temp table mysql_query("\r\n INSERT INTO tempresult\r\n VALUES(\r\n {$serienstart}\r\n , {$serie}\r\n , {$leistung}\r\n , {$topX}\r\n , {$totX})\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } // initialize variables $leistung = 0; $serienstart = 0; $serie = 0; $totX = 0; $topX = 0; $tt = FALSE; } // save data of current athlete's top result if ($tt == FALSE && strstr($row[1], 'O')) { $leistung = $row[0]; $serienstart = $row[2]; $serie = $row[3]; $topX = substr_count($row[1], 'X'); $tt = TRUE; } // count total invalid attempts $totX = $totX + substr_count($row[1], 'X'); $ss = $row[2]; // keep athlete's ID } mysql_free_result($result); // insert last pending data in temp table if ($ss != 0 && $leistung != 0) { mysql_query("\r\n INSERT INTO tempresult\r\n VALUES(\r\n {$serienstart}\r\n , {$serie}\r\n , {$leistung}\r\n , {$topX}\r\n , {$totX})\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } if ($eval == $cfgEvalType[$strEvalTypeHeat]) { // eval per heat $order = "xSerie ,"; } else { // default: rank results from all heats together $order = ""; } // Read rows from temporary table ordered by performance, // nbr of invalid attempts for top performance and // total nbr of invalid attempts to determine ranking. $result = mysql_query("\r\n SELECT\r\n xSerienstart\r\n , xSerie\r\n , Leistung\r\n , TopX\r\n , TotalX\r\n FROM\r\n tempresult\r\n ORDER BY\r\n {$order}\r\n Leistung DESC\r\n ,TopX ASC\r\n ,TotalX ASC\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $heat = 0; $perf = 0; $topX = 0; $totalX = 0; $i = 0; $rank = 0; // set rank for every athlete while ($row = mysql_fetch_row($result)) { if ($eval == $cfgEvalType[$strEvalTypeHeat] && $heat != $row[1]) { $i = 0; // restart ranking $perf = 0; $topX = 0; $totalX = 0; } $j++; // increment ranking if ($perf != $row[2] || $topX != $row[3] || $totalX != $row[4]) { $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 = $row[2]; $topX = $row[3]; $totalX = $row[4]; } 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) AA_results_setNotStarted($round); // update athletes with no result if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } } // end prog mode = 2 (decentral with ranking) } elseif ($_POST['arg'] == 'save_height') { $max = $_POST['max']; $arr_prev = array(); $arr_new = array(); for ($g = 0; $g < $max; $g++) { $name = "hight_" . $g; $hiddenName = "hiddenHeight_" . $g; $previous_height = $_POST[$hiddenName]; $previous_height = new PerformanceAttempt($previous_height); $previous_height = $previous_height->getPerformance(); if (isset($_POST[$name])) { $new_height = $_POST[$name]; $new_height = new PerformanceAttempt($new_height); $new_height = $new_height->getPerformance(); } else { $new_height = $previous_height; } $arr_prev[$g] = $previous_height; $arr_new[$g] = $new_height; } $diff = 0; $first_change = false; foreach ($arr_prev as $key => $val) { if ($first_change) { $arr_new[$key] = $arr_new[$key - 1] + $diff; } else { if ($val == $arr_new[$key]) { if ($diff > 0) { $arr_new[$key] = $arr_new[$key - 1] + $diff; } } else { if ($diff == 0) { if ($key == 0) { $first_change = true; if ($_POST['disCode'] == '310') { // jump $diff = $cfgHeightDiffJump * 100; } elseif ($_POST['disCode'] == '320') { $diff = $cfgHeightDiffPole * 100; // pole } else { $diff = $cfgHeightDiffJump * 100; } } else { $diff = $arr_new[$key] - $keep_val; } } else { $arr_new[$key] = $arr_prev[$key] + $diff; } } } $keep_val = $val; } AA_delHeight($_POST['round'], $_POST['heat']); AA_setHeight($arr_new, $_POST['round'], $_POST['heat']); $name = "hight_" . $max; if (isset($_POST[$name]) && !empty($_POST[$name])) { $new_height = $_POST[$name]; $new_height = new PerformanceAttempt($new_height); $new_height = $new_height->getPerformance(); // insert new hight $sql = "INSERT INTO hoehe SET \r\n hoehe = " . $new_height . ",\r\n xRunde = " . $_POST['round'] . ", \r\n xSerie = " . $_POST['heat']; $res = mysql_query($sql); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } else { if ($_GET['arg'] == 'delete') { AA_results_delete($round, $_GET['item']); } } // // terminate result processing // if ($_GET['arg'] == 'results_done') { $eval = AA_results_getEvaluationType($round); $combined = AA_checkCombined(0, $round); 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 serie READ\r\n , wettkampf READ\r\n , resultat WRITE\r\n , serienstart WRITE\r\n , tempresult WRITE\r\n "); // clean ranks, set all to 0 mysql_query("UPDATE \r\n serienstart\r\n , serie\r\n SET\r\n serienstart.Rang = 0\r\n WHERE\r\n serienstart.xSerie = serie.xSerie\r\n AND serie.xRunde = {$round}"); // Set up a temporary table to hold all results for ranking. mysql_query("\r\n CREATE TABLE tempresult (\r\n xSerienstart int(11)\r\n , xSerie int(11)\r\n , Leistung int(9)\r\n , TopX int(1)\r\n , TotalX int(2)\r\n )\r\n TYPE=HEAP\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // if this is a combined event, rank all rounds togheter $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}"; } // read all valid results (per athlet) $result = mysql_query("\r\n SELECT\r\n resultat.Leistung\r\n , resultat.Info\r\n , serienstart.xSerienstart\r\n , serienstart.xSerie\r\n FROM\r\n resultat\r\n , serienstart\r\n , serie\r\n WHERE resultat.xSerienstart = serienstart.xSerienstart\r\n AND serienstart.xSerie = serie.xSerie\r\n {$roundSQL}\r\n AND resultat.Leistung != 0\r\n ORDER BY\r\n serienstart.xSerienstart\r\n ,resultat.Leistung DESC\r\n "); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $leistung = 0; $serienstart = 0; $serie = 0; $topX = 0; $totX = 0; $ss = 0; // athlete's ID $tt = FALSE; // top result check // process every result while ($row = mysql_fetch_row($result)) { // new athlete: save last athlete's data if ($ss != $row[2] && $ss != 0) { if ($leistung != 0) { // add one row per athlete to temp table mysql_query("\r\n INSERT INTO tempresult\r\n VALUES(\r\n {$serienstart}\r\n , {$serie}\r\n , {$leistung}\r\n , {$topX}\r\n , {$totX})\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } // initialize variables $leistung = 0; $serienstart = 0; $serie = 0; $totX = 0; $topX = 0; $tt = FALSE; } // save data of current athlete's top result if ($tt == FALSE && strstr($row[1], 'O')) { $leistung = $row[0]; $serienstart = $row[2]; $serie = $row[3]; $topX = substr_count($row[1], 'X'); $tt = TRUE; } // count total invalid attempts $totX = $totX + substr_count($row[1], 'X'); $ss = $row[2]; // keep athlete's ID } mysql_free_result($result); // insert last pending data in temp table if ($ss != 0 && $leistung != 0) { mysql_query("\r\n INSERT INTO tempresult\r\n VALUES(\r\n {$serienstart}\r\n , {$serie}\r\n , {$leistung}\r\n , {$topX}\r\n , {$totX})\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } } if ($eval == $cfgEvalType[$strEvalTypeHeat]) { // eval per heat $order = "xSerie ,"; } else { // default: rank results from all heats together $order = ""; } // Read rows from temporary table ordered by performance, // nbr of invalid attempts for top performance and // total nbr of invalid attempts to determine ranking. $result = mysql_query("\r\n SELECT\r\n xSerienstart\r\n , xSerie\r\n , Leistung\r\n , TopX\r\n , TotalX\r\n FROM\r\n tempresult\r\n ORDER BY\r\n {$order}\r\n Leistung DESC\r\n ,TopX ASC\r\n ,TotalX ASC\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // initialize variables $heat = 0; $perf = 0; $topX = 0; $totalX = 0; $i = 0; $rank = 0; // set rank for every athlete while ($row = mysql_fetch_row($result)) { if ($eval == $cfgEvalType[$strEvalTypeHeat] && $heat != $row[1]) { $i = 0; // restart ranking $perf = 0; $topX = 0; $totalX = 0; } $j++; // increment ranking if ($perf != $row[2] || $topX != $row[3] || $totalX != $row[4]) { $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 = $row[2]; $topX = $row[3]; $totalX = $row[4]; } 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) // read all starting athletes with no valid result (rank=0) // and add disqualification code $result = mysql_query("\r\n SELECT DISTINCT\r\n serienstart.xSerienstart\r\n FROM\r\n resultat\r\n , serienstart\r\n , serie\r\n WHERE resultat.xSerienstart = serienstart.xSerienstart\r\n AND serienstart.xSerie = serie.xSerie\r\n AND serienstart.Rang = 0\r\n AND serie.xRunde = {$round}\r\n AND resultat.Leistung >= 0\r\n "); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { // while ($row = mysql_fetch_row($result)) { // check if "disqualified" result already there $res = mysql_query("\r\n SELECT\r\n xResultat\r\n FROM\r\n resultat\r\n WHERE xSerienstart = {$row['0']}\r\n AND (Leistung = " . $cfgInvalidResult['DSQ']['code'] . "OR Leistung = " . $cfgInvalidResult['NRS']['code'] . ")"); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { if (mysql_num_rows($res) <= 0) { mysql_query("\r\n INSERT INTO\r\n resultat\r\n SET\r\n Leistung = " . $cfgInvalidResult['NRS']['code'] . "\r\n , Info = '{$cfgResultsHighOut}'\r\n , xSerienstart = {$row['0']}\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } } mysql_free_result($res); } } mysql_free_result($result); } mysql_query("UNLOCK TABLES"); } // ET DB error (drop temp table) 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']); } } // // calculate ranking points if needed // if ($_GET['arg'] == 'results_done' || $_POST['arg'] == 'save_rank') { AA_utils_calcRankingPoints($round); } if ($_POST['arg'] == 'save_remark') { AA_utils_saveRemark($_POST['item'], $_POST['remark'], $_POST['xAthlete']); } // // 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 && $prog_mode != 2) { $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"); // display all athletes $result = mysql_query("\r\n SELECT rt.Name\r\n , rt.Typ\r\n , s.xSerie\r\n , s.Bezeichnung\r\n , ss.xSerienstart\r\n , ss.Position\r\n , ss.Rang\r\n , a.Startnummer\r\n , at.Name\r\n , at.Vorname\r\n , at.Jahrgang\r\n , if('" . $svm . "', t.Name, IF(a.Vereinsinfo = '', v.Name, a.Vereinsinfo)) \r\n , LPAD(s.Bezeichnung,5,'0') as heatid\r\n , rs.xResultat\r\n , rs.Leistung\r\n , rs.Info\r\n , at.Land\r\n , ss.Bemerkung\r\n , at.xAthlet\r\n , r.xRunde \r\n , ss.RundeZusammen \r\n FROM\r\n runde AS r\r\n , serie AS s\r\n , serienstart AS ss\r\n , start AS st\r\n , anmeldung AS a\r\n , athlet AS at\r\n , verein AS v\r\n LEFT JOIN team AS t ON(a.xTeam = t.xTeam) \r\n LEFT JOIN rundentyp AS rt\r\n ON rt.xRundentyp = r.xRundentyp\r\n LEFT JOIN resultat AS rs\r\n ON rs.xSerienstart = ss.xSerienstart\r\n WHERE r.xRunde = {$round}\r\n AND s.xRunde = r.xRunde\r\n AND ss.xSerie = s.xSerie\r\n AND st.xStart = ss.xStart\r\n AND a.xAnmeldung = st.xAnmeldung\r\n AND at.xAthlet = a.xAthlet\r\n AND v.xVerein = at.xVerein\r\n ORDER BY\r\n heatid\r\n , ss.Position\r\n , rs.xResultat DESC\r\n "); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { AA_results_printMenu($round, $status, $prog_mode, 'high'); // initialize variables $a = 0; $h = 0; $i = 0; if (!empty($_GET['athlete'])) { $_POST['athlete'] = $_GET['athlete']; } if (empty($_POST['athlete']) || mysql_num_rows($result) < $_POST['athlete']) { $_POST['athlete'] = 1; // focus to first athlete } $rowclass = 'odd'; if ($cfgProgramMode[$prog_mode]['name'] == $strProgramModeBackoffice) { $focus = 0; // keep focus on this athlete if Backoffice Mode } else { $focus = 1; // focus on next athlete if Field Mode } ?> <p/> <table class='dialog'> <?php $btn = new GUI_Button('', ''); // create button object while ($row = mysql_fetch_row($result)) { if ($row[20] > 0) { $singleRound = $row[20]; } else { $singleRound = $row[19]; } // terminate last row if new athlete and not first item if ($a != $row[4] && $i != 0) { if ($_POST['athlete'] == $i + 1 && $cfgProgramMode[$prog_mode]['name'] == $strProgramModeField) { if ($row[15] == 'XXX' && !$click) { $_POST['athlete'] = $_POST['athlete'] + 1; } } if ($_POST['athlete'] == $i) { echo "<td>"; $btn->set("event_results.php?arg=del_start&item={$a}&round={$round}", $strDelete); $btn->printButton(); echo "</td>"; } echo "</tr>"; } /* * 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']) { $c = 1; // 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 7 + $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='singleRound' value='<?php echo $singleRound; ?> ' /> <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']) { ?> <th class='dialog'><?php echo $strRank; ?> </th> <?php } ?> <th class='dialog' ><?php echo $strResultRemark; ?> </th> <th class='dialog' colspan='2'><?php echo $strPerformance; ?> </th> </tr> <?php } // ET new heat /* * Athlete data lines */ if ($a != $row[4]) { $a = $row[4]; // keep athlete ID $i++; // increment athlete counter $l = 0; // reset result counter if ($_POST['athlete'] == $i) { // active item $rowclass = 'active'; } else { if ($row[5] % 2 == 0) { // even row numer $rowclass = 'even'; } else { // odd row number $rowclass = 'odd'; } } if ($rowclass == 'active') { ?> <tr class='active'> <?php } else { ?> <tr class='<?php echo $rowclass; ?> ' onclick='selectAthlete(<?php echo $i; ?> )'> <?php } ?> <td class='forms_right'><?php echo $row[5]; ?> </td> <td class='forms_right'><?php echo $row[7]; /* start nbr */ ?> </td> <td nowrap><?php echo $row[8] . " " . $row[9]; /* name */ ?> </td> <td class='forms_ctr'><?php echo AA_formatYearOfBirth($row[10]); ?> </td> <td><?php echo $row[16] != '' && $row[16] != '-' ? $row[16] : ' '; ?> </td> <td nowrap><?php echo $row[11]; /* club */ ?> </td> <?php if ($status == $cfgRoundStatus['results_done']) { if ($_POST['athlete'] == $i) { ?> <form action='event_results.php' method='post' name='rank'> <td> <input type='hidden' name='arg' value='save_rank' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[4]; ?> ' /> <input class='nbr' type='text' name='rank' maxlength='3' value='<?php echo $row[6]; ?> ' onChange='document.rank.submit()' /> </td> </form> <?php } else { echo "<td>" . $row[6] . "</td>"; } echo "<td>" . $row[17] . "</td>"; } else { ?> <form action='event_results.php' method='post' name='remark_<?php echo $i; ?> '> <td> <input type='hidden' name='arg' value='save_remark' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[4]; ?> ' /> <input type='hidden' name='xAthlete' value='<?php echo $row[18]; ?> ' /> <input class='textshort' type='text' name='remark' maxlength='5' value='<?php echo $row[17]; ?> ' onchange='document.remark_<?php echo $i; ?> .submit()' /> </td> </form> <?php } } // ET new athlete $new_perf = ''; if ($_POST['athlete'] == $i) { if (is_null($row[14])) { // no result yet: show form $last_perf = 0; } else { $last_perf = $row[14]; } $item = ''; if ($l == 0) { // read all performances achieved in current heat and // better than last entered performance if ($cfgProgramMode[$prog_mode]['name'] == $strProgramModeField) { if (in_array($row[15], $cfgResultsHighStayDecentral)) { $new_perf = AA_formatResultMeter($last_perf); $new_info = $row[15]; $item = $row[13]; } else { $new_perf = getNextHeight($row[2], $last_perf); $new_info = ''; } } else { if (in_array($row[15], $cfgResultsHighStay)) { $new_perf = AA_formatResultMeter($last_perf); $new_info = $row[15]; $item = $row[13]; } else { $new_perf = getNextHeight($row[2], $last_perf); $new_info = ''; } } ?> <form action='event_results.php' method='post' name='perf'> <td nowrap colspan='2'> <input type='hidden' name='arg' value='save_res' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[4]; ?> ' /> <input type='hidden' name='xSerie' value='<?php echo $row[2]; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input class='perfheight' type='text' name='perf' maxlength='5' value='<?php echo $new_perf; ?> ' onChange='checkSubmit(document.perf)' /> <input class='texttiny' type='text' name='attempts' maxlength='3' value='<?php echo $new_info; ?> ' onChange='document.perf.submit()' onBlur='document.perf.submit()' /> </td> </form> <?php } if (is_null($row[14]) == false && empty($item)) { // next height ?> <td nowrap> <?php echo AA_formatResultMeter($row[14]) . "<br/>( {$row['15']} )"; ?> </td> <td> <?php $btn = new GUI_Button("event_results.php?arg=delete&round={$round}&item={$row['13']}&athlete={$i}", "X"); $btn->printButton(); ?> </td> <?php } $l++; } else { if (is_null($row[14]) == false) { echo "<td colspan='2' nowrap>" . AA_formatResultMeter($row[14]) . " ( {$row['15']} )</td>"; } } } if ($a != 0) { if ($_POST['athlete'] == $i) { echo "<td>"; $btn->set("event_results.php?arg=del_start&item={$a}&round={$round}", $strDelete); $btn->printButton(); echo "</td>"; } echo "</tr>"; } ?> </table> <?php mysql_free_result($result); } // ET DB error } } } } else { if ($round > 0 && $prog_mode == 2) { $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"); $ph = 0; // find max height per athlete $sql_max_h = "SELECT \r\n LPAD(s.Bezeichnung,5,'0') as heatid\r\n , count(*) \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 LEFT JOIN verein AS v ON (v.xVerein = at.xVerein)\r\n LEFT JOIN team AS t ON(a.xTeam = t.xTeam) \r\n LEFT JOIN rundentyp AS rt ON rt.xRundentyp = r.xRundentyp\r\n LEFT JOIN resultat AS rs ON rs.xSerienstart = ss.xSerienstart\r\n WHERE r.xRunde = {$round} \r\n GROUP BY ss.xSerienstart\r\n ORDER BY\r\n heatid\r\n , ss.Position DESC\r\n , rs.xResultat"; $res_max_h = mysql_query($sql_max_h); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $ph = 0; // height column $starts = 0; // all started athletes while ($row_max_h = mysql_fetch_row($res_max_h)) { $starts++; if ($row_max_h[1] > $ph) { $ph = $row_max_h[1]; } } } // fill last infos (included previous info by 'XXX') in an array $sql_info = "SELECT rt.Name\r\n , rt.Typ\r\n , s.xSerie\r\n , s.Bezeichnung\r\n , ss.xSerienstart\r\n , ss.Position\r\n , ss.Rang\r\n , a.Startnummer\r\n , at.Name\r\n , at.Vorname\r\n , at.Jahrgang\r\n , if('" . $svm . "', t.Name, IF(a.Vereinsinfo = '', v.Name, a.Vereinsinfo)) \r\n , LPAD(s.Bezeichnung,5,'0') as heatid\r\n , rs.xResultat\r\n , rs.Leistung\r\n , rs.Info\r\n , at.Land\r\n , ss.Bemerkung\r\n , at.xAthlet\r\n , r.xRunde \r\n , ss.RundeZusammen \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 LEFT JOIN verein AS v ON (v.xVerein = at.xVerein)\r\n LEFT JOIN team AS t ON(a.xTeam = t.xTeam) \r\n LEFT JOIN rundentyp AS rt ON rt.xRundentyp = r.xRundentyp\r\n LEFT JOIN resultat AS rs ON rs.xSerienstart = ss.xSerienstart \r\n WHERE r.xRunde = {$round} \r\n ORDER BY\r\n heatid\r\n , ss.Position \r\n , rs.xResultat\r\n \r\n "; $res_info = mysql_query($sql_info); if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $c = 0; $arr_info = array(); $arr_info_remark = array(); // previous info 'p' $count_results = 0; $count_ends = 0; // athletes with results 'XXX' while ($row_info = mysql_fetch_row($res_info)) { if ($row_info[4] != $a && $c > 0) { if (!empty($keep_info)) { if ($c == $ph) { $arr_info[] = $keep_info; $arr_info_remark[] = ''; $count_results++; } else { if ($keep_info == 'XXX') { $arr_info[] = $keep_info; $arr_info_remark[] = 'p'; // previous $count_results++; } else { $arr_info[] = ''; $arr_info_remark[] = ''; $count_results++; } } $c = 0; } } $c++; if ($row_info[15] == 'XXX') { $count_ends++; } $a = $row_info[4]; $keep_info = $row_info[15]; } if (!empty($keep_info)) { if ($c == $ph) { $arr_info[] = $keep_info; $arr_info_remark[] = ''; $count_results++; } else { if ($keep_info == 'XXX') { $arr_info[] = $keep_info; $arr_info_remark[] = 'p'; // previous $count_results++; } else { $arr_info[] = ''; $arr_info_remark[] = ''; $count_results++; } } } } // array for infos to jump $arr_info_toJump = array(); foreach ($arr_info as $key => $val) { if (!in_array($val, $cfgResultsHighStayDecentralEnd)) { $arr_info_toJump[$key] = $val; } } // find out new column (= newHight ) $sql_hight = "SELECT \r\n LPAD(s.Bezeichnung,5,'0') as heatid \r\n , rs.Leistung\r\n , rs.Info \r\n , d.Code \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 LEFT JOIN verein AS v ON (v.xVerein = at.xVerein)\r\n LEFT JOIN team AS t ON(a.xTeam = t.xTeam) \r\n LEFT JOIN rundentyp AS rt ON rt.xRundentyp = r.xRundentyp\r\n LEFT JOIN resultat AS rs ON rs.xSerienstart = ss.xSerienstart\r\n LEFT JOIN wettkampf AS w ON (w.xWettkampf = r.xWettkampf) \r\n LEFT JOIN disziplin AS d ON (d.xDisziplin = w.xDisziplin) \r\n WHERE r.xRunde = {$round} \r\n ORDER BY\r\n heatid\r\n , rs.Leistung DESC\r\n , ss.Position ASC\r\n "; $res_hight = mysql_query($sql_hight); $e = 0; // count performance when is finished with this high $z = 0; $first = true; $disCode = 0; while ($row_hight = mysql_fetch_row($res_hight)) { if ($perf_keep != $row_hight[1] && !$first) { $z++; if ($z > 1) { break; } else { $e_keep = $e; $e = 0; } } $first = false; if (in_array($row_hight[2], $cfgResultsHighStayDecentralEnd)) { if ($row_hight[2] != 'XXX') { $e++; } } $perf_keep = $row_hight[1]; $disCode = $row_hight[3]; } $newHight = false; if (is_null($e_keep)) { $e_keep = $e; } if ($e_keep == $starts - $count_ends) { $newHight = true; } if (empty($_POST)) { if ($ph > $max) { $max = $ph; } } if (empty($_POST)) { $y = 0; while ($row = mysql_fetch_row($res_c_h)) { $name = "hight_" . $y; $hiddenName = "hiddeHight_" . $y; $performance_new = AA_formatResultMeter($row[0]); $_POST[$name] = $performance_new; $_POST[$hiddenName] = $performance_new; $y++; } } // found active athlete $a_activ = 0; $flen = 0; $f_len_keep = 0; $r_f_len = 0; $r_f_len_keep = 0; $a_activ_set = false; $f = 0; $reset_activ = false; for ($r = $starts - 1; $r >= 0; $r--) { if ($arr_info[$r] == '' || $arr_info_remark[$r] == 'p') { $f++; } else { if ($f > 0) { $a_activ = $r + 2; for ($j = $a_activ - 1; $j < $starts; $j++) { if ($arr_info_remark[$a_activ - 1] == 'p') { $a_activ++; } } $a_activ_set = true; } if ($a_activ > $starts) { $a_activ_set = false; $reset_activ = true; } break; } } if (!$a_activ_set) { if ($newHight) { for ($r = 0; $r < $starts; $r++) { if ($arr_info[$r] != 'XXX') { $a_activ = $r + 1; $a_activ_set = true; break; } } if (!$a_activ_set) { $a_activ = 1; } } elseif ($reset_activ) { $val_keep = ''; foreach ($arr_info_toJump as $key => $val) { if (strlen($val) == 1) { $arr_info_toJump_1[$key] = $val; } elseif (strlen($val) == 2) { $arr_info_toJump_2[$key] = $val; } } if (count($arr_info_toJump_1) > 0) { foreach ($arr_info_toJump_1 as $key => $val) { $a_activ = $key + 1; break; } } else { foreach ($arr_info_toJump_2 as $key => $val) { $a_activ = $key + 1; break; } } } else { for ($r = $starts - 1; $r >= 0; $r--) { if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValidFirst = false; } else { $f_len = strlen($arr_info[$r]); $r_f_len = $r; if ($f_len_keep > 0) { if ($f_len_keep < $f_len) { $a_activ = $r_f_len_keep + 1; break; } elseif ($f_len_keep = $f_len) { $a_activ = $r_f_len + 1; } elseif ($f_len_keep > $f_len) { break; } } else { $a_activ = $r_f_len + 1; } $f_len_keep = $f_len; $r_f_len_keep = $r_f_len; } } } } if (is_null($_POST['athlete'])) { $_POST['athlete'] = $a_activ; } $aClick = false; if (isset($_POST['result'])) { // this means that user makes a click to a athlete $aClick = true; } if (isset($_GET['arg']) && $_GET['arg'] == 'delete') { $aClick = true; } $athleteValidAfter = true; if ($_POST['athlete'] >= 1 && !$aClick) { $athleteValidAfter = true; if ($starts != $count_ends) { if (count($arr_info) == $starts) { for ($r = $starts - 1; $r >= 0; $r--) { if ($r < $_POST['athlete'] - 1) { break; } if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValidAfter = false; } else { $athleteValidAfter = true; break; } } if ($_POST['athlete'] > $starts) { $athleteValidAfter = false; } } } else { $athleteValidAfter = false; if (!$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } } if (!$athleteValidAfter && !$aClick && !$newHight) { // set to first athlete when no valid athletes after $_POST['athlete'] = 1; } } // find out first valid athlete $athleteValidFirst = true; $a_first = 0; if ($_POST['athlete'] >= 1 && !$aClick) { $athleteValidFirst = true; if ($starts != $count_ends) { if (count($arr_info) == $starts) { for ($r = 0; $r < $starts; $r++) { if ($arr_info[$r] == 'XXX') { $athleteValidFirst = false; } else { $athleteValidFirst = true; $a_first = $r + 1; break; } } } } else { $athleteValidAfter = false; if (!$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } } if ($a_first > 0 && !$athleteValidAfter && !$click) { $_POST['athlete'] = $a_first; } } if (isset($_POST['result']) || $aClick) { // this means that user makes a click to a athlete $a_activ = $_POST['athlete']; } if ($starts == $count_ends && !$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } if (mysql_errno() > 0) { // DB error AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { AA_results_printMenu($round, $status, $prog_mode, 'high'); // initialize variables $a = 0; $h = 0; $i = 0; if (!empty($_GET['athlete'])) { $_POST['athlete'] = $_GET['athlete']; } if (empty($_POST['athlete']) || $starts < $_POST['athlete']) { $_POST['athlete'] = 1; // focus to first athlete } $rowclass = 'odd'; if ($cfgProgramMode[$prog_mode]['name'] == $strProgramModeBackoffice) { $focus = 0; // keep focus on this athlete if Backoffice Mode } else { $focus = 1; // focus on next athlete if Field Mode } ?> <p/> <table class='dialog'> <?php $l = 0; $newAthl = false; $flagField = false; $skip = false; $s = 0; $s_keep = 0; $k = 0; $p = 0; // all pass $btn = new GUI_Button('', ''); // create button object $flagField = false; $res_info = mysql_query($sql_info); while ($row = mysql_fetch_row($res_info)) { if ($a != $row[4] && $i != 0) { // new athlete $k = 0; if ($s >= $s_keep) { $s_keep = $s; } $s = 0; } $p++; $k++; $s++; if ($row[15] == 'XXX') { $skip = true; } else { if (in_array($row[15], $cfgResultsHighStayDecentralEnd) && $ph == $k && !$newHight) { $skip = true; } else { $skip = false; } } if ($row[20] > 0) { $singleRound = $row[20]; } else { $singleRound = $row[19]; } // terminate last row if new athlete and not first item if ($a != $row[4] && $i != 0) { $athleteValid = true; $athleteValidAfter = true; if ($starts != $count_ends) { if (count($arr_info) == $starts) { for ($r = $starts - 1; $r >= 0; $r--) { if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValid = false; } else { $athleteValid = true; break; } } for ($r = $starts - 1; $r >= 0; $r--) { if ($r < $_POST['athlete'] - 1) { break; } if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValidAfter = false; } else { $athleteValidAfter = true; break; } } } } else { $athleteValid = false; $athleteValidAfter = false; if (!$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } } if ($_POST['athlete'] == $i || !$athleteValid && $newHight && $k != 1 || $aClick && $a_activ == $i) { if (!$flagField) { ?> <form action='event_results.php' method='post' name='perf'> <td nowrap colspan='2'> <input type='hidden' name='arg' value='save_res' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='start' value='<?php echo $a; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input class='perfheight' type='hidden' name='perf' maxlength='5' value='<?php echo $new_perf; ?> ' /> <?php foreach ($_POST as $key => $val) { $arr_key = explode('_', $key); $hiddenName = $arr_key[0] . "_" . $arr_key[1]; ?> <input type='hidden' name='<?php echo $hiddenName; ?> ' value='<?php echo $val; ?> ' /> <?php } ?> <input class='texttiny' type='text' name='attempts' maxlength='3' onfocus="this.value = '<?php echo $new_info; ?> '" value='<?php echo $new_info; ?> ' /> <button type='button' name="butt" onclick="document.perf.submit()">ok</button> </td> </form> <?php $flagField = true; echo "<td colspan='31'> "; echo "</td>"; echo "<td>"; $btn->set("event_results.php?arg=del_start&item={$a}&round={$round}", $strDelete); $btn->printButton(); echo "</td>"; } } echo "</tr>"; } /* * 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']) { $c = 1; // 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 7 + $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='singleRound' value='<?php echo $singleRound; ?> ' /> <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> <?php if (isset($_POST['max'])) { $colspanPerf = $_POST['max'] * 2 + 2; } else { $colspanPerf = $cfgCountHeight * 2 + 2; } ?> <th colspan="<?php echo $colspanPerf; ?> "><?php echo $strPerformance; ?> </th> <?php ?> </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> <th class='dialog'><?php echo $strRank; ?> </th> <th class='dialog' ><?php echo $strResultRemark; ?> </th> <?php $height_start = $cfgHeightStartJump; // default jump if ($disCode == '310') { // jump $height_start = $cfgHeightStartJump; } elseif ($disCode == '320') { $height_start = $cfgHeightStartPole; // pole } ?> <form action='event_results.php' method='post' name='hight_id'> <input type='hidden' name='arg' value='save_height' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='heat' value='<?php echo $row[2]; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <?php $count_height = AA_checkHeight($round, $row[2]); $arr_height = array(); if ($count_height > 0) { $max = $count_height; $sql = "SELECT h.Hoehe \r\n FROM \r\n hoehe AS h\r\n LEFT JOIN runde AS r ON (r.xRunde = h.xRunde)\r\n LEFT JOIN wettkampf AS w ON (w.xWettkampf = r.xWettkampf) \r\n WHERE \r\n h.xRunde = " . $round . " \r\n AND h.xSerie = " . $row[2] . " \r\n AND w.xMeeting = " . $_COOKIE['meeting_id'] . "\r\n ORDER BY hoehe"; $res = mysql_query($sql); if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } else { $g = 0; while ($row_height = mysql_fetch_row($res)) { $arr_height[] = $row_height[0]; $height = AA_formatResultMeter($row_height[0]); $dis = ''; // disable the hight done if ($newHight) { $ph_vgl = $ph - 1; if ($g <= $ph_vgl) { $dis = 'disabled="disabled"'; } } else { $ph_vgl = ceil($ph - 1); if ($g <= $ph_vgl) { $dis = 'disabled="disabled"'; } if ($count_results == 0 && $g == 0) { $dis = ''; } } ?> <input class='perfheight' type='hidden' name='hiddenHeight_<?php echo $g; ?> ' maxlength='5' value='<?php echo $height; ?> '/> <th class='dialog' colspan='2'><input class='perfheight' type='text' name='hight_<?php echo $g; ?> ' maxlength='5' value='<?php echo $height; ?> ' onchange='document.hight_id.submit()' <?php echo $dis; ?> /></th> <?php $g++; } } } else { $max = $cfgCountHeight; for ($g = 0; $g < $cfgCountHeight; $g++) { $_POST['start'] = 0; $height_start_tmp = new PerformanceAttempt($height_start); $height_start_tmp = $height_start_tmp->getPerformance(); $arr_height[] = $height_start_tmp; AA_setHeight($height_start_tmp, $round, $row[2], ''); ?> <input class='perfheight' type='hidden' name='hiddenHeight_<?php echo $g; ?> ' maxlength='5' value='<?php echo sprintf("%.2f", $height_start); ?> '/> <th class='dialog' colspan='2'><input class='perfheight' type='text' name='hight_<?php echo $g; ?> ' maxlength='5' value='<?php echo sprintf("%.2f", $height_start); ?> ' onchange='document.hight_id.submit()' /></th> <?php if ($disCode == '310') { // jump $height_start += $cfgHeightDiffJump; } elseif ($disCode == '320') { $height_start += $cfgHeightDiffPole; // pole } else { $height_start += $cfgHeightDiffJump; } } } ?> <input class='perfheight' type='hidden' name='hiddenHeight_<?php echo $g; ?> ' maxlength='5' value=''/> <th class='dialog' colspan='2'><input class='perfheight' type='text' name='hight_<?php echo $max; ?> ' maxlength='5' value='' onchange='document.hight_id.submit()' /></th> <input type='hidden' name='max' value='<?php echo $max; ?> ' /> <input type='hidden' name='disCode' value='<?php echo $disCode; ?> ' /> </form> </tr> <?php } // ET new heat /* * Athlete data lines */ if ($newAthl) { if ($k == $ph) { // k = results per athlete ph = hight column $athleteValid = true; $athleteValidAfter = true; if ($starts != $count_ends) { if (count($arr_info) == $starts) { for ($r = $starts - 1; $r >= 0; $r--) { if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValid = false; } else { $athleteValid = true; break; } } for ($r = $starts - 1; $r >= 0; $r--) { if ($r < $_POST['athlete'] - 1) { break; } if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValidAfter = false; } else { $athleteValidAfter = true; break; } } } } else { $athleteValid = false; $athleteValidAfter = false; if (!$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } } if (!$athleteValid) { $l = 1; if (!$click) { if ($a_first == 0) { $_POST['athlete'] = 1; $l = 0; } } } } if (in_array($row[15], $cfgResultsHighStayDecentralNotPassed)) { // find O (example: O, XO , XXO ) $l = 0; // reset result counter $newAthl = false; } else { if (is_null($row[15])) { $l = 0; $newAthl = false; } else { if (in_array($row[15], $cfgResultsHighStayDecentralEnd) && $_POST['athlete'] == $i && $skip) { if ($athleteValidAfter && !$aClick) { $_POST['athlete']++; } $newAthl = false; $l = 1; } elseif (in_array($row[15], $cfgResultsHighStayDecentralEnd) && $_POST['athlete'] == $i && !$skip && $p != $ph) { $l = 1; } else { $l = 1; } } } } if ($a != $row[4]) { if ($k == $ph) { $athleteValid = true; if ($starts != $count_ends) { if (count($arr_info) == $starts) { for ($r = $starts - 1; $r >= 0; $r--) { if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValid = false; } else { $athleteValid = true; break; } } } } else { $athleteValid = false; if (!$aClick) { $_POST['athlete'] = 1; $a_activ = 1; } } $athleteValidAfter = true; for ($r = $starts - 1; $r >= 0; $r--) { if ($r >= $_POST['athlete']) { break; } if (in_array($arr_info[$r], $cfgResultsHighStayDecentralEnd)) { $athleteValidAfter = false; } else { $athleteValidAfter = true; break; } } if (!$athleteValid) { $l = 1; if (!$click) { if ($a_first == 0) { $_POST['athlete'] = 1; $l = 0; } } } } $a = $row[4]; // keep athlete ID $info_keep = $row[15]; // keep info $i++; // increment athlete counter $newAthl = true; if (in_array($row[15], $cfgResultsHighStayDecentralNotPassed)) { // find O (example: O, XO , XXO ) $l = 0; // reset result counter $newAthl = false; } else { if (is_null($row[15])) { $l = 0; $newAthl = false; } else { if (in_array($row[15], $cfgResultsHighStayDecentralEnd) && $_POST['athlete'] == $i && $skip && !$aClick) { if ($starts != $count_ends) { $_POST['athlete']++; } $newAthl = false; $l = 1; } elseif (in_array($row[15], $cfgResultsHighStayDecentralEnd) && $_POST['athlete'] == $i && !$skip && $p != $ph) { $l = 1; } else { $l = 1; } } } if ($a_activ == $i) { // active item $rowclass = 'active'; if (isset($_POST['start'])) { AA_setCurrAthlete($row[2], $row[4]); } } else { if ($row[5] % 2 == 0) { // even row numer $rowclass = 'even'; } else { // odd row number $rowclass = 'odd'; } } if ($rowclass == 'active') { ?> <tr id="athlete_<?php echo $i; ?> " class='active'> <?php } else { ?> <tr id="athlete_<?php echo $i; ?> " class='<?php echo $rowclass; ?> ' onclick='selectAthlete(<?php echo $i; ?> )'> <?php } ?> <td class='forms_right'><?php echo $row[5]; ?> </td> <td class='forms_right'><?php echo $row[7]; /* start nbr */ ?> </td> <td nowrap><?php echo $row[8] . " " . $row[9]; /* name */ ?> </td> <td class='forms_ctr'><?php echo AA_formatYearOfBirth($row[10]); ?> </td> <td><?php echo $row[16] != '' && $row[16] != '-' ? $row[16] : ' '; ?> </td> <td nowrap><?php echo $row[11]; /* club */ ?> </td> <?php if ($a_activ == $i) { ?> <form action='event_results.php' method='post' name='rank'> <td> <input type='hidden' name='arg' value='save_rank' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[4]; ?> ' /> <input class='nbr' type='text' name='rank' maxlength='3' value='<?php echo $row[6]; ?> ' onchange='document.rank.submit()' /> </td> </form> <?php if ($zaehler == 0) { ?> <form action='event_results.php' method='post' name='remark_<?php echo $i; ?> '> <td> <input type='hidden' name='arg' value='save_remark' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='item' value='<?php echo $row[4]; ?> ' /> <input type='hidden' name='xAthlete' value='<?php echo $row[18]; ?> ' /> <input class='textshort' type='text' name='remark' maxlength='5' value='<?php echo $row[17]; ?> ' onchange='document.remark_<?php echo $i; ?> .submit()' /> </td> </form> <?php $zaehler++; } } else { echo "<td>" . $row[6] . "</td>"; echo "<td>" . $row[17] . "</td>"; } } // ET new athlete $new_perf = ''; if ($_POST['athlete'] == $i) { // only current athlet $item = ''; $ph_perf = $ph - 1; $hiddenName = "hiddenHight_" . $ph_perf; if ($newHight) { $ph_perf += 1; } $hiddenName = "hiddenHight_" . $ph_perf; $new_perf = $arr_height[$ph_perf]; $new_perf = new PerformanceAttempt($new_perf); $new_perf = $new_perf->getPerformance(); // read all performances achieved in current heat and // better than last entered performance if (in_array($row[15], $cfgResultsHighStayDecentral)) { $new_info = $row[15]; if (in_array($row[15], $cfgResultsHighStayDecentralEnd)) { $new_info = ''; } else { $item = $row[13]; } } else { $new_info = ''; } if (is_null($row[14]) == false && empty($item)) { // next height ?> <td nowrap> <?php echo $row[15]; ?> </td> <?php if ($_POST['athlete'] == $a_activ) { ?> <td> <?php $btn = new GUI_Button("event_results.php?arg=delete&round={$round}&item={$row['13']}&athlete={$i}", "del"); $btn->printButton(); ?> </td> <?php } else { ?> <td></td> <?php } } if ($l == 0) { // first item $find = strpos(strtoupper($row[15], 'O')); if ($row[15] == '-') { if (!$skip) { $l++; } } elseif (!in_array($row[15], $cfgResultsHighStayDecentralNotPassed)) { $l++; } $flagField = true; ?> <form action='event_results.php' method='post' name='perf'> <td nowrap colspan='2'> <input type='hidden' name='arg' value='save_res' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='start' value='<?php echo $row[4]; ?> ' /> <input type='hidden' name='xSerie' value='<?php echo $row[2]; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input class='perfheight' type='hidden' name='perf' maxlength='5' value='<?php echo $new_perf; ?> ' /> <?php foreach ($_POST as $key => $val) { $arr_key = explode('_', $key); $hiddenName = $arr_key[0] . "_" . $arr_key[1]; ?> <input type='hidden' name='<?php echo $hiddenName; ?> ' value='<?php echo $val; ?> ' /> <?php } ?> <input class='texttiny' type='text' name='attempts' maxlength='3' onfocus="this.value = '<?php echo $new_info; ?> '" value='<?php echo $new_info; ?> ' /> <button type='button' name="butt" onclick="document.perf.submit()">ok</button> </td> </form> <?php $prev_info = ''; echo "<td colspan='31'> "; echo "</td>"; echo "<td>"; $btn->set("event_results.php?arg=del_start&item={$a}&round={$round}", $strDelete); $btn->printButton(); echo "</td>"; } } else { if (is_null($row[14]) == false) { // result entered $showNotValidRes = ''; if ($row[14] < 0) { $showNotValidRes = "({$row['14']})"; } echo "<td colspan='2' nowrap>{$showNotValidRes} {$row['15']} </td>"; } } } if ($a != 0) { if ($s == $s_keep || $s_keep == 1 || $info_keep == '-' && $ph == $k) { if (!$aClick) { $skip = true; $_POST['athlete']++; } } else { $skip = false; } if ($_POST['athlete'] == $i) { if (!$flagField && !$skip) { ?> <form action='event_results.php' method='post' name='perf'> <td nowrap colspan='2'> <input type='hidden' name='arg' value='save_res' /> <input type='hidden' name='round' value='<?php echo $round; ?> ' /> <input type='hidden' name='singleRound' value='<?php echo $singleRound; ?> ' /> <input type='hidden' name='athlete' value='<?php echo $i + $focus; ?> ' /> <input type='hidden' name='start' value='<?php echo $a; ?> ' /> <input type='hidden' name='item' value='<?php echo $item; ?> ' /> <input class='perfheight' type='hidden' name='perf' maxlength='5' value='<?php echo $new_perf; ?> ' /> <?php foreach ($_POST as $key => $val) { $arr_key = explode('_', $key); $hiddenName = $arr_key[0] . "_" . $arr_key[1]; ?> <input type='hidden' name='<?php echo $hiddenName; ?> ' value='<?php echo $val; ?> ' /> <?php } ?> <input class='texttiny' type='text' name='attempts' maxlength='3' onfocus="this.value = '<?php echo $new_info; ?> '" value='<?php echo $new_info; ?> ' /> <button type='button' name="butt" onclick="document.perf.submit()">ok</button> </td> </form> <?php echo "<td colspan='15'> "; echo "</td>"; echo "<td>"; $btn->set("event_results.php?arg=del_start&item={$a}&round={$round}", $strDelete); $btn->printButton(); echo "</td>"; } } echo "</tr>"; } ?> </table> <?php mysql_free_result($res); } // ET DB error } } } } } ?> <script type="text/javascript"> <!-- var prog = "<?php echo $prog_mode; ?> "; if (prog == 2) { if(document.perf) { document.perf.attempts.focus(); window.scrollBy(0,100); } } else { if(document.perf) { document.perf.perf.focus(); document.perf.perf.select(); window.scrollBy(0,100); } if(document.rank) { document.rank.rank.focus(); document.rank.rank.select(); window.scrollBy(0,100); } } //--> </script> </body> </html> <?php } else { AA_printErrorMsg($strErrMergedRound); } }
AA_printErrorMsg($strCategory . $strErrNotValid); } else { if (AA_checkReference("meeting", "xMeeting", $_COOKIE['meeting_id']) == 0) { AA_printErrorMsg($strMeeting . $strErrNotValid); } else { if (AA_checkReference("verein", "xVerein", $_POST['club']) == 0) { AA_printErrorMsg($strClub . $strErrNotValid); } else { // Team selected if (!empty($_POST['team']) && AA_checkReference("team", "xTeam", $_POST['team']) == 0) { AA_printErrorMsg($strTeam . $strErrNotValid); } else { $eventcheck = TRUE; if (count($_POST['events']) > 0) { foreach ($_POST['events'] as $event) { if (AA_checkReference("wettkampf", "xWettkampf", $event) == 0) { $eventcheck = FALSE; } } } if ($eventcheck == FALSE) { AA_printErrorMsg($strEvent . $strErrNotValid); } else { $startnbr = AA_getLastStartnbr(); // startnbrs already assigned, none provided if ($startnbr > 0 && empty($_POST['startnbr'])) { $startnbr++; // use next available nbr // check if this nbr is used for a relay $result = mysql_query("SELECT xStaffel " . " FROM staffel" . " WHERE xMeeting=" . $_COOKIE['meeting_id'] . " AND Startnummer=" . $startnbr); if (mysql_errno() > 0) {
AA_printErrorMsg($strErrEmptyFields); } else { if ($_POST['arg'] == "add") { mysql_query("\r\n\t\t\tINSERT INTO stadion SET \r\n\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\t\t, Bahnen=\"" . $_POST['tracks'] . "\"\r\n\t\t\t\t, BahnenGerade=\"" . $_POST['tracks2'] . "\"\r\n\t\t\t\t, Ueber1000m=\"{$o1000m}\"\r\n\t\t\t\t, Halle=\"{$inhall}\"\r\n\t\t"); } else { if ($_POST['arg'] == "change") { mysql_query("\r\n\t\t\tUPDATE stadion SET \r\n\t\t\t\tName=\"" . $_POST['name'] . "\"\r\n\t\t\t\t, Bahnen=" . $_POST['tracks'] . "\r\n\t\t\t\t, BahnenGerade=\"" . $_POST['tracks2'] . "\"\r\n\t\t\t\t, Ueber1000m=\"{$o1000m}\"\r\n\t\t\t\t, Halle=\"{$inhall}\"\r\n\t\t\tWHERE xStadion=" . $_POST['item']); } } } } else { if ($_GET['arg'] == "del") { mysql_query("LOCK TABLES anlage READ, meeting READ, stadion WRITE"); // Still in use? $rows = AA_checkReference("anlage", "xStadion", $_GET['item']); $rows = $rows + AA_checkReference("meeting", "xStadion", $_GET['item']); // OK: not used anymore if ($rows == 0) { mysql_query("DELETE FROM stadion WHERE xStadion=" . $_GET['item']); } else { AA_printErrorMsg($strStadium . $strErrStillUsed); } mysql_query("UNLOCK TABLES"); } } // Check if any error returned from DB if (mysql_errno() > 0) { AA_printErrorMsg(mysql_errno() . ": " . mysql_error()); } // // Display current data