Example #1
0
function recMatches(&$matches, $key)
{
    if (hasNextWinnerMatch($matches[$key])) {
        $winner_bracket = getNextWinnerBracket($matches[$key]);
        $winner_round = getNextWinnerRound($matches[$key]);
        $winner_match = getNextWinnerMatch($matches[$key]);
        $winner_player = getNextWinnerPlayer($matches[$key]);
        $new_key = "{$winner_bracket}-{$winner_round}-{$winner_match}";
        if ($matches[$new_key]['id_' . $winner_player] == 0 and $matches[$key]['confirmed'] == "0000-00-00 00:00:00") {
            $matches[$new_key][$winner_player] = "Winner [{$key}]";
        }
        $matches[$new_key]['prev_match_' . $winner_player] = $key;
    }
    if (hasNextLoserMatch($matches[$key])) {
        $loser_bracket = getNextLoserBracket($matches[$key]);
        $loser_round = getNextLoserRound($matches[$key]);
        $loser_match = getNextLoserMatch($matches[$key]);
        $loser_player = getNextLoserPlayer($matches[$key]);
        $new_key = "{$loser_bracket}-{$loser_round}-{$loser_match}";
        if ($matches[$new_key]['id_' . $loser_player] == 0) {
            $matches[$new_key][$loser_player] = "Loser [{$key}]";
        }
        $matches[$new_key]['prev_match_' . $loser_player] = $key;
    }
}
Example #2
0
function isLastMatch(&$match)
{
    global $cfg;
    $next_winner_match_played = false;
    if (hasNextWinnerMatch($match)) {
        $winner_bracket = getNextWinnerBracket($match);
        $winner_round = getNextWinnerRound($match);
        $winner_match = getNextWinnerMatch($match);
        $matches_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}matches` " . "WHERE `id_season` = {$match['id_season']} " . "AND `bracket` = '{$winner_bracket}' " . "AND `round` = {$winner_round} " . "AND `match` = {$winner_match} " . "AND `submitted` <> '0000-00-00 00:00:00'");
        if (dbNumRows($matches_ref) == 1) {
            $next_winner_match_played = true;
        }
    }
    $next_loser_match_played = false;
    if (hasNextLoserMatch($match)) {
        $loser_bracket = getNextLoserBracket($match);
        $loser_round = getNextLoserRound($match);
        $loser_match = getNextLoserMatch($match);
        $matches_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}matches` " . "WHERE `id_season` = {$match['id_season']} " . "AND `bracket` = '{$loser_bracket}' " . "AND `round` = {$loser_round} " . "AND `match` = {$loser_match} " . "AND `submitted` <> '0000-00-00 00:00:00'");
        if (dbNumRows($matches_ref) == 1) {
            $next_loser_match_played = true;
        }
    }
    if ($next_winner_match_played or $next_loser_match_played) {
        return false;
    } else {
        return true;
    }
}