public function getAdminMenu() { global $lng; // Ring access allowances. $ring_sys_access = array('log' => $lng->getTrn('name', 'LogSubSys'), 'cpanel' => $lng->getTrn('menu/admin_menu/cpanel')); $ring_com_access = array(); if (!Module::isRegistered('Scheduler')) { $ring_com_access['schedule'] = $lng->getTrn('menu/admin_menu/schedule'); } $ring_com_access['nodes'] = array('title' => $lng->getTrn('menu/admin_menu/nodes'), 'sub' => array(array('title' => $lng->getTrn('common/tournament'), 'href' => 'node=' . T_NODE_TOURNAMENT), array('title' => $lng->getTrn('common/division'), 'href' => 'node=' . T_NODE_DIVISION), array('title' => $lng->getTrn('common/league'), 'href' => 'node=' . T_NODE_LEAGUE))); $ring_com_access['usr_man'] = $lng->getTrn('menu/admin_menu/usr_man'); $ring_com_access['ct_man'] = $lng->getTrn('menu/admin_menu/ct_man'); $ring_com_access['import'] = $lng->getTrn('menu/admin_menu/import'); $my_admin_menu = array(); $result = mysql_query("SELECT COUNT(*) FROM memberships WHERE cid = {$this->coach_id} AND ring = " . self::T_RING_LOCAL_ADMIN); list($cnt) = mysql_fetch_row($result); $my_admin_menu = array_merge($this->ring == Coach::T_RING_GLOBAL_ADMIN ? $ring_com_access + $ring_sys_access : array(), $cnt > 0 ? $ring_com_access : array()); return $my_admin_menu; }
private function _actionBoxes($ALLOW_EDIT, $players) { /****************************** * Team management * --------------- * * Here we are able to view team stats and manage the team, depending on visitors privileges. * ******************************/ global $lng, $rules, $settings, $skillarray, $coach, $DEA, $CHR_CONV; global $leagues, $divisions; global $racesHasNecromancer, $racesNoApothecary; global $T_ALLOWED_PLAYER_NR; $team = $this; // Copy. Used instead of $this for readability. $JMP_ANC = isset($_POST['menu_tmanage']) || isset($_POST['menu_admintools']); # Jump condition MUST be set here due to _POST variables being changed later. ?> <a name="aanc"></a> <div class="boxTeamPage"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><a name='anc'><?php echo $lng->getTrn('profile/team/box_info/title'); ?> </a></div> <div class="boxBody"> <table width="100%"> <tr> <td><?php echo $lng->getTrn('common/coach'); ?> </td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team->owned_by_coach_id, false, false); ?> "><?php echo $team->f_cname; ?> </a></td> </tr> <tr> <td><?php echo $lng->getTrn('common/race'); ?> </td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team->f_race_id, false, false); ?> "><?php echo $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team->f_rname))); ?> </a></td> </tr> <tr> <td><?php echo $lng->getTrn('common/league'); ?> </td> <td><?php if (isset($leagues[$team->f_lid])) { echo "<a href=\""; echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_LEAGUE, $team->f_lid); echo "\">" . $leagues[$team->f_lid]['lname'] . "</a>"; } else { echo '<i>' . $lng->getTrn('common/none') . '</i>'; } ?> </td> </tr> <?php if ($team->f_did != self::T_NO_DIVISION_TIE) { ?> <tr> <td><?php echo $lng->getTrn('common/division'); ?> </td> <td><?php if (isset($divisions[$team->f_did])) { echo "<a href=\""; echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, $team->f_did); echo "\">" . $divisions[$team->f_did]['dname'] . "</a>"; } else { echo '<i>' . $lng->getTrn('common/none') . '</i>'; } ?> </td> </tr> <?php } ?> <tr> <td><?php echo $lng->getTrn('common/ready'); ?> </td> <td><?php echo $team->rdy ? $lng->getTrn('common/yes') : $lng->getTrn('common/no'); ?> </td> </tr> <tr> <td>TV</td> <td><?php echo $team->tv / 1000 . 'k'; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('matches/report/treas'); ?> </td> <td><?php echo $team->treasury / 1000 . 'k'; ?> </td> </tr> <tr> <?php if (in_array($team->f_race_id, $racesHasNecromancer)) { ?> <td>Necromancer</td> <td><?php echo $lng->getTrn('common/yes'); ?> </td> <?php } if (!in_array($team->f_race_id, $racesNoApothecary)) { echo "<td>" . $lng->getTrn('common/apothecary') . "</td>\n"; echo "<td>" . ($team->apothecary ? $lng->getTrn('common/yes') : $lng->getTrn('common/no')) . "</td>\n"; } ?> </tr> <tr> <td><?php echo $lng->getTrn('common/reroll'); ?> </td> <td><?php echo $team->rerolls; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('matches/report/ff'); ?> </td> <td><?php echo $team->rg_ff; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/ass_coach'); ?> </td> <td><?php echo $team->ass_coaches; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/cheerleader'); ?> </td> <td><?php echo $team->cheerleaders; ?> </td> </tr> <tr> <td colspan=2><hr></td> </tr> <tr> <td><?php echo $lng->getTrn('common/played'); ?> </td> <td><?php echo $team->mv_played; ?> </td> </tr> <tr> <td>WIN%</td> <td><?php echo sprintf("%1.1f", $team->rg_win_pct) . '%'; ?> </td> </tr> <tr> <td>ELO</td> <td><?php echo $team->rg_elo ? sprintf("%1.2f", $team->rg_elo) : '<i>N/A</i>'; ?> </td> </tr> <tr> <td>W/L/D</td> <td><?php echo "{$team->mv_won}/{$team->mv_lost}/{$team->mv_draw}"; ?> </td> </tr> <tr> <td>W/L/D <?php echo $lng->getTrn('common/streaks'); ?> </td> <td><?php echo "{$team->rg_swon}/{$team->rg_slost}/{$team->rg_sdraw}"; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/wontours'); ?> </td> <td><?php echo $team->wt_cnt; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('profile/team/box_info/ltour'); ?> </td> <td><?php echo Tour::getTourUrl($team->getLatestTour()); ?> </td> </tr> <tr valign="top"> <td><?php echo $lng->getTrn('common/playedtours'); ?> </td> <td><small><?php $tours = $team->getToursPlayedIn(false); if (empty($tours)) { echo $lng->getTrn('common/none'); } else { $first = true; foreach ($tours as $tour) { if ($first) { $first = false; } else { echo ", "; } echo $tour->getUrl(); } } ?> </small></td> </tr> <?php if (Module::isRegistered('Prize')) { ?> <tr valign="top"> <td><?php echo $lng->getTrn('name', 'Prize'); ?> </td> <td><small><?php echo Module::run('Prize', array('getPrizesString', T_OBJ_TEAM, $team->team_id)); ?> </small></td> </tr> <?php } if (Module::isRegistered('FamousTeams')) { ?> <tr> <td><?php echo $lng->getTrn('isfamous', 'FamousTeams'); ?> </td> <td><?php echo Module::run('FamousTeams', array('isInFT', $team->team_id)) ? '<b><font color="green">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } ?> </table> </div> </div> <?php if ($ALLOW_EDIT) { ?> <div class="boxTeamPage"> <div class="boxTitle<?php echo T_HTMLBOX_COACH; ?> "><?php echo $lng->getTrn('profile/team/box_tm/title'); ?> </div> <div class="boxBody"> <?php $base = 'profile/team'; $tmanage = array('hire_player' => $lng->getTrn($base . '/box_tm/hire_player'), 'hire_journeyman' => $lng->getTrn($base . '/box_tm/hire_journeyman'), 'fire_player' => $lng->getTrn($base . '/box_tm/fire_player'), 'unbuy_player' => $lng->getTrn($base . '/box_tm/unbuy_player'), 'rename_player' => $lng->getTrn($base . '/box_tm/rename_player'), 'renumber_player' => $lng->getTrn($base . '/box_tm/renumber_player'), 'rename_team' => $lng->getTrn($base . '/box_tm/rename_team'), 'buy_goods' => $lng->getTrn($base . '/box_tm/buy_goods'), 'drop_goods' => $lng->getTrn($base . '/box_tm/drop_goods'), 'ready_state' => $lng->getTrn($base . '/box_tm/ready_state'), 'retire' => $lng->getTrn($base . '/box_tm/retire'), 'delete' => $lng->getTrn($base . '/box_tm/delete')); # If one of these are selected from the menu, a JavaScript confirm prompt is displayed before submitting. # Note: Don't add "hire_player" here - players may be un-bought if not having played any games. $tmange_confirm = array('hire_journeyman', 'fire_player', 'buy_goods', 'drop_goods'); // Set default choice. if (!isset($_POST['menu_tmanage'])) { reset($tmanage); $_POST['menu_tmanage'] = key($tmanage); } // If action is already chosen, then make it the default selected. if (isset($_POST['type']) && array_key_exists($_POST['type'], $tmanage)) { $_POST['menu_tmanage'] = $_POST['type']; } ?> <form method="POST" name="menu_tmanage_form"> <select name="menu_tmanage" onchange="document.menu_tmanage_form.submit();"> <?php foreach ($tmanage as $opt => $desc) { echo "<option value='{$opt}'" . ($_POST['menu_tmanage'] == $opt ? 'SELECTED' : '') . ">{$desc}</option>"; } ?> </select> <!-- <input type="submit" name="tmanage" value="OK"> --> </form> <br><i><?php echo $lng->getTrn('common/desc'); ?> :</i><br><br> <form name="form_tmanage" method="POST" enctype="multipart/form-data"> <?php $DISABLE = false; switch ($_POST['menu_tmanage']) { /************** * Hire player **************/ case 'hire_player': echo $lng->getTrn('profile/team/box_tm/desc/hire_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name='player'> <?php $active_players = array_filter($players, create_function('$p', "return (\$p->is_sold || \$p->is_dead || \$p->is_mng) ? false : true;")); $DISABLE = true; foreach ($DEA[$team->f_rname]['players'] as $pos => $details) { // Show players on the select list if buyable, or if player is a potential journeyman AND team has not reached journeymen limit. if ($team->isPlayerBuyable($details['pos_id']) && $team->treasury >= $details['cost'] || ($details['qty'] == 16 || $details['qty'] == 12) && count($active_players) < $rules['journeymen_limit']) { echo "<option value='{$details['pos_id']}'>" . $details['cost'] / 1000 . "k | " . $lng->GetTrn('position/' . strtolower($lng->FilterPosition($pos))) . "</option>\n"; $DISABLE = false; } } echo "</select>\n"; ?> <br><br> <?php echo $lng->getTrn('common/number'); ?> :<br> <select name="number"> <?php foreach ($T_ALLOWED_PLAYER_NR as $i) { foreach ($players as $p) { if ($p->nr == $i && !$p->is_sold && !$p->is_dead) { continue 2; } } echo "<option value='{$i}'>{$i}</option>\n"; } ?> </select> <br><br> <?php echo $lng->GetTrn('common/journeyman'); ?> ? <input type="checkbox" name="as_journeyman" value="1"> <br><br> <?php echo $lng->getTrn('common/name'); ?> :<br> <input type="text" name="name"> <input type="hidden" name="type" value="hire_player"> <?php break; /************** * Hire journeymen **************/ /************** * Hire journeymen **************/ case 'hire_journeyman': echo $lng->getTrn('profile/team/box_tm/desc/hire_journeyman'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { $price = $DEA[$team->f_rname]['players'][$p->pos]['cost']; if (!$p->is_journeyman || $p->is_sold || $p->is_dead || $team->treasury < $price || !$team->isPlayerBuyable($p->f_pos_id) || $team->isFull()) { continue; } echo "<option value='{$p->player_id}'>{$p->name} | " . $price / 1000 . " k</option>\n"; $DISABLE = false; } ?> </select> <input type="hidden" name="type" value="hire_journeyman"> <?php break; /************** * Fire player **************/ /************** * Fire player **************/ case 'fire_player': echo $lng->getTrn('profile/team/box_tm/desc/fire_player') . ' ' . $rules['player_refund'] * 100 . "%.\n"; ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_dead || $p->is_sold) { continue; } echo "<option value='{$p->player_id}'>" . $p->value / 1000 * $rules['player_refund'] . "k refund | {$p->name}</option>\n"; $DISABLE = false; } ?> </select> <input type="hidden" name="type" value="fire_player"> <?php break; /*************** * Un-buy player **************/ /*************** * Un-buy player **************/ case 'unbuy_player': echo $lng->getTrn('profile/team/box_tm/desc/unbuy_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_unbuyable() && !$p->is_sold) { echo "<option value='{$p->player_id}'>{$p->name}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="unbuy_player"> <?php break; /************** * Rename player **************/ /************** * Rename player **************/ case 'rename_player': echo $lng->getTrn('profile/team/box_tm/desc/rename_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { unset($color); if ($p->is_dead) { $color = COLOR_HTML_DEAD; } elseif ($p->is_sold) { $color = COLOR_HTML_SOLD; } echo "<option value='{$p->player_id}' " . (isset($color) ? "style='background-color: {$color};'" : '') . ">{$p->name}</option>\n"; $DISABLE = false; } ?> </select> <br><br> <?php echo $lng->getTrn('common/name'); ?> :<br> <input type='text' name='name' maxlength=50 size=20> <input type="hidden" name="type" value="rename_player"> <?php break; /************** * Renumber player **************/ /************** * Renumber player **************/ case 'renumber_player': echo $lng->getTrn('profile/team/box_tm/desc/renumber_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { unset($color); if ($p->is_dead) { $color = COLOR_HTML_DEAD; } elseif ($p->is_sold) { $color = COLOR_HTML_SOLD; } echo "<option value='{$p->player_id}' " . (isset($color) ? "style='background-color: {$color};'" : '') . ">{$p->nr} {$p->name}</option>\n"; $DISABLE = false; } ?> </select> <br><br> <?php echo $lng->getTrn('common/number'); ?> :<br> <select name="number"> <?php foreach ($T_ALLOWED_PLAYER_NR as $i) { echo "<option value='{$i}'>{$i}</option>\n"; } ?> </select> <input type="hidden" name="type" value="renumber_player"> <?php break; /************** * Rename team **************/ /************** * Rename team **************/ case 'rename_team': echo $lng->getTrn('profile/team/box_tm/desc/rename_team'); ?> <hr><br> <?php echo $lng->getTrn('common/name'); ?> :<br> <input type='text' name='name' maxlength='50' size='20'> <input type="hidden" name="type" value="rename_team"> <?php break; /************** * Buy team goods **************/ /************** * Buy team goods **************/ case 'buy_goods': echo $lng->getTrn('profile/team/box_tm/desc/buy_goods'); $goods_temp = $team->getGoods(); if ($DEA[$team->f_rname]['other']['rr_cost'] != $goods_temp['rerolls']['cost']) { echo $lng->getTrn('profile/team/box_tm/desc/buy_goods_warn'); } ?> <hr><br> <?php echo $lng->getTrn('profile/team/box_tm/fdescs/thing'); ?> :<br> <select name="thing"> <?php $DISABLE = true; foreach ($team->getGoods() as $name => $details) { if ($name == 'ff_bought' && !$team->mayBuyFF()) { continue; } if (($team->{$name} < $details['max'] || $details['max'] == -1) && $team->treasury >= $details['cost']) { echo "<option value='{$name}'>" . $details['cost'] / 1000 . "k | {$details['item']}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="buy_goods"> <?php break; /************** * Let go (drop) of team goods **************/ /************** * Let go (drop) of team goods **************/ case 'drop_goods': echo $lng->getTrn('profile/team/box_tm/desc/drop_goods'); ?> <hr><br> <?php echo $lng->getTrn('profile/team/box_tm/fdescs/thing'); ?> :<br> <select name="thing"> <?php $DISABLE = true; foreach ($team->getGoods() as $name => $details) { if ($name == 'ff_bought' && !$team->mayBuyFF()) { continue; } if ($team->{$name} > 0) { echo "<option value='{$name}'>{$details['item']}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="drop_goods"> <?php break; /************** * Set ready state **************/ /************** * Set ready state **************/ case 'ready_state': echo $lng->getTrn('profile/team/box_tm/desc/ready_state'); ?> <hr><br> <?php echo $lng->getTrn('profile/team/box_tm/fdescs/teamready'); ?> <input type="checkbox" name="bool" value="1" <?php echo $team->rdy ? 'CHECKED' : ''; ?> > <input type="hidden" name="type" value="ready_state"> <?php break; /*************** * Retire **************/ /*************** * Retire **************/ case 'retire': echo $lng->getTrn('profile/team/box_tm/desc/retire'); ?> <hr><br> <?php echo $lng->getTrn('profile/team/box_tm/fdescs/retire'); ?> <input type="checkbox" name="bool" value="1"> <input type="hidden" name="type" value="retire"> <?php break; /*************** * Delete **************/ /*************** * Delete **************/ case 'delete': echo $lng->getTrn('profile/team/box_tm/desc/delete'); if (!$this->isDeletable()) { $DISABLE = true; } ?> <hr><br> <?php echo $lng->getTrn('profile/team/box_tm/fdescs/suredeleteteam'); ?> <input type="checkbox" name="bool" value="1" <?php echo $DISABLE ? 'DISABLED' : ''; ?> > <input type="hidden" name="type" value="delete"> <?php break; } ?> <br><br> <input type="submit" name="button" value="OK" <?php echo $DISABLE ? 'DISABLED' : ''; ?> <?php if (in_array($_POST['menu_tmanage'], $tmange_confirm)) { echo "onClick=\"if(!confirm('" . $lng->getTrn('common/confirm_box') . "')){return false;}\""; } ?> > </form> </div> </div> <?php if ($coach->isNodeCommish(T_NODE_LEAGUE, $team->f_lid)) { ?> <div class="boxTeamPage"> <div class="boxTitle<?php echo T_HTMLBOX_ADMIN; ?> "><?php echo $lng->getTrn('profile/team/box_admin/title'); ?> </div> <div class="boxBody"> <?php $base = 'profile/team'; $admin_tools = array('unhire_journeyman' => $lng->getTrn($base . '/box_admin/unhire_journeyman'), 'unsell_player' => $lng->getTrn($base . '/box_admin/unsell_player'), 'unbuy_goods' => $lng->getTrn($base . '/box_admin/unbuy_goods'), 'bank' => $lng->getTrn($base . '/box_admin/bank'), 'spp' => $lng->getTrn($base . '/box_admin/spp'), 'dval' => $lng->getTrn($base . '/box_admin/dval'), 'extra_skills' => $lng->getTrn($base . '/box_admin/extra_skills'), 'ach_skills' => $lng->getTrn($base . '/box_admin/ach_skills')); // Set default choice. if (!isset($_POST['menu_admintools'])) { reset($admin_tools); $_POST['menu_admintools'] = key($admin_tools); } // If action is already chosen, then make it the default selected. if (isset($_POST['type']) && array_key_exists($_POST['type'], $admin_tools)) { $_POST['menu_admintools'] = $_POST['type']; } ?> <form method="POST" name="menu_admintools_form"> <select name="menu_admintools" onchange="document.menu_admintools_form.submit();"> <?php foreach ($admin_tools as $opt => $desc) { echo "<option value='{$opt}'" . ($_POST['menu_admintools'] == $opt ? 'SELECTED' : '') . ">{$desc}</option>"; } ?> </select> <!-- <input type="submit" name="admintools" value="OK"> --> </form> <br><i><?php echo $lng->getTrn('common/desc'); ?> :</i><br><br> <form name='form_admintools' method='POST'> <?php $DISABLE = false; switch ($_POST['menu_admintools']) { /*************** * Un-hire journeymen **************/ case 'unhire_journeyman': echo $lng->getTrn('profile/team/box_admin/desc/unhire_journeyman'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_sold || $p->is_dead || $p->is_journeyman || $p->qty != 16) { continue; } echo "<option value='{$p->player_id}'>{$p->name}</option>\n"; $DISABLE = false; } ?> </select> <input type="hidden" name="type" value="unhire_journeyman"> <?php break; /*************** * Un-sell player **************/ /*************** * Un-sell player **************/ case 'unsell_player': echo $lng->getTrn('profile/team/box_admin/desc/unsell_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_sold) { echo "<option value='{$p->player_id}'>{$p->name}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="unsell_player"> <?php break; /*************** * Un-buy team goods **************/ /*************** * Un-buy team goods **************/ case 'unbuy_goods': echo $lng->getTrn('profile/team/box_admin/desc/unbuy_goods'); ?> <hr><br> <select name="thing"> <?php $DISABLE = true; foreach ($team->getGoods() as $name => $details) { if ($team->{$name} > 0) { # Only allow to un-buy those things which we already have some of. echo "<option value='{$name}'>{$details['item']}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="unbuy_goods"> <?php break; /*************** * Gold bank **************/ /*************** * Gold bank **************/ case 'bank': echo $lng->getTrn('profile/team/box_admin/desc/bank'); ?> <hr><br> Δ team treasury:<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name="amount" maxlength=5 size=5>k <input type="hidden" name="type" value="bank"> <?php break; /*************** * Manage extra SPP **************/ /*************** * Manage extra SPP **************/ case 'spp': echo $lng->getTrn('profile/team/box_admin/desc/spp'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; objsort($players, array('+is_dead', '+name')); foreach ($players as $p) { if (!$p->is_sold) { echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->name}</option>"; $DISABLE = false; } } objsort($players, array('+nr')); ?> </select> <br><br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name='amount' maxlength="5" size="5"> Δ SPP <input type="hidden" name="type" value="spp"> <?php break; /*************** * Manage extra player value **************/ /*************** * Manage extra player value **************/ case 'dval': echo $lng->getTrn('profile/team/box_admin/desc/dval'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; objsort($players, array('+is_dead', '+name')); foreach ($players as $p) { if (!$p->is_sold) { echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->name} (current extra = " . $p->extra_val / 1000 . "k)</option>"; $DISABLE = false; } } objsort($players, array('+nr')); ?> </select> <br><br> Set extra value to<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name='amount' maxlength="10" size="6">k <input type="hidden" name="type" value="dval"> <?php break; /*************** * Manage extra skills **************/ /*************** * Manage extra skills **************/ case 'extra_skills': echo $lng->getTrn('profile/team/box_admin/desc/extra_skills'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if (!$p->is_sold && !$p->is_dead) { echo "<option value='{$p->player_id}'>{$p->name}</option>"; $DISABLE = false; } } ?> </select> <br><br> Skill:<br> <select name="skill"> <?php foreach ($skillarray as $cat => $skills) { echo "<OPTGROUP LABEL='{$cat}'>"; foreach ($skills as $id => $skill) { echo "<option value='{$id}'>{$skill}</option>"; } echo "</OPTGROUP>"; } ?> </select> <br><br> Action (add/remove)<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type="hidden" name="type" value="extra_skills"> <?php break; /*************** * Remove achived skills **************/ /*************** * Remove achived skills **************/ case 'ach_skills': echo $lng->getTrn('profile/team/box_admin/desc/ach_skills'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if (!$p->is_dead && !$p->is_sold) { echo "<option value='{$p->player_id}'>{$p->name}</option>\n"; $DISABLE = false; } } ?> </select> <br><br> Skill<br> <select name="skill"> <?php foreach ($skillarray as $cat => $skills) { echo "<OPTGROUP LABEL='{$cat}'>"; foreach ($skills as $id => $skill) { echo "<option value='{$id}'>{$skill}</option>"; } echo "</OPTGROUP>"; } echo "<optgroup label='Characteristic increases'>\n"; foreach ($CHR_CONV as $key => $name) { echo "<option value='ach_{$key}'>+ " . ucfirst($name) . "</option>\n"; } echo "</optgroup>\n"; ?> </select> <input type="hidden" name="type" value="ach_skills"> <?php break; } ?> <br><br> <input type="submit" name="button" value="OK" <?php echo $DISABLE ? 'DISABLED' : ''; ?> > </form> </div> </div> <?php } } ?> <br> <div class="row"></div> <br> <?php if (!$settings['hide_ES_extensions']) { ?> <div class="row"> <div class="boxWide"> <div class="boxTitle<?php echo T_HTMLBOX_STATS; ?> "><a href='javascript:void(0);' onClick="slideToggleFast('ES');"><b>[+/-]</b></a> <?php echo $lng->getTrn('common/extrastats'); ?> </div> <div class="boxBody" id="ES" style='display:none;'> <?php HTMLOUT::generateEStable($this); ?> </div> </div> </div> <?php } // If an team action was chosen, jump to actions HTML anchor. if ($JMP_ANC) { ?> <script language="JavaScript" type="text/javascript"> window.location = "#aanc"; </script> <?php } }
private function _stats() { global $lng, $settings; ?> <div class="row"> <div class="boxCoachPage"> <h3 class='boxTitle1'><?php echo $lng->getTrn('common/general'); ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php echo "<tr><td>Played</td><td>{$this->mv_played}</td></tr>\n"; echo "<tr><td>WIN%</td><td>" . (sprintf("%1.1f", $this->rg_win_pct) . '%') . "</td></tr>\n"; echo "<tr><td>ELO</td><td>" . ($this->rg_elo ? sprintf("%1.2f", $this->rg_elo) : '<i>N/A</i>') . "</td></tr>\n"; echo "<tr><td>W/L/D</td><td>{$this->mv_won}/{$this->mv_lost}/{$this->mv_draw}</td></tr>\n"; echo "<tr><td>W/L/D " . $lng->getTrn('common/streaks') . "</td><td>{$this->mv_swon}/{$this->mv_slost}/{$this->mv_sdraw}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('common/wontours') . "</td><td>{$this->wt_cnt}</td></tr>\n"; if (Module::isRegistered('Prize')) { echo "<tr><td>" . $lng->getTrn('name', 'Prize') . "</td><td><small>" . Module::run('Prize', array('getPrizesString', T_OBJ_COACH, $this->coach_id)) . "</small></td></tr>\n"; } echo "<tr><td colspan='2'><hr></td></tr>"; $result = mysql_query("\n SELECT \n COUNT(*) AS 'teams_total', \n IFNULL(SUM(IF(rdy IS TRUE AND retired IS FALSE,1,0)),0) AS 'teams_active', \n IFNULL(SUM(IF(rdy IS FALSE,1,0)),0) AS 'teams_notready',\n IFNULL(SUM(IF(retired IS TRUE,1,0)),0) AS 'teams_retired',\n IFNULL(AVG(elo),0) AS 'avg_elo',\n IFNULL(CAST(AVG(ff) AS SIGNED INT),0) AS 'avg_ff',\n IFNULL(CAST(AVG(tv)/1000 AS SIGNED INT),0) AS 'avg_tv'\n FROM teams WHERE owned_by_coach_id = {$this->coach_id}"); $row = mysql_fetch_assoc($result); echo "<tr><td>" . $lng->getTrn('profile/coach/teams_total') . "</td><td>{$row['teams_total']}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/teams_active') . "</td><td>{$row['teams_active']}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/teams_notready') . "</td><td>{$row['teams_notready']}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/teams_retired') . "</td><td>{$row['teams_retired']}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/avgteam_elo') . "</td><td>" . ($row['avg_elo'] ? sprintf("%1.2f", $row['avg_elo']) : '<i>N/A</i>') . "</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/avgteam_tv') . "</td><td>{$row['avg_tv']}</td></tr>\n"; echo "<tr><td>" . $lng->getTrn('profile/coach/avgteam_ff') . "</td><td>{$row['avg_ff']}</td></tr>\n"; ?> </table> </div> </div> <div class="boxCoachPage"> <h3 class='boxTitle1'><?php echo $lng->getTrn('common/ach'); ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php $stats = array('CAS' => array('cas', 2), 'BH' => array('bh', 2), 'Ki' => array('ki', 2), 'Si' => array('si', 2), 'TD' => array('td', 2), 'Int' => array('intcpt', 2), 'Cp' => array('cp', 2), 'GF' => array('gf', 2), 'GA' => array('ga', 2), 'SMP' => array('smp', 2)); $thisAVG = clone $this; $thisAVG->setStats(false, false, true); echo "<tr><td>" . $lng->getTrn('common/stat') . "</td> <td>" . $lng->getTrn('common/amount') . "</td> <td>" . $lng->getTrn('common/matchavg') . "</td></tr>\n"; echo "<tr><td colspan='5'><hr></td></tr>\n"; foreach ($stats as $name => $d) { echo "<tr><td><i>{$name}</i></td>"; echo "<td>" . $this->{"mv_{$d['0']}"} . "</td>"; echo "<td>" . sprintf("%1.{$d['1']}f", $thisAVG->{"mv_{$d['0']}"}) . "</td>"; echo "</tr>\n"; } ?> </table> </div> </div> </div> <br> <div class="row"></div> <br> <?php if (!$settings['hide_ES_extensions']) { ?> <div class="row"> <div class="boxWide"> <div class="boxTitle<?php echo T_HTMLBOX_STATS; ?> "><a href='javascript:void(0);' onClick="slideToggleFast('ES');"><b>[+/-]</b></a> <?php echo $lng->getTrn('common/extrastats'); ?> </div> <div class="boxBody" id="ES"> <?php HTMLOUT::generateEStable($this); ?> </div> </div> </div> <?php } }
private function _about($ALLOW_EDIT) { global $lng; $p = $this; // Copy. Used instead of $this for readability. $p->skills = $p->getSkillsStr(true); $p->injs = $p->getInjsStr(true); ?> <div class="row"> <div class="boxPlayerPageInfo"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/player/about'); ?> </div> <div class="boxBody"> <table class="pbox"> <tr> <td><b><?php echo $lng->getTrn('common/name'); ?> </b></td> <td><?php echo "{$p->name} (#{$p->nr})"; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/pos'); ?> </b></td> <td><?php echo $lng->getTrn('position/' . strtolower($lng->FilterPosition($p->position))); ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/team'); ?> </b></td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $p->owned_by_team_id, false, false); ?> "><?php echo $p->f_tname; ?> </a></td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/bought'); ?> </b></td> <td><?php echo $p->date_bought; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/status'); ?> </b></td> <td> <?php if ($p->is_dead) { echo "<b><font color='red'>" . $lng->getTrn('common/dead') . "</font></b> ({$p->date_died})"; } elseif ($p->is_sold) { echo "<b>" . $lng->getTrn('common/sold') . "</b> ({$p->date_sold})"; } else { global $T_INJS; $status = ucfirst(strtolower($T_INJS[$p->status])); echo $status == 'none' ? '<b><font color="green">' . $lng->getTrn('common/ready') . '</font></b>' : "<b><font color='blue'>{$status}</font></b>"; } ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/value'); ?> </b></td> <td><?php echo $p->value / 1000 . 'k'; ?> </td> </tr> <tr> <td><b>SPP/extra</b></td> <td><?php echo "{$p->mv_spp}/{$p->extra_spp}"; ?> </td> </tr> <?php if (Module::isRegistered('Wanted')) { ?> <tr> <td><b>Wanted</b></td> <td><?php echo Module::run('Wanted', array('isWanted', $p->player_id)) ? '<b><font color="red">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } if (Module::isRegistered('HOF')) { ?> <tr> <td><b>In HoF</b></td> <td><?php echo Module::run('HOF', array('isInHOF', $p->player_id)) ? '<b><font color="green">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } ?> <tr> <td><b><?php echo $lng->getTrn('common/played'); ?> </b></td> <td><?php echo $p->mv_played; ?> </td> </tr> <tr> <td><b>W/L/D</b></td> <td><?php echo "{$p->mv_won}/{$p->mv_lost}/{$p->mv_draw}"; ?> </td> </tr> <?php if (Module::isRegistered('SGraph')) { ?> <tr> <td><b>Vis. stats</b></td> <td><?php echo "<a href='handler.php?type=graph&gtype=" . SG_T_PLAYER . "&id={$p->player_id}''>" . $lng->getTrn('common/view') . "</a>\n"; ?> </td> </tr> <?php } ?> <tr> <td colspan="2"><hr></td> </tr> <tr> <td><b>Ma</b></td> <td><?php echo $p->ma; ?> </td> </tr> <tr> <td><b>St</b></td> <td><?php echo $p->st; ?> </td> </tr> <tr> <td><b>Ag</b></td> <td><?php echo $p->ag; ?> </td> </tr> <tr> <td><b>Av</b></td> <td><?php echo $p->av; ?> </td> </tr> <tr valign="top"> <td><b><?php echo $lng->getTrn('common/skills'); ?> </b></td> <td><?php echo empty($p->skills) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $p->skills; ?> </td> </tr> <tr> <td><b><?php echo $lng->getTrn('common/injs'); ?> </b></td> <td><?php echo empty($p->injs) ? '<i>' . $lng->getTrn('common/none') . '</i>' : $p->injs; ?> </td> </tr> <tr> <td><b>Cp</b></td> <td><?php echo $p->mv_cp; ?> </td> </tr> <tr> <td><b>Td</b></td> <td><?php echo $p->mv_td; ?> </td> </tr> <tr> <td><b>Int</b></td> <td><?php echo $p->mv_intcpt; ?> </td> </tr> <tr> <td><b>BH/SI/Ki</b></td> <td><?php echo "{$p->mv_bh}/{$p->mv_si}/{$p->mv_ki}"; ?> </td> </tr> <tr> <td><b>Cas</b></td> <td><?php echo $p->mv_cas; ?> </td> </tr> <tr> <td><b>MVP</b></td> <td><?php echo $p->mv_mvp; ?> </td> </tr> </table> </div> </div> <div class="boxCommon"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/player/profile'); ?> </div> <div class="boxBody"> <i><?php echo $lng->getTrn('common/picof'); ?> </i><hr> <?php ImageSubSys::makeBox(IMGTYPE_PLAYER, $p->player_id, $ALLOW_EDIT, false); ?> <br><br> <i><?php echo $lng->getTrn('common/about'); ?> </i><hr> <?php $txt = $p->getText(); if (empty($txt)) { $txt = $lng->getTrn('common/nobody'); } if ($ALLOW_EDIT) { ?> <form method="POST" enctype="multipart/form-data"> <textarea name='playertext' rows='8' cols='45'><?php echo $txt; ?> </textarea> <br><br> <input type="hidden" name="type" value="playertext"> <input type="submit" name='Save' value='<?php echo $lng->getTrn('common/save'); ?> '> </form> <?php } else { echo '<p>' . fmtprint($txt) . '</p>'; } ?> </div> </div> </div> <?php }
private static function make_menu() { global $lng, $coach, $settings, $rules, $admin_menu; ?> <ul id="nav" class="dropdown dropdown-horizontal"> <?php if (isset($_SESSION['logged_in'])) { ?> <li><a href="index.php?logout=1"> <?php echo $lng->getTrn('menu/logout'); ?> </a></li><?php } else { ?> <li><a href="index.php?section=login"><?php echo $lng->getTrn('menu/login'); ?> </a></li><?php } if (isset($_SESSION['logged_in']) && is_object($coach)) { echo '<li><a href="' . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '">' . $lng->getTrn('menu/cc') . ' (' . ucfirst($coach->name) . ')</a></li>'; if (!empty($admin_menu)) { ?> <li><span class="dir"><?php echo $lng->getTrn('menu/admin_menu/name'); ?> </span> <ul> <?php foreach ($admin_menu as $lnk => $desc) { if (!is_array($desc)) { echo "<li><a href='index.php?section=admin&subsec={$lnk}'>{$desc}</a></li>\n"; } else { ?> <li><span class="dir"><?php echo $desc['title']; ?> </span> <ul> <?php foreach ($desc['sub'] as $sub) { echo "<li><a href='index.php?section=admin&subsec={$lnk}&{$sub['href']}'>{$sub['title']}</a></li>\n"; } ?> </ul> </li> <?php } } ?> </ul> </li> <?php } } ?> <li><a href="index.php?section=main"><?php echo $lng->getTrn('menu/home'); ?> </a></li> <li><a href="index.php?section=teamlist"><?php echo $lng->getTrn('menu/teams'); ?> </a></li> <li><a href="index.php?section=coachlist"><?php echo $lng->getTrn('menu/coaches'); ?> </a></li> <li><span class="dir"><?php echo $lng->getTrn('menu/matches_menu/name'); ?> </span> <ul> <li><a href="index.php?section=matches&type=tours"><?php echo $lng->getTrn('menu/matches_menu/tours'); ?> </a></li> <li><a href="index.php?section=matches&type=recent"><?php echo $lng->getTrn('menu/matches_menu/recent'); ?> </a></li> <li><a href="index.php?section=matches&type=upcoming"><?php echo $lng->getTrn('menu/matches_menu/upcoming'); ?> </a></li> <?php if (isset($_SESSION['logged_in'])) { ?> <li><a href="index.php?section=matches&type=usersched"><?php echo $lng->getTrn('menu/matches_menu/usersched'); ?> </a></li> <?php } ?> </ul> </li> <li><span class="dir"><?php echo $lng->getTrn('menu/statistics_menu/name'); ?> </span> <ul> <li><a href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/team_stn'); ?> </a></li> <li><a href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_PLAYER, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/player_stn'); ?> </a></li> <li><a href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_COACH, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/coach_stn'); ?> </a></li> <li><a href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_RACE, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/race_stn'); ?> </a></li> <li><a href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_STAR, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/star_stn'); ?> </a></li> </ul> </li> <?php // To avoid showing the plugin menu if no plugins are loaded, we start output buffering here ob_start(); ?> <?php if (Module::isRegistered('Search')) { ?> <li><a href="handler.php?type=search"><?php echo $lng->getTrn('name', 'Search'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('TeamCompare')) { ?> <li><a href="handler.php?type=teamcompare"><?php echo $lng->getTrn('name', 'TeamCompare'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('HOF')) { ?> <li><a href="handler.php?type=hof"><?php echo $lng->getTrn('name', 'HOF'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('FamousTeams')) { ?> <li><a href="handler.php?type=famousteams"><?php echo $lng->getTrn('name', 'FamousTeams'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Wanted')) { ?> <li><a href="handler.php?type=wanted"><?php echo $lng->getTrn('name', 'Wanted'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Prize')) { ?> <li><a href="handler.php?type=prize"><?php echo $lng->getTrn('name', 'Prize'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Cemetery')) { ?> <li><a href="handler.php?type=cemetery&tid=0"><?php echo $lng->getTrn('name', 'Cemetery'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Memmatches')) { ?> <li><a href="handler.php?type=memmatches"><?php echo $lng->getTrn('name', 'Memmatches'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('SGraph')) { ?> <li><a href="handler.php?type=graph&gtype=<?php echo SG_T_LEAGUE; ?> &id=none"><?php echo $lng->getTrn('name', 'SGraph'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Gallery')) { ?> <li><a href="handler.php?type=gallery"><?php echo $lng->getTrn('name', 'Gallery'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('LeagueTables')) { ?> <li><a href="handler.php?type=leaguetables"><?php echo $lng->getTrn('menu-label', 'LeagueTables'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Conference')) { ?> <li><a href="handler.php?type=conference"><?php echo $lng->getTrn('menu-conf', 'Conference'); ?> </a></li><?php } ?> <?php if (isset($_SESSION['logged_in']) && is_object($coach) && ($coach->ring == Coach::T_RING_GLOBAL_ADMIN || $coach->ring == Coach::T_RING_LOCAL_ADMIN)) { ?> <?php if (Module::isRegistered('Scheduler')) { ?> <li><a href="handler.php?type=scheduler"><?php echo $lng->getTrn('name', 'Scheduler'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('UPLOAD_BOTOCS') && $settings['leegmgr_enabled']) { ?> <li><a href="handler.php?type=leegmgr">Client Match Report Upload</a></li><?php } ?> <?php if (Module::isRegistered('PDFMatchReport')) { ?> <li><a href="handler.php?type=pdfmatchreport"><?php echo $lng->getTrn('name', 'PDFMatchReport'); ?> </a></li><?php } ?> <?php } ?> <?php $plugin_menu = trim(ob_get_contents()); ob_end_clean(); if (strlen($plugin_menu) > 0) { ?> <li><span class="dir"><?php echo $lng->getTrn('menu/plugins'); ?> </span> <ul> <?php echo $plugin_menu; ?> </ul> </li> <?php } /*end of output buffering of the plugin menu*/ ?> <li><a href="index.php?section=rules"><?php echo $lng->getTrn('menu/rules'); ?> </a></li> <li><a href="index.php?section=about">OBBLM</a></li> <?php if (!empty($settings['league_url'])) { ?> <li><a href="<?php echo $settings['league_url']; ?> "><?php echo $settings['league_url_name']; ?> </a></li><?php } ?> </ul> <?php }
/** * Generates the newsfeed and writes it to disc. * */ public function generateNewsRssFeed() { $dom = new DOMDocument(); $dom->formatOutput = true; $el_root = $dom->appendChild($dom->createElement('rss')); $el_root->setAttribute('version', '2.0'); $el_channel = $el_root->appendChild($dom->createElement('channel')); $el_channel->appendChild($dom->createElement('title', $this->title)); $el_channel->appendChild($dom->createElement('link', $this->link)); $el_channel->appendChild($dom->createElement('description', $this->desc)); if ($this->lang != '') { $el_channel->appendChild($dom->createElement('language', $this->lang)); } $el_channel->appendChild($dom->createElement('docs', $this->docs)); $el_channel->appendChild($dom->createElement('lastBuildDate', date(DATE_RSS))); $el_channel->appendChild($dom->createElement('generator', 'OBBLM ' . OBBLM_VERSION)); $entries = array(); foreach ($this->type as $t) { $obj = (object) null; switch ($t) { case T_TEXT_MSG: foreach (Message::getMessages(RSS_SIZE) as $item) { $entries[] = (object) array('title' => "Announcement by " . get_alt_col('coaches', 'coach_id', $item->f_coach_id, 'name') . ": {$item->title}", 'desc' => $item->message, 'date' => $item->date); } break; case 'HOF': if (Module::isRegistered('HOF')) { foreach (Module::run('HOF', array('getHOF', false, RSS_SIZE)) as $item) { $item = $item['hof']; $entries[] = (object) array('title' => "HOF entry for " . get_alt_col('players', 'player_id', $item->pid, 'name') . ": {$item->title}", 'desc' => $item->about, 'date' => $item->date); } } break; case 'Wanted': if (Module::isRegistered('Wanted')) { foreach (Module::run('Wanted', array('getWanted', false, RSS_SIZE)) as $item) { $item = $item['wanted']; $entries[] = (object) array('title' => "Wanted entry for " . get_alt_col('players', 'player_id', $item->pid, 'name') . ": {$item->bounty}", 'desc' => $item->why, 'date' => $item->date); } } break; case T_TEXT_MATCH_SUMMARY: foreach (MatchSummary::getSummaries(RSS_SIZE) as $item) { $m = new Match($item->match_id); $entries[] = (object) array('title' => "Match: {$m->team1_name} ({$m->team1_score}) vs. {$m->team2_name} ({$m->team2_score})", 'desc' => $m->getText(), 'date' => $m->date_played); } break; case T_TEXT_TNEWS: foreach (TeamNews::getNews(false, RSS_SIZE) as $item) { $entries[] = (object) array('title' => "Team news by " . get_alt_col('teams', 'team_id', $item->f_id, 'name'), 'desc' => $item->txt, 'date' => $item->date); } break; } } objsort($entries, array('-date')); foreach (array_slice($entries, 0, RSS_SIZE) as $item) { $el_item = $dom->createElement('item'); $el_item->appendChild($dom->createElement('title', htmlspecialchars($item->title, ENT_NOQUOTES, "UTF-8"))); $el_item->appendChild($dom->createElement('description', htmlspecialchars($item->desc, ENT_NOQUOTES, "UTF-8"))); $el_item->appendChild($dom->createElement('link', $this->link)); # $el_item->appendChild($dom->createElement('pubDate', $item->date)); $el_item->appendChild($dom->createElement('pubDate', date('r', strtotime($item->date)))); $el_item->appendChild($dom->createElement('guid', $this->link . 'index.php?' . date('U', strtotime($item->date)))); # RSS 2.0 dirty workaround. $el_channel->appendChild($el_item); } // Write the file $handle = fopen("rss.xml", "w"); fwrite($handle, $dom->saveXML()); fclose($handle); return $dom->saveXML(); }
public static function report() { // Is $match_id valid? $match_id = (int) $_GET['mid']; if (!get_alt_col('matches', 'match_id', $match_id, 'match_id')) { fatal("Invalid match ID."); } global $lng, $stars, $rules, $settings, $coach, $racesHasNecromancer, $racesMayRaiseRotters, $DEA, $T_PMD__ENTRY_EXPECTED; global $T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ; global $leagues, $divisions, $tours; $T_ROUNDS = Match::getRounds(); // Perform actions (delete, lock/unlock and reset). Needs the $IS_LOCAL_ADMIN = is_object($coach) && $coach->isNodeCommish(T_NODE_TOURNAMENT, get_alt_col('matches', 'match_id', $match_id, 'f_tour_id')); self::matchActions($IS_LOCAL_ADMIN); // Create objects $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); // Determine visitor privileges. $lid = $divisions[$tours[$m->f_tour_id]['f_did']]['f_lid']; $ALLOW_EDIT = !$m->locked && is_object($coach) && ($coach->ring == Coach::T_RING_GLOBAL_ADMIN || $leagues[$lid]['ring'] == Coach::T_RING_LOCAL_ADMIN || $coach->isInMatch($m->match_id)); $DIS = $ALLOW_EDIT ? '' : 'DISABLED'; // Lock page for other reasons? (Used journeys etc) $USED_JOURNEYMAN_PRESENT = false; foreach (array(1 => $team1, 2 => $team2) as $id => $t) { foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } if (!$m->is_played && $p->is_journeyman_used) { $USED_JOURNEYMAN_PRESENT = true; } } } if ($USED_JOURNEYMAN_PRESENT) { $DIS = 'DISABLED'; } // Relay to ES report page? if (isset($_GET['es_report'])) { # Don't care what value the GET field has! self::report_ES($match_id, !$ALLOW_EDIT); return; } $easyconvert = new array_to_js(); @$easyconvert->add_array($stars, 'phpStars'); // Load stars array into JavaScript array. echo $easyconvert->output_all(); echo '<script language="JavaScript" type="text/javascript"> var ID_MERCS = ' . ID_MERCS . '; var ID_STARS_BEGIN = ' . ID_STARS_BEGIN . '; </script> '; /***************** * * Submitted form? * *****************/ if (isset($_POST['button']) && $ALLOW_EDIT) { if (get_magic_quotes_gpc()) { $_POST['summary'] = stripslashes($_POST['summary']); } MTS('Report submit STARTED'); // FIRST, if any raised zombies are kept we need to create their player objects in order have the correct player- vs. match creation & played dates. foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesHasNecromancer) && isset($_POST["t{$id}zombie"])) { $pos_id = $DEA[$t->f_rname]['players']['Zombie']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => 'RAISED ZOMBIE'), array('free' => true)); /* Knowing the new zombie's PID we relocate the zombie match data to regular player data - this allows us to use the same loop for submitting the zombie's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}zombie"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } // SECONDLY, look for raised rotters too, do same as above with zombies... foreach (array(1 => $team1, 2 => $team2) as $id => $t) { if (in_array($t->f_race_id, $racesMayRaiseRotters) && isset($_POST["t{$id}rotterCnt"]) && ($N = (int) $_POST["t{$id}rotterCnt"]) > 0) { foreach (range(1, $N) as $n) { $pos_id = $DEA[$t->f_rname]['players']['Rotter']['pos_id']; list($exitStatus, $pid) = Player::create(array('nr' => $t->getFreePlayerNr(), 'f_pos_id' => $pos_id, 'team_id' => $t->team_id, 'name' => "RAISED ROTTER {$n}"), array('free' => true)); /* Knowing the new rotter's PID we relocate the rotter match data to regular player data - this allows us to use the same loop for submitting the rotter's match data. */ foreach ($T_PMD__ENTRY_EXPECTED as $f) { $postName = "{$f}_t{$id}rotter{$n}"; $_POST["{$f}_{$pid}"] = isset($_POST[$postName]) ? $_POST[$postName] : 0; unset($_POST[$postName]); } } } } // Update general match data status($m->update(array('submitter_id' => (int) $_SESSION['coach_id'], 'stadium' => (int) $_POST['stadium'], 'gate' => (int) $_POST['gate'] * 1000, 'fans' => (int) $_POST['fans'], 'ffactor1' => (int) $_POST['ff1'], 'ffactor2' => (int) $_POST['ff2'], 'income1' => (int) $_POST['inc1'] * 1000, 'income2' => (int) $_POST['inc2'] * 1000, 'team1_score' => (int) $_POST['result1'], 'team2_score' => (int) $_POST['result2'], 'smp1' => (int) $_POST['smp1'], 'smp2' => (int) $_POST['smp2'], 'tcas1' => (int) $_POST['tcas1'], 'tcas2' => (int) $_POST['tcas2'], 'fame1' => (int) $_POST['fame1'], 'fame2' => (int) $_POST['fame2'], 'tv1' => (int) $_POST['tv1'] * 1000, 'tv2' => (int) $_POST['tv2'] * 1000)), 'Saving match report'); if (!empty($_POST['summary'])) { $m->saveText($_POST['summary']); # Save summery. } MTS('matches entry submitted'); // Update match's player data foreach (array(1 => $team1, 2 => $team2) as $id => $t) { /* Save ordinary players */ foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // We create zero entries for MNG player(s). This is required! $pid = $p->player_id; # Shortcut if ($p->getStatus($m->match_id) == MNG) { $_POST["mvp_{$pid}"] = 0; $_POST["cp_{$pid}"] = 0; $_POST["td_{$pid}"] = 0; $_POST["intcpt_{$pid}"] = 0; $_POST["bh_{$pid}"] = 0; $_POST["si_{$pid}"] = 0; $_POST["ki_{$pid}"] = 0; $_POST["ir1_d1_{$pid}"] = 0; $_POST["ir1_d2_{$pid}"] = 0; $_POST["ir2_d1_{$pid}"] = 0; $_POST["ir2_d2_{$pid}"] = 0; $_POST["ir3_d1_{$pid}"] = 0; $_POST["ir3_d2_{$pid}"] = 0; $_POST["inj_{$pid}"] = NONE; $_POST["agn1_{$pid}"] = NONE; $_POST["agn2_{$pid}"] = NONE; } $m->entry($p->player_id, array('mvp' => $_POST["mvp_{$pid}"], 'cp' => $_POST["cp_{$pid}"], 'td' => $_POST["td_{$pid}"], 'intcpt' => $_POST["intcpt_{$pid}"], 'bh' => $_POST["bh_{$pid}"], 'si' => $_POST["si_{$pid}"], 'ki' => $_POST["ki_{$pid}"], 'ir1_d1' => $_POST["ir1_d1_{$pid}"], 'ir1_d2' => $_POST["ir1_d2_{$pid}"], 'ir2_d1' => $_POST["ir2_d1_{$pid}"], 'ir2_d2' => $_POST["ir2_d2_{$pid}"], 'ir3_d1' => $_POST["ir3_d1_{$pid}"], 'ir3_d2' => $_POST["ir3_d2_{$pid}"], 'inj' => $_POST["inj_{$pid}"], 'agn1' => $_POST["agn1_{$pid}"], 'agn2' => $_POST["agn2_{$pid}"])); } MTS('Saved all REGULAR player entries in match_data for team ' . $id); /* Save stars entries. */ foreach ($stars as $star) { $s = new Star($star['id']); if (isset($_POST['team_' . $star['id']]) && $_POST['team_' . $star['id']] == $id) { $sid = $s->star_id; $m->entry($sid, array('f_team_id' => $t->team_id, 'mvp' => isset($_POST["mvp_{$sid}"]) && $_POST["mvp_{$sid}"] ? 1 : 0, 'cp' => $_POST["cp_{$sid}"], 'td' => $_POST["td_{$sid}"], 'intcpt' => $_POST["intcpt_{$sid}"], 'bh' => $_POST["bh_{$sid}"], 'si' => $_POST["si_{$sid}"], 'ki' => $_POST["ki_{$sid}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } else { $s->rmMatchEntry($m->match_id, $t->team_id); } } MTS('Saved all STAR player entries in match_data for team ' . $id); /* Save mercenary entries. */ Mercenary::rmMatchEntries($m->match_id, $t->team_id); // Remove all previously saved mercs in this match. for ($i = 0; $i <= 20; $i++) { # We don't expect over 20 mercs. This is just some large random number. $idm = '_' . ID_MERCS . '_' . $i; if (isset($_POST["team{$idm}"]) && $_POST["team{$idm}"] == $id) { $m->entry(ID_MERCS, array('f_team_id' => $t->team_id, 'nr' => $i, 'skills' => $_POST["skills{$idm}"], 'mvp' => isset($_POST["mvp{$idm}"]) && $_POST["mvp{$idm}"] ? 1 : 0, 'cp' => $_POST["cp{$idm}"], 'td' => $_POST["td{$idm}"], 'intcpt' => $_POST["intcpt{$idm}"], 'bh' => $_POST["bh{$idm}"], 'si' => $_POST["si{$idm}"], 'ki' => $_POST["ki{$idm}"], 'ir1_d1' => 0, 'ir1_d2' => 0, 'ir2_d1' => 0, 'ir2_d2' => 0, 'ir3_d1' => 0, 'ir3_d2' => 0, 'inj' => NONE, 'agn1' => NONE, 'agn2' => NONE)); } } MTS('Saved all MERC player entries in match_data for team ' . $id); } $m->finalizeMatchSubmit(); # Required! MTS('Report submit ENDED'); // Refresh objects used to display form. $m = new Match($match_id); $team1 = new Team($m->team1_id); $team2 = new Team($m->team2_id); } // Change round form submitted? if ($IS_LOCAL_ADMIN && isset($_POST['round'])) { status($m->chRound((int) $_POST['round'])); } /**************** * * Generate form * ****************/ $teamUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "\">" . $m->team1_name . "</a>"; $teamUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "\">" . $m->team2_name . "</a>"; $coachUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team1->owned_by_coach_id, false, false) . "\">" . $team1->f_cname . "</a>"; $coachUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team2->owned_by_coach_id, false, false) . "\">" . $team2->f_cname . "</a>"; $raceUrl1 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team1->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team1->f_rname))) . "</a>"; $raceUrl2 = "<a href=\"" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team2->f_race_id, false, false) . "\">" . $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team2->f_rname))) . "</a>"; $leagueUrl = League::getLeagueUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_LEAGUE)); $divUrl = "<a href=\"" . urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION)) . "\">" . get_parent_name(T_NODE_MATCH, $m->match_id, T_NODE_DIVISION) . "</a>"; $tourUrl = Tour::getTourUrl(get_parent_id(T_NODE_MATCH, $m->match_id, T_NODE_TOURNAMENT)); title($teamUrl1 . " - " . $teamUrl2); $CP = 8; // Colspan. ?> <table> <tr><td></td><td style='text-align: right;'><i><?php echo $lng->getTrn('common/home'); ?> </i></td><td>—</td><td style='text-align: left;'><i><?php echo $lng->getTrn('common/away'); ?> </i></td></tr> <tr><td><b><?php echo $lng->getTrn('common/teams'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$teamUrl1}</td><td> — </td><td style='text-align: left;'>{$teamUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/coaches'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$coachUrl1}</td><td> — </td><td style='text-align: left;'>{$coachUrl2}"; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/races'); ?> </b>:</td><td style='text-align: right;'><?php echo "{$raceUrl1}</td><td> — </td><td style='text-align: left;'>{$raceUrl2}"; ?> </td></tr> <tr><td colspan="4"><hr></td></tr> <tr><td><b><?php echo $lng->getTrn('common/league'); ?> </b>:</td><td colspan="3"> <?php echo $leagueUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/division'); ?> </b>:</td><td colspan="3"> <?php echo $divUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/tournament'); ?> </b>:</td><td colspan="3"><?php echo $tourUrl; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/round'); ?> </b>:</td><td colspan="3"> <?php echo $T_ROUNDS[$m->round]; ?> </td></tr> <tr><td><b><?php echo $lng->getTrn('common/dateplayed'); ?> </b>:</td><td colspan="3"><?php echo $m->is_played ? textdate($m->date_played) : '<i>' . $lng->getTrn('matches/report/notplayed') . '</i>'; ?> </td></tr> <?php if (Module::isRegistered('PDFMatchReport')) { $str = '<a href="handler.php?type=pdfmatchreport&tid1=' . $team1->team_id . '&tid2=' . $team2->team_id . '&mid=' . $m->match_id . '" TARGET="_blank">Download PDF report</a>'; echo "<tr><td><b>Match report</b>:</td><td>{$str}</td></tr>"; } if (Module::isRegistered('UPLOAD_BOTOCS')) { echo "<tr><td><b>Replay</b>:</td><td colspan='3'><a href='handler.php?type=leegmgr&replay={$m->match_id}'>View replay</a></td></tr>"; } if ($IS_LOCAL_ADMIN) { ?> <script language="JavaScript" type="text/javascript"> function match_delete() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/matchdelete'); ?> '); } function match_reset() { return confirm('<?php echo $lng->getTrn('matches/tourmatches/reset_notice'); ?> '); } </script> <?php $matchURL = "index.php?section=matches&type=report&mid={$m->match_id}"; $deleteURL = "index.php?section=matches&type=tourmatches&trid={$m->f_tour_id}&mid={$m->match_id}"; echo "<tr><td><b>Admin:</b></td><td colspan='3'><b>"; echo "<a onclick=\"return match_reset();\" href='{$matchURL}&action=reset'>" . $lng->getTrn('common/reset') . "</a> \n"; echo "<a onclick=\"return match_delete();\" href='{$deleteURL}&action=delete' style='color:" . (!empty($m->date_played) ? 'Red' : 'Blue') . ";'>" . $lng->getTrn('common/delete') . "</a> \n"; echo "<a href='{$matchURL}&action=" . ($m->locked ? 'unlock' : 'lock') . "'>" . ($m->locked ? $lng->getTrn('common/unlock') : $lng->getTrn('common/lock')) . "</a> \n"; echo "<br><a href='javascript:void(0);' onClick='slideToggleFast(\"chRound\");'>" . $lng->getTrn('matches/report/chround') . "</a><div id='chRound' style='display:none;'>\n\t\t<form method='POST'>\n\t\t<select name='round'>"; foreach ($T_ROUNDS as $id => $desc) { echo "<option value='{$id}'>" . $desc . "</option>\n"; } echo "</select>\n\t\t<input type='submit' value='" . $lng->getTrn('matches/report/chround') . "'>\n\t\t</form>\n\t\t</div>"; echo "</b></td></tr>"; } ?> </table> <br> <?php echo "<b><a TARGET='_blank' href='" . DOC_URL_GUIDE . "'>" . $lng->getTrn('common/needhelp') . "</a></b><br><br>"; ?> <form method="POST" enctype="multipart/form-data"> <table class="common"> <tr class='commonhead'><td colspan="<?php echo $CP; ?> "><b><?php echo $lng->getTrn('matches/report/info'); ?> </b></td></tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/stadium'); ?> </b> <select name="stadium" <?php echo $DIS; ?> > <?php $stad = $m->stadium ? $m->stadium : $m->team1_id; foreach (array($team1, $team2) as $_t) { echo "<option value='{$_t->team_id}'" . ($stad == $_t->team_id ? 'SELECTED' : '') . ">{$_t->name}</option>\n"; } ?> </select> </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('common/gate'); ?> </b> <input type="text" name="gate" onChange='numError(this);' value="<?php echo $m->gate ? $m->gate / 1000 : 0; ?> " size="4" maxlength="4" <?php echo $DIS; ?> >k </td></tr> <tr><td colspan='<?php echo $CP; ?> '> <b><?php echo $lng->getTrn('matches/report/fans'); ?> </b> <input type="text" name="fans" onChange='numError(this);' value="<?php echo $m->fans; ?> " size="7" maxlength="12" <?php echo $DIS; ?> > </td></tr> <?php if (!$settings['hide_ES_extensions']) { ?> <tr><td colspan='<?php echo $CP; ?> '> <b>E</b>xtra player <b>S</b>tats (ES) <a href="index.php?section=matches&type=report&mid=<?php echo $m->match_id; ?> &es_report=1">report page here</a> </td></tr> <?php } ?> <tr><td class="seperator" colspan='<?php echo $CP; ?> '></td></tr> <tr class='commonhead'> <td><b><?php echo $lng->getTrn('common/teams'); ?> </b></td> <td><b><?php echo $lng->getTrn('common/score'); ?> </b></td> <td><b>Δ <?php echo $lng->getTrn('matches/report/treas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/ff'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/smp'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tcas'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/fame'); ?> </b></td> <td><b><?php echo $lng->getTrn('matches/report/tv'); ?> </b></td> </tr> <tr><td class='seperator' colspan='<?php echo $CP; ?> '></td></tr> <?php foreach (array(1, 2) as $N) { echo "<tr>\n"; echo "<td>" . ${"teamUrl{$N}"} . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='result{$N}' value='" . (int) $m->{"team{$N}_score"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numErrorAllowNegative(this);' name='inc{$N}' value='" . (int) $m->{"income{$N}"} / 1000 . "' size='4' maxlength='4' {$DIS}>k</td>\n"; echo "<td>"; foreach (array('1' => 'green', '0' => 'blue', '-1' => 'red') as $Nff => $color) { echo "<input {$DIS} type='radio' name='ff{$N}' value='{$Nff}' " . ($m->{"ffactor{$N}"} == (int) $Nff ? 'CHECKED' : '') . "><font color='{$color}'><b>{$Nff}</b></font>"; } echo "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='smp{$N}' value='" . $m->{"smp{$N}"} . "' size='1' maxlength='2' {$DIS}>" . $lng->getTrn('matches/report/pts') . "</td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tcas{$N}' value='" . $m->{"tcas{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='fame{$N}' value='" . $m->{"fame{$N}"} . "' size='1' maxlength='2' {$DIS}></td>\n"; echo "<td><input type='text' onChange='numError(this);' name='tv{$N}' value='" . ($m->is_played ? $m->{"tv{$N}"} / 1000 : ${"team{$N}"}->value / 1000) . "' size='4' maxlength='10' {$DIS}>k</td>\n"; echo "</tr>\n"; } ?> </table> <?php $playerFields = array_merge($T_MOUT_REL, $T_MOUT_ACH, $T_MOUT_IR, $T_MOUT_INJ); $CPP = count($playerFields); foreach (array(1 => $team1, 2 => $team2) as $id => $t) { ?> <table class='common'> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <tr class='commonhead'><td colspan='<?php echo $CPP; ?> '> <b><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t->team_id, false, false); ?> "><?php echo $t->name; ?> </a> <?php echo $lng->getTrn('matches/report/report'); ?> </b> </td></tr> <tr><td class='seperator' colspan='<?php echo $CPP; ?> '></td></tr> <?php echo "<tr>\n"; foreach (array_values($playerFields) as $f) { // We need to translate table headers switch (strtolower(str_replace(' ', '', $f))) { case 'name': $header_text = $lng->getTrn('common/name'); break; case 'mvp': $header_text = $lng->getTrn('matches/report/mvp'); break; case 'cp': $header_text = $lng->getTrn('matches/report/cp'); break; case 'bh': $header_text = $lng->getTrn('matches/report/bh'); break; case 'si': $header_text = $lng->getTrn('matches/report/si'); break; case 'ki': $header_text = $lng->getTrn('matches/report/ki'); break; case 'ir1d1': $header_text = $lng->getTrn('matches/report/ir1') . " D1"; break; case 'ir1d2': $header_text = $lng->getTrn('matches/report/ir1') . " D2"; break; case 'ir2d1': $header_text = $lng->getTrn('matches/report/ir2') . " D1"; break; case 'ir2d2': $header_text = $lng->getTrn('matches/report/ir2') . " D2"; break; case 'ir3d1': $header_text = $lng->getTrn('matches/report/ir3') . " D1"; break; case 'ir3d2': $header_text = $lng->getTrn('matches/report/ir3') . " D2"; break; case 'inj': $header_text = $lng->getTrn('matches/report/inj'); break; case 'ageing1': $header_text = $lng->getTrn('matches/report/ageing1'); break; case 'ageing2': $header_text = $lng->getTrn('matches/report/ageing2'); break; default: $header_text = $f; } echo "<td><i>{$header_text}</i></td>\n"; } echo "</tr>\n"; $NORMSTAT = true; // only normal player statuses foreach ($t->getPlayers() as $p) { if (!self::player_validation($p, $m)) { continue; } // Fetch player data from match $status = $p->getStatus($m->match_id); $mdat = $m->getPlayerEntry($p->player_id); // Print player row if ($p->is_journeyman_used && !$m->is_played) { $bgcolor = COLOR_HTML_JOURNEY_USED; $NORMSTAT = false; } elseif ($p->is_journeyman) { $bgcolor = COLOR_HTML_JOURNEY; $NORMSTAT = false; } elseif ($status == MNG) { $bgcolor = COLOR_HTML_MNG; $NORMSTAT = false; } elseif ($p->mayHaveNewSkill()) { $bgcolor = COLOR_HTML_NEWSKILL; $NORMSTAT = false; } else { $bgcolor = false; } self::_print_player_row($p->player_id, '<a href="index.php?section=objhandler&type=1&obj=1&obj_id=' . $p->player_id . '">' . $p->name . '</a>', $p->nr, $lng->getTrn('position/' . strtolower($lng->FilterPosition($p->position))) . ($status == MNG ? ' [MNG]' : ''), $bgcolor, $mdat, $DIS || $status == MNG); } echo "</table>\n"; echo "<br>\n"; if (!$NORMSTAT) { ?> <table class="text"><tr><td style="width: 100%;"></td><?php if (1) { ?> <td style="background-color: <?php echo COLOR_HTML_MNG; ?> ;"><font color='black'><b> MNG </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY; ?> ;"><font color='black'><b> Journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_JOURNEY_USED; ?> ;"><font color='black'><b> Used journeyman </b></font></td> <td style="background-color: <?php echo COLOR_HTML_NEWSKILL; ?> ;"><font color='black'><b> New skill available </b></font></td> <?php } ?> </tr></table><?php } // Add raised zombies global $racesHasNecromancer; if (in_array($t->f_race_id, $racesHasNecromancer)) { echo "<hr style='width:200px;float:left;'><br>\n <b>Raised zombie?:</b> <input type='checkbox' name='t{$id}zombie' value='1' onclick='slideToggleFast(\"t{$id}zombie\");'><br>\n"; echo "<div id='t{$id}zombie' style='display:none;'>\n"; echo "<table class='common'>\n"; self::_print_player_row("t{$id}zombie", 'Raised zombie', '—', 'Zombie', false, array(), $DIS); echo "</table>\n"; echo "</div>\n"; } // Add raised rotters global $racesMayRaiseRotters; if (in_array($t->f_race_id, $racesMayRaiseRotters)) { $maxRotters = 6; # Note there is no real limit for raised rotters. echo "<hr style='width:200px;float:left;'><br>\n <b>Raised rotters?:</b>\n <select name='t{$id}rotterCnt' onChange='var i = this.options[this.selectedIndex].value; var j=1; for (j=1; j<={$maxRotters}; j++) {if (j<=i) {slideDownFast(\"t{$id}rotter\"+j);} else {slideUpFast(\"t{$id}rotter\"+j);}}' >"; foreach (range(0, $maxRotters) as $n) { echo "<option value='{$n}'>{$n}</option>"; } echo "</select>\n"; foreach (range(0, $maxRotters) as $n) { echo "<div id='t{$id}rotter{$n}' style='display:none;'><table class='common'>\n"; self::_print_player_row("t{$id}rotter{$n}", "Raised Rotter #{$n}", '—', 'Rotter', false, array(), $DIS); echo "</table></div>\n"; } } ?> <table style='border-spacing: 0px 10px;'> <tr><td align="left" valign="top"> <b>Star Players</b>: <input type='button' id="addStarsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="stars = document.getElementById('stars_<?php echo $id; ?> '); addStarMerc(<?php echo $id; ?> , stars.options[stars.selectedIndex].value);" <?php echo $DIS; ?> > <select id="stars_<?php echo $id; ?> " <?php echo $DIS; ?> > <?php foreach ($stars as $s => $d) { echo "<option " . (in_array($t->f_race_id, $d['races']) ? 'style="background-color: ' . COLOR_HTML_READY . ';"' : '') . " value='{$d['id']}'>{$s}</option>\n"; } ?> </select> </td></tr> <tr><td align="left" valign="top"> <b>Mercenaries</b>: <input type='button' id="addMercsBtn_<?php echo $id; ?> " value="<?php echo $lng->getTrn('common/add'); ?> " onClick="addStarMerc(<?php echo "{$id}, " . ID_MERCS; ?> );" <?php echo $DIS; ?> > </td></tr> </table> <table class='common' id='<?php echo "starsmercs_{$id}"; ?> '> </table> <?php } ?> <table class='common'> <tr><td class='seperator' colspan='13'></td></tr> <tr class='commonhead'><td colspan='13'><b><?php echo $lng->getTrn('matches/report/summary'); ?> </b></td></tr> <tr><td colspan='13'><textarea name='summary' rows='10' cols='100' <?php echo $DIS . ">" . $m->getText(); ?> </textarea></td></tr> </table> <br> <center> <input type="submit" name='button' value="<?php echo $lng->getTrn('common/save'); ?> " <?php echo $DIS; ?> > <?php if ($USED_JOURNEYMAN_PRESENT) { echo "<br><br><b>" . $lng->getTrn('matches/report/usedjourney') . "</b>"; } ?> </center> </form> <br><br> <?php /* Now, we call javascript routine(s) to fill out stars and mercs rows, if such entries exist in database. */ $i = 0; // Counter. Used to pass PHP-data to Javascript. foreach (array(1 => $team1->team_id, 2 => $team2->team_id) as $id => $t) { foreach (Star::getStars(STATS_TEAM, $t, STATS_MATCH, $m->match_id) as $s) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; $mdat = $s->getStats(T_NODE_MATCH, $m->match_id); foreach (array_keys($T_MOUT_ACH) as $f) { echo "mdat{$i}['{$f}'] = " . $mdat[$f] . ";\n"; } echo "existingStarMerc({$id}, {$s->star_id}, mdat{$i});\n"; echo "</script>\n"; $i++; } foreach (Mercenary::getMercsHiredByTeam($t, $m->match_id) as $merc) { echo "<script language='JavaScript' type='text/javascript'>\n"; echo "var mdat{$i} = [];\n"; foreach (array_merge(array_keys($T_MOUT_ACH), array('skills')) as $f) { echo "mdat{$i}['{$f}'] = " . $merc->{$f} . ";\n"; } echo "existingStarMerc({$id}, " . ID_MERCS . ", mdat{$i});\n"; echo "</script>\n"; $i++; } } }
public static function showTables() { global $lng, $tours; title($lng->getTrn('name', 'LeagueTables')); // Selector for the tournament $tour_id = 0; if (isset($_POST['tour_id'])) { $tour_id = $_POST['tour_id']; } else { if (isset($_GET['tour_id'])) { $tour_id = $_GET['tour_id']; } } $firstTour = 0; ?> <div class='boxWide'> <h3 class='boxTitle2'><?php echo $lng->getTrn('tours', 'LeagueTables'); ?> </h3> <div class='boxBody'> <form method="POST"> <select name="tour_id"> <?php $rTours = array_reverse($tours, true); foreach ($rTours as $trid => $desc) { if ($firstTour == 0) { $firstTour = $trid; } echo "<option value='{$trid}'" . ($trid == $tour_id ? 'SELECTED' : '') . " >{$desc['tname']}</option>\n"; } /*Replace the prior foreach with this once lid is known. foreach ($rTours as $trif => $desc) { if($firstTour == 0 && $lid == $_SESSION["NS_node_id"]) { $firstTour = $trid; } if($lid == $_SESSION["NS_node_id"]) { echo "<option value='$trid'" . ($trid==$tour_id ? 'SELECTED' : '') . " >$desc[tname]</option>\n"; } } */ ?> </select> <input type="submit" value="OK"> </form> </div> </div> <?php if ($tour_id == 0) { $tour_id = $firstTour; } // create the tournament and get the sorting rules $tour = new Tour($tour_id); $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule()); // load all the teams according to the sorting rule list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array(T_NODE_TOURNAMENT => $tour_id), array(1, 1000), $SR, false); // Dump all the raw info for the first team as debug so I can work out the fields /* echo "<!--\n"; foreach (array_keys($teams[0]) as $field) { echo $field. "=" . $teams[0][$field] . "\n"; } echo "-->\n"; */ // Hard coded list of fields to show - matching existing SLOBB/ECBBL league tables $fields = array($lng->getTrn('table-coach', 'LeagueTables') => 'f_cname', $lng->getTrn('table-name', 'LeagueTables') => 'name', $lng->getTrn('table-race', 'LeagueTables') => 'f_rname', $lng->getTrn('table-tv', 'LeagueTables') => 'tv', $lng->getTrn('table-played', 'LeagueTables') => 'mv_played', $lng->getTrn('table-won', 'LeagueTables') => 'mv_won', $lng->getTrn('table-draw', 'LeagueTables') => 'mv_draw', $lng->getTrn('table-loss', 'LeagueTables') => 'mv_lost', $lng->getTrn('table-td', 'LeagueTables') => 'mv_sdiff', $lng->getTrn('table-cas', 'LeagueTables') => 'mv_tcdiff', $lng->getTrn('table-points', 'LeagueTables') => 'mv_pts'); $unplayedTeams = self::getUnplayedTeamsForTournament($tour_id); $confs = 0; if (Module::isRegistered('Conference')) { $confs = Conference::getConferencesForTour($tour_id); } // Now the clean output. ?> <div class='boxWide'> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $tour->name; ?> </h3> <?php if ($confs == 0 || empty($confs)) { // no conferences at all, or not for this league - normal format echo <<<EOQ \t\t<div class='boxBody'> \t\t\t<table class="boxTable"> EOQ; $i = 0; self::showHeader($fields); self::showPlayedTeams($teams, $fields, $i); self::showUnplayedTeams($unplayedTeams, $i); echo <<<EOQ \t\t\t</table> \t\t</div> EOQ; } else { // conferences - so show them one at a time $allConfIds = array(); foreach ($confs as $conf) { $allConfIds = array_merge($allConfIds, $conf->teamIds); echo <<<EOQ \t\t<div class='boxWide'> \t\t\t<h4 class='boxTitleConf'>{$conf->name}</h4> \t\t\t\t<table class="boxTable"> EOQ; $i = 0; self::showHeader($fields); self::showPlayedTeams($teams, $fields, $i, $conf->teamIds); self::showMissingConferenceTeams($teams, $i, $conf); echo <<<EOQ \t\t\t\t</table> \t\t</div> EOQ; } // now check to see if we have teams that aren't in a conference and show them $allConfIds = array_unique($allConfIds); if (sizeof($allConfIds) < sizeof($teams) + sizeof($unplayedTeams)) { $title = $lng->getTrn('no-conf', 'LeagueTables'); echo <<<EOQ \t\t<div class='boxWide'> \t\t\t<h4 class='boxTitleConf'>{$title}</h4> \t\t\t<table class="boxTable"> EOQ; $noConfTeam = array(); $noConfUPTeam = array(); foreach ($teams as $t) { if (!in_array($t['team_id'], $allConfIds)) { array_push($noConfTeam, $t); } } foreach ($unplayedTeams as $t) { if (!in_array($t->team_id, $allConfIds)) { array_push($noConfUPTeam, $t); } } $i = 0; self::showHeader($fields); self::showPlayedTeams($noConfTeam, $fields, $i); self::showUnplayedTeams($noConfUPTeam, $i); echo <<<EOQ \t\t\t</table> \t\t</div> EOQ; } } echo "</div>"; }
private static function make_menu() { global $lng, $coach, $settings, $rules, $admin_menu; ?> <ul class="css3menu1 topmenu"> <li class="topfirst"><a href="index.php?section=main"><?php echo $lng->getTrn('menu/home'); ?> </a> <ul> <?php if (Settings::getValueOrDefault('show-regional-menu', false)) { foreach (League::getLeaguesByLocation() as $locationName => $leagues) { echo '<li><a href="#">' . $locationName . ' ></a><ul>'; foreach ($leagues as $league) { echo '<li><a href="index.php?SLS_lid=' . $league->lid . '">' . $league->name . '</a></li>'; } echo '</ul></li>'; } if (isset($_SESSION['logged_in'])) { echo '<li><a href="index.php?section=requestleague">Request a League</a></li>'; } echo '<li><a href="http://www.thenaf.net/leagues/leagues-locator/" >TheNAF.net League Locator</a></li>'; echo '<li><a href="index.php?SLS_lid=1" >League Hosting Home</a></li>'; } ?> <li><a href="index.php?section=about">About OBBLM</a></li> </ul> </li> <?php if (isset($_SESSION['logged_in'])) { ?> <li class="topfirst"><a href="#">User Menu</a> <ul> <li class="subfirst"><a href="handler.php?type=teamcreator">Create a New Team</a></li> <li><a href="index.php?section=matches&type=usersched" >Schedule Match</a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=teams'; ?> "><?php echo $lng->getTrn('cc/coach_teams'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=profile'; ?> "><?php echo $lng->getTrn('cc/profile'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=stats'; ?> "><?php echo $lng->getTrn('common/stats'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=recentmatches'; ?> "><?php echo $lng->getTrn('common/recentmatches'); ?> </a></li> <li><a rel="nofollow"href="index.php?logout=1"><?php echo $lng->getTrn('menu/logout'); ?> </a></li> </ul><?php } else { ?> <li class="topfirst"><a rel="nofollow" href="index.php?section=login" style="height:20px;line-height:20px;"><?php echo $lng->getTrn('menu/login'); ?> </a></li><?php } ?> <?php if (!empty($admin_menu)) { ?> <li class="topmenu"> <a href="#"><?php echo $lng->getTrn('menu/admin_menu/name'); ?> </a> <ul> <li class="subfirst"> <a href="handler.php?type=leaguepref"><?php echo $lng->getTrn('name', 'LeaguePref'); ?> </a> </li> <?php if (Module::isRegistered('Conference')) { echo '<li><a href="handler.php?type=conference">' . $lng->getTrn('name', 'Conference') . '</a></li>'; } if (Module::isRegistered('Scheduler')) { echo '<li><a href="handler.php?type=scheduler">' . $lng->getTrn('menu/admin_menu/schedule') . '</a></li>'; } foreach ($admin_menu as $lnk => $desc) { if (!is_array($desc)) { echo "<li><a href='index.php?section=admin&subsec={$lnk}'>{$desc}</a></li>\n"; } else { echo '<li><a href="#">' . $desc['title'] . '<ul>'; foreach ($desc['sub'] as $sub) { echo "<li><a href='index.php?section=admin&subsec={$lnk}&{$sub['href']}'>{$sub['title']}</a></li>\n"; } echo '</ul></li>'; } } ?> </ul> </li> <?php } ?> <li class="topmenu"> <a href="#">League Menu</a> <ul> <li class="subfirst"><a href="index.php?section=rules"><?php echo $lng->getTrn('menu/rules'); ?> </a></li> <li><a href="handler.php?type=leaguetables"><?php echo $lng->getTrn('name', 'LeagueTables'); ?> </a></li> <li><a href="index.php?section=teamlist"><?php echo $lng->getTrn('menu/teams'); ?> </a></li> <li><a href="index.php?section=coachlist"><?php echo $lng->getTrn('menu/coaches'); ?> </a></li> <li><a href="index.php?section=matches&type=recent"><?php echo $lng->getTrn('menu/matches_menu/recent'); ?> </a></li> <li><a href="index.php?section=matches&type=upcoming"><?php echo $lng->getTrn('menu/matches_menu/upcoming'); ?> </a> <?php if (!empty($settings['league_url'])) { $leagueUrl = $settings['league_url']; $leagueUrl = !strpos($leagueUrl, 'http') ? 'http://' . $leagueUrl : $leagueUrl; ?> <li><a href="<?php echo $leagueUrl; ?> "><?php echo $settings['league_url_name']; ?> </a></li><?php } ?> </ul> </li> <li class="topmenu"><a rel="nofollow" href="index.php?section=rules">League History</a> <ul> <?php if (Module::isRegistered('Gallery')) { ?> <li><a href="handler.php?type=gallery"><?php echo $lng->getTrn('name', 'Gallery'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Wanted')) { ?> <li><a href="handler.php?type=wanted"><?php echo $lng->getTrn('name', 'Wanted'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Prize')) { ?> <li><a href="handler.php?type=prize"><?php echo $lng->getTrn('name', 'Prize'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('HOF')) { ?> <li><a href="handler.php?type=hof"><?php echo $lng->getTrn('name', 'HOF'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('FamousTeams')) { ?> <li><a href="handler.php?type=famousteams"><?php echo $lng->getTrn('name', 'FamousTeams'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Memmatches')) { ?> <li><a href="handler.php?type=memmatches"><?php echo $lng->getTrn('name', 'Memmatches'); ?> </a></li><?php } ?> <li><a href="index.php?section=matches&type=tours"><?php echo $lng->getTrn('menu/matches_menu/tours'); ?> </a></li> </ul> </li> <li class="topmenu"><a rel="nofollow" href="#">Statistics</a> <ul> <li class="subfirst"><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/team_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_PLAYER, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/player_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_COACH, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/coach_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_RACE, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/race_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_STAR, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/star_stn'); ?> </a></li> </ul> </li> <li class="topmenu"><a rel="nofollow" href="#">Game Rules</a> <ul> <li class="subfirst"><a rel="nofollow" href="#">CRP Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=0" style="height:10px;line-height:10px;">Amazon</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=1" style="height:10px;line-height:10px;">Chaos</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=2" style="height:10px;line-height:10px;">Chaos Dwarf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=3" style="height:10px;line-height:10px;">Dark Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=4" style="height:10px;line-height:10px;">Dwarf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=5" style="height:10px;line-height:10px;">Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=6" style="height:10px;line-height:10px;">Goblin</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=7" style="height:10px;line-height:10px;">Halfling</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=8" style="height:10px;line-height:10px;">High Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=9" style="height:10px;line-height:10px;">Human</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=10" style="height:10px;line-height:10px;">Khemri</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=11" style="height:10px;line-height:10px;">Lizardman</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=13" style="height:10px;line-height:10px;">Necromantic</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=14" style="height:10px;line-height:10px;">Norse</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=15" style="height:10px;line-height:10px;">Nurgle</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=16" style="height:10px;line-height:10px;">Ogre</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=12" style="height:10px;line-height:10px;">Orc</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=19" style="height:10px;line-height:10px;">Skaven</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=17" style="height:10px;line-height:10px;">Undead</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=18" style="height:10px;line-height:10px;">Vampire</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=20" style="height:10px;line-height:10px;">Wood Elf</a></li> </ul></li> <li class="subfirst"><a rel="nofollow" href="#">LRB6 Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=21" style="height:10px;line-height:10px;">Chaos Pact</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=22" style="height:10px;line-height:10px;">Slann</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=23" style="height:10px;line-height:10px;">Underworld</a></li> </ul></li> <li class="subfirst"><a rel="nofollow" href="#">(Optional) Community Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=24" style="height:10px;line-height:10px;">Bretonnian</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=25" style="height:10px;line-height:10px;">Khorne</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=26" style="height:10px;line-height:10px;">Simyin</a></li> </ul></li> <li><a href="http://www.thenaf.net/wp-content/uploads/2013/06/CRP1.pdf">The CRP (Full Blood Bowl Rules)</a></li> <li><a href="http://the-outcast.com/bloodbowl/blood%20bowl%20crp%20lite.pdf">A5 Rules Summary</a></li> </ul> </li> <?php if (Module::isRegistered('Search')) { ?> <li><a href="handler.php?type=search"><?php echo $lng->getTrn('name', 'Search'); ?> </a></li><?php } ?> <?php }
function sec_main() { global $settings, $rules, $coach, $lng, $leagues; MTS('Main start'); list($sel_lid, $HTML_LeagueSelector) = HTMLOUT::simpleLeagueSelector(); $IS_GLOBAL_ADMIN = is_object($coach) && $coach->ring == Coach::T_RING_GLOBAL_ADMIN; /* * Was any main board actions made? */ if (isset($_POST['type']) && is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) { if (get_magic_quotes_gpc()) { if (isset($_POST['title'])) { $_POST['title'] = stripslashes($_POST['title']); } if (isset($_POST['txt'])) { $_POST['txt'] = stripslashes($_POST['txt']); } } $msg = isset($_POST['msg_id']) ? new Message((int) $_POST['msg_id']) : null; switch ($_POST['type']) { case 'msgdel': status($msg->delete()); break; case 'msgnew': status(Message::create(array('f_coach_id' => $coach->coach_id, 'f_lid' => $IS_GLOBAL_ADMIN && isset($_POST['BC']) && $_POST['BC'] ? Message::T_BROADCAST : $sel_lid, 'title' => $_POST['title'], 'msg' => $_POST['txt']))); break; case 'msgedit': status($msg->edit($_POST['title'], $_POST['txt'])); break; case 'pin': status($msg->pin(1)); break; case 'unpin': status($msg->pin(0)); break; } } /* * Now we are ready to generate the HTML code. */ ?> <div class="main_head"><?php echo $settings['league_name']; ?> </div> <div class='main_leftColumn'> <div class="main_leftColumn_head"> <?php echo "<div class='main_leftColumn_welcome'>\n"; echo $settings['welcome']; echo "</div>\n"; echo "<div class='main_leftColumn_left'>\n"; if (count($leagues) > 1) { echo $HTML_LeagueSelector; } echo "</div>\n"; echo "<div class='main_leftColumn_right'>\n"; if (is_object($coach) && $coach->isNodeCommish(T_NODE_LEAGUE, $sel_lid)) { echo "<a href='javascript:void(0);' onClick=\"slideToggle('msgnew');\">" . $lng->getTrn('main/newmsg') . "</a> \n"; } if (Module::isRegistered('RSSfeed')) { echo "<a href='handler.php?type=rss'>RSS</a>\n"; } echo "</div>\n"; ?> <div style="display:none; clear:both;" id="msgnew"> <br><br> <form method="POST"> <textarea name="title" rows="1" cols="50"><?php echo $lng->getTrn('common/notitle'); ?> </textarea><br><br> <textarea name="txt" rows="15" cols="50"><?php echo $lng->getTrn('common/nobody'); ?> </textarea><br><br> <?php if ($IS_GLOBAL_ADMIN) { echo $lng->getTrn('main/broadcast'); ?> <input type="checkbox" name="BC"><br><br><?php } ?> <input type="hidden" name="type" value="msgnew"> <input type="submit" value="<?php echo $lng->getTrn('common/submit'); ?> "> </form> </div> </div> <?php /* Generate main board. Left column is the message board, consisting of both commissioner messages and game summaries/results. To generate this table we create a general array holding the content of both. */ $j = 1; $prevPinned = 0; foreach (TextSubSys::getMainBoardMessages($settings['fp_messageboard']['length'], $sel_lid, $settings['fp_messageboard']['show_team_news'], $settings['fp_messageboard']['show_match_summaries']) as $e) { if ($prevPinned == 1 && !$e->pinned) { echo "<hr>\n"; } $prevPinned = $e->pinned; echo "<div class='boxWide'>\n"; echo "<h3 class='boxTitle{$e->cssidx}'>{$e->title}</h3>\n"; echo "<div class='boxBody'>\n"; $fmtMsg = fmtprint($e->message); # Basic supported syntax: linebreaks. echo "\r\n <div id='e{$j}' class='expandable'>{$fmtMsg}</div>\r\n <script type='text/javascript'>\r\n \$('#e{$j}').expander({\r\n slicePoint: 300,\r\n expandText: '" . $lng->getTrn('main/more') . "',\r\n collapseTimer: 0,\r\n userCollapseText: ''\r\n });\r\n </script>"; echo "<br><hr>\n"; echo "<table class='boxTable'><tr>\n"; switch ($e->type) { case T_TEXT_MATCH_SUMMARY: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . (isset($e->date_mod) && $e->date_mod != $e->date ? "(" . $lng->getTrn('main/lastedit') . " " . textdate($e->date_mod) . ") " : '') . $lng->getTrn('main/by') . " {$e->author}</td>\n"; echo "<td align='right'><a href='index.php?section=matches&type=report&mid={$e->match_id}'>" . $lng->getTrn('common/view') . "</a></td>\n"; break; case T_TEXT_MSG: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . " " . $lng->getTrn('main/by') . " {$e->author}</td>\n"; if (is_object($coach) && ($IS_GLOBAL_ADMIN || $coach->coach_id == $e->author_id)) { // Only admins may delete messages, or if it's a commissioner's own message. echo "<td align='right'><a href='javascript:void(0);' onClick=\"slideToggle('msgedit{$e->msg_id}');\">" . $lng->getTrn('common/edit') . "</a></td>\n"; echo "<td align='right'>"; $fieldname = 'pin'; if ($e->pinned) { $fieldname = 'unpin'; } echo inlineform(array('type' => "{$fieldname}", 'msg_id' => $e->msg_id), "{$fieldname}{$e->msg_id}", $lng->getTrn("main/{$fieldname}")); echo "</td>"; echo "<td align='right'>"; echo inlineform(array('type' => 'msgdel', 'msg_id' => $e->msg_id), "msgdel{$e->msg_id}", $lng->getTrn('common/delete')); echo "</td>"; } break; case T_TEXT_TNEWS: echo "<td align='left' width='100%'>" . $lng->getTrn('main/posted') . " " . textdate($e->date) . "</td>\n"; break; } ?> </tr></table> <?php if ($e->type == T_TEXT_MSG) { echo "<div style='display:none;' id='msgedit{$e->msg_id}'>\n"; echo "<hr><br>\n"; echo '<form method="POST"> <textarea name="title" rows="1" cols="50">' . $e->title . '</textarea><br><br> <textarea name="txt" rows="15" cols="50">' . $e->message . '</textarea><br><br> <input type="hidden" name="type" value="msgedit"> <input type="hidden" name="msg_id" value="' . $e->msg_id . '"> <input type="submit" value="' . $lng->getTrn('common/submit') . '"> </form>'; echo "</div>"; } ?> </div> </div> <?php $j++; } ?> </div> <?php MTS('Board messages generated'); /* The right hand side column optionally (depending on settings) contains standings, latest game results, touchdown and casualties stats. We will now generate the stats, so that they are ready to be printed in correct order. */ echo "<div class='main_rightColumn'>\n"; $boxes_all = array_merge($settings['fp_standings'], $settings['fp_leaders'], $settings['fp_events'], $settings['fp_latestgames']); usort($boxes_all, create_function('$a,$b', 'return (($a["box_ID"] > $b["box_ID"]) ? 1 : (($a["box_ID"] < $b["box_ID"]) ? -1 : 0) );')); $boxes = array(); foreach ($boxes_all as $box) { # These fields distinguishes the box types. if (isset($box['fields'])) { $box['dispType'] = 'standings'; } else { if (isset($box['field'])) { $box['dispType'] = 'leaders'; } else { if (isset($box['content'])) { $box['dispType'] = 'events'; } else { $box['dispType'] = 'latestgames'; } } } switch ($box['type']) { case 'league': $_type = T_NODE_LEAGUE; break; case 'division': $_type = T_NODE_DIVISION; break; case 'tournament': $_type = T_NODE_TOURNAMENT; break; default: $_type = T_NODE_LEAGUE; } $box['type'] = $_type; $boxes[] = $box; } // Used in the below standings dispType boxes. global $core_tables, $ES_fields; $_MV_COLS = array_merge(array_keys($core_tables['mv_teams']), array_keys($ES_fields)); $_MV_RG_INTERSECT = array_intersect(array_keys($core_tables['teams']), array_keys($core_tables['mv_teams'])); // Let's print those boxes! foreach ($boxes as $box) { switch ($box['dispType']) { case 'standings': $_BAD_COLS = array(); # Halt on these columns/fields. switch ($box['type']) { case T_NODE_TOURNAMENT: if (!get_alt_col('tours', 'tour_id', $box['id'], 'tour_id')) { break 2; } $tour = new Tour($box['id']); $SR = array_map(create_function('$val', 'return $val[0]."mv_".substr($val,1);'), $tour->getRSSortRule()); break; case T_NODE_DIVISION: $_BAD_COLS = array('elo', 'swon', 'slost', 'sdraw', 'win_pct'); # Divisions do not have pre-calculated, MV, values of these fields. // Fall through! # Divisions do not have pre-calculated, MV, values of these fields. // Fall through! case T_NODE_LEAGUE: default: global $hrs; $SR = $hrs[$box['HRS']]['rule']; foreach ($SR as &$f) { $field = substr($f, 1); if (in_array($field, $_MV_RG_INTERSECT)) { if (in_array($field, $_BAD_COLS)) { # E.g. divisions have no win_pct record for teams like the mv_teams table (for tours) has. fatal("Sorry, the element '{$field}' in your specified house sortrule #{$box['HRS']} is not supported for your chosen type (ie. tournament/division/league)."); } $f = $f[0] . "rg_" . substr($f, 1); } else { $f = $f[0] . "mv_" . substr($f, 1); } } break; } list($teams, ) = Stats::getRaw(T_OBJ_TEAM, array($box['type'] => $box['id']), array(1, $box['length']), $SR, false); ?> <div class='boxWide'> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php echo "<tr>\n"; foreach ($box['fields'] as $title => $f) { echo "<td><i>{$title}</i></td>\n"; } echo "</tr>\n"; foreach ($teams as $t) { if (!$t['retired']) { echo "<tr>\n"; foreach ($box['fields'] as $title => $f) { if (in_array($f, $_MV_COLS)) { $f = 'mv_' . $f; } echo "<td>"; if ($settings['fp_links'] && $f == 'name') { echo "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $t['team_id'], false, false) . "'>{$t['name']}</a>"; } elseif (is_numeric($t[$f]) && !ctype_digit($t[$f][0] == '-' ? substr($t[$f], 1) : $t[$f])) { echo sprintf('%1.2f', $t[$f]); } else { echo in_array($f, array('tv')) ? $t[$f] / 1000 : $t[$f]; } echo "</td>\n"; } echo "</tr>\n"; } } ?> </table> <?php if (isset($box['infocus']) && $box['infocus']) { echo "<hr>"; _infocus($teams); } ?> </div> </div> <?php MTS('Standings table generated'); break; case 'latestgames': if ($box['length'] <= 0) { break; } ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_MATCH; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <tr> <td style="text-align: right;" width="50%"><i><?php echo $lng->getTrn('common/home'); ?> </i></td> <td> </td> <td style="text-align: left;" width="50%"><i><?php echo $lng->getTrn('common/away'); ?> </i></td> <td><i><?php echo $lng->getTrn('common/date'); ?> </i></td> <td> </td> </tr> <?php list($matches, $pages) = Match::getMatches(array(1, $box['length']), $box['type'], $box['id'], false); foreach ($matches as $m) { echo "<tr valign='top'>\n"; $t1name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "'>{$m->team1_name}</a>" : $m->team1_name; $t2name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "'>{$m->team2_name}</a>" : $m->team2_name; echo "<td style='text-align: right;'>{$t1name}</td>\n"; echo "<td><nobr>{$m->team1_score}—{$m->team2_score}</nobr></td>\n"; echo "<td style='text-align: left;'>{$t2name}</td>\n"; echo "<td>" . str_replace(' ', ' ', textdate($m->date_played, true)) . "</td>"; echo "<td><a href='index.php?section=matches&type=report&mid={$m->match_id}'>Show</a></td>"; echo "</tr>"; } ?> </table> </div> </div> <?php MTS('Latest matches table generated'); break; case 'leaders': $f = 'mv_' . $box['field']; list($players, ) = Stats::getRaw(T_OBJ_PLAYER, array($box['type'] => $box['id']), array(1, $box['length']), array('-' . $f), false); ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <tr> <td><i><?php echo $lng->getTrn('common/name'); ?> </i></td> <?php if ($box['show_team']) { ?> <td><i><?php echo $lng->getTrn('common/team'); ?> </i></td><?php } ?> <td><i>#</i></td> <td><i><?php echo $lng->getTrn('common/value'); ?> </i></td> </tr> <?php foreach ($players as $p) { echo "<tr>\n"; echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $p['player_id'], false, false) . "'>{$p['name']}</a>" : $p['name']) . "</td>\n"; if ($box['show_team']) { echo "<td>" . ($settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $p['owned_by_team_id'], false, false) . "'>{$p['f_tname']}</a>" : $p['f_tname']) . "</td>\n"; } echo "<td>" . $p[$f] . "</td>\n"; echo "<td>" . $p['value'] / 1000 . "k</td>\n"; echo "</tr>"; } ?> </table> </div> </div> <?php MTS('Leaders standings generated'); break; case 'events': $events = _events($box['content'], $box['type'], $box['id'], $box['length']); ?> <div class="boxWide"> <h3 class='boxTitle<?php echo T_HTMLBOX_STATS; ?> '><?php echo $box['title']; ?> </h3> <div class='boxBody'> <table class="boxTable"> <?php $head = array_pop($events); echo "<tr>\n"; foreach ($head as $col => $name) { echo "<td><i>{$name}</i></td>\n"; } echo "</tr>\n"; foreach ($events as $e) { echo "<tr>\n"; foreach ($head as $col => $name) { switch ($col) { case 'date': $e->{$col} = str_replace(' ', ' ', textdate($e->{$col}, true)); break; case 'name': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_PLAYER, $e->pid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'tname': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $e->f_tid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'rname': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'f_pos_name': if ($settings['fp_links']) { $e->{$col} = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_RACE, $e->f_rid, false, false) . "'>" . $e->{$col} . "</a>"; } break; case 'value': $e->{$col} = $e->{$col} / 1000 . 'k'; break; } echo "<td>" . $e->{$col} . "</td>\n"; } echo "</tr>\n"; } ?> </table> </div> </div> <?php MTS('Events box generated'); break; } } ?> </div> <div class="main_foot"> <?php HTMLOUT::dnt(); ?> <br> <a TARGET="_blank" href="http://nicholasmr.dk/index.php?sec=obblm">OBBLM official website</a><br><br> This web site is completely unofficial and in no way endorsed by Games Workshop Limited. <br> Bloodquest, Blood Bowl, the Blood Bowl logo, The Blood Bowl Spike Device, Chaos, the Chaos device, the Chaos logo, Games Workshop, Games Workshop logo, Nurgle, the Nurgle device, Skaven, Tomb Kings, and all associated marks, names, races, race insignia, characters, vehicles, locations, units, illustrations and images from the Blood Bowl game, the Warhammer world are either (R), TM and/or (C) Games Workshop Ltd 2000-2006, variably registered in the UK and other countries around the world. Used without permission. No challenge to their status intended. All Rights Reserved to their respective owners. </div> <?php }
} } ?> </select> <br><br> <input type="hidden" name="type" value="ch_ring_global"> <input type="submit" name="button" value="Change GLOBAL access" <?php echo !$IS_GLOBAL_ADMIN ? 'DISABLED' : ''; ?> > </form> </div> </div> <?php if (Module::isRegistered('Registration') && $settings['allow_registration']) { ?> <div class="boxCommon"> <div class="boxTitle<?php echo T_HTMLBOX_ADMIN; ?> "> Activate Users </div> <div class="boxBody"> <?php $retiredCoaches = Coach::getCoaches('retired = 2'); if (empty($retiredCoaches)) { echo 'No coaches to activate!'; } else { ?>
private static function make_menu() { global $lng, $coach, $settings, $rules, $admin_menu; ?> <ul id="css3menu1" class="topmenu"> <li class="topfirst"><a href="index.php?section=main" style="height:20px;line-height:20px;"><?php echo $lng->getTrn('menu/home'); ?> </a> <ul> <li class="subfirst"><a href="#" >Europe ></a> <ul> <li><a href="#" >UK ></a> <ul> <li><a href="index.php?SLS_lid=5" >Basildon Warboyz (Basildon)</a></li> <li><a href="index.php?SLS_lid=4" >FennLong (Basildon)</a></li> <li><a href="index.php?SLS_lid=6" >League of Extraordinary Gentlemen (Swindon)</a></li> <li><a href="index.php?SLS_lid=8" >Rom-at-the-Ford's Blood Bowl League (Romford)</a></li> <li><a href="index.php?SLS_lid=9" >ARBBL (Andover)</a></li> <li><a href="index.php?SLS_lid=15" >Bristol Vanguard (Bristol)</a></li> <li><a href="index.php?SLS_lid=14" >MAD League (Ashfordby)</a></li> <li><a href="index.php?SLS_lid=12" >DSBBTT (London)</a></li> <li><a href="index.php?SLS_lid=13" >KRBBL (Folkestone)</a></li> </ul> </li> <li><a href="#" >Sweden ></a> <ul> <li><a href="index.php?SLS_lid=2" >MARBBL (Malmo)</a></li> </ul> </li> <li><a href="#" >Spain ></a> <ul> <li><a href="index.php?SLS_lid=18" >Liga Burgalesa</a></li> </ul> </li> <li><a href="#" >Germany ></a> <ul> <li><a href="index.php?SLS_lid=7" >United Friends</a></li> </ul> </li> </ul> </li> <li><a href="#" >North America ></a> <ul> <li><a href="#" >USA ></a> <ul> <li><a href="index.php?SLS_lid=11" >KABBL (Knoxville)</a></li> <li><a href="index.php?SLS_lid=16" >KIL (Denver)</a></li> <li><a href="index.php?SLS_lid=19" >PaDGBBL (Vista CA)</a></li> </ul> </li> <li><a href="#" >Canada ></a> <ul> <li><a href="index.php?SLS_lid=10" >CHOP (Vancouver)</a></li> </ul> </li> </ul> </li> <li><a href="#" >Rest of the World ></a> <ul> <li><a href="#" >Australia ></a> <ul> <li><a href="index.php?SLS_lid=17" >Newcastle Legion</a> </li> </ul> </li> </ul> </li> <li><a href="http://www.thenaf.net/leagues/leagues-locator/" >TheNAF.net League Locator</a></li> <li><a href="index.php?SLS_lid=1" >League Hosting Home</a></li> <li><a href="index.php?section=about">About OBBLM</a></li> </ul> </li> <?php if (isset($_SESSION['logged_in'])) { ?> <li class="topfirst"><a href="#" style="height:20px;line-height:20px;">User Menu</a> <ul> <li class="subfirst"><a href="handler.php?type=teamcreator">Create a New Team</a></li> <li><a href="index.php?section=matches&type=usersched" >Schedule Match</a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=teams'; ?> "><?php echo $lng->getTrn('cc/coach_teams'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=profile'; ?> "><?php echo $lng->getTrn('cc/profile'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=stats'; ?> "><?php echo $lng->getTrn('common/stats'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $coach->coach_id, false, false) . '&subsec=recentmatches'; ?> "><?php echo $lng->getTrn('common/recentmatches'); ?> </a></li> <li><a rel="nofollow"href="index.php?logout=1"><?php echo $lng->getTrn('menu/logout'); ?> </a></li> </ul><?php } else { ?> <li class="topfirst"><a rel="nofollow" href="index.php?section=login" style="height:20px;line-height:20px;"><?php echo $lng->getTrn('menu/login'); ?> </a></li><?php } ?> <?php if (!empty($admin_menu)) { ?> <li class="topmenu"><a href="#" style="height:20px;line-height:20px;"><?php echo $lng->getTrn('menu/admin_menu/name'); ?> </a> <ul> <li class="subfirst"><a href="handler.php?type=leaguepref"><?php echo $lng->getTrn('name', 'LeaguePref'); ?> </a></li> <?php if (Module::isRegistered('Conference')) { ?> <li><a href="handler.php?type=conference"><?php echo $lng->getTrn('name', 'Conference'); ?> </a></li><?php } ?> <?php foreach ($admin_menu as $lnk => $desc) { if (!is_array($desc)) { echo "<li><a href='index.php?section=admin&subsec={$lnk}'>{$desc}</a></li>\n"; } else { ?> <li><a href="#"><?php echo $desc['title']; ?> <ul><?php foreach ($desc['sub'] as $sub) { echo "<li><a href='index.php?section=admin&subsec={$lnk}&{$sub['href']}'>{$sub['title']}</a></li>\n"; } ?> </ul> </li> <?php } } ?> </ul> </li> <?php } ?> <li class="topmenu"><a href="#" style="height:20px;line-height:20px;">League Menu</a> <ul> <li class="subfirst"><a href="index.php?section=rules"><?php echo $lng->getTrn('menu/rules'); ?> </a></li> <li><a href="handler.php?type=leaguetables"><?php echo $lng->getTrn('name', 'LeagueTables'); ?> </a></li> <li><a href="index.php?section=teamlist"><?php echo $lng->getTrn('menu/teams'); ?> </a></li> <li><a href="index.php?section=coachlist"><?php echo $lng->getTrn('menu/coaches'); ?> </a></li> <li><a href="index.php?section=matches&type=recent"><?php echo $lng->getTrn('menu/matches_menu/recent'); ?> </a></li> <li><a href="index.php?section=matches&type=upcoming"><?php echo $lng->getTrn('menu/matches_menu/upcoming'); ?> </a> <?php if (!empty($settings['league_url'])) { ?> <li><a href="<?php echo $settings['league_url']; ?> "><?php echo $settings['league_url_name']; ?> </a></li><?php } ?> </ul> </li> <li class="topmenu"><a rel="nofollow" href="index.php?section=rules" style="height:20px;line-height:20px;">League History</a> <ul> <?php if (Module::isRegistered('Gallery')) { ?> <li><a href="handler.php?type=gallery"><?php echo $lng->getTrn('name', 'Gallery'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Wanted')) { ?> <li><a href="handler.php?type=wanted"><?php echo $lng->getTrn('name', 'Wanted'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Prize')) { ?> <li><a href="handler.php?type=prize"><?php echo $lng->getTrn('name', 'Prize'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('HOF')) { ?> <li><a href="handler.php?type=hof"><?php echo $lng->getTrn('name', 'HOF'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('FamousTeams')) { ?> <li><a href="handler.php?type=famousteams"><?php echo $lng->getTrn('name', 'FamousTeams'); ?> </a></li><?php } ?> <?php if (Module::isRegistered('Memmatches')) { ?> <li><a href="handler.php?type=memmatches"><?php echo $lng->getTrn('name', 'Memmatches'); ?> </a></li><?php } ?> <li><a href="index.php?section=matches&type=tours"><?php echo $lng->getTrn('menu/matches_menu/tours'); ?> </a></li> </ul></li> <li class="topmenu"><a rel="nofollow" href="#" style="height:20px;line-height:20px;">Statistics</a> <ul> <li class="subfirst"><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/team_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_PLAYER, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/player_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_COACH, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/coach_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_RACE, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/race_stn'); ?> </a></li> <li><a rel="nofollow" href="<?php echo urlcompile(T_URL_STANDINGS, T_OBJ_STAR, false, false, false); ?> "><?php echo $lng->getTrn('menu/statistics_menu/star_stn'); ?> </a></li> </ul> </li> <li class="topmenu"><a rel="nofollow" href="#" style="height:20px;line-height:20px;">Game Rules</a> <ul> <li class="subfirst"><a rel="nofollow" href="#">CRP Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=0" style="height:10px;line-height:10px;">Amazon</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=1" style="height:10px;line-height:10px;">Chaos</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=2" style="height:10px;line-height:10px;">Chaos Dwarf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=3" style="height:10px;line-height:10px;">Dark Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=4" style="height:10px;line-height:10px;">Dwarf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=5" style="height:10px;line-height:10px;">Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=6" style="height:10px;line-height:10px;">Goblin</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=7" style="height:10px;line-height:10px;">Halfling</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=8" style="height:10px;line-height:10px;">High Elf</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=9" style="height:10px;line-height:10px;">Human</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=10" style="height:10px;line-height:10px;">Khemri</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=11" style="height:10px;line-height:10px;">Lizardman</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=13" style="height:10px;line-height:10px;">Necromantic</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=14" style="height:10px;line-height:10px;">Norse</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=15" style="height:10px;line-height:10px;">Nurgle</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=16" style="height:10px;line-height:10px;">Ogre</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=12" style="height:10px;line-height:10px;">Orc</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=19" style="height:10px;line-height:10px;">Skaven</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=17" style="height:10px;line-height:10px;">Undead</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=18" style="height:10px;line-height:10px;">Vampire</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=20" style="height:10px;line-height:10px;">Wood Elf</a></li> </ul></li> <li class="subfirst"><a rel="nofollow" href="#">LRB6 Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=21" style="height:10px;line-height:10px;">Chaos Pact</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=22" style="height:10px;line-height:10px;">Slann</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=23" style="height:10px;line-height:10px;">Underworld</a></li> </ul></li> <li class="subfirst"><a rel="nofollow" href="#">(Optional) Community Rosters ></a> <ul><li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=24" style="height:10px;line-height:10px;">Bretonnian</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=25" style="height:10px;line-height:10px;">Khorne</a></li> <li><a href="index.php?section=objhandler&type=1&obj=4&obj_id=26" style="height:10px;line-height:10px;">Simyin</a></li> </ul></li> <li><a href="http://www.thenaf.net/wp-content/uploads/2013/06/CRP1.pdf">The CRP (Full Blood Bowl Rules)</a></li> <li><a href="http://the-outcast.com/bloodbowl/blood%20bowl%20crp%20lite.pdf">A5 Rules Summary</a></li> </ul> </li> <?php if (Module::isRegistered('Search')) { ?> <li><a href="handler.php?type=search"><?php echo $lng->getTrn('name', 'Search'); ?> </a></li><?php } ?> <?php }
private function _actionBoxes($ALLOW_EDIT, $players) { /****************************** * Team management * --------------- * * Here we are able to view team stats and manage the team, depending on visitors privileges. * ******************************/ global $lng, $rules, $settings, $skillarray, $coach, $DEA, $CHR_CONV; global $leagues, $divisions; global $racesHasNecromancer, $racesNoApothecary; global $T_ALLOWED_PLAYER_NR; $team = $this; // Copy. Used instead of $this for readability. $JMP_ANC = isset($_POST['menu_tmanage']) || isset($_POST['menu_admintools']); # Jump condition MUST be set here due to _POST variables being changed later. ?> <a name="aanc"></a> <div class="boxTeamPage"> <div class="boxTitle<?php echo T_HTMLBOX_INFO; ?> "><?php echo $lng->getTrn('profile/team/box_info/title'); ?> </div> <div class="boxBody"> <table width="100%"> <tr> <td><?php echo $lng->getTrn('common/coach'); ?> </td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_COACH, $team->owned_by_coach_id, false, false); ?> "><?php echo $team->f_cname; ?> </a></td> </tr> <tr> <td><?php echo $lng->getTrn('common/race'); ?> </td> <td><a href="<?php echo urlcompile(T_URL_PROFILE, T_OBJ_RACE, $team->f_race_id, false, false); ?> "><?php echo $lng->getTrn('race/' . strtolower(str_replace(' ', '', $team->f_rname))); ?> </a></td> </tr> <tr> <td><?php echo $lng->getTrn('common/league'); ?> </td> <td><?php if (isset($leagues[$team->f_lid])) { echo "<a href=\""; echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_LEAGUE, $team->f_lid); echo "\">" . $leagues[$team->f_lid]['lname'] . "</a>"; } else { echo '<i>' . $lng->getTrn('common/none') . '</i>'; } ?> </td> </tr> <?php if ($team->f_did != self::T_NO_DIVISION_TIE) { ?> <tr> <td><?php echo $lng->getTrn('common/division'); ?> </td> <td><?php if (isset($divisions[$team->f_did])) { echo "<a href=\""; echo urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_DIVISION, $team->f_did); echo "\">" . $divisions[$team->f_did]['dname'] . "</a>"; } else { echo '<i>' . $lng->getTrn('common/none') . '</i>'; } ?> </td> </tr> <?php } ?> <tr> <td><?php echo $lng->getTrn('common/ready'); ?> </td> <td><?php echo $team->rdy ? $lng->getTrn('common/yes') : $lng->getTrn('common/no'); ?> </td> </tr> <tr> <td>TV</td> <td><?php echo $team->tv / 1000 . 'k'; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('matches/report/treas'); ?> </td> <td><?php echo $team->treasury / 1000 . 'k'; ?> </td> </tr> <tr> <?php if (in_array($team->f_race_id, $racesHasNecromancer)) { ?> <td>Necromancer</td> <td><?php echo $lng->getTrn('common/yes'); ?> </td> <?php } if (!in_array($team->f_race_id, $racesNoApothecary)) { echo "<td>" . $lng->getTrn('common/apothecary') . "</td>\n"; echo "<td>" . ($team->apothecary ? $lng->getTrn('common/yes') : $lng->getTrn('common/no')) . "</td>\n"; } ?> </tr> <tr> <td><?php echo $lng->getTrn('common/reroll'); ?> </td> <td><?php echo $team->rerolls; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('matches/report/ff'); ?> </td> <td><?php echo $team->rg_ff; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/ass_coach'); ?> </td> <td><?php echo $team->ass_coaches; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/cheerleader'); ?> </td> <td><?php echo $team->cheerleaders; ?> </td> </tr> <tr> <td colspan=2><hr></td> </tr> <tr> <td><?php echo $lng->getTrn('common/played'); ?> </td> <td><?php echo $team->mv_played; ?> </td> </tr> <tr> <td>WIN%</td> <td><?php echo sprintf("%1.1f", $team->rg_win_pct) . '%'; ?> </td> </tr> <tr> <td>ELO</td> <td><?php echo $team->rg_elo ? sprintf("%1.2f", $team->rg_elo) : '<i>N/A</i>'; ?> </td> </tr> <tr> <td>W/L/D</td> <td><?php echo "{$team->mv_won}/{$team->mv_lost}/{$team->mv_draw}"; ?> </td> </tr> <tr> <td>W/L/D <?php echo $lng->getTrn('common/streaks'); ?> </td> <td><?php echo "{$team->rg_swon}/{$team->rg_slost}/{$team->rg_sdraw}"; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('common/wontours'); ?> </td> <td><?php echo $team->wt_cnt; ?> </td> </tr> <tr> <td><?php echo $lng->getTrn('profile/team/box_info/ltour'); ?> </td> <td><?php echo Tour::getTourUrl($team->getLatestTour()); ?> </td> </tr> <tr valign="top"> <td><?php echo $lng->getTrn('common/playedtours'); ?> </td> <td><small><?php $tours = $team->getToursPlayedIn(false); if (empty($tours)) { echo $lng->getTrn('common/none'); } else { $first = true; foreach ($tours as $tour) { if ($first) { $first = false; } else { echo ", "; } echo $tour->getUrl(); } } ?> </small></td> </tr> <?php if (Module::isRegistered('Prize')) { ?> <tr valign="top"> <td><?php echo $lng->getTrn('name', 'Prize'); ?> </td> <td><small><?php echo Module::run('Prize', array('getPrizesString', T_OBJ_TEAM, $team->team_id)); ?> </small></td> </tr> <?php } if (Module::isRegistered('FamousTeams')) { ?> <tr> <td><?php echo $lng->getTrn('isfamous', 'FamousTeams'); ?> </td> <td><?php echo Module::run('FamousTeams', array('isInFT', $team->team_id)) ? '<b><font color="green">Yes</font></b>' : 'No'; ?> </td> </tr> <?php } ?> </table> </div> </div> <?php if ($ALLOW_EDIT) { $this->_teamManagementBox($players, $team); if ($coach->isNodeCommish(T_NODE_LEAGUE, $team->f_lid)) { ?> <div class="boxTeamPage"> <div class="boxTitle<?php echo T_HTMLBOX_ADMIN; ?> "><?php echo $lng->getTrn('profile/team/box_admin/title'); ?> </div> <div class="boxBody"> <?php $base = 'profile/team'; $admin_tools = array('unhire_journeyman' => $lng->getTrn($base . '/box_admin/unhire_journeyman'), 'unsell_player' => $lng->getTrn($base . '/box_admin/unsell_player'), 'unbuy_goods' => $lng->getTrn($base . '/box_admin/unbuy_goods'), 'bank' => $lng->getTrn($base . '/box_admin/bank'), 'spp' => $lng->getTrn($base . '/box_admin/spp'), 'dval' => $lng->getTrn($base . '/box_admin/dval'), 'extra_skills' => $lng->getTrn($base . '/box_admin/extra_skills'), 'ach_skills' => $lng->getTrn($base . '/box_admin/ach_skills'), 'ff' => $lng->getTrn($base . '/box_admin/ff')); // Set default choice. if (!isset($_POST['menu_admintools'])) { reset($admin_tools); $_POST['menu_admintools'] = key($admin_tools); } // If action is already chosen, then make it the default selected. if (isset($_POST['type']) && array_key_exists($_POST['type'], $admin_tools)) { $_POST['menu_admintools'] = $_POST['type']; } ?> <form method="POST" name="menu_admintools_form"> <select name="menu_admintools" onchange="document.menu_admintools_form.submit();"> <?php foreach ($admin_tools as $opt => $desc) { echo "<option value='{$opt}'" . ($_POST['menu_admintools'] == $opt ? 'SELECTED' : '') . ">{$desc}</option>"; } ?> </select> <!-- <input type="submit" name="admintools" value="OK"> --> </form> <br><i><?php echo $lng->getTrn('common/desc'); ?> :</i><br><br> <form name='form_admintools' method='POST'> <?php $DISABLE = false; switch ($_POST['menu_admintools']) { /*************** * Un-hire journeymen **************/ case 'unhire_journeyman': echo $lng->getTrn('profile/team/box_admin/desc/unhire_journeyman'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_sold || $p->is_dead || $p->is_journeyman || $p->qty != 16) { continue; } echo "<option value='{$p->player_id}'>{$p->nr} {$p->name}</option>\n"; $DISABLE = false; } ?> </select> <input type="hidden" name="type" value="unhire_journeyman"> <?php break; /*************** * Un-sell player **************/ /*************** * Un-sell player **************/ case 'unsell_player': echo $lng->getTrn('profile/team/box_admin/desc/unsell_player'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if ($p->is_sold) { echo "<option value='{$p->player_id}'>{$p->nr} {$p->name}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="unsell_player"> <?php break; /*************** * Un-buy team goods **************/ /*************** * Un-buy team goods **************/ case 'unbuy_goods': echo $lng->getTrn('profile/team/box_admin/desc/unbuy_goods'); ?> <hr><br> <select name="thing"> <?php $DISABLE = true; foreach ($team->getGoods() as $name => $details) { if ($team->{$name} > 0) { # Only allow to un-buy those things which we already have some of. echo "<option value='{$name}'>{$details['item']}</option>\n"; $DISABLE = false; } } ?> </select> <input type="hidden" name="type" value="unbuy_goods"> <?php break; /*************** * Gold bank **************/ /*************** * Gold bank **************/ case 'bank': echo $lng->getTrn('profile/team/box_admin/desc/bank'); ?> <hr><br> Δ team treasury:<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name="amount" maxlength=5 size=5>k <input type="hidden" name="type" value="bank"> <?php break; /*************** * Manage Fan Factor ***************/ /*************** * Manage Fan Factor ***************/ case 'ff': echo $lng->getTrn('profile/team/box_admin/desc/ff'); ?> <hr><br> Bought ff + Match ff = Total<br> <input type='text' name="amount" value="<?php echo $team->ff_bought . '" maxlength=2 size=1 style="text-align: right">+' . ($team->rg_ff - $team->ff_bought) . '=' . $team->rg_ff; ?> <input type="hidden" name="type" value="ff"> <?php break; /*************** * Manage extra SPP **************/ /*************** * Manage extra SPP **************/ case 'spp': echo $lng->getTrn('profile/team/box_admin/desc/spp'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; objsort($players, array('+is_dead', '+name')); foreach ($players as $p) { if (!$p->is_sold) { echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->nr} {$p->name}</option>"; $DISABLE = false; } } objsort($players, array('+nr')); ?> </select> <br><br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name='amount' maxlength="5" size="5"> Δ SPP <input type="hidden" name="type" value="spp"> <?php break; /*************** * Manage extra player value **************/ /*************** * Manage extra player value **************/ case 'dval': echo $lng->getTrn('profile/team/box_admin/desc/dval'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; objsort($players, array('+is_dead', '+name')); foreach ($players as $p) { if (!$p->is_sold) { echo "<option value='{$p->player_id}'" . ($p->is_dead ? ' style="background-color:' . COLOR_HTML_DEAD . ';"' : '') . ">{$p->nr} {$p->name} (current extra = " . $p->extra_val / 1000 . "k)</option>"; $DISABLE = false; } } objsort($players, array('+nr')); ?> </select> <br><br> Set extra value to<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type='text' name='amount' maxlength="10" size="6">k <input type="hidden" name="type" value="dval"> <?php break; /*************** * Manage extra skills **************/ /*************** * Manage extra skills **************/ case 'extra_skills': echo $lng->getTrn('profile/team/box_admin/desc/extra_skills'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if (!$p->is_sold && !$p->is_dead) { echo "<option value='{$p->player_id}'>{$p->nr} {$p->name}</option>"; $DISABLE = false; } } ?> </select> <br><br> Skill:<br> <select name="skill"> <?php foreach ($skillarray as $cat => $skills) { echo "<OPTGROUP LABEL='{$cat}'>"; foreach ($skills as $id => $skill) { echo "<option value='{$id}'>{$skill}</option>"; } echo "</OPTGROUP>"; } ?> </select> <br><br> Action (add/remove)<br> <input type="radio" CHECKED name="sign" value="+">+ <input type="radio" name="sign" value="-">- <input type="hidden" name="type" value="extra_skills"> <?php break; /*************** * Remove achived skills **************/ /*************** * Remove achived skills **************/ case 'ach_skills': echo $lng->getTrn('profile/team/box_admin/desc/ach_skills'); ?> <hr><br> <?php echo $lng->getTrn('common/player'); ?> :<br> <select name="player"> <?php $DISABLE = true; foreach ($players as $p) { if (!$p->is_dead && !$p->is_sold) { echo "<option value='{$p->player_id}'>{$p->nr} {$p->name}</option>\n"; $DISABLE = false; } } ?> </select> <br><br> Skill<br> <select name="skill"> <?php foreach ($skillarray as $cat => $skills) { echo "<OPTGROUP LABEL='{$cat}'>"; foreach ($skills as $id => $skill) { echo "<option value='{$id}'>{$skill}</option>"; } echo "</OPTGROUP>"; } echo "<optgroup label='Characteristic increases'>\n"; foreach ($CHR_CONV as $key => $name) { echo "<option value='ach_{$key}'>+ " . ucfirst($name) . "</option>\n"; } echo "</optgroup>\n"; ?> </select> <input type="hidden" name="type" value="ach_skills"> <?php break; } ?> <br><br> <input type="submit" name="button" value="OK" <?php echo $DISABLE ? 'DISABLED' : ''; ?> > </form> </div> </div> <?php } } ?> <br> <div class="row"></div> <br> <?php if (!$settings['hide_ES_extensions']) { ?> <div class="row"> <div class="boxWide"> <div class="boxTitle<?php echo T_HTMLBOX_STATS; ?> "><a href='javascript:void(0);' onClick="slideToggleFast('ES');"><b>[+/-]</b></a> <?php echo $lng->getTrn('common/extrastats'); ?> </div> <div class="boxBody" id="ES" style='display:none;'> <?php HTMLOUT::generateEStable($this); ?> </div> </div> </div> <?php } // If an team action was chosen, jump to actions HTML anchor. if ($JMP_ANC) { ?> <script language="JavaScript" type="text/javascript"> window.location = "#aanc"; </script> <?php } }
public static function getTourUrl($tour_id, $tour_name = null) { if (isset($tour_id)) { if (!isset($tour_name)) { $tour_name = get_alt_col('tours', 'tour_id', $tour_id, 'name'); } if (Module::isRegistered('LeagueTables')) { $tourUrl = "<a href=\"handler.php?type=leaguetables&tour_id=" . $tour_id . "\">" . $tour_name . "</a>"; } else { $tourUrl = "<a href=\"" . urlcompile(T_URL_STANDINGS, T_OBJ_TEAM, false, T_NODE_TOURNAMENT, $tour_id) . "\">" . $tour_name . "</a>"; } return $tourUrl; } else { return '<i>' . $lng->getTrn('common/none') . '</i>'; } }