'; for ($i = 0; $i < $numUsers; $i++) { $uid = mysql_result($result, $i, TBL_USERS . ".user_id"); $uname = mysql_result($result, $i, TBL_USERS . ".user_name"); // fm: can we do this in 1 query? $q_Members = "SELECT COUNT(*) as NbrMembers" . " FROM " . TBL_MEMBERS . " WHERE (" . TBL_MEMBERS . ".Division = '{$div_id}')" . " AND (" . TBL_MEMBERS . ".User = '******')"; $result_Members = $sql->db_Query($q_Members); $row = mysql_fetch_array($result_Members); $nbrMembers = $row['NbrMembers']; if ($nbrMembers == 0) { $text .= '<option value="' . $uid . '">' . $uname . '</option>'; } } $text .= ' </select></div></td> <td>' . ebImageTextButton('claninviteuser', 'user_add.png', EB_CLANM_L38) . '</td> </tr> </table> </td> </tr>'; $text .= ' </tbody> </table> </form> '; } } $text .= '</div>'; // tab-page "Team Divisions" $text .= '</div>'; // tabs"
$text .= '<input class="tbox" type="text" name="eventdatesperchallenge" size="2" value="' . $event->getField('MaxDatesPerChallenge') . '"/>'; $text .= ' </div> </td> </tr> '; // ------------------------------ $text .= ' </tbody> </table> '; //<!-- Save Button --> $text .= ' <table><tr><td> <div> ' . ebImageTextButton('eventchallengessave', 'disk.png', EB_EVENTM_L123) . ' </div> </td></tr></table> </form> </div> '; // tab-page "Event Challenges" if ($event->getField('FixturesEnable') == TRUE) { // tab-page "Brackets" $text .= '<div id="tabs-8">'; list($bracket_html) = $event->brackets(false, 0, 'round-robin'); $text .= $bracket_html; $text .= '</div>'; // tab-page "Brackets" }
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) . '/> '; $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 . '"/> ' . $nbrMatchesPending . ' ' . 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 .= ' ' . 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; }
function displayMatchInfo($type = 0, $header = '') { global $time; global $sql; global $pref; $match_id = $this->fields['MatchID']; $string = ''; // Get info about the match $q = "SELECT DISTINCT " . TBL_MATCHS . ".*, " . TBL_USERS . ".*, " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_USERS . ", " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_MATCHS . ".ReportedBy)" . " AND (" . TBL_MATCHS . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)"; $result = $sql->db_Query($q); $numMatchs = mysql_numrows($result); if ($numMatchs > 0) { $mReportedBy = mysql_result($result, 0, TBL_USERS . ".user_id"); $mReportedByNickName = mysql_result($result, 0, TBL_USERS . ".user_name"); $mEventgame = mysql_result($result, 0, TBL_GAMES . ".Name"); $mEventgameicon = mysql_result($result, 0, TBL_GAMES . ".Icon"); $mStatus = mysql_result($result, 0, TBL_MATCHS . ".Status"); $mTime = mysql_result($result, 0, TBL_MATCHS . ".TimeReported"); $mTime_local = $mTime + TIMEOFFSET; $date = date("d M Y, h:i A", $mTime_local); $mTimeScheduled = mysql_result($result, 0, TBL_MATCHS . ".TimeScheduled"); $mTimeScheduled_local = $mTimeScheduled + TIMEOFFSET; $dateScheduled = date("d M Y, h:i A", $mTimeScheduled_local); $mComments = mysql_result($result, 0, TBL_MATCHS . ".Comments"); $event_id = mysql_result($result, 0, TBL_EVENTS . ".EventID"); $event = new Event($event_id); // Calculate number of players and teams for the match $q = "SELECT DISTINCT " . TBL_SCORES . ".Player_MatchTeam" . " FROM " . TBL_SCORES . " WHERE (" . TBL_SCORES . ".MatchID = '" . $match_id . "')"; $result = $sql->db_Query($q); $nbr_teams = mysql_numrows($result); // Check if the match has several ranks $q = "SELECT DISTINCT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".Player_Rank" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)"; $result = $sql->db_Query($q); $numRanks = mysql_numrows($result); if ($numRanks > 0) { //------------ permissions -------------- $permissions = $this->get_permissions(USERID); $userclass = $permissions['userclass']; $can_approve = $permissions['can_approve']; $can_report = $permissions['can_report']; $can_schedule = $permissions['can_schedule']; $can_delete = $permissions['can_delete']; $can_edit = $permissions['can_edit']; $orderby_str = " ORDER BY " . TBL_SCORES . ".Player_Rank, " . TBL_SCORES . ".Player_MatchTeam"; if ($nbr_teams == 2) { $orderby_str = " ORDER BY " . TBL_SCORES . ".Player_MatchTeam"; } switch ($event->getMatchPlayersType()) { case 'Players': $q = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_PLAYERS . ".PlayerID = " . TBL_SCORES . ".Player)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . $orderby_str; break; case 'Teams': $q = "SELECT " . TBL_MATCHS . ".*, " . TBL_SCORES . ".*, " . TBL_CLANS . ".*, " . TBL_TEAMS . ".*, " . TBL_DIVISIONS . ".*" . " FROM " . TBL_MATCHS . ", " . TBL_SCORES . ", " . TBL_CLANS . ", " . TBL_TEAMS . ", " . TBL_DIVISIONS . " WHERE (" . TBL_MATCHS . ".MatchID = '" . $match_id . "')" . " AND (" . TBL_SCORES . ".MatchID = " . TBL_MATCHS . ".MatchID)" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_SCORES . ".Team)" . " AND (" . TBL_CLANS . ".ClanID = " . TBL_DIVISIONS . ".Clan)" . " AND (" . TBL_TEAMS . ".Division = " . TBL_DIVISIONS . ".DivisionID)" . $orderby_str; break; default: } $result = $sql->db_Query($q); $numPlayers = mysql_numrows($result); $pname = ''; $string .= '<tr>'; if ($header) { $string .= '<td>' . $header . '</td>'; } $scores = ''; if (($type & eb_MATCH_NOEVENTINFO) == 0) { $string .= '<td style="vertical-align:top">'; $string .= '<img ' . getActivityGameIconResize($mEventgameicon) . ' title="' . $mEventgame . '"/>'; $string .= '</td>'; } $string .= '<td>'; $matchteam = 0; for ($index = 0; $index < $numPlayers; $index++) { switch ($event->getMatchPlayersType()) { case 'Players': $puid = mysql_result($result, $index, TBL_USERS . ".user_id"); $gamer_id = mysql_result($result, $index, TBL_PLAYERS . ".Gamer"); $gamer = new Gamer($gamer_id); $pname = $gamer->getField('Name'); $pavatar = mysql_result($result, $index, TBL_USERS . ".user_image"); $pteam = mysql_result($result, $index, TBL_PLAYERS . ".Team"); break; case 'Teams': $pname = mysql_result($result, $index, TBL_CLANS . ".Name"); $pavatar = mysql_result($result, $index, TBL_CLANS . ".Image"); $pteam = mysql_result($result, $index, TBL_TEAMS . ".TeamID"); break; default: } list($pclan, $pclantag, $pclanid) = getClanInfo($pteam); $prank = mysql_result($result, $index, TBL_SCORES . ".Player_Rank"); $pmatchteam = mysql_result($result, $index, TBL_SCORES . ".Player_MatchTeam"); $pscore = mysql_result($result, $index, TBL_SCORES . ".Player_Score"); $pfaction = mysql_result($result, $index, TBL_SCORES . ".Faction"); $pfactionIcon = ""; //if (($pfaction!=0)&&($type!=0)) if ($pfaction != 0) { $q_Factions = "SELECT " . TBL_FACTIONS . ".*" . " FROM " . TBL_FACTIONS . " WHERE (" . TBL_FACTIONS . ".FactionID = '{$pfaction}')"; $result_Factions = $sql->db_Query($q_Factions); $numFactions = mysql_numrows($result_Factions); if ($numFactions > 0) { $fIcon = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Icon"); $fName = mysql_result($result_Factions, 0, TBL_FACTIONS . ".Name"); $pfactionIcon = ' <img ' . getFactionIconResize($fIcon) . ' title="' . $fName . '"/>'; } } /* takes too long $image = ''; if ($pref['eb_avatar_enable_playersstandings'] == 1) { switch($event->getMatchPlayersType()) { case 'Players': if($pavatar) { $image = '<img '.getAvatarResize(avatar($pavatar)).'/>'; } else if ($pref['eb_avatar_default_image'] != ''){ $image = '<img '.getAvatarResize(getImagePath($pref['eb_avatar_default_image'], 'avatars')).'/>'; } break; case 'Teams': if($pavatar) { $image = '<img '.getAvatarResize(getImagePath($pavatar, 'team_avatars')).'/>'; } else if ($pref['eb_avatar_default_image'] != ''){ $image = '<img '.getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')).'/>'; } break; default: } } */ if ($index > 0) { $scores .= "-" . $pscore; if ($pmatchteam == $matchteam) { $string .= ' & '; } else { if (($type & eb_MATCH_SCHEDULED) != 0) { $str = ' vs. '; } else { if ($prank == $rank) { $str = ' ' . EB_MATCH_L2 . ' '; } else { if ($prank > $rank) { $str = ' ' . EB_MATCH_L3 . ' '; } else { $str = ' ' . EB_MATCH_L14 . ' '; } } } $string .= $str; $matchteam = $pmatchteam; $rank = $prank; } } else { $rank = $prank; $matchteam = $pmatchteam; $scores .= $pscore; } /* echo "rank: $rank, prank: $prank<br>"; echo "mt: $matchteam, pmt $pmatchteam<br>"; */ $string .= $pfactionIcon . ' '; switch ($event->getMatchPlayersType()) { case 'Players': $string .= '<a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $pclantag . $pname . '</a>'; break; case 'Teams': $string .= '<a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $pclanid . '">' . $pclan . '</a>'; break; default: } } //score here if ($event->getField('AllowScore') == TRUE && ($type & eb_MATCH_SCHEDULED) == 0) { $string .= ' (' . $scores . ') '; } if (($type & eb_MATCH_NOEVENTINFO) == 0) { $string .= ' ' . EB_MATCH_L12 . ' <a href="' . e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id . '">' . $event->getField('Name') . '</a>'; } if ($can_approve == 1) { $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/exclamation.png" alt="' . EB_MATCH_L13 . '" title="' . EB_MATCH_L13 . '"/></a>'; } else { if (($type & eb_MATCH_SCHEDULED) == 0 || $can_schedule == 1) { $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '"><img class="eb_image" src="' . e_PLUGIN . 'ebattles/images/magnify.png" alt="' . EB_MATCH_L5 . '" title="' . EB_MATCH_L5 . '"/></a>'; } } if (($type & eb_MATCH_SCHEDULED) == 0) { $string .= ' <div class="smalltext">'; $string .= EB_MATCH_L6 . ' <a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $mReportedByNickName . '</a> '; if ($time - $mTime < INT_MINUTE) { $string .= EB_MATCH_L7; } else { if ($time - $mTime < INT_DAY) { $string .= get_formatted_timediff($mTime, $time) . ' ' . EB_MATCH_L8; } else { $string .= EB_MATCH_L9 . ' ' . $date . '.'; } } $nbr_comments = ebGetCommentTotal("ebmatches", $match_id); $nbr_comments += $mComments == '' ? 0 : 1; $string .= ' <a href="' . e_PLUGIN . 'ebattles/matchinfo.php?matchid=' . $match_id . '" title="' . EB_MATCH_L4 . ' ' . $match_id . '">' . $nbr_comments . ' '; $string .= $nbr_comments > 1 ? EB_MATCH_L10 : EB_MATCH_L11; $string .= '</a>'; $string .= '</div></td>'; } else { $string .= ' <div class="smalltext">'; $string .= EB_MATCH_L16 . ' '; $string .= EB_MATCH_L17 . ' ' . $dateScheduled . '.'; $string .= '</div></td>'; } if (($type & eb_MATCH_NO_EDIT_ICONS) == 0) { if ($can_delete == 1) { $delete_text = $competition_type == 'Tournament' ? EB_MATCHD_L29 : EB_MATCHD_L5; $string .= '<td>'; $string .= '<form action="' . e_PLUGIN . 'ebattles/matchdelete.php?eventid=' . $event_id . '" method="post">'; $string .= '<div>'; $string .= '<input type="hidden" name="eventid" value="' . $event_id . '"/>'; $string .= '<input type="hidden" name="matchid" value="' . $match_id . '"/>'; $string .= '</div>'; $string .= ebImageTextButton('deletematch', 'cross.png', '', 'simple', $delete_text, EB_MATCHD_L4); $string .= '</form>'; $string .= '</td>'; } if ($can_approve == 1) { $string .= '<td>'; $string .= '<form id="approvematch_form" action="' . e_PLUGIN . 'ebattles/matchprocess.php" method="post">'; $string .= '<div>'; $string .= '<input type="hidden" name="eventid" value="' . $event_id . '"/>'; $string .= '<input type="hidden" name="matchid" value="' . $match_id . '"/>'; $string .= '</div>'; $string .= ebImageTextButton('approvematch', 'accept.png', '', 'simple', '', EB_MATCHD_L17); $string .= '</form>'; $string .= '</td>'; } if ($can_edit == 1) { if ($this->getField('Status') == 'scheduled') { $string .= '<td>'; $string .= ebImageLink('matchschedulededit', EB_MATCHR_L46, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&matchid=' . $match_id . '&actionid=matchschedulededit&userclass=' . $userclass, 'page_white_edit.png', '', 'matchreport_link', '', EB_MATCHD_L27); $string .= '</td>'; } else { $string .= '<td>'; $string .= ebImageLink('matchedit', EB_MATCHR_L46, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&matchid=' . $match_id . '&actionid=matchedit&userclass=' . $userclass, 'page_white_edit.png', '', 'matchreport_link', '', EB_MATCHD_L27); $string .= '</td>'; } } if ($can_report == 1) { $string .= '<td>'; $string .= '<div>'; $string .= ebImageLink('matchscheduledreport', EB_MATCHR_L32, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&matchid=' . $match_id . '&actionid=matchscheduledreport&userclass=' . $userclass, 'report.png', '', 'matchreport_link', '', EB_MATCHD_L30); $string .= '</div>'; $string .= '</td>'; } } $string .= '</tr>'; } } return $string; }
/** * displayEvents - Displays the events database table in * a nicely formatted html table. */ function displayCurrentEvents() { global $pref; global $sql; global $text; global $time; $pages = new Paginator(); if (check_class($pref['eb_events_create_class'])) { $text .= '<form action="' . e_PLUGIN . 'ebattles/eventcreate.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="userid" value="' . USERID . '"/>'; $text .= '<input type="hidden" name="username" value="' . USERNAME . '"/>'; $text .= '</div>'; $text .= ebImageTextButton('createevent', 'add.png', EB_EVENTS_L20); $text .= '</form><br />'; } else { //$text .= '<div>'.EB_EVENTC_L2.'</div>'; } $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); if ($numGames > 0) { //$text .= '<div>'.$uname.' '.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 .= ' '; } $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="submitform" 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}')"; $show_draft_events_str = check_class($pref['eb_mod_class']) ? '' : "AND (" . TBL_EVENTS . ".Status != 'draft')"; $q = "SELECT count(*) " . " FROM " . TBL_EVENTS . " WHERE (" . TBL_EVENTS . ".Status != 'finished')" . $show_draft_events_str . $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')" . $show_draft_events_str . " 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 .= ' '; // Go To Page $text .= $pages->display_jump_menu(); $text .= ' '; // 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>'; 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 />'; } } }
$prank_txt = EB_EVENT_L54; } else { $prank_txt = "#{$prank}"; } $text .= '<option value="' . $pid . '">' . $pclantag . $pname . ' (' . $prank_txt . ')</option>'; } } $text .= ' </select> </td> </tr> <tr> <td> '; $reported_by = USERID; $text .= '<div>'; $text .= '<input type="hidden" name="EventID" value="' . $event_id . '"/>'; $text .= '<input type="hidden" name="reported_by" value="' . $reported_by . '"/>'; $text .= ' </div> ' . ebImageTextButton('qrsubmitloss', 'flag_red.png', EB_MATCHQL_L6) . ' </td> </tr> </table> </form> </div> '; } $ns->tablerender($event->getField('Name') . " ({$egame} - " . $event->eventTypeToString() . ") - " . EB_MATCHQL_L1, $text); require_once FOOTERF; exit;
function challengeConfirmForm() { global $sql; global $tp; global $time; $output = ''; // Get info about the challenge $q = "SELECT DISTINCT " . TBL_CHALLENGES . ".*, " . TBL_USERS . ".*, " . TBL_EVENTS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_CHALLENGES . ", " . TBL_USERS . ", " . TBL_EVENTS . ", " . TBL_GAMES . " WHERE (" . TBL_CHALLENGES . ".ChallengeID = '" . $this->fields['ChallengeID'] . "')" . " AND (" . TBL_USERS . ".user_id = " . TBL_CHALLENGES . ".ReportedBy)" . " AND (" . TBL_CHALLENGES . ".Event = " . TBL_EVENTS . ".EventID)" . " AND (" . TBL_EVENTS . ".Game = " . TBL_GAMES . ".GameID)"; $result = $sql->db_Query($q); $numChallenges = mysql_numrows($result); if ($numChallenges > 0) { $event_id = mysql_result($result, 0, TBL_EVENTS . ".EventID"); $event = new Event($event_id); $cReportedBy = mysql_result($result, 0, TBL_USERS . ".user_id"); $cReportedByNickName = mysql_result($result, 0, TBL_USERS . ".user_name"); $cEventgame = mysql_result($result, 0, TBL_GAMES . ".Name"); $cEventgameicon = mysql_result($result, 0, TBL_GAMES . ".Icon"); $cComments = mysql_result($result, 0, TBL_CHALLENGES . ".Comments"); $cStatus = mysql_result($result, 0, TBL_CHALLENGES . ".Status"); $cTime = mysql_result($result, 0, TBL_CHALLENGES . ".TimeReported"); $cTime_local = $cTime + TIMEOFFSET; $date = date("d M Y, h:i A", $cTime_local); $cMatchDates = mysql_result($result, 0, TBL_CHALLENGES . ".MatchDates"); $cChallengerpID = mysql_result($result, 0, TBL_CHALLENGES . ".ChallengerPlayer"); $cChallengedpID = mysql_result($result, 0, TBL_CHALLENGES . ".ChallengedPlayer"); $cChallengertID = mysql_result($result, 0, TBL_CHALLENGES . ".ChallengerTeam"); $cChallengedtID = mysql_result($result, 0, TBL_CHALLENGES . ".ChallengedTeam"); $output .= '<form action="' . e_PLUGIN . 'ebattles/challengeconfirm.php?eventid=' . $event_id . '&challengeid=' . $this->fields['ChallengeID'] . '" method="post">'; $output .= '<b>' . EB_CHALLENGE_L18 . '</b><br />'; $output .= '<br />'; switch ($event->getMatchPlayersType()) { case 'Players': // Challenger Info $q = "SELECT " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . " AND (" . TBL_PLAYERS . ".PlayerID = '{$cChallengerpID}')"; $result = $sql->db_Query($q); $challengerpid = mysql_result($result, 0, TBL_PLAYERS . ".PlayerID"); $challengerpuid = mysql_result($result, 0, TBL_USERS . ".user_id"); $challengerpname = mysql_result($result, 0, TBL_USERS . ".user_name"); $challengerpavatar = mysql_result($result, $index, TBL_USERS . ".user_image"); $challengerpteam = mysql_result($result, $index, TBL_PLAYERS . ".Team"); list($challengerpclan, $challengerpclantag, $challengerpclanid) = getClanInfo($challengerpteam); $isUserChallenger = USERID == $challengerpuid ? TRUE : FALSE; $string .= '<a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $challengerpclantag . $challengerpname . '</a>'; $string .= ' vs. '; // Challenged Info $q = "SELECT " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . " AND (" . TBL_PLAYERS . ".PlayerID = '{$cChallengedpID}')"; $result = $sql->db_Query($q); $challengedpid = mysql_result($result, 0, TBL_PLAYERS . ".PlayerID"); $challengedpuid = mysql_result($result, 0, TBL_USERS . ".user_id"); $challengedpname = mysql_result($result, 0, TBL_USERS . ".user_name"); $challengedpavatar = mysql_result($result, $index, TBL_USERS . ".user_image"); $challengedpteam = mysql_result($result, $index, TBL_PLAYERS . ".Team"); list($challengedpclan, $challengedpclantag, $challengedpclanid) = getClanInfo($challengedpteam); $isUserChallenged = USERID == $challengedpuid ? TRUE : FALSE; $string .= '<a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $challengedpclantag . $challengedpname . '</a>'; break; case 'Teams': // Challenger Info $q = "SELECT " . TBL_TEAMS . ".*" . " AND (" . TBL_TEAMS . ".TeamID = '{$cChallengertID}')"; $result = $sql->db_Query($q); $challengertrank = mysql_result($result, 0, TBL_TEAMS . ".Rank"); list($challengertclan, $challengertclantag, $challengertclanid) = getClanInfo($cChallengertID); $isUserChallenger = $uteam == $cChallengertID ? TRUE : FALSE; $string .= '<a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $challengertclanid . '">' . $challengertclan . '</a>'; $string .= ' vs. '; // Challenged Info $q = "SELECT " . TBL_TEAMS . ".*" . " AND (" . TBL_TEAMS . ".TeamID = '{$cChallengedtID}')"; $result = $sql->db_Query($q); $challengedtrank = mysql_result($result, 0, TBL_TEAMS . ".Rank"); list($challengedtclan, $challengedtclantag, $challengedtclanid) = getClanInfo($cChallengedtID); $isUserChallenged = $uteam == $cChallengedtID ? TRUE : FALSE; $string .= '<a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $challengedtclanid . '">' . $challengedtclan . '</a>'; break; default: } $output .= ' ' . $string . '<br />'; $output .= '<br />'; // Comments if ($cComments) { $output .= '<b>' . EB_CHALLENGE_L28 . '</b><br />'; // Comments $output .= '<p>'; $output .= $tp->toHTML($cComments, true) . '<br />'; $output .= '</p>'; $output .= '<br />'; } // Select Date $matchDates = explode(",", $cMatchDates); $output .= '<b>' . EB_CHALLENGE_L19 . '</b><br />'; // Select Dates $output .= '<div> <select class="tbox" name="challengedate"> '; foreach ($matchDates as $matchDate) { $matchDate_local = $matchDate + TIMEOFFSET; $date = date("d M Y, h:i A", $matchDate_local); $output .= '<option value="' . $matchDate . '"'; $output .= '>' . $date . '</option>'; } $output .= ' </select> </div> '; $output .= ' <br /> <table class="table_left"><tr> <td>' . ebImageTextButton('challenge_accept', 'thumb_up.png', EB_CHALLENGE_L20, 'positive jq-button') . '</td> <td>' . ebImageTextButton('challenge_decline', 'thumb_down.png', EB_CHALLENGE_L21, 'negative jq-button') . '</td> </tr></table> </form> '; } return $output; }
function TeamChallengeForm($event_id, $challengerpuid, $challengedtid) { global $sql; global $tp; global $time; $event = new Event($event_id); $output .= '<form action="' . e_PLUGIN . 'ebattles/challengerequest.php?eventid=' . $event_id . '" method="post">'; $output .= '<b>' . EB_CHALLENGE_L3 . '</b><br />'; $output .= '<br />'; // Challenger Info // Attention here, we use user_id, so there has to be 1 user for 1 player $output .= '<b>' . EB_CHALLENGE_L5 . '</b>'; // Challenger $q = "SELECT " . TBL_PLAYERS . ".*, " . TBL_USERS . ".*, " . TBL_TEAMS . ".*" . " FROM " . TBL_PLAYERS . ", " . TBL_GAMERS . ", " . TBL_USERS . ", " . TBL_TEAMS . " WHERE (" . TBL_PLAYERS . ".Event = '{$event_id}')" . " AND (" . TBL_TEAMS . ".TeamID = " . TBL_PLAYERS . ".Team)" . " AND (" . TBL_PLAYERS . ".Gamer = " . TBL_GAMERS . ".GamerID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_GAMERS . ".User)" . " AND (" . TBL_USERS . ".user_id = '{$challengerpuid}')"; $result = $sql->db_Query($q); $uteam = mysql_result($result, 0, TBL_PLAYERS . ".Team"); $trank = mysql_result($result, 0, TBL_TEAMS . ".Rank"); list($tclan, $tclantag, $tclanid) = getClanInfo($uteam); if ($trank == 0) { $trank_txt = EB_EVENT_L54; } else { $trank_txt = "#{$trank}"; } $str = $tclan . ' (' . $trank_txt . ')'; $output .= ' ' . $str . '<br />'; // Challenged Info $output .= '<b>' . EB_CHALLENGE_L6 . '</b>'; // Challenged $q = "SELECT " . TBL_TEAMS . ".*" . " FROM " . TBL_TEAMS . " WHERE (" . TBL_TEAMS . ".TeamID = '{$challengedtid}')"; $result = $sql->db_Query($q); $uteam = mysql_result($result, 0, TBL_TEAMS . ".TeamID"); $trank = mysql_result($result, 0, TBL_TEAMS . ".Rank"); list($tclan, $tclantag, $tclanid) = getClanInfo($uteam); if ($trank == 0) { $trank_txt = EB_EVENT_L54; } else { $trank_txt = "#{$trank}"; } $str = $tclan . ' (' . $trank_txt . ')'; $output .= ' ' . $str . '<br />'; $output .= '<br />'; // Select Dates $output .= '<b>' . EB_CHALLENGE_L7 . '</b><br />'; // Select Dates $output .= '<table class="table_left">'; for ($date = 1; $date <= $event->getField('MaxDatesPerChallenge'); $date++) { //<!-- Select date Date --> $output .= ' <tr> <td><b>' . EB_CHALLENGE_L10 . ' #' . $date . '</b></td> <td> <table> <tr> <td> <div><input class="tbox timepicker" type="text" name="date' . $date . '" id="f_date' . $date . '" value="' . $_POST['date' . $date] . '" readonly="readonly" /></div> </td> <td> <div><input class="eb_button" type="button" value="' . EB_EVENTM_L34 . '" onclick="clearDate(this.form, ' . $date . ');"/></div> </td> </tr> </table> </td> </tr> '; } $output .= '</table>'; // comments //---------------------------------- if (isset($_POST['challenge_comments'])) { $comments = $tp->toDB($_POST['challenge_comments']); } else { $comments = ''; } $output .= '<br />'; $output .= '<div>'; $output .= EB_CHALLENGE_L8 . '<br />'; $output .= '<textarea class="tbox" id="challenge_comments" name="challenge_comments" style="width:500px" cols="70" ' . $insertjs . '>' . $comments . '</textarea>'; if (!e_WYSIWYG) { $output .= '<br />' . display_help("helpb", "comments"); } $output .= '</div>'; $output .= '<br />'; $output .= '<div>'; $output .= '<input type="hidden" name="submitted_by" value="' . $challengerpuid . '"/>'; $output .= '<input type="hidden" name="Challenged" value="' . $challengedtid . '"/>'; $output .= ' </div> <div> ' . ebImageTextButton('challenge_team_submit', 'challenge.png', EB_CHALLENGE_L9) . ' </div> </form> '; return $output; }
function displayClanSettingsForm($create = false) { global $sql; 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) { $clan_str = ''; $action_str = 'actionid=create'; } else { $clan_str = 'clanid=' . $this->getField('ClanID'); $action_str = '&actionid=edit'; } $text .= "\r\n\t\t<script type='text/javascript'>\r\n\t\t<!--//\r\n\t\tfunction changeteamtext(v)\r\n\t\t{\r\n\t\tdocument.getElementById('clanavatar').value=v;\r\n\t\t} //-->\r\n\t\t</script>\r\n\t\t"; if ($this->getField('Image') == '' && $pref['eb_avatar_default_team_image'] != '') { $this->setFieldDB('Image', $pref['eb_avatar_default_team_image']); } $text .= '<form id="form-clan-settings" action="' . e_PLUGIN . 'ebattles/clanprocess.php?' . $clan_str . $action_str . '" method="post">'; $text .= ' <table class="eb_table" style="width:95%"> <tbody> '; //<!-- Clan Name -->' $text .= '<tr>'; $text .= ' <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L9 . '<span class="required">*</span></td> <td class="eb_td"> <input class="tbox required" type="text" size="40" name="clanname" value="' . $this->getField('Name') . '"/> </td> </tr>'; //<!-- Clan Avatar --> $text .= '<tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L29 . '<div class="smalltext">' . EB_CLANM_L30 . '</div></td> <td class="eb_td">'; if ($this->getField('Image') != '') { $text .= '<img ' . getAvatarResize(getImagePath($this->getField('Image'), 'team_avatars')) . '/> '; } $text .= '<input class="tbox" type="text" id="clanavatar" name="clanavatar" size="20" value="' . $this->getField('Image') . '"/>'; $text .= '<div><br />'; $avatarlist = array(); $avatarlist[0] = ""; $handle = opendir(e_PLUGIN . "ebattles/images/team_avatars/"); while ($file = readdir($handle)) { if ($file != "." && $file != ".." && $file != "index.html" && $file != ".svn" && $file != "Thumbs.db") { $avatarlist[] = $file; } } closedir($handle); for ($c = 1; $c <= count($avatarlist) - 1; $c++) { $text .= '<a href="javascript:changeteamtext(\'' . $avatarlist[$c] . '\')"><img src="' . e_PLUGIN . 'ebattles/images/team_avatars/' . $avatarlist[$c] . '" alt="' . $avatarlist[$c] . '" style="border:0"/></a> '; } $text .= ' </div> </td> </tr>'; //<!-- Clan Tag --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L10 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clantag" value="' . $this->getField('Tag') . '"/> </td> </tr> '; //<!-- Clan Password --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L11 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanpassword" value="' . $this->getField('password') . '"/> </td> </tr> '; //<!-- Clan Website --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L31 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanwebsite" value="' . $this->getField('websiteURL') . '"/> </td> </tr> '; //<!-- Clan Email --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L32 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanemail" value="' . $this->getField('email') . '"/> </td> </tr> '; //<!-- Clan IM --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L33 . '</td> <td class="eb_td"> <input class="tbox" type="text" size="40" name="clanIM" value="' . $this->getField('IM') . '"/> </td> </tr> '; //<!-- Clan Description --> $text .= ' <tr> <td class="eb_td eb_tdc1 eb_w40">' . EB_CLANM_L34 . '</td> <td class="eb_td"> '; $text .= '<textarea class="tbox" id="clandescription" name="clandescription" cols="70" ' . $insertjs . '>' . $this->getField('Description') . '</textarea>'; if (!e_WYSIWYG) { $text .= '<br />' . display_help("helpb", 1); } $text .= ' </td> </tr> </tbody> </table> '; //<!-- Save Button --> $text .= ' <table><tbody><tr><td> <div> ' . ebImageTextButton('clansettingssave', 'disk.png', EB_CLANM_L12) . ' </div> </td></tr></tbody></table> </form>'; return $text; }
$text .= '<div id="tabs-4">'; /* Display Match Report buttons */ if ($can_report_quickloss == 1 || $can_report == 1 || $can_submit_replay == 1 || $can_schedule == 1) { $text .= '<table>'; $text .= '<tr>'; if ($can_submit_replay == 1) { $text .= '<td>'; $text .= '<form action="' . e_PLUGIN . 'ebattles/submitreplay.php?eventid=' . $event_id . '" method="post"><div>'; $text .= ebImageTextButton('submitreplay', 'flag_red.png', EB_EVENT_L81); $text .= '</div></form>'; $text .= '</td>'; } if ($can_report_quickloss == 1) { $text .= '<td>'; $text .= '<form action="' . e_PLUGIN . 'ebattles/quickreport.php?eventid=' . $event_id . '" method="post"><div>'; $text .= ebImageTextButton('quicklossreport', 'flag_red.png', EB_EVENT_L56); $text .= '</div></form>'; $text .= '</td>'; } if ($can_report == 1) { $text .= '<td>'; $text .= '<div>'; $text .= ebImageLink('matchreport', EB_MATCHR_L32, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&actionid=matchreport&userclass=' . $userclass, 'report.png', EB_EVENT_L57, 'matchreport_link jq-button'); $text .= '</div>'; $text .= '</td>'; } if ($can_schedule == 1) { $text .= '<td>'; $text .= '<div>'; $text .= ebImageLink('matchschedule', EB_MATCHR_L32, '', e_PLUGIN . 'ebattles/matchreport.php?eventid=' . $event_id . '&actionid=matchschedule&userclass=' . $userclass, 'add.png', EB_EVENT_L72, 'matchreport_link jq-button'); $text .= '</div>';
--------------------- */ $text .= '<div id="tabs-3">'; // tab-page "Teams" // Display list of games icons $text .= $games_links_list; if (strcmp(USERID, $req_user) == 0 && check_class($pref['eb_teams_create_class'])) { $text .= '<table class="table_left">'; $text .= '<tr>'; $text .= '<td>'; $text .= '<form action="' . e_PLUGIN . 'ebattles/clancreate.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="userid" value="' . $req_user . '"/>'; $text .= '<input type="hidden" name="username" value="' . $uname . '"/>'; $text .= '</div>'; $text .= ebImageTextButton('createteam', 'add.png', EB_CLANS_L7); $text .= '</form>'; $text .= '</td>'; $text .= '</tr>'; $text .= '</table>'; } $text .= '<div class="spacer">'; $text .= '<a href="' . $teams_link . '">'; $text .= EB_MENU_L3; $text .= '</a>'; $text .= '</div>'; /* Display list of teams where the user is the owner */ $q = "SELECT " . TBL_CLANS . ".*, " . TBL_USERS . ".*" . " FROM " . TBL_CLANS . ", " . TBL_USERS . " WHERE (" . TBL_CLANS . ".Owner = " . TBL_USERS . ".user_id)" . " AND (" . TBL_USERS . ".user_id = '{$req_user}')"; $result = $sql->db_Query($q); $num_teams = mysql_numrows($result); if ($num_teams > 0) {
/** * displayTeamDivisions - Displays ... */ function displayTeamDivisions($clan_id, $game_id) { global $sql; global $text; $q = "SELECT " . TBL_CLANS . ".*, " . TBL_DIVISIONS . ".*, " . TBL_USERS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_CLANS . ", " . TBL_DIVISIONS . ", " . TBL_USERS . ", " . TBL_GAMES . " WHERE (" . TBL_CLANS . ".ClanID = '{$clan_id}')" . " AND (" . TBL_DIVISIONS . ".Clan = " . TBL_CLANS . ".ClanID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_DIVISIONS . ".Captain)" . " AND (" . TBL_GAMES . ".GameID = " . TBL_DIVISIONS . ".Game)"; $result = $sql->db_Query($q); $num_divs = mysql_numrows($result); for ($i = 0; $i < $num_divs; $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"); $div_id = mysql_result($result, $i, TBL_DIVISIONS . ".DivisionID"); $div_captain = mysql_result($result, $i, TBL_USERS . ".user_id"); $div_captain_name = mysql_result($result, $i, TBL_USERS . ".user_name"); $clan_password = mysql_result($result, $i, TBL_CLANS . ".password"); $clan_id = mysql_result($result, $i, TBL_CLANS . ".ClanID"); if ($gid == $game_id) { $text .= '<div class="spacer">'; $text .= '<p>' . EB_CLAN_L9 . ': <a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $div_captain_name . '</a></p>'; if (check_class(e_UC_MEMBER)) { // Find gamer for that user $q_2 = "SELECT " . TBL_GAMERS . ".*" . " FROM " . TBL_GAMERS . " WHERE (" . TBL_GAMERS . ".Game = '" . $gid . "')" . " AND (" . TBL_GAMERS . ".User = "******")"; $result_2 = $sql->db_Query($q_2); $num_Gamers = mysql_numrows($result_2); if ($num_Gamers != 0) { $gamerID = mysql_result($result_2, 0, TBL_GAMERS . ".GamerID"); $gamer = new Gamer($gamerID); $gamerName = $gamer->getField('Name'); $gamerUniqueGameID = $gamer->getField('UniqueGameID'); } else { $gamerID = 0; $gamerName = ''; $gamerUniqueGameID = ''; } $q_2 = "SELECT " . TBL_MEMBERS . ".*" . " FROM " . TBL_MEMBERS . " WHERE (" . TBL_MEMBERS . ".Division = '{$div_id}')" . " AND (" . TBL_MEMBERS . ".User = "******")"; $result_2 = $sql->db_Query($q_2); if (!$result_2 || mysql_numrows($result_2) < 1) { $hide_password = $clan_password == "" ? 'hide ignore' : ''; $text .= ' <div> <input type="hidden" name="division" value="' . $div_id . '"/> </div> ' . ebImageTextButton('joindivision', 'user_add.png', EB_CLAN_L12); $text .= gamerDivisionSignupModalForm($clan_id, $div_id, $gamerID, $gamerName, $gamerUniqueGameID, $hide_password); } else { // Check that the member has made no games with this division $q_MemberScores = "SELECT " . TBL_MEMBERS . ".*, " . TBL_TEAMS . ".*, " . TBL_PLAYERS . ".*, " . TBL_SCORES . ".*" . " FROM " . TBL_MEMBERS . ", " . TBL_TEAMS . ", " . TBL_PLAYERS . ", " . TBL_SCORES . " WHERE (" . TBL_MEMBERS . ".User = "******")" . " AND (" . TBL_MEMBERS . ".Division = '{$div_id}')" . " AND (" . TBL_TEAMS . ".Division = '{$div_id}')" . " AND (" . TBL_PLAYERS . ".Team = " . TBL_TEAMS . ".TeamID)" . " AND (" . TBL_SCORES . ".Player = " . TBL_PLAYERS . ".PlayerID)"; $result_MemberScores = $sql->db_Query($q_MemberScores); $numMemberScores = mysql_numrows($result_MemberScores); if ($numMemberScores == 0) { $text .= ' <form action="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $clan_id . '" method="post"> <div> <input type="hidden" name="division" value="' . $div_id . '"/> </div> ' . ebImageTextButton('quitdivision', 'user_delete.ico', EB_CLAN_L13, 'negative jq-button', EB_CLAN_L25) . ' </form>'; } } } $q_2 = "SELECT " . TBL_CLANS . ".*, " . TBL_DIVISIONS . ".*, " . TBL_MEMBERS . ".*, " . TBL_USERS . ".*, " . TBL_GAMES . ".*" . " FROM " . TBL_CLANS . ", " . TBL_DIVISIONS . ", " . TBL_USERS . ", " . TBL_MEMBERS . ", " . TBL_GAMES . " WHERE (" . TBL_CLANS . ".ClanID = '{$clan_id}')" . " AND (" . TBL_DIVISIONS . ".Clan = " . TBL_CLANS . ".ClanID)" . " AND (" . TBL_DIVISIONS . ".DivisionID = '{$div_id}')" . " AND (" . TBL_MEMBERS . ".Division = " . TBL_DIVISIONS . ".DivisionID)" . " AND (" . TBL_USERS . ".user_id = " . TBL_MEMBERS . ".User)" . " AND (" . TBL_GAMES . ".GameID = " . TBL_DIVISIONS . ".Game)"; $result_2 = $sql->db_Query($q_2); if (!$result_2 || mysql_numrows($result_2) < 1) { $text .= '<p>' . EB_CLAN_L14 . '</p>'; } else { $row = mysql_fetch_array($result_2); $numMembers = mysql_numrows($result_2); $text .= '<p>' . $numMembers . ' ' . EB_CLAN_L15 . '</p>'; $text .= '<table class="eb_table" style="width:95%"><tbody>'; $text .= '<tr> <th class="eb_th2">' . EB_CLAN_L16 . '</th> <th class="eb_th2">' . EB_CLAN_L17 . '</th> <th class="eb_th2">' . EB_CLAN_L18 . '</th> </tr>'; // Captain for ($j = 0; $j < $numMembers; $j++) { $mid = mysql_result($result_2, $j, TBL_USERS . ".user_id"); $mname = mysql_result($result_2, $j, TBL_USERS . ".user_name"); $mjoined = mysql_result($result_2, $j, TBL_MEMBERS . ".timestamp"); $mjoined_local = $mjoined + TIMEOFFSET; $date = date("d M Y", $mjoined_local); if ($mid == $div_captain) { $status = EB_CLAN_L9; $text .= '<tr>'; $text .= '<td class="eb_td"><b><a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $mname . '</a></b></td> <td class="eb_td">' . $status . '</td> <td class="eb_td">' . $date . '</td></tr>'; } } // Other members for ($j = 0; $j < $numMembers; $j++) { $mid = mysql_result($result_2, $j, TBL_USERS . ".user_id"); $mname = mysql_result($result_2, $j, TBL_USERS . ".user_name"); $mjoined = mysql_result($result_2, $j, TBL_MEMBERS . ".timestamp"); $mjoined_local = $mjoined + TIMEOFFSET; $date = date("d M Y", $mjoined_local); if ($mid != $div_captain) { $status = EB_CLAN_L26; $text .= '<tr>'; $text .= '<td class="eb_td"><b><a href="' . e_PLUGIN . 'ebattles/userinfo.php?user='******'">' . $mname . '</a></b></td> <td class="eb_td">' . $status . '</td> <td class="eb_td">' . $date . '</td></tr>'; } } $text .= '</tbody></table>'; } $text .= '<br /></div>'; } } }
/** * displayClans - Displays the Clans database table in * a nicely formatted html table. */ function displayClans() { global $pref; global $sql; global $text; $pages = new Paginator(); if (check_class($pref['eb_teams_create_class'])) { $text .= '<form action="' . e_PLUGIN . 'ebattles/clancreate.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="userid" value="' . USERID . '"/>'; $text .= '<input type="hidden" name="username" value="' . USERNAME . '"/>'; $text .= '</div>'; $text .= ebImageTextButton('createteam', 'add.png', EB_CLANS_L7); $text .= '</form><br />'; } else { //$text .= '<div>'..'</div>'; } /* set pagination variables */ $q = "SELECT count(*) " . " FROM " . TBL_CLANS; $result = $sql->db_Query($q); $totalItems = mysql_result($result, 0); $pages->items_total = $totalItems; $pages->mid_range = eb_PAGINATION_MIDRANGE; $pages->paginate(); $q = "SELECT " . TBL_CLANS . ".*" . " FROM " . TBL_CLANS . " ORDER BY Name" . " {$pages->limit}"; $result = $sql->db_Query($q); /* Error occurred, return given name by default */ $num_rows = mysql_numrows($result); if (!$result || $num_rows < 0) { $text .= EB_CLANS_L3; return; } if ($num_rows == 0) { $text .= '<div>' . EB_CLANS_L4 . '</div>'; } else { // Paginate $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 .= ' '; // Items per page $text .= $pages->display_items_per_page(); $text .= '</span><br /><br />'; /* Display table contents */ $text .= '<table class="eb_table" style="width:95%"><tbody>'; $text .= '<tr> <th class="eb_th2">' . EB_CLANS_L5 . '</th> <th class="eb_th2">' . EB_CLANS_L6 . '</th> </tr>'; for ($i = 0; $i < $num_rows; $i++) { $clan_id = mysql_result($result, $i, TBL_CLANS . ".ClanID"); $clan = new Clan($clan_id); $image = ""; if ($pref['eb_avatar_enable_teamslist'] == 1) { if ($clan->getField('Image')) { $image = '<img ' . getAvatarResize(getImagePath($clan->getField('Image'), 'team_avatars')) . '/>'; } else { if ($pref['eb_avatar_default_team_image'] != '') { $image = '<img ' . getAvatarResize(getImagePath($pref['eb_avatar_default_team_image'], 'team_avatars')) . '/>'; } } } $text .= '<tr> <td class="eb_td">' . $image . ' <a href="' . e_PLUGIN . 'ebattles/claninfo.php?clanid=' . $clan_id . '">' . $clan->getField('Name') . '</a></td> <td class="eb_td">' . $clan->getField('Tag') . '</td></tr>'; } $text .= '</tbody></table><br />'; } }
*/ if ($can_submit_media == 1) { $text .= '<form action="' . e_PLUGIN . 'ebattles/matchprocess.php" method="post">'; $text .= '<div>'; $text .= '<input type="hidden" name="eventid" value="' . $event_id . '"/>'; $text .= '<input type="hidden" name="matchid" value="' . $match_id . '"/>'; $text .= '</div>'; $text .= '<table class="table_left"><tr>'; $text .= '<td><select class="tbox" name="mediatype">'; foreach ($array_types as $key => $value) { $text .= '<option value="' . $key . '"'; $text .= '>' . $value . '</option>'; } $text .= '</select></td>'; $text .= '<td><input class="tbox" type="text" name="mediapath" size="40" value="" maxlength="256" title="' . EB_MATCHD_L22 . '"/></td>'; $text .= '<td>' . ebImageTextButton('addmedia', 'film_add.png', EB_MATCHD_L23) . '</td>'; $text .= '</tr></table>'; $text .= '</form>'; } if ($comments) { $text .= '<p>'; $text .= EB_MATCHD_L14 . ':<br />'; $text .= $tp->toHTML($comments, true) . '<br />'; $text .= '</p>'; } $text .= '<div>'; $text .= ebImageLink('back_to_event', '', e_PLUGIN . 'ebattles/eventinfo.php?eventid=' . $event_id, '', 'action_back.gif', EB_MATCHD_L15 . ' ' . EB_MATCHD_L16, 'jq-button'); $text .= '</div>'; $text .= '</div>'; // spacer $text .= '</div>';