Пример #1
0
 function replaceTeam($team_id, $new_seed)
 {
     global $sql;
     global $time;
     $error = 0;
     // Get team's old seed
     $q = "SELECT " . TBL_TEAMS . ".*" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".TeamID = '{$team_id}')";
     $result = $sql->db_Query($q);
     $old_seed = mysql_result($result, 0, TBL_TEAMS . ".Seed");
     echo "old_seed: {$old_seed}<br>";
     // Find team_target
     $q = "SELECT " . TBL_TEAMS . ".*" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".Event = '" . $this->fields['EventID'] . "')" . " AND (" . TBL_TEAMS . ".Seed = '{$new_seed}')";
     $result = $sql->db_Query($q);
     $numTeams = mysql_numrows($result);
     if ($numTeams == 1) {
         $team_target_id = mysql_result($result, 0, TBL_TEAMS . ".TeamID");
         echo "team_target_id: {$team_target_id}<br>";
         $q_2 = "SELECT count(*) " . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_TEAMS . " WHERE (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_SCORES . ".Team)" . " AND (" . TBL_TEAMS . ".TeamID = '{$team_target_id}')";
         $result_2 = $sql->db_Query($q_2);
         $tmatches = mysql_result($result_2, 0);
         echo "tmatches: {$tmatches}<br>";
         if ($tmatches > 0) {
             // Cannot switch with a team_target who has played already ???
             $error = 1;
         } else {
             // Delete team_target matches
             // And then change his seed.
             deleteTeamMatches($team_target_id);
             // Update team's seed
             $q = "UPDATE " . TBL_TEAMS . " SET Seed = '" . $old_seed . "' WHERE (TeamID = '" . $team_target_id . "')";
             $sql->db_Query($q);
         }
     }
     if ($error == 0) {
         // Update team's seed
         $q = "UPDATE " . TBL_TEAMS . " SET Seed = '" . $new_seed . "' WHERE (TeamID = '" . $team_id . "')";
         $sql->db_Query($q);
         if ($this->getField('FixturesEnable') == TRUE && $this->getField('Status') == 'active') {
             $this->brackets(true);
         }
         $this->setFieldDB('IsChanged', 1);
     }
     return $error;
 }
Пример #2
0
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['kick_team']) && $_POST['kick_team'] != "") {
    $teamid = $_POST['kick_team'];
    deleteTeam($teamid);
    if ($event->getField('FixturesEnable') == TRUE && $event->getField('Status') == 'active') {
        $event->brackets(true);
    }
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['del_team_games']) && $_POST['del_team_games'] != "") {
    $teamid = $_POST['del_team_games'];
    deleteTeamMatches($teamid);
    if ($event->getField('FixturesEnable') == TRUE) {
        $event->brackets(true);
    }
    updateStats($event_id, $time, TRUE);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['del_team_awards']) && $_POST['del_team_awards'] != "") {
    $teamid = $_POST['del_team_awards'];
    deleteTeamAwards($teamid);
    header("Location: eventmanage.php?eventid={$event_id}");
    exit;
}
if (isset($_POST['checkin_team']) && $_POST['checkin_team'] != "") {
    $teamid = $_POST['checkin_team'];