/** * get round status * ---------------- */ function AA_getRoundStatus($round) { $status = AA_utils_getRoundStatus($round); if (!empty($GLOBALS['AA_ERROR'])) { AA_printErrorMsg($GLOBALS['AA_ERROR']); } return $status; }
function change() { include './convtables.inc.php'; require './lib/common.lib.php'; // Error: Empty fields if (empty($this->round)) { $GLOBALS['AA_ERROR'] = $GLOBALS['strErrEmptyFields']; } else { mysql_query("LOCK TABLES serie READ, kategorie_svm as ks READ, wettkampf as w READ, runde as r READ, disziplin_de as d READ, disziplin_fr as d READ, disziplin_it as d READ, runde WRITE, wettkampf WRITE, meeting WRITE"); $status = AA_utils_getRoundStatus($this->round); if ($status == $GLOBALS['cfgRoundStatus']['results_done']) { $GLOBALS['AA_ERROR'] = $GLOBALS['strErrResultsEntered']; } else { if (empty($this->type)) { // round type is not optional! $GLOBALS['AA_ERROR'] = $GLOBALS['strType'] . $GLOBALS['strErrNotValid']; } else { if (!empty($this->etime)) { $et = AA_formatEnteredTime($this->etime); $sqlEtime = ", Appellzeit = '{$et['0']}:{$et['1']}:00'"; } if (!empty($this->mtime)) { $mt = AA_formatEnteredTime($this->mtime); $sqlMtime = ", Stellzeit = '{$mt['0']}:{$mt['1']}:00'"; } // set conversion table if (isset($cfgSVM[$this->svmCode])) { $cfgSVM_arr = $cfgSVM[$this->svmCode]; if (isset($cfgSVM[$this->svmCode . "_NT"])) { // _NT = nulltime $cfgSVM_arr_NT = $cfgSVM[$this->svmCode . "_NT"]; } } if (isset($cfgSVM[$this->svmCode . "_NT"])) { // _NT = nulltime foreach ($cfgSVM_arr as $key => $val) { if ($val == $_POST['dCode']) { $keep_key = $key; continue; } } if ($cfgSVM_arr_NT[$keep_key] == '0000') { // discipline with nulltime $this->change_all(); } else { mysql_query("\r\n UPDATE runde SET\r\n Datum = '" . $this->date . "'\r\n , Startzeit = '" . $this->hour . ":" . $this->min . ":00" . "'\r\n , xRundentyp = " . $this->type . "\r\n , Gruppe = '" . $this->group . "' \r\n {$sqlEtime}\r\n {$sqlMtime}\r\n WHERE xRunde = " . $this->round); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } else { $sql = "SELECT \r\n xRundentyp,\r\n xWettkampf\r\n FROM\r\n runde as r\r\n WHERE\r\n r.xRunde = " . $this->round; $result = mysql_query($sql); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } else { $row = mysql_fetch_array($result); if ($row[0] == 8 && $this->type != 8) { // typ 8 = combined event $typchange = ''; $sql_event = "SELECT \r\n w.Typ,\r\n w.Punktetabelle,\r\n w.Punkteformel,\r\n w.Info,\r\n w.Mehrkampfcode,\r\n w.Mehrkampfende, \r\n w.Mehrkampfreihenfolge \r\n FROM\r\n wettkampf as w\r\n WHERE\r\n w.xWettkampf = " . $row[1]; $res_event = mysql_query($sql_event); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } else { $row_event = mysql_fetch_array($res_event); $typchange = $row_event[0] . "," . $row_event[1] . "," . $row_event[2] . "," . $row_event[3] . "," . $row_event[4] . "," . $row_event[5] . "," . $row_event[6]; // update event as single event mysql_query("\r\n UPDATE wettkampf SET\r\n Typ = 0\r\n , Punktetabelle = 0\r\n , Punkteformel = '0'\r\n , Info = '' \r\n , Mehrkampfcode = 0\r\n , Mehrkampfende = 0 \r\n , Mehrkampfreihenfolge = 0 \r\n , TypAenderung = '" . $typchange . "' \r\n WHERE xWettkampf = " . $row[1]); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } elseif ($this->type == 8 && $row[0] != 8) { // typ 8 = combined event $sql_event = "SELECT \r\n w.TypAenderung \r\n FROM\r\n wettkampf as w\r\n WHERE\r\n w.xWettkampf = " . $row[1]; $res_event = mysql_query($sql_event); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } else { $row_event = mysql_fetch_array($res_event); if ($row_event[0] != '') { $typchange = explode(",", $row_event[0]); // update event as combined event mysql_query("\r\n UPDATE wettkampf SET\r\n Typ = " . $typchange[0] . "\r\n , Punktetabelle = " . $typchange[1] . " \r\n , Punkteformel = '" . $typchange[2] . "' \r\n , Info = '" . $typchange[3] . "' \r\n , Mehrkampfcode = " . $typchange[4] . " \r\n , Mehrkampfende = " . $typchange[5] . " \r\n , Mehrkampfreihenfolge = " . $typchange[6] . " \r\n , TypAenderung = '' \r\n WHERE xWettkampf = " . $row[1]); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } } mysql_query("\r\n\t\t\t\t\t\t UPDATE runde SET\r\n\t\t\t\t\t\t\t Datum = '" . $this->date . "'\r\n\t\t\t\t\t\t\t , Startzeit = '" . $this->hour . ":" . $this->min . ":00" . "'\r\n\t\t\t\t\t\t\t , xRundentyp = " . $this->type . "\r\n\t\t\t\t\t\t\t , Gruppe = '" . $this->group . "' \r\n\t\t\t\t\t\t\t {$sqlEtime}\r\n\t\t\t\t\t\t\t {$sqlMtime}\r\n\t\t\t\t\t\t WHERE xRunde = " . $this->round); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } $sql = "UPDATE meeting SET\r\n StatusChanged = 'y' \r\n WHERE xMeeting = " . $_COOKIE['meeting_id']; mysql_query($sql); if (mysql_errno() > 0) { $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error(); } } } mysql_query("UNLOCK TABLES"); if ($status > 0 && $status != 4) { $txt = $GLOBALS['strTimetableChanged'] . ": " . $this->date . ", " . $this->hr . ":" . $this->min; AA_utils_logRoundEvent($this->round, $txt); } } // ET round status }