Example #1
0
 public function renderAction()
 {
     $this->oSession->userdata['c'] = 2000;
     $this->_view->title = 'Day la trang dung chuc nang renderAction --- ' . $this->oSession->userdata['test'];
     $this->_view->part_render = Module::run(new Request('site/home/part-render', array('Title duoc truyen vao ' . $this->oSession->userdata['c'])));
     $this->renderView('site/home/render');
 }
Example #2
0
 public function dispatch()
 {
     $request = new Request($_SERVER['QUERY_STRING']);
     $this->_module = $request->getModule();
     $this->_controller = $request->getController();
     $this->_action = $request->getAction();
     foreach ($this->pre_request as $pre_request) {
         $result = Module::run($pre_request);
         if ($result) {
             $request = $result;
             break;
         }
     }
     while ($request) {
         $request = Module::run($request);
     }
 }
Example #3
0
function sec_admin()
{
    global $rules, $settings, $DEA, $coach, $lng, $admin_menu;
    global $leagues, $divisions, $tours;
    if (!is_object($coach)) {
        fatal('Please login.');
    }
    if (!isset($_GET['subsec'])) {
        $_GET['subsec'] = '_NONE_';
    }
    $IS_GLOBAL_ADMIN = $coach->ring == Coach::T_RING_GLOBAL_ADMIN;
    $ONLY_FOR_GLOBAL_ADMIN = "Note: This feature may only be used by <i>global</i> administrators.";
    # Used string in a few common feature/action boxes.
    // Deny un-authorized users.
    if (!in_array($_GET['subsec'], array_keys($admin_menu))) {
        fatal("Sorry. Your access level does not allow you opening the requested page.");
    }
    switch ($_GET['subsec']) {
        case 'usr_man':
            include 'admin/admin_usr_man.php';
            break;
        case 'ct_man':
            include 'admin/admin_ct_man.php';
            break;
        case 'nodes':
            include 'admin/admin_nodes.php';
            break;
        case 'schedule':
            include 'admin/admin_schedule.php';
            break;
        case 'import':
            include 'admin/admin_import.php';
            break;
        case 'log':
            Module::run('LogSubSys', array('logViewPage'));
            break;
        case 'cpanel':
            include 'admin/admin_cpanel.php';
            break;
        default:
            fatal('The requested admin page does not exist.');
    }
    echo "<br><br>";
    HTMLOUT::dnt();
}
Example #4
0
    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> &nbsp;<?php 
            echo $lng->getTrn('common/extrastats');
            ?>
</div>
                <div class="boxBody" id="ES">
                    <?php 
            HTMLOUT::generateEStable($this);
            ?>
                </div>
            </div>
        </div>
        <?php 
        }
    }
Example #5
0
    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>
                                &Delta; 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"> &Delta; 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> &nbsp;<?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 
        }
    }
Example #6
0
                case 'apa_generate_draw':
                    Scheduler::apa_generate_draw();
                    break;
                case 'manual_draw':
                    Scheduler::show_manual_draw();
                    break;
                case 'manual_schedule':
                    $teams = json_decode($_POST['teams']);
                    $draw = array();
                    foreach ($teams->teams as $team) {
                        $draw[] = str_replace("pool", "", $team);
                    }
                    Scheduler::apa_generate_schedule($draw);
                    break;
                case 'custom_draw':
                    Scheduler::show_custom_draw();
                    break;
                case 'custom_game':
                    Scheduler::schedule_custom_game();
                    break;
            }
        } else {
            Module::run('Scheduler', array());
        }
        break;
    case 'scheduler_apa_schedule_available':
        break;
    default:
        fatal("Sorry. I don't know what the type '{$_GET['type']}' means.\n");
}
mysql_close($conn);
Example #7
0
    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&amp;gtype=" . SG_T_PLAYER . "&amp;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 
    }
Example #8
0
 /**
  * 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();
 }
Example #9
0
    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>
                                &Delta; 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"> &Delta; 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> &nbsp;<?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 
        }
    }