예제 #1
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";
    }
}