}
        }
    }
    mysql_query("UNLOCK TABLES");
} elseif ($_POST['arg'] == "teamsm_remove") {
    mysql_query("LOCK TABLES runde as r WRITE, wettkampf as w READ, runde WRITE, serie READ");
    // if there are already rounds with groups, remove all but the one with the lowest group
    $res = mysql_query("SELECT r.xRunde, r.Gruppe FROM\r\n\t\t\t\trunde as r\r\n\t\t\t\t, wettkampf as w\r\n\t\t\tWHERE\r\n\t\t\t\tr.xWettkampf = w.xWettkampf\r\n\t\t\tAND\tw.xWettkampf = {$disc}\r\n\t\t\tORDER BY\r\n\t\t\t\tr.Gruppe ASC");
    if (mysql_errno() > 0) {
        AA_printErrorMsg(mysql_errno() . ": " . mysql_error());
    } else {
        if (mysql_num_rows($res) > 0) {
            $g = 0;
            $del = false;
            while ($row = mysql_Fetch_array($res)) {
                if (AA_utils_checkReference("serie", "xRunde", $row[0]) != 0) {
                    $error = $GLOBALS['strRound'] . $GLOBALS['strErrStillUsed'];
                    AA_printErrorMsg($error);
                    $_POST['arg'] = "";
                    break;
                }
                if ($g != 0 && $g != $row[1]) {
                    // first group over
                    $del = true;
                }
                if ($del) {
                    mysql_query("DELETE FROM runde WHERE xRunde = {$row['0']}");
                } else {
                    mysql_query("UPDATE runde as r SET Gruppe = '' WHERE xRunde = {$row['0']}");
                }
                $g = $row[1];
Exemplo n.º 2
0
 function update_remark()
 {
     $GLOBALS['AA_ERROR'] = '';
     $query = '';
     $reply = new ResultReturn();
     mysql_query("\r\n            LOCK TABLES rundenset READ, runde READ, runde as r READ , serie as s READ , start as st READ, \r\n            wettkampf as w READ , anmeldung as a READ , athlet as at READ, verein as v READ, \r\n            rundentyp_de as rt READ, rundentyp_fr as rt READ, rundentyp_it as rt READ, serienstart as ss READ  , serienstart WRITE\r\n        ");
     if (!empty($this->startID)) {
         if (AA_utils_checkReference("serienstart", "xSerienstart", $this->startID) == 0) {
             $GLOBALS['AA_ERROR'] = $GLOBALS['strErrAthleteNotInHeat'];
         } else {
             $query = "SELECT \r\n                        w.mehrkampfcode , ss.Bemerkung\r\n                    FROM\r\n                        athletica.serienstart as ss\r\n                        LEFT JOIN athletica.start as st On (ss.xStart = st.xStart)\r\n                        LEFT JOIN athletica.wettkampf as w On (w.xWettkampf = st.xWettkampf) \r\n                    WHERE\r\n                        w.mehrkampfcode = 0\r\n                        AND ss.xSerienstart = " . $this->startID;
             $result = mysql_query($query);
             if (mysql_errno() > 0) {
                 $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
             } else {
                 if (mysql_num_rows($result) > 0) {
                     $sql = "UPDATE athletica.serienstart \r\n                                    SET Bemerkung = '" . $this->remark . "'                                     \r\n                                         WHERE xSerienstart = " . $this->startID . ";";
                     mysql_query($sql);
                     if (mysql_errno() > 0) {
                         $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                     }
                 } else {
                     // comnined event
                     $query_mk = "SELECT \r\n                                    ss.xSerienstart , ss.Bemerkung   \r\n                               FROM \r\n                                    athletica.runde AS r \r\n                                    LEFT JOIN athletica.serie AS s ON (s.xRunde = r.xRunde) \r\n                                    LEFT JOIN athletica.serienstart AS ss ON (ss.xSerie = s.xSerie)\r\n                                    LEFT JOIN athletica.start AS st ON (st.xStart = ss.xStart) \r\n                                    LEFT JOIN athletica.wettkampf as w ON (w.xWettkampf = st.xWettkampf)\r\n                                    LEFT JOIN athletica.anmeldung AS a ON (a.xAnmeldung = st.xAnmeldung)\r\n                                    LEFT JOIN athletica.athlet AS at ON (at.xAthlet = a.xAthlet)\r\n                                    LEFT JOIN athletica.verein AS v ON (v.xVerein = at.xVerein   )\r\n                                    LEFT JOIN athletica.rundentyp_" . $_COOKIE['language'] . " AS rt ON rt.xRundentyp = r.xRundentyp                              \r\n                               WHERE \r\n                                    w.mehrkampfcode > 0\r\n                                    AND at.xAthlet = " . $this->xAthlete;
                     $result = mysql_query($query_mk);
                     if (mysql_errno() > 0) {
                         $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                     } else {
                         while ($row = mysql_fetch_row($result)) {
                             $sql = "UPDATE athletica.serienstart \r\n                                            SET Bemerkung = '" . $this->remark . "'                                     \r\n                                            WHERE xSerienstart = " . $row[0] . ";";
                             mysql_query($sql);
                             if (mysql_errno() > 0) {
                                 $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                             }
                         }
                     }
                 }
             }
         }
     }
     mysql_query("UNLOCK TABLES");
     return $reply;
 }
Exemplo n.º 3
0
 /**
  * Check data reference
  *
  * @param		string	table		name of table to be checked
  * @param		string	unique	name of unique key column
  * @param		int			id			uniqe key of item to be checked (xTablename)
  * @return	int			rows		nbr of rows found
  */
 function AA_checkReference($table, $unique, $id)
 {
     $rows = AA_utils_checkReference($table, $unique, $id);
     if (!empty($GLOBALS['AA_ERROR'])) {
         AA_printErrorMsg($GLOBALS['AA_ERROR']);
     }
     return $rows;
 }
Exemplo n.º 4
0
 function delete()
 {
     require './lib/utils.lib.php';
     $GLOBALS['AA_ERROR'] = '';
     // Error: Empty fields
     if (empty($_POST['round'])) {
         $GLOBALS['AA_ERROR'] = $GLOBALS['strErrEmptyFields'];
     } else {
         mysql_query("LOCK TABLES serie READ, runde WRITE, rundenset READ, rundenset WRITE");
         // Still in use?
         if (AA_utils_checkReference("serie", "xRunde", $this->round) != 0) {
             $GLOBALS['AA_ERROR'] = $GLOBALS['strRound'] . $GLOBALS['strErrStillUsed'];
         } else {
             mysql_query("\r\n\t\t\t\t\tDELETE FROM\r\n\t\t\t\t\t\trunde\r\n\t\t\t\t\tWHERE xRunde = " . $this->round);
         }
         // Check if any error returned from DB
         if (mysql_errno() > 0) {
             $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
         }
         // check if merged round
         $sql = "SELECT xRundenset, Hauptrunde FROM rundenset WHERE xRunde = " . $this->round . " AND xMeeting = " . $_COOKIE['meeting_id'];
         $result = mysql_query($sql);
         if (mysql_errno() > 0) {
             $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
         }
         $num = mysql_num_rows($result);
         if ($num > 0) {
             $row = mysql_fetch_row($result);
             if ($row[1] == 1 || $num == 2) {
                 // main round
                 mysql_query("\r\n                        DELETE FROM\r\n                            rundenset\r\n                        WHERE xRundenset = " . $row[0] . " AND xMeeting = " . $_COOKIE['meeting_id']);
                 if (mysql_errno() > 0) {
                     $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                 }
             } else {
                 mysql_query("\r\n                        DELETE FROM\r\n                            rundenset\r\n                        WHERE xRunde= " . $this->round . " AND xMeeting = " . $_COOKIE['meeting_id']);
                 if (mysql_errno() > 0) {
                     $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                 }
             }
         }
         mysql_query("UNLOCK TABLES");
     }
 }
Exemplo n.º 5
0
 function delete()
 {
     require './lib/utils.lib.php';
     $GLOBALS['AA_ERROR'] = '';
     // Error: Empty fields
     if (empty($_POST['round'])) {
         $GLOBALS['AA_ERROR'] = $GLOBALS['strErrEmptyFields'];
     } else {
         mysql_query("LOCK TABLES serie READ, runde WRITE");
         // Still in use?
         if (AA_utils_checkReference("serie", "xRunde", $this->round) != 0) {
             $GLOBALS['AA_ERROR'] = $GLOBALS['strRound'] . $GLOBALS['strErrStillUsed'];
         } else {
             mysql_query("\r\n\t\t\t\t\tDELETE FROM\r\n\t\t\t\t\t\trunde\r\n\t\t\t\t\tWHERE xRunde = " . $this->round);
         }
         // Check if any error returned from DB
         if (mysql_errno() > 0) {
             $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
         }
         mysql_query("UNLOCK TABLES");
     }
 }
Exemplo n.º 6
0
 /**
  * save remark
  * ---------------
  */
 function AA_utils_saveRemark($startID, $remark, $xAthlete)
 {
     $GLOBALS['AA_ERROR'] = '';
     $query = '';
     mysql_query("\r\n            LOCK TABLES rundenset READ, runde READ, runde as r READ , serie as s READ , start as st READ, \r\n            wettkampf as w READ , anmeldung as a READ , athlet as at READ, verein as v READ, \r\n            rundentyp as rt READ, serienstart as ss READ  , serienstart WRITE\r\n        ");
     if (!empty($startID)) {
         if (AA_utils_checkReference("serienstart", "xSerienstart", $startID) == 0) {
             $GLOBALS['AA_ERROR'] = $GLOBALS['strErrAthleteNotInHeat'];
         } else {
             $query = "SELECT \r\n                        w.mehrkampfcode , ss.Bemerkung\r\n                    FROM\r\n                        serienstart as ss\r\n                        LEFT JOIN start as st On (ss.xStart = st.xStart)\r\n                        LEFT JOIN wettkampf as w On (w.xWettkampf = st.xWettkampf) \r\n                    WHERE\r\n                        w.mehrkampfcode = 0\r\n                        AND ss.xSerienstart = " . $startID;
             $result = mysql_query($query);
             if (mysql_errno() > 0) {
                 $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
             } else {
                 if (mysql_num_rows($result) > 0) {
                     $sql = "UPDATE serienstart \r\n                                    SET Bemerkung = '" . $remark . "'                                     \r\n                                         WHERE xSerienstart = " . $startID . ";";
                     mysql_query($sql);
                     if (mysql_errno() > 0) {
                         $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                     }
                 } else {
                     // comnined event
                     $query_mk = "SELECT \r\n                                        ss.xSerienstart , ss.Bemerkung   \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 wettkampf as w ON (w.xWettkampf = st.xWettkampf)\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 rundentyp AS rt ON rt.xRundentyp = r.xRundentyp                              \r\n                                   WHERE w.mehrkampfcode > 0\r\n                                        AND at.xAthlet = " . $xAthlete;
                     $result = mysql_query($query_mk);
                     if (mysql_errno() > 0) {
                         $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                     } else {
                         while ($row = mysql_fetch_row($result)) {
                             $sql = "UPDATE serienstart \r\n                                            SET Bemerkung = '" . $remark . "'                                     \r\n                                            WHERE xSerienstart = " . $row[0] . ";";
                             mysql_query($sql);
                             if (mysql_errno() > 0) {
                                 $GLOBALS['AA_ERROR'] = mysql_errno() . ": " . mysql_error();
                             }
                         }
                     }
                 }
             }
         }
     }
     mysql_query("UNLOCK TABLES");
 }