Example #1
0
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/tournament.php";
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$tournamentObj = new Tournament($mysqli);
$tID = $_POST['tID'];
$arrMembers = array();
if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->select($tID) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info();
    $tmemberID = $tournamentObj->get_info("member_id");
    $tournamentInfo = $tournamentObj->get_info_filtered();
    if ($memberInfo['member_id'] == $tmemberID || $memberInfo['rank_id'] == "1" || $tournamentObj->isManager($memberInfo['member_id'])) {
        $arrPlayers = $tournamentObj->getPlayers();
        $playerList = urlencode($_POST['players']);
        $arrNewPlayers = explode("%0A", $playerList);
        $maxPlayers = $tournamentInfo['playersperteam'] * $tournamentInfo['maxteams'];
        if (count($arrNewPlayers) + count($arrPlayers) <= $maxPlayers) {
            foreach ($arrNewPlayers as $newPlayer) {
                $newPlayer = urldecode($newPlayer);
                $arrPlayers = $tournamentObj->getPlayers();
                if ($member->select($newPlayer)) {
                    $newPlayerID = $member->get_info("member_id");
                    if (!in_array($newPlayerID, $arrPlayers)) {
                        // Prevent multiple entries of same person
                        $tournamentObj->objPlayer->addNew(array("member_id", "tournament_id"), array($newPlayerID, $tID));
                    }
                } elseif ($tournamentInfo['access'] != 1) {
Example #2
0
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$countErrors = 0;
$dispError = "";
$tournamentObj = new Tournament($mysqli);
if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->objTeam->select($_POST['teamID']) && $tournamentObj->objTournamentPool->select($_POST['poolID']) && $tournamentObj->objTournamentPool->objTournamentPoolMatch->select($_POST['poolTeamID']) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info();
    $teamInfo = $tournamentObj->objTeam->get_info_filtered();
    $tournamentObj->select($teamInfo['tournament_id']);
    $tournamentInfo = $tournamentObj->get_info_filtered();
    $poolInfo = $tournamentObj->objTournamentPool->get_info();
    $poolTeamInfo = $tournamentObj->objTournamentPool->objTournamentPoolMatch->get_info();
    $dispTeamName = $tournamentObj->getPlayerName();
    $tmemberID = $tournamentInfo['member_id'];
    if (($memberInfo['member_id'] == $tmemberID || $memberInfo['rank_id'] == "1" || $tournamentObj->isManager($memberInfo['member_id'])) && $poolInfo['tournament_id'] == $teamInfo['tournament_id'] && $poolTeamInfo['tournament_id'] == $teamInfo['tournament_id']) {
        // Check Match Score
        if (!is_numeric($_POST['teamScore']) || !is_numeric($_POST['opponentScore'])) {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> Scores must be a numeric value.";
        }
        // Check Winner
        $arrMatchWinners = array(0, 1, 2);
        if (!in_array($_POST['matchWinner'], $arrMatchWinners)) {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> You selected an invalid match winner.";
        }
        // Check Match Details
        if ($teamInfo['tournamentteam_id'] != $poolTeamInfo['team1_id'] && $teamInfo['tournamentteam_id'] != $poolTeamInfo['team2_id']) {
            $countErrors++;
            $dispError .= "&nbsp;&nbsp;&nbsp;<b>&middot;</b> The selected teams do not face each other.";
Example #3
0
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$tournamentObj = new Tournament($mysqli);
$tID = $_POST['tID'];
$arrMembers = array();
if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->select($tID) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info();
    $tournamentInfo = $tournamentObj->get_info_filtered();
    if ($tournamentInfo['playersperteam'] == 1) {
        $dispTeamOrPlayer = "Player";
    } else {
        $dispTeamOrPlayer = "Team";
    }
    if (($memberInfo['member_id'] == $tournamentInfo['member_id'] || $memberInfo['rank_id'] == "1" || $tournamentObj->isManager($memberInfo['member_id'])) && $tournamentInfo['seedtype'] == 3) {
        echo "\n\t\t\n\t\t\t\t<table class='formTable' align='center' style='margin-left: auto; margin-right: auto; width: 250px'>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formTitle' style='width: 40px'>Seed:</td>\n\t\t\t\t\t\t<td class='formTitle' style='width: 210px'>" . $dispTeamOrPlayer . ":</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\n\t\t\t\t\t";
        $arrTeams = $tournamentObj->getTeams(true, "ORDER BY seed");
        foreach ($arrTeams as $teamID) {
            $dispName = $tournamentObj->getPlayerName($teamID);
            $tournamentObj->objTeam->select($teamID);
            $dispSeed = $tournamentObj->objTeam->get_info("seed");
            $teamPoolID = $tournamentObj->getTeamPoolID($teamID);
            $tournamentObj->objTournamentPool->select($teamPoolID);
            $tournamentObj->objTournamentPool->getTeamRecord($teamID);
            echo "\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td class='main' align='center'>" . $dispSeed . ".</td>\n\t\t\t\t\t\t\t<td class='main' style='padding-left: 5px'><a href='javascript:void(0)' onclick=\"setSeed('" . $teamID . "')\">" . $dispName . "</a> (" . $tournamentObj->objTournamentPool->getTeamRecord($teamID) . ")</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t";
            $seedCount++;
        }
        echo "\n\t\t\t\t\t\n\t\t\t\t</table>\n\t\t\n\t\t\n\t\t\n\t\t";
    }
}
Example #4
0
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/tournament.php";
include_once "../../../classes/squad.php";
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$countErrors = 0;
$dispError = "";
$tournamentObj = new Tournament($mysqli);
$squadObj = new Squad($mysqli);
if ($member->authorizeLogin($_SESSION['btPassword']) && $squadObj->select($_POST['squadID']) && $tournamentObj->objTeam->select($_POST['teamID']) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info_filtered();
    $teamInfo = $tournamentObj->objTeam->get_info_filtered();
    $tournamentObj->select($teamInfo['tournament_id']);
    $tournamentInfo = $tournamentObj->get_info();
    if ($tournamentInfo['member_id'] == $memberInfo['member_id'] || $memberInfo['rank_id'] == 1 || $tournamentObj->isManager($memberInfo['member_id'])) {
        $arrSquadMembers = $squadObj->getMemberListSorted();
        echo "\n\t\t\t<input type='hidden' value='" . $squadObj->get_info_filtered("name") . "' id='squadName'>\n\t\t\t<div id='squadMemberList' style='max-height: 200px; overflow-y: auto'>\n\t\t\t<table class='formTable' style='width: 95%'>\n\t\t\t\t<tr>\n\t\t\t\t\t<td></td>\n\t\t\t\t\t<td class='main' align='center'>\n\t\t\t\t\t\t<a href='javascript:void(0)' id='checkAllLink'>Check All</a>\n\t\t\t\t\t</td>\n\t\t\t\t</tr>\n\t\t\t";
        foreach ($arrSquadMembers as $value) {
            if ($member->select($value)) {
                $tempMemberInfo = $member->get_info_filtered();
                echo "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td class='formLabel'>" . $tempMemberInfo['username'] . "</td>\n\t\t\t\t\t\t<td class='main' align='center'><input type='checkbox' value='" . $tempMemberInfo['member_id'] . "'></td>\n\t\t\t\t\t</tr>\n\t\t\t\t";
            }
        }
        $member->select($memberInfo['member_id']);
        echo "\n\t\t\t</table>\n\t\t\t</div>\n\t\t\t\n\t\t\t<script type='text/javascript'>\n\t\t\t\n\t\t\t\tvar intCheckAll = 1;\n\t\t\t\n\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\$('#checkAllLink').click(function() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#squadMemberList input[type=checkbox]').each(function() {\n\t\t\t\t\t\t\tif(intCheckAll == 1) {\n\t\t\t\t\t\t\t\t\$(this).attr('checked', true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse {\n\t\t\t\t\t\t\t\t\$(this).attr('checked', false);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t\t\n\t\t\t\t\t\tif(intCheckAll == 1) {\n\t\t\t\t\t\t\tintCheckAll = 0;\n\t\t\t\t\t\t\t\$('#checkAllLink').html('Uncheck All');\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tintCheckAll = 1;\n\t\t\t\t\t\t\t\$('#checkAllLink').html('Check All');\n\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t});\n\t\t\t\n\t\t\t</script>\n\t\t\t\n\t\t";
    }
}
Example #5
0
include_once "../../../classes/rank.php";
include_once "../../../classes/tournament.php";
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$tournamentObj = new Tournament($mysqli);
$dispMessage = "";
if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->objTeam->select($_POST['teamID']) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info();
    $teamInfo = $tournamentObj->objTeam->get_info_filtered();
    $tournamentObj->select($teamInfo['tournament_id']);
    $tournamentInfo = $tournamentObj->get_info_filtered();
    $tmemberID = $tournamentInfo['member_id'];
    if ($memberInfo['member_id'] == $tmemberID || $memberInfo['rank_id'] == "1" || $tournamentObj->isManager($memberInfo['member_id']) && trim($_POST['newName']) != "") {
        if ($tournamentObj->objTeam->update(array("name"), array($_POST['newName']))) {
            $dispMessage = "<p class='successFont'><b>Team Name Saved!</b></p>";
            $teamCounter = 1;
            $arrTeams = $tournamentObj->getTeams(true);
            foreach ($arrTeams as $teamID) {
                $tournamentObj->objTeam->select($teamID);
                $teamInfo = $tournamentObj->objTeam->get_info_filtered();
                $dispTeamName = $teamInfo['name'];
                if ($teamInfo['name'] == "") {
                    $dispTeamName = "Team " . $teamCounter;
                }
                $dispSelected = "";
                if ($teamID == $_POST['teamID']) {
                    $dispSelected = " selected";
                }
Example #6
0
include_once "../../../_setup.php";
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/tournament.php";
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
$consoleObj->select($cID);
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$tournamentObj = new Tournament($mysqli);
$tID = $_POST['tID'];
$arrMembers = array();
if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->select($tID) && $member->hasAccess($consoleObj)) {
    $memberInfo = $member->get_info();
    $tournamentInfo = $tournamentObj->get_info_filtered();
    if ($memberInfo['member_id'] == $tournamentInfo['member_id'] || $memberInfo['rank_id'] == "1" || $tournamentObj->isManager($memberInfo['member_id']) && $tournamentObj->objTeam->select($_POST['teamID']) && $tournamentObj->objTeam->get_info("tournament_id") == $tID) {
        $teamInfo = $tournamentObj->objTeam->get_info_filtered();
        if (!isset($_POST['newSeed'])) {
            for ($i = 1; $i <= $tournamentInfo['maxteams']; $i++) {
                $dispSelected = "";
                if ($teamInfo['seed'] == $i) {
                    $dispSelected = "selected";
                }
                $seedOptions .= "<option value='" . $i . "' " . $dispSelected . ">" . $i . "</option>";
            }
            if ($tournamentInfo['playersperteam'] == 1) {
                $tPlayers = $tournamentObj->getTeamPlayers($_POST['teamID'], true);
                $tournamentObj->objPlayer->select($tPlayers[0]);
                $playerInfo = $tournamentObj->objPlayer->get_info();
                if ($member->select($playerInfo['member_id'])) {
                    $dispName = $member->get_info_filtered("username");
 include_once "../../../_setup.php";
 include_once "../../../classes/member.php";
 include_once "../../../classes/rank.php";
 include_once "../../../classes/tournament.php";
 $consoleObj = new ConsoleOption($mysqli);
 $cID = $consoleObj->findConsoleIDByName("Manage Tournaments");
 $consoleObj->select($cID);
 $member = new Member($mysqli);
 $member->select($_SESSION['btUsername']);
 $tournamentObj = new Tournament($mysqli);
 if ($member->authorizeLogin($_SESSION['btPassword']) && $tournamentObj->select($_POST['tournamentID']) && $member->hasAccess($consoleObj)) {
     $memberInfo = $member->get_info();
     $tournamentInfo = $tournamentObj->get_info_filtered();
     $tmemberID = $tournamentInfo['member_id'];
     $tID = $tournamentInfo['tournament_id'];
     if ($memberInfo['member_id'] != $tmemberID && $memberInfo['rank_id'] != "1" && !$tournamentObj->isManager($memberInfo['member_id'])) {
         exit;
     }
 }
 $arrTeams = $tournamentObj->getTeams();
 if (isset($_POST['action']) && $_POST['action'] == "remove") {
     $arrRemovePlayers = json_decode($_POST['playerList'], true);
     foreach ($arrRemovePlayers as $playerID) {
         if ($tournamentObj->objPlayer->select($playerID)) {
             $tournamentObj->objPlayer->delete();
         }
     }
 } elseif (isset($_POST['action']) && $_POST['action'] == "add" && in_array($_POST['teamID'], $arrTeams)) {
     $arrUnableToAddPlayer = array();
     $arrAddPlayers = json_decode($_POST['playerList'], true);
     foreach ($arrAddPlayers as $playerID) {