Esempio n. 1
0
    function displayEventSettingsForm($create = false)
    {
        global $sql;
        global $pref;
        if (e_WYSIWYG) {
            $insertjs = "rows='15'";
        } else {
            require_once e_HANDLER . "ren_help.php";
            $insertjs = "rows='5' onselect='storeCaret(this);' onclick='storeCaret(this);' onkeyup='storeCaret(this);'";
        }
        if ($create == true) {
            $event_str = '';
            $action_str = 'actionid=create';
        } else {
            $event_str = 'eventid=' . $this->getField('EventID');
            $action_str = '&actionid=edit';
        }
        /* Nbr players */
        $q = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (" . TBL_PLAYERS . ".Event = '" . $this->fields['EventID'] . "')";
        $result = $sql->db_Query($q);
        $row = mysql_fetch_array($result);
        $nbrplayers = $row['NbrPlayers'];
        /* Nbr Teams */
        $q = "SELECT COUNT(*) as NbrTeams" . " FROM " . TBL_TEAMS . " WHERE (Event = '" . $this->fields['EventID'] . "')";
        $result = $sql->db_Query($q);
        $row = mysql_fetch_array($result);
        $nbrteams = $row['NbrTeams'];
        $competition_type = $this->getCompetitionType();
        $text .= "\r\n\t\t<script type='text/javascript'>\r\n\t\t<!--//\r\n\t\t// Forms\r\n\t\t\$(function() {\r\n\t\t\$( '#radio2' ).buttonset();\r\n\t\t\$('.timepicker').datetimepicker({\r\n\t\tampm: true,\r\n\t\ttimeFormat: 'hh:mm TT',\r\n\t\tstepHour: 1,\r\n\t\tstepMinute: 10,\r\n\t\tminDate: 0\r\n\t\t});\r\n\t\t});\r\n\t\t//-->\r\n\t\t</script>\r\n\t\t";
        $text .= '
		<script type="text/javascript">
		<!--//
		function clearStartDate(frm)
		{
		frm.startdate.value = ""
		}
		function clearEndDate(frm)
		{
		frm.enddate.value = ""
		}
		//-->
		</script>
		';
        $text .= "\r\n\t\t<script type='text/javascript'>\r\n\t\t<!--//\r\n\t\tfunction kick_player(v)\r\n\t\t{\r\n\t\tdocument.getElementById('kick_player').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction ban_player(v)\r\n\t\t{\r\n\t\tdocument.getElementById('ban_player').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction unban_player(v)\r\n\t\t{\r\n\t\tdocument.getElementById('unban_player').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction del_player_games(v)\r\n\t\t{\r\n\t\tdocument.getElementById('del_player_games').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction del_player_awards(v)\r\n\t\t{\r\n\t\tdocument.getElementById('del_player_awards').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction checkin_player(v)\r\n\t\t{\r\n\t\tdocument.getElementById('checkin_player').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\r\n\t\tfunction replace_player(v)\r\n\t\t{\r\n\t\tdocument.getElementById('replace_player').value=v;\r\n\t\tdocument.getElementById('playersform').submit();\r\n\t\t}\t\t\r\n\t\tfunction kick_team(v)\r\n\t\t{\r\n\t\tdocument.getElementById('kick_team').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction ban_team(v)\r\n\t\t{\r\n\t\tdocument.getElementById('ban_team').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction unban_team(v)\r\n\t\t{\r\n\t\tdocument.getElementById('unban_team').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction del_team_games(v)\r\n\t\t{\r\n\t\tdocument.getElementById('del_team_games').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction del_team_awards(v)\r\n\t\t{\r\n\t\tdocument.getElementById('del_team_awards').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction checkin_team(v)\r\n\t\t{\r\n\t\tdocument.getElementById('checkin_team').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\r\n\t\tfunction replace_team(v)\r\n\t\t{\r\n\t\tdocument.getElementById('replace_team').value=v;\r\n\t\tdocument.getElementById('teamsform').submit();\r\n\t\t}\t\t\r\n\t\t//-->\r\n\t\t</script>\r\n\t\t";
        $text .= '<form id="form-event-settings" action="' . e_PLUGIN . 'ebattles/eventprocess.php?' . $event_str . $action_str . '" method="post">';
        $text .= '
		<table class="eb_table" style="width:95%">
		<tbody>
		';
        //<!-- Event Name -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L15 . '<span class="required">*</span></td>
		<td class="eb_td">
		<div><input class="tbox required" type="text" size="40" name="eventname" value="' . $this->getField('Name') . '"/></div>
		</td>
		</tr>
		';
        //<!-- Event Password -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L16 . '</td>
		<td class="eb_td">
		<div><input class="tbox" type="text" size="40" name="eventpassword" value="' . $this->getField('password') . '"/></div>
		</td>
		</tr>
		';
        //<!-- Event Game -->
        // Can change only if no players are signed up
        $disabled_str = $nbrplayers + $nbrteams == 0 ? '' : 'disabled="disabled"';
        $q = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . " WHERE (GameID = '" . $this->getField('Game') . "')";
        $result = $sql->db_Query($q);
        $gIcon = mysql_result($result, $i, TBL_GAMES . ".Icon");
        $q = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . " ORDER BY Name";
        $result = $sql->db_Query($q);
        /* Error occurred, return given name by default */
        $numGames = mysql_numrows($result);
        $text .= '<tr>';
        $text .= '<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L17 . '</td>';
        $text .= '<td class="eb_td">';
        $text .= '<img ' . getGameIconResize($gIcon) . '/>&nbsp;';
        $text .= '<select class="tbox" name="eventgame" ' . $disabled_str . '>';
        for ($i = 0; $i < $numGames; $i++) {
            $gname = mysql_result($result, $i, TBL_GAMES . ".Name");
            $gid = mysql_result($result, $i, TBL_GAMES . ".GameID");
            if ($this->getField('Game') == $gid) {
                $text .= '<option value="' . $gid . '" selected="selected">' . htmlspecialchars($gname) . '</option>';
                $ematchtypes = explode(",", preg_replace('/\\s+/', '', mysql_result($result, $i, TBL_GAMES . ".MatchTypes")));
            } else {
                $text .= '<option value="' . $gid . '">' . htmlspecialchars($gname) . '</option>';
            }
        }
        $text .= '</select>';
        $text .= '</td></tr>';
        //<!-- Type -->
        $disabled_str = $create == true ? '' : 'disabled="disabled"';
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L18 . '</td>
		<td class="eb_td"><select class="tbox" name="eventtype" ' . $disabled_str . '>';
        $text .= '<option value="One Player Ladder" ' . ($this->getField('Type') == "One Player Ladder" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L22 . '</option>';
        $text .= '<option value="Team Ladder" ' . ($this->getField('Type') == "Team Ladder" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L23 . '</option>';
        $text .= '<option value="Clan Ladder" ' . ($this->getField('Type') == "Clan Ladder" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L25 . '</option>';
        $text .= '<option value="One Player Tournament" ' . ($this->getField('Type') == "One Player Tournament" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L33 . '</option>';
        $text .= '<option value="Clan Tournament" ' . ($this->getField('Type') == "Clan Tournament" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L35 . '</option>';
        $text .= '</select>
		</td>
		</tr>
		';
        if ($create == false) {
            //<!-- Match Type -->
            // Can change only if no players are signed up
            $disabled_str = $nbrplayers + $nbrteams == 0 ? '' : 'disabled="disabled"';
            $text .= '
			<tr>
			<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L132 . '</td>
			<td class="eb_td">
			<div>
			';
            $text .= '<select class="tbox" name="eventmatchtype" ' . $disabled_str . '>';
            $text .= '<option value="" ' . ($this->getField('MatchType') == "" ? 'selected="selected"' : '') . '>-</option>';
            foreach ($ematchtypes as $matchtype) {
                if ($matchtype != '') {
                    $text .= '<option value="' . $matchtype . '" ' . ($this->getField('MatchType') == $matchtype ? 'selected="selected"' : '') . '>' . $matchtype . '</option>';
                }
            }
            $text .= '</select>
			</div>
			</td>
			</tr>';
        }
        if ($create == false) {
            //<!-- Rating Type -->
            switch ($competition_type) {
                case "Ladder":
                    $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40" title="' . EB_EVENTM_L118 . '">' . EB_EVENTM_L117 . '</td>
				<td class="eb_td">
				<div id="radio2">
				';
                    $text .= '<input class="tbox" type="radio" id="radio21" size="40" name="eventrankingtype" ' . ($this->getField('RankingType') == "Classic" ? 'checked="checked"' : '') . ' value="Classic" /><label for="radio21">' . EB_EVENTM_L119 . '</label>';
                    $text .= '<input class="tbox" type="radio" id="radio22" size="40" name="eventrankingtype" ' . ($this->getField('RankingType') == "CombinedStats" ? 'checked="checked"' : '') . ' value="CombinedStats" /><label for="radio22">' . EB_EVENTM_L120 . '</label>';
                    $text .= '
				</div>
				</td>
				</tr>
				';
                    break;
            }
        }
        //<!-- Match report userclass -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L21 . '</td>
		<td class="eb_td"><select class="tbox" name="eventmatchreportuserclass">';
        $text .= '<option value="' . eb_UC_MATCH_WINNER . '" ' . ($this->getField('match_report_userclass') == eb_UC_MATCH_WINNER ? 'selected="selected"' : '') . '>' . EB_EVENTM_L211 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_PLAYER . '" ' . ($this->getField('match_report_userclass') == eb_UC_EVENT_PLAYER ? 'selected="selected"' : '') . '>' . EB_EVENTM_L22 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_MODERATOR . '" ' . ($this->getField('match_report_userclass') == eb_UC_EVENT_MODERATOR ? 'selected="selected"' : '') . '>' . EB_EVENTM_L23 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_OWNER . '" ' . ($this->getField('match_report_userclass') == eb_UC_EVENT_OWNER ? 'selected="selected"' : '') . '>' . EB_EVENTM_L24 . '</option>';
        $text .= '</select>
		</td>
		</tr>
		';
        //<!-- Match replay report userclass -->
        /*
        $text .= '
        <tr>
        <td class="eb_td eb_tdc1 eb_w40">'.EB_EVENTM_L134.'</td>
        <td class="eb_td"><select class="tbox" name="eventmatchreplayreportuserclass">';
        $text .= '<option value="'.eb_UC_EVENT_PLAYER.'" '.($this->getField('match_replay_report_userclass') == eb_UC_EVENT_PLAYER ? 'selected="selected"' : '') .'>'.EB_EVENTM_L22.'</option>';
        $text .= '<option value="'.eb_UC_EVENT_MODERATOR.'" '.($this->getField('match_replay_report_userclass') == eb_UC_EVENT_MODERATOR ? 'selected="selected"' : '') .'>'.EB_EVENTM_L23.'</option>';
        $text .= '<option value="'.eb_UC_EVENT_OWNER.'" '.($this->getField('match_replay_report_userclass') == eb_UC_EVENT_OWNER ? 'selected="selected"' : '') .'>'.EB_EVENTM_L24.'</option>';
        $text .= '</select>
        </td>
        </tr>
        ';
        */
        if ($create == false) {
            //<!-- Allow Quick Loss Report -->
            switch ($competition_type) {
                case "Ladder":
                    $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L25 . '</td>
				<td class="eb_td">
				<div>
				';
                    $text .= '<input class="tbox" type="checkbox" name="eventallowquickloss"';
                    if ($this->getField('quick_loss_report') == true) {
                        $text .= ' checked="checked"/>';
                    } else {
                        $text .= '/>';
                    }
                    $text .= '
				</div>
				</td>
				</tr>
				';
                    break;
            }
        }
        //<!-- Allow Score -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L26 . '</td>
		<td class="eb_td">
		<div>
		';
        $text .= '<input class="tbox" type="checkbox" name="eventallowscore"';
        if ($this->getField('AllowScore') == true) {
            $text .= ' checked="checked"/>';
        } else {
            $text .= '/>';
        }
        $text .= '
		</div>
		</td>
		</tr>';
        //<!-- Match Approval -->
        $q = "SELECT COUNT(DISTINCT " . TBL_MATCHS . ".MatchID) as NbrMatches" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (" . TBL_MATCHS . ".Event = '" . $this->getField('EventID') . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_MATCHS . ".Status = 'pending')";
        $result = $sql->db_Query($q);
        $row = mysql_fetch_array($result);
        $nbrMatchesPending = $row['NbrMatches'];
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40" title="' . EB_EVENTM_L109 . '">' . EB_EVENTM_L108 . '</td>
		<td class="eb_td">
		<div>';
        $text .= '<select class="tbox" name="eventmatchapprovaluserclass">';
        $text .= '<option value="' . eb_UC_NONE . '" ' . ($this->getField('MatchesApproval') == eb_UC_NONE ? 'selected="selected"' : '') . '>' . EB_EVENTM_L113 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_PLAYER . '" ' . (($this->getField('MatchesApproval') & eb_UC_EVENT_PLAYER) != 0 ? 'selected="selected"' : '') . '>' . EB_EVENTM_L112 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_MODERATOR . '" ' . (($this->getField('MatchesApproval') & eb_UC_EVENT_MODERATOR) != 0 ? 'selected="selected"' : '') . '>' . EB_EVENTM_L111 . '</option>';
        $text .= '<option value="' . eb_UC_EVENT_OWNER . '" ' . (($this->getField('MatchesApproval') & eb_UC_EVENT_OWNER) != 0 ? 'selected="selected"' : '') . '>' . EB_EVENTM_L110 . '</option>';
        $text .= '</select>';
        $text .= $nbrMatchesPending > 0 ? '<div><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/exclamation.png" alt="' . EB_MATCH_L13 . '" title="' . EB_MATCH_L13 . '"/>&nbsp;' . $nbrMatchesPending . '&nbsp;' . EB_EVENT_L64 . '</div>' : '';
        $text .= '
		</div>
		</td>
		</tr>
		';
        if ($create == false) {
            //<!-- Allow Draws -->
            switch ($competition_type) {
                case "Ladder":
                    $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L27 . '</td>
				<td class="eb_td">
				<div>';
                    $text .= '<input class="tbox" type="checkbox" name="eventallowdraw"';
                    if ($this->getField('AllowDraw') == true) {
                        $text .= ' checked="checked"/>';
                    } else {
                        $text .= '/>';
                    }
                    $text .= '
				</div>
				</td>
				</tr>
				';
                    //<!-- Points -->
                    $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L28 . '</td>
				<td class="eb_td">
				<table class="table_left">
				<tr>
				<td>' . EB_EVENTM_L29 . '</td>
				<td>' . EB_EVENTM_L30 . '</td>
				<td>' . EB_EVENTM_L31 . '</td>
				</tr>
				<tr>
				<td>
				<div><input class="tbox" type="text" name="eventpointsperwin" value="' . $this->getField('PointsPerWin') . '"/></div>
				</td>
				<td>
				<div><input class="tbox" type="text" name="eventpointsperdraw" value="' . $this->getField('PointsPerDraw') . '"/></div>
				</td>
				<td>
				<div><input class="tbox" type="text" name="eventpointsperloss" value="' . $this->getField('PointsPerLoss') . '"/></div>
				</td>
				</tr>
				</table>
				</td>
				</tr>
				';
                    break;
            }
        }
        if ($create == false) {
            //<!-- Allow Forfeits -->
            $text .= '
			<tr>
			<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L127 . '</td>
			<td class="eb_td">
			<div>';
            $text .= '<input class="tbox" type="checkbox" name="eventallowforfeit"';
            if ($this->getField('AllowForfeit') == true) {
                $text .= ' checked="checked"/>';
            } else {
                $text .= '/>';
            }
            $text .= '&nbsp;' . EB_EVENTM_L128;
            $text .= '</div>';
            switch ($competition_type) {
                case "Ladder":
                    $text .= '<div>';
                    $text .= '<input class="tbox" type="checkbox" name="eventForfeitWinLossUpdate"';
                    if ($this->getField('ForfeitWinLossUpdate') == true) {
                        $text .= ' checked="checked"/>';
                    } else {
                        $text .= '/>';
                    }
                    $text .= EB_EVENTM_L129;
                    $text .= '</div>';
                    $text .= '
				<div>
				<table class="table_left">
				<tr>
				<td>' . EB_EVENTM_L130 . '</td>
				<td>' . EB_EVENTM_L131 . '</td>
				</tr>
				<tr>
				<td>
				<div><input class="tbox" type="text" name="eventforfeitwinpoints" value="' . $this->getField('ForfeitWinPoints') . '"/></div>
				</td>
				<td>
				<div><input class="tbox" type="text" name="eventforfeitlosspoints" value="' . $this->getField('ForfeitLossPoints') . '"/></div>
				</td>
				</tr>
				</table>
				</div>
				';
                    break;
            }
            $text .= '
			</td>
			</tr>
			';
            //<!-- Maps -->
            $text .= '
			<tr>
			<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L125 . '</td>
			<td class="eb_td">
			<div>
			';
            $text .= '<input class="tbox" type="text" name="eventmaxmapspermatch" size="2" value="' . $this->getField('MaxMapsPerMatch') . '"/>';
            $text .= '
			</div>
			</td>
			</tr>
			';
            //<!-- Gold -->
            if (is_gold_system_active() && check_class($pref['eb_gold_userclass'])) {
                $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L175 . '</td>
				<td class="eb_td">
				<div>
				';
                $text .= '<input class="tbox" type="text" name="event_gold_entry_fee" size="4" value="' . $this->getField('GoldEntryFee') . '"/>';
                $text .= '
				</div>
				</td>
				</tr>
				';
                $text .= '
				<tr>
				<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L176 . '</td>
				<td class="eb_td">
				<div>
				';
                $text .= '<input class="tbox" type="text" name="event_gold_winning_event" size="4" value="' . $this->getField('GoldWinningEvent') . '"/>';
                $text .= '
				</div>
				</td>
				</tr>
				';
            }
        }
        //<!-- Start Date -->
        if ($this->getField('StartDateTime') != 0) {
            $startdatetime_local = $this->getField('StartDateTime') + TIMEOFFSET;
            $date_start = date("m/d/Y h:i A", $startdatetime_local);
        } else {
            $date_start = "";
        }
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L32 . '<span class="required">*</span></td>
		<td class="eb_td">
		<table class="table_left">
		<tr>
		<td>
		<div><input class="eb_button" type="button" value="' . EB_EVENTM_L34 . '" onclick="clearStartDate(this.form);"/></div>
		</td>
		<td>
		<div><input class="tbox timepicker required" type="text" name="startdate" id="f_date_start" value="' . $date_start . '" readonly="readonly" /></div>
		</td>
		</tr>
		</table>
		</td>
		</tr>
		';
        //<!-- End Date -->
        if ($this->getField('EndDateTime') != 0) {
            $enddatetime_local = $this->getField('EndDateTime') + TIMEOFFSET;
            $date_end = date("m/d/Y h:i A", $enddatetime_local);
        } else {
            $date_end = "";
        }
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L35 . '</td>
		<td class="eb_td">
		<table class="table_left">
		<tr>
		<td>
		<div><input class="eb_button" type="button" value="' . EB_EVENTM_L34 . '" onclick="clearEndDate(this.form);"/></div>
		</td>
		<td>
		<div><input class="tbox timepicker" type="text" name="enddate" id="f_date_end"  value="' . $date_end . '" readonly="readonly" /></div>
		</td>
		</tr>
		</table>
		</td>
		</tr>
		';
        //<!-- Checkin Duration -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L169 . '</td>
		<td class="eb_td">
		<div>
		';
        $text .= '<input class="tbox" type="text" name="checkin_duration" size="5" value="' . $this->getField('CheckinDuration') . '"/>';
        $text .= '
		</div>
		</td>
		</tr>
		';
        //<!-- Signups Enable -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L177 . '</td>
		<td class="eb_td">
		<div>
		';
        $text .= '<input class="tbox" type="checkbox" name="eventsignupsenable"';
        if ($this->getField('SignupsEnable') == true) {
            $text .= ' checked="checked"/>';
        } else {
            $text .= '/>';
        }
        $text .= '
		</div>
		</td>
		</tr>';
        //<!-- Allow Late Signups -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L178 . '</td>
		<td class="eb_td">
		<div>
		';
        $text .= '<input class="tbox" type="checkbox" name="eventallowlatesignups"';
        if ($this->getField('AllowLateSignups') == true) {
            $text .= ' checked="checked"/>';
        } else {
            $text .= '/>';
        }
        $text .= '
		</div>
		</td>
		</tr>';
        if ($create == false) {
            switch ($competition_type) {
                case "Tournament":
                    //<!-- Map Pool -->
                    if ($this->getID() != 0) {
                        $mapPool = explode(",", $this->getField('MapPool'));
                        $nbrMapsInPool = count($mapPool);
                        $text .= '
					<tr>
					<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L147 . '</td>
					<td class="eb_td">';
                        $text .= '<table class="table_left">';
                        foreach ($mapPool as $key => $map) {
                            if ($map != '') {
                                $mapID = $map;
                                $q_Maps = "SELECT " . TBL_MAPS . ".*" . " FROM " . TBL_MAPS . " WHERE (" . TBL_MAPS . ".MapID = '{$mapID}')";
                                $result_Maps = $sql->db_Query($q_Maps);
                                $mapName = mysql_result($result_Maps, 0, TBL_MAPS . ".Name");
                                $text .= '<tr>';
                                $text .= '<td>' . $mapName . '</td>';
                                $text .= '<td>';
                                $text .= '<div>';
                                $text .= ebImageTextButton('eventdeletemap', 'delete.png', EB_EVENTM_L150, 'negative jq-button', '', '', 'value="' . $key . '"');
                                $text .= '</div>';
                                $text .= '</td>';
                                $text .= '</tr>';
                            } else {
                                $text .= '<tr>';
                                $text .= '<td><div>';
                                $text .= EB_EVENTM_L148;
                                $text .= '</div></td>';
                                $text .= '</tr>';
                            }
                        }
                        $text .= '</table>';
                        // List of all Maps
                        $q_Maps = "SELECT " . TBL_MAPS . ".*" . " FROM " . TBL_MAPS . " WHERE (" . TBL_MAPS . ".Game = '" . $this->getField('Game') . "')";
                        $result_Maps = $sql->db_Query($q_Maps);
                        $numMaps = mysql_numrows($result_Maps);
                        if ($numMaps > $nbrMapsInPool) {
                            $text .= '
						<table class="table_left">
						<tr>';
                            $text .= '<td><select class="tbox" name="map">';
                            for ($map = 0; $map < $numMaps; $map++) {
                                $mID = mysql_result($result_Maps, $map, TBL_MAPS . ".MapID");
                                $mImage = mysql_result($result_Maps, $map, TBL_MAPS . ".Image");
                                $mName = mysql_result($result_Maps, $map, TBL_MAPS . ".Name");
                                $mDescrition = mysql_result($result_Maps, $map, TBL_MAPS . ".Description");
                                $isMapInMapPool = false;
                                foreach ($mapPool as $poolmap) {
                                    if ($mID == $poolmap) {
                                        $isMapInMapPool = true;
                                    }
                                }
                                if ($isMapInMapPool == false) {
                                    $text .= '<option value="' . $mID . '"';
                                    $text .= '>' . $mName . '</option>';
                                }
                            }
                            $text .= '</select></td>';
                            $text .= '
						<td>
						<div>
						' . ebImageTextButton('eventaddmap', 'add.png', EB_EVENTM_L149) . '
						</div>
						</td>
						</tr>
						</table>
						';
                        }
                        $text .= '</td></tr>';
                    }
                    break;
            }
        }
        //<!-- Description -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L36 . '</td>
		<td class="eb_td">
		';
        $text .= '<textarea class="tbox" id="eventdescription" name="eventdescription" cols="70" ' . $insertjs . '>' . $this->getField('Description') . '</textarea>';
        if (!e_WYSIWYG) {
            $text .= '<br />' . display_help("helpb", 1);
        }
        $text .= '
		</td>
		</tr>';
        //<!-- Rules -->
        $text .= '
		<tr>
		<td class="eb_td eb_tdc1 eb_w40">' . EB_EVENTM_L38 . '</td>
		<td class="eb_td">
		';
        $text .= '<textarea class="tbox" id="eventrules" name="eventrules" cols="70" ' . $insertjs . '>' . $this->getField('Rules') . '</textarea>';
        if (!e_WYSIWYG) {
            $text .= '<br />' . display_help("helpb", 1);
        }
        $text .= '
		</td>
		</tr>
		</tbody>
		</table>
		';
        //<!-- Save Button -->
        $text .= '
		<table><tbody><tr><td>
		<div>
		' . ebImageTextButton('eventsettingssave', 'disk.png', EB_EVENTM_L37) . '
		</div>
		</td></tr></tbody></table>
		</form>';
        return $text;
    }
Esempio n. 2
0
$num_divs = mysql_numrows($result);
if ($num_divs > 0) {
    //$text .= '<div>'.$uname.'&nbsp;'.EB_USER_L35.'</div>';
    // Display list of games icons
    $games_links_list = '<div class="spacer">';
    for ($i = 0; $i < $num_divs; $i++) {
        $gname = mysql_result($result, $i, TBL_GAMES . ".Name");
        $gicon = mysql_result($result, $i, TBL_GAMES . ".Icon");
        $gid = mysql_result($result, $i, TBL_GAMES . ".GameID");
        if ($game_id == "") {
            $game_id = $gid;
        }
        if ($gid == $game_id) {
            $gname_selected = $gname;
        }
        $games_links_list .= '<a href="' . e_PLUGIN . 'ebattles/clanmanage.php?clanid=' . $clan_id . '&amp;gameid=' . $gid . '"><img ' . getGameIconResize($gicon) . ' title="' . $gname . '"/></a>';
        $games_links_list .= '&nbsp;';
    }
    $games_links_list .= '<br /><b>' . $gname_selected . '</b></div><br />';
}
$text .= '<div id="tabs">';
$text .= '<ul>';
$text .= '<li><a href="#tabs-1">' . EB_CLANM_L2 . '</a></li>';
$text .= '<li><a href="#tabs-2">' . EB_CLANM_L36 . '</a></li>';
$text .= '<li><a href="#tabs-3">' . EB_CLANM_L3 . '</a></li>';
$text .= '</ul>';
//***************************************************************************************
// tab-page "Team Summary"
$text .= '<div id="tabs-1">';
$text .= '<table class="eb_table" style="width:95%">';
$text .= '<tbody>';
Esempio n. 3
0
/**
* displayEvents - Displays the events database table in
* a nicely formatted html table.
*/
function displayPastEvents()
{
    global $sql;
    global $text;
    global $time;
    $pages = new Paginator();
    $array = array('latest' => array(EB_EVENTS_L4, 'EventID'), 'name' => array(EB_EVENTS_L5, TBL_EVENTS . '.Name'), 'game' => array(EB_EVENTS_L6, TBL_GAMES . '.Name'), 'type' => array(EB_EVENTS_L7, TBL_EVENTS . '.Type'), 'start' => array(EB_EVENTS_L8, TBL_EVENTS . '.StartDateTime'));
    if (!isset($_GET['gameid'])) {
        $_GET['gameid'] = "All";
    }
    $gameid = eb_sanitize($_GET['gameid']);
    if (!isset($_GET['matchtype'])) {
        $_GET['matchtype'] = "All";
    }
    $matchtype = eb_sanitize($_GET['matchtype']);
    if (!isset($_GET['orderby'])) {
        $_GET['orderby'] = 'game';
    }
    $orderby = eb_sanitize($_GET['orderby']);
    $sort = "ASC";
    if (isset($_GET["sort"]) && !empty($_GET["sort"])) {
        $sort = $_GET["sort"] == "ASC" ? "DESC" : "ASC";
    }
    $game_string = $gameid == "All" ? "" : "   AND (" . TBL_EVENTS . ".Game = '{$gameid}')";
    $matchtype_string = $matchtype == "All" ? "" : "   AND (" . TBL_GAMES . ".MatchTypes LIKE '%{$matchtype}%')";
    // Drop down list to select Games to display
    $q_Games = "SELECT DISTINCT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $matchtype_string . " ORDER BY Name";
    $result_Games = $sql->db_Query($q_Games);
    $numGames = mysql_numrows($result_Games);
    // Drop down list to select Match type to display
    $q_mt = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string;
    $result_mt = $sql->db_Query($q_mt);
    $num_mt = mysql_numrows($result_mt);
    $gmatchtypes = '';
    for ($i = 0; $i < $num_mt; $i++) {
        $gmatchtypes .= ',' . mysql_result($result_mt, $i, TBL_GAMES . ".MatchTypes");
    }
    $text .= '<form id="submitform" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="get">';
    $text .= '<div>';
    $text .= '<table class="table_left">';
    $text .= '<tr>';
    // Games drop down
    $text .= '<td>' . EB_EVENTS_L9 . '<br />';
    $text .= '<select class="tbox" name="gameid" onchange="this.form.submit()">';
    $text .= '<option value="All" ' . ($gameid == "All" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L10 . '</option>';
    for ($i = 0; $i < $numGames; $i++) {
        $gName = mysql_result($result_Games, $i, TBL_GAMES . ".Name");
        $gid = mysql_result($result_Games, $i, TBL_GAMES . ".GameID");
        $text .= '<option value="' . $gid . '" ' . ($gameid == $gid ? 'selected="selected"' : '') . '>' . htmlspecialchars($gName) . '</option>';
    }
    $text .= '</select>';
    $text .= '</td>';
    // Match Types drop down
    $text .= '<td>' . EB_EVENTS_L32 . '<br />';
    $text .= '<select class="tbox" name="matchtype" onchange="this.form.submit()">';
    $text .= '<option value="All" ' . ($matchtype == "All" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L10 . '</option>';
    $gmatchtypes = explode(",", $gmatchtypes);
    $gmatchtypes = array_unique($gmatchtypes);
    sort($gmatchtypes);
    foreach ($gmatchtypes as $gmatchtype) {
        if ($gmatchtype != '') {
            $text .= '<option value="' . $gmatchtype . '" ' . ($gmatchtype == $matchtype ? 'selected="selected"' : '') . '>' . htmlspecialchars($gmatchtype) . '</option>';
        }
    }
    $text .= '</select>';
    $text .= '</td>';
    $text .= '</tr>';
    $text .= '</table>';
    $game_string = $gameid == "All" ? "" : "   AND (" . TBL_EVENTS . ".Game = '{$gameid}')";
    $matchtype_string = $matchtype == "All" ? "" : "   AND (" . TBL_EVENTS . ".MatchType = '{$matchtype}')";
    $q = "SELECT count(*) " . " FROM " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Status = 'finished')" . $game_string . $matchtype_string;
    $result = $sql->db_Query($q);
    $totalItems = mysql_result($result, 0);
    $pages->items_total = $totalItems;
    $pages->mid_range = eb_PAGINATION_MIDRANGE;
    $pages->paginate();
    $orderby_array = $array["{$orderby}"];
    $q = "SELECT " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_EVENTS . ".Status = 'finished')" . "   AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string . $matchtype_string . " ORDER BY {$orderby_array['1']} {$sort}, EventID DESC" . " {$pages->limit}";
    $result = $sql->db_Query($q);
    $numEvents = mysql_numrows($result);
    if (!$result || $numEvents < 0) {
        /* Error occurred, return given name by default */
        $text .= EB_EVENTS_L11 . '</div>';
        $text .= '</form><br/>';
    } else {
        if ($numEvents == 0) {
            $text .= EB_EVENTS_L12 . '</div>';
            $text .= '</form><br/>';
        } else {
            // Paginate & Sorting
            $items = '';
            foreach ($array as $opt => $opt_array) {
                $items .= $opt == $orderby ? '<option selected="selected" value="' . $opt . '">' . $opt_array[0] . '</option>' : '<option value="' . $opt . '">' . $opt_array[0] . '</option>';
            }
            // Paginate
            $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>';
            $text .= '<span style="float:right">';
            // Sort By
            $text .= EB_PGN_L6;
            $text .= '<select class="tbox" name="orderby" onchange="this.form.submit()">';
            $text .= $items;
            $text .= '</select>';
            // Up/Down arrow
            $text .= '<input type="hidden" id="sort" name="sort" value=""/>';
            if ($sort == "ASC") {
                $text .= '<a href="javascript:buttonval(\'ASC\');" title="Ascending"><img src="' . e_PLUGIN . 'ebattles/images/sort_asc.gif" alt="Asc" style="vertical-align:middle; border:0"/></a>';
            } else {
                $text .= '<a href="javascript:buttonval(\'DESC\');" title="Descending"><img src="' . e_PLUGIN . 'ebattles/images/sort_desc.gif" alt="Desc" style="vertical-align:middle; border:0"/></a>';
            }
            $text .= '&nbsp;&nbsp;&nbsp;';
            // Go To Page
            $text .= $pages->display_jump_menu();
            $text .= '&nbsp;&nbsp;&nbsp;';
            // Items per page
            $text .= $pages->display_items_per_page();
            $text .= '</span>';
            $text .= '</div>';
            $text .= '</form><br/><br/>';
            /* Display table contents */
            $text .= '<table class="eb_table" style="width:95%"><tbody>';
            $text .= '<tr>
		<th class="eb_th2">' . EB_EVENTS_L13 . '</th>
		<th colspan="2" class="eb_th2">' . EB_EVENTS_L14 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L15 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L16 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L17 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L18 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L19 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L34 . '</th>
		</tr>';
            for ($i = 0; $i < $numEvents; $i++) {
                $gName = mysql_result($result, $i, TBL_GAMES . ".Name");
                $gIcon = mysql_result($result, $i, TBL_GAMES . ".Icon");
                $event_id = mysql_result($result, $i, TBL_EVENTS . ".EventID");
                $event = new Event($event_id);
                if ($event->getField('StartDateTime') != 0) {
                    $startdatetime_local = $event->getField('StartDateTime') + TIMEOFFSET;
                    $date_start = date("d M Y", $startdatetime_local);
                } else {
                    $date_start = "-";
                }
                if ($event->getField('EndDateTime') != 0) {
                    $enddatetime_local = $event->getField('EndDateTime') + TIMEOFFSET;
                    $date_end = date("d M Y", $enddatetime_local);
                } else {
                    $date_end = "-";
                }
                /* Nbr players */
                $q_2 = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrplayers = $row['NbrPlayers'];
                /* Nbr Teams */
                $q_2 = "SELECT COUNT(*) as NbrTeams" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".Event = '{$event_id}')";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrTeams = $row['NbrTeams'];
                /* Nbr matches */
                $q_2 = "SELECT COUNT(DISTINCT " . TBL_MATCHS . ".MatchID) as NbrMatches" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (Event = '{$event_id}')" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrmatches = $row['NbrMatches'];
                switch ($event->getField('Type')) {
                    case "One Player Ladder":
                    case "One Player Tournament":
                        $nbrTeamPlayers = $nbrplayers;
                        break;
                    case "Team Ladder":
                        $nbrTeamPlayers = $nbrTeams . '/' . $nbrplayers;
                        break;
                    case "Clan Ladder":
                    case "Clan Tournament":
                        $nbrTeamPlayers = $nbrTeams;
                        break;
                    default:
                }
                $text .= '<tr>
			<td class="eb_td"><a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . $event->getField('Name') . '</a></td>
			<td class="eb_td"><img ' . getGameIconResize($gIcon) . '/></td>
			<td class="eb_td">' . $gName . '</td>
			<td class="eb_td">' . ($event->getField('MatchType') != '' ? $event->getField('MatchType') . ' - ' : '') . $event->eventTypeToString() . '</td>
			<td class="eb_td">' . $date_start . '</td>
			<td class="eb_td">' . $date_end . '</td>
			<td class="eb_td">' . $nbrTeamPlayers . '</td>
			<td class="eb_td">' . $nbrmatches . '</td>
			<td class="eb_td">' . $event->eventStatusToString() . '</td>
			</tr>';
            }
            $text .= '</tbody></table><br />';
            $text .= '<div>';
            $text .= ebImageLink('back_to_events', '', e_PLUGIN . 'ebattles/events.php', '', 'action_back.gif', EB_EVENTP_L3 . ' ' . EB_EVENTP_L4, 'jq-button');
            $text .= '</div>';
        }
    }
}
Esempio n. 4
0
function displayRecentEvents()
{
    global $pref;
    global $sql;
    global $text;
    global $time;
    $pages = new Paginator();
    // how many rows to show per page
    $rowsPerPage = $pref['eb_default_items_per_page'];
    if (!isset($_GET['gameid'])) {
        $_GET['gameid'] = "All";
    }
    $gameid = eb_sanitize($_GET['gameid']);
    if (!isset($_GET['matchtype'])) {
        $_GET['matchtype'] = "All";
    }
    $matchtype = eb_sanitize($_GET['matchtype']);
    $game_string = $gameid == "All" ? "" : "   AND (" . TBL_EVENTS . ".Game = '{$gameid}')";
    $matchtype_string = $matchtype == "All" ? "" : "   AND (" . TBL_GAMES . ".MatchTypes LIKE '%{$matchtype}%')";
    // Drop down list to select Games to display
    $q_Games = "SELECT DISTINCT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $matchtype_string . " ORDER BY Name";
    $result_Games = $sql->db_Query($q_Games);
    $numGames = mysql_numrows($result_Games);
    if ($numGames > 0) {
        //$text .= '<div>'.$uname.'&nbsp;'.EB_USER_L35.'</div>';
        // Display list of games icons
        $games_links_list = '<div class="spacer">';
        for ($i = 0; $i < $numGames; $i++) {
            $gname = mysql_result($result_Games, $i, TBL_GAMES . ".Name");
            $gicon = mysql_result($result_Games, $i, TBL_GAMES . ".Icon");
            $gid = mysql_result($result_Games, $i, TBL_GAMES . ".GameID");
            if ($gameid == "All") {
                $gname_selected = EB_EVENTS_L10;
            }
            if ($gid == $gameid) {
                $gname_selected = $gname;
            }
            $games_links_list .= '<a href="' . e_PLUGIN . 'ebattles/events.php?gameid=' . $gid . '"><img ' . getGameIconResize($gicon) . ' title="' . $gname . '"/></a>';
            $games_links_list .= '&nbsp;';
        }
        $games_links_list .= '<br /><b>' . $gname_selected . '</b></div><br />';
    }
    $text .= $games_links_list;
    // Drop down list to select Match type to display
    $q_mt = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . ", " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string;
    $result_mt = $sql->db_Query($q_mt);
    $num_mt = mysql_numrows($result_mt);
    $gmatchtypes = '';
    for ($i = 0; $i < $num_mt; $i++) {
        $gmatchtypes .= ',' . mysql_result($result_mt, $i, TBL_GAMES . ".MatchTypes");
    }
    $text .= '<form id="submitformrecent" action="' . htmlspecialchars($_SERVER['PHP_SELF']) . '" method="get">';
    $text .= '<div>';
    $text .= '<table class="table_left">';
    $text .= '<tr>';
    // Match Types drop down
    $text .= '<td>' . EB_EVENTS_L32 . '<br />';
    $text .= '<select class="tbox" name="matchtype" onchange="this.form.submit()">';
    $text .= '<option value="All" ' . ($matchtype == "All" ? 'selected="selected"' : '') . '>' . EB_EVENTS_L10 . '</option>';
    $gmatchtypes = explode(",", $gmatchtypes);
    $gmatchtypes = array_unique($gmatchtypes);
    sort($gmatchtypes);
    foreach ($gmatchtypes as $gmatchtype) {
        if ($gmatchtype != '') {
            $text .= '<option value="' . $gmatchtype . '" ' . ($gmatchtype == $matchtype ? 'selected="selected"' : '') . '>' . htmlspecialchars($gmatchtype) . '</option>';
        }
    }
    $text .= '</select>';
    $text .= '</td>';
    $text .= '</tr>';
    $text .= '</table>';
    $game_string = $gameid == "All" ? "" : "   AND (" . TBL_EVENTS . ".Game = '{$gameid}')";
    $matchtype_string = $matchtype == "All" ? "" : "   AND (" . TBL_EVENTS . ".MatchType = '{$matchtype}')";
    $q = "SELECT " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_EVENTS . ".Status = 'finished')" . "   AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)" . $game_string . $matchtype_string . " LIMIT 0, {$rowsPerPage}";
    $result = $sql->db_Query($q);
    $numEvents = mysql_numrows($result);
    if (!$result || $numEvents < 0) {
        /* Error occurred, return given name by default */
        $text .= EB_EVENTS_L11 . '</div>';
        $text .= '</form><br/>';
    } else {
        if ($numEvents == 0) {
            $text .= EB_EVENTS_L12 . '</div>';
            $text .= '</form><br/>';
        } else {
            $text .= '</div>';
            $text .= '</form><br/><br/>';
            /* Display table contents */
            $text .= '<table class="eb_table" style="width:95%"><tbody>';
            $text .= '<tr>
		<th class="eb_th2">' . EB_EVENTS_L13 . '</th>';
            if ($gameid == "All") {
                $text .= '<th colspan="2" class="eb_th2">' . EB_EVENTS_L14 . '</th>';
            }
            $text .= '
		<th class="eb_th2">' . EB_EVENTS_L15 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L16 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L17 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L18 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L19 . '</th>
		<th class="eb_th2">' . EB_EVENTS_L34 . '</th>
		</tr>';
            for ($i = 0; $i < $numEvents; $i++) {
                $gName = mysql_result($result, $i, TBL_GAMES . ".Name");
                $gIcon = mysql_result($result, $i, TBL_GAMES . ".Icon");
                $event_id = mysql_result($result, $i, TBL_EVENTS . ".EventID");
                $event = new Event($event_id);
                if ($event->getField('StartDateTime') != 0) {
                    $startdatetime_local = $event->getField('StartDateTime') + TIMEOFFSET;
                    $date_start = date("d M Y", $startdatetime_local);
                } else {
                    $date_start = "-";
                }
                if ($event->getField('EndDateTime') != 0) {
                    $enddatetime_local = $event->getField('EndDateTime') + TIMEOFFSET;
                    $date_end = date("d M Y", $enddatetime_local);
                } else {
                    $date_end = "-";
                }
                /* Nbr players */
                $q_2 = "SELECT COUNT(*) as NbrPlayers" . " FROM " . TBL_PLAYERS . " WHERE (Event = '{$event_id}')";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrplayers = $row['NbrPlayers'];
                /* Nbr Teams */
                $q_2 = "SELECT COUNT(*) as NbrTeams" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".Event = '{$event_id}')";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrTeams = $row['NbrTeams'];
                /* Nbr matches */
                $q_2 = "SELECT COUNT(DISTINCT " . TBL_MATCHS . ".MatchID) as NbrMatches" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (Event = '{$event_id}')" . " AND (" . TBL_MATCHS . ".Status = 'active')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)";
                $result_2 = $sql->db_Query($q_2);
                $row = mysql_fetch_array($result_2);
                $nbrmatches = $row['NbrMatches'];
                switch ($event->getField('Type')) {
                    case "One Player Ladder":
                    case "One Player Tournament":
                        $nbrTeamPlayers = $nbrplayers;
                        break;
                    case "Team Ladder":
                        $nbrTeamPlayers = $nbrTeams . '/' . $nbrplayers;
                        break;
                    case "Clan Ladder":
                    case "Clan Tournament":
                        $nbrTeamPlayers = $nbrTeams;
                        break;
                    default:
                }
                $text .= '<tr>
			<td class="eb_td"><a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . $event->getField('Name') . '</a></td>';
                if ($gameid == "All") {
                    $text .= '<td class="eb_td"><img ' . getGameIconResize($gIcon) . '/></td>
				<td class="eb_td">' . $gName . '</td>';
                }
                $text .= '
			<td class="eb_td">' . ($event->getField('MatchType') != '' ? $event->getField('MatchType') . ' - ' : '') . $event->eventTypeToString() . '</td>
			<td class="eb_td">' . $date_start . '</td>
			<td class="eb_td">' . $date_end . '</td>
			<td class="eb_td">' . $nbrTeamPlayers . '</td>
			<td class="eb_td">' . $nbrmatches . '</td>
			<td class="eb_td">' . $event->eventStatusToString() . '</td>
			</tr>';
            }
            $text .= '</tbody></table><br />';
            $text .= '<div>';
            $text .= ebImageLink('link_to_eventspast', '', e_PLUGIN . 'ebattles/eventspast.php', '', 'action_back.gif', EB_EVENTS_L21, 'jq-button');
            $text .= '</div>';
        }
    }
}
Esempio n. 5
0
/**
* displayGames - Displays the games database table
*/
function displayGames()
{
    global $pref;
    global $sql;
    global $text;
    global $session;
    $pages = new Paginator();
    $array = array('id' => array(EB_GAMES_L3, TBL_GAMES . '.GameID'), 'icon' => array(EB_GAMES_L4, TBL_GAMES . '.Icon'), 'game' => array(EB_GAMES_L5, TBL_GAMES . '.Name'));
    if (!isset($_GET['orderby'])) {
        $_GET['orderby'] = 'game';
    }
    $orderby = eb_sanitize($_GET['orderby']);
    $sort = "ASC";
    if (isset($_GET["sort"]) && !empty($_GET["sort"])) {
        $sort = $_GET["sort"] == "ASC" ? "DESC" : "ASC";
    }
    $q = "SELECT count(*) " . " FROM " . TBL_GAMES;
    $result = $sql->db_Query($q);
    $numGames = mysql_result($result, 0);
    $totalItems = $numGames;
    $pages->items_total = $totalItems;
    $pages->mid_range = eb_PAGINATION_MIDRANGE;
    $pages->paginate();
    $text .= '<div class="spacer">';
    $text .= '<p>';
    $text .= $numGames . ' ' . EB_GAMES_L6 . '<br />';
    $text .= '</p>';
    $text .= '</div>';
    $orderby_array = $array["{$orderby}"];
    $q = "SELECT " . TBL_GAMES . ".*" . " FROM " . TBL_GAMES . " ORDER BY {$orderby_array['1']} {$sort}" . " {$pages->limit}";
    $result = $sql->db_Query($q);
    $num_rows = mysql_numrows($result);
    if (!$result || $num_rows < 0) {
        $text .= EB_GAMES_L7;
        return;
    }
    if ($num_rows == 0) {
        $text .= EB_GAMES_L8;
    } else {
        // Paginate
        $text .= '<br />';
        $text .= '<span class="paginate" style="float:left;">' . $pages->display_pages() . '</span>';
        $text .= '<span style="float:right">';
        // Go To Page
        $text .= $pages->display_jump_menu();
        $text .= '&nbsp;&nbsp;&nbsp;';
        // Items per page
        $text .= $pages->display_items_per_page();
        $text .= '</span><br /><br />';
        /* Display table contents */
        $text .= '<form id="gamesform" action="' . e_PLUGIN . 'ebattles/gameprocess.php" method="post">';
        $text .= '<table class="fborder" style="width:95%"><tbody>';
        $text .= '<tr>';
        $text .= '<td class="eb_td2"><input class="tbox" type="checkbox" name="sAll" onclick="selectAll(this)" /> (' . EB_GAMES_L9 . ')</td>';
        foreach ($array as $opt => $opt_array) {
            $text .= '<td class="eb_td2"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&orderby=' . $opt . '&amp;sort=' . $sort . '">' . $opt_array[0] . '</a></td>';
        }
        $text .= '<td class="eb_td2">' . EB_GAMES_L10;
        $text .= '<input type="hidden" id="delete_game" name="delete_game" value=""/></td></tr>';
        for ($i = 0; $i < $num_rows; $i++) {
            $gid = mysql_result($result, $i, TBL_GAMES . ".GameID");
            $gname = mysql_result($result, $i, TBL_GAMES . ".Name");
            $gicon = mysql_result($result, $i, TBL_GAMES . ".Icon");
            $text .= '<tr>';
            $text .= '<td class="forumheader3"><input class="tbox" type="checkbox" name="game_sel[]" value="' . $gid . '" /></td>';
            $text .= '<td class="forumheader3">' . $gid . '</td>';
            $text .= '<td class="forumheader3"><img ' . getGameIconResize($gicon) . ' title="' . $gicon . '"/></td>';
            $text .= '<td class="forumheader3"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&gameid=' . $gid . '">' . $gname . '</a></td>';
            $text .= '<td class="forumheader3"><a href="' . e_PLUGIN . 'ebattles/admin_config.php?eb_games&gameid=' . $gid . '"><img src="' . e_PLUGIN . 'ebattles/images/page_white_edit.png" alt="' . EB_GAMES_L11 . '" title="' . EB_GAMES_L11 . '"/></a>';
            $text .= '<a href="javascript:buttonval(\'' . $gid . '\');" title="' . EB_GAMES_L12 . '" onclick="return confirm(\'' . EB_GAMES_L13 . '\')"><img src="' . e_PLUGIN . 'ebattles/images/cross.png" alt="' . EB_GAMES_L12 . '"/></a>';
            $text .= '</td>';
            $text .= '</tr>';
        }
        $text .= '</tbody></table>';
        $text .= '<table><tr>
		<td>
		<input class="eb_button" type="submit" name="delete_selected_games" value="' . EB_GAMES_L14 . '" onclick="return confirm(\'' . EB_GAMES_L15 . '\')"/>
		</td>
		<td>
		<input class="eb_button" type="submit" name="delete_all_games" value="' . EB_GAMES_L16 . '" onclick="return confirm(\'' . EB_GAMES_L17 . '\')"/>
		</td>
		<td>
		<input class="eb_button" type="submit" name="update_selected_games" value="' . EB_GAMES_L18 . '"/>
		</td>
		<td>
		<input class="eb_button" type="submit" name="update_all_games" value="' . EB_GAMES_L19 . '"/>
		</td>
		<td>
		<input class="eb_button" type="submit" name="add_games" value="' . EB_GAMES_L20 . '"/>
		</td>
		</tr>
		</table>
		';
        $text .= '</form>';
    }
}
Esempio n. 6
0
    default:
}
$text .= '</tbody></table>';
/* Info */
$text .= '<table class="eb_table" style="width:95%"><tbody>';
$text .= '<tr>';
$text .= '<td class="eb_td eb_tdc1">' . EB_EVENT_L36 . '</td>';
$text .= '<td class="eb_td" style="font-variant:small-caps"><b>' . $event->getField('Name') . '</b></td>';
$text .= '</tr>';
$text .= '<tr>';
$text .= '<td class="eb_td eb_tdc1">' . EB_EVENT_L37 . '</td>';
$text .= '<td class="eb_td">' . ($event->getField('MatchType') != '' ? $event->getField('MatchType') . ' - ' : '') . $event->eventTypeToString() . '</td>';
$text .= '</tr>';
$text .= '<tr>';
$text .= '<td class="eb_td eb_tdc1">' . EB_EVENT_L38 . '</td>';
$text .= '<td class="eb_td"><img ' . getGameIconResize($egameicon) . '/> ' . $egame . '</td>';
$text .= '</tr>';
$text .= '<tr>';
$text .= '<td class="eb_td eb_tdc1">' . EB_EVENT_L39 . '</td>';
$text .= '<td class="eb_td"><a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $eownername . '</a>';
$text .= '</td></tr>';
$text .= '<tr>';
$q = "SELECT " . TBL_EVENTMODS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_EVENTMODS . ", " . TBL_USERS . " WHERE (" . TBL_EVENTMODS . ".Event = '{$event_id}')" . "   AND (" . TBL_USERS . ".user_id = " . TBL_EVENTMODS . ".User)";
$result = $sql->db_Query($q);
$numMods = mysql_numrows($result);
$text .= '<td class="eb_td eb_tdc1">' . EB_EVENT_L41 . '</td>';
$text .= '<td class="eb_td">';
if ($numMods > 0) {
    $text .= '<ul>';
    for ($i = 0; $i < $numMods; $i++) {
        $modid = mysql_result($result, $i, TBL_USERS . ".user_id");
Esempio n. 7
0
$num_gamers = mysql_numrows($result);
if ($num_gamers > 0) {
    //$text .= '<div>'.$uname.'&nbsp;'.EB_USER_L35.'</div>';
    // Display list of games icons
    $games_links_list = '<div class="spacer">';
    for ($i = 0; $i < $num_gamers; $i++) {
        $gname = mysql_result($result, $i, TBL_GAMES . ".Name");
        $gicon = mysql_result($result, $i, TBL_GAMES . ".Icon");
        $gid = mysql_result($result, $i, TBL_GAMES . ".GameID");
        if ($game_id == "") {
            $game_id = $gid;
        }
        if ($gid == $game_id) {
            $gname_selected = $gname;
        }
        $games_links_list .= '<a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'&amp;gameid=' . $gid . '"><img ' . getGameIconResize($gicon) . ' title="' . $gname . '"/></a>';
        $games_links_list .= '&nbsp;';
    }
    $games_links_list .= '<br /><b>' . $gname_selected . '</b></div><br />';
}
$text .= '<div id="tabs">';
$text .= '<ul>';
$text .= '<li><a href="#tabs-1">' . EB_USER_L2 . '</a></li>';
$text .= '<li><a href="#tabs-2">' . EB_USER_L3 . '</a></li>';
$text .= '<li><a href="#tabs-3">' . EB_USER_L4 . '</a></li>';
$text .= '<li><a href="#tabs-4">' . EB_USER_L5 . '</a></li>';
$text .= '<li><a href="#tabs-5">' . EB_USER_L6 . '</a></li>';
$text .= '</ul>';
/*
---------------------
Player Profile