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; } }
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; } }
$content_tpl->set_var("I_PLAYER2", htmlspecialchars($matches[$matchkey]['player2'])); if ($matches[$matchkey]['confirmed'] != "0000-00-00 00:00:00") { if ($matches[$matchkey]['wo'] != 0) { $content_tpl->set_var("I_ID_SEASON", $season['id']); $content_tpl->parse("I_MATCH", "B_WO_MATCH", true); } elseif ($matches[$matchkey]['out'] == 1) { $content_tpl->set_var("I_ID_SEASON", $season['id']); $content_tpl->parse("I_MATCH", "B_OUT_MATCH", true); } elseif ($matches[$matchkey]['bye'] == 1) { $content_tpl->set_var("I_ID_SEASON", $season['id']); $content_tpl->parse("I_MATCH", "B_BYE_MATCH", true); } else { $content_tpl->set_var("I_ID_SEASON", $season['id']); $content_tpl->parse("I_MATCH", "B_PLAYED_MATCH", true); } } elseif ($matches[$matchkey]['match'] == 1 or hasNextWinnerMatch($matches["gf-1-1"])) { $content_tpl->parse("I_MATCH", "B_MATCH", true); } } } // Deadline $content_tpl->set_var("H_GF_ACTUAL_ROUND", ""); $content_tpl->set_var("H_GF_DEADLINE", ""); $deadline_ref = dbQuery("SELECT * FROM `{$cfg['db_table_prefix']}deadlines` " . "WHERE `id_season` = {$season['id']} AND `round` = 'gf1'"); if ($deadline_row = dbFetch($deadline_ref)) { if (isAfterPreDeadline($season, "gf", 1) and isBeforePostDeadline($season, "gf", 1)) { $content_tpl->parse("H_GF_ACTUAL_ROUND", "B_GF_ACTUAL_ROUND"); } $content_tpl->set_var("I_DEADLINE", htmlspecialchars($deadline_row['deadline'])); $content_tpl->parse("H_GF_DEADLINE", "B_GF_DEADLINE"); }