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 _ES() { global $lng; ?> <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 }
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 _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 } }