Exemplo n.º 1
0
 public static function recentGames($obj, $obj_id, $node, $node_id, $opp_obj, $opp_obj_id, array $opts)
 {
     /*
         Make recent games table.
     
          $opts = array(
             'url' => The URL of the page on which this table is to be printed.
             'n' => (int) Fetch the n most recent games. If not specified all matches are displayed.
             'GET_SS' => GET Sorting suffix
          );
     */
     global $lng;
     $T_ROUNDS = Match::getRounds();
     $extra = array('doNr' => false, 'noHelp' => true);
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     if (!(array_key_exists('n', $opts) && $opts['n'])) {
         $opts['n'] = false;
     }
     if (!$opts['n']) {
         $N = array();
     } else {
         $N = isset($_GET["page"]) ? array((int) $_GET["page"], $opts['n']) : array(1, $opts['n']);
     }
     $FOR_OBJ = $obj;
     if ($obj && $obj_id) {
         list($matches, $pages) = Stats::getMatches($obj, $obj_id, $node, $node_id, $opp_obj, $opp_obj_id, $N, true, false);
     } else {
         list($matches, $pages) = Match::getMatches($N, $node ? $node : false, $node ? $node_id : false, false);
     }
     $extra['page'] = $N[0];
     $extra['pages'] = $pages;
     foreach ($matches as $m) {
         $m->date_played_disp = textdate($m->date_played, false, false);
         $m->score = "{$m->team1_score}—{$m->team2_score}";
         $m->mlink = "<a href='index.php?section=matches&amp;type=report&amp;mid={$m->match_id}'>" . $lng->getTrn('common/view') . "</a>";
         $m->tour_name = Tour::getTourUrl($m->f_tour_id);
         $m->league_name = League::getLeagueUrl(get_parent_id(T_NODE_TOURNAMENT, $m->f_tour_id, T_NODE_LEAGUE));
         if ($FOR_OBJ) {
             $m->result = matchresult_icon($m->result);
         }
         if (in_array($m->round, array_keys($T_ROUNDS))) {
             $m->round = $T_ROUNDS[$m->round];
         }
         $m->team1_name = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "'>{$m->team1_name}</a>&nbsp;<i>(<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $m->coach1_id, false, false) . "'>{$m->coach1_name}</a>)</i>";
         $m->team2_name = "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "'>{$m->team2_name}</a>&nbsp;<i>(<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $m->coach2_id, false, false) . "'>{$m->coach2_name}</a>)</i>";
     }
     $fields = array('date_played_disp' => array('desc' => $lng->getTrn('common/dateplayed'), 'nosort' => true), 'league_name' => array('desc' => $lng->getTrn('common/league'), 'nosort' => true), 'tour_name' => array('desc' => $lng->getTrn('common/tournament'), 'nosort' => true), 'round' => array('desc' => $lng->getTrn('common/round'), 'nosort' => true), 'team1_name' => array('desc' => $lng->getTrn('common/home'), 'nosort' => true), 'team2_name' => array('desc' => $lng->getTrn('common/away'), 'nosort' => true), 'gate' => array('desc' => $lng->getTrn('common/gate'), 'kilo' => true, 'suffix' => 'k', 'href' => false, 'nosort' => true), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true));
     if ($FOR_OBJ) {
         $fields['result'] = array('desc' => $lng->getTrn('common/result'), 'nosort' => true);
     }
     $fields['mlink'] = array('desc' => $lng->getTrn('common/match'), 'nosort' => true);
     # Must be last!
     HTMLOUT::sort_table($lng->getTrn('common/recentmatches'), $opts['url'], $matches, $fields, sort_rule('match'), isset($_GET["sort{$opts['GET_SS']}"]) ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $extra);
 }
Exemplo n.º 2
0
 public static function starHireHistory($obj, $obj_id, $node, $node_id, $star_id = false, $opts = array())
 {
     global $lng;
     /* 
         If $star_id is false, then the HH from all stars of $obj = $obj_id will be displayed, instead of only the HH of star = $star_id 
     */
     if (!array_key_exists('GET_SS', $opts)) {
         $opts['GET_SS'] = '';
     } else {
         $extra['GETsuffix'] = $opts['GET_SS'];
     }
     # GET Sorting Suffix
     $extra['doNr'] = false;
     $extra['noHelp'] = true;
     if ($ANC = array_key_exists('anchor', $opts)) {
         $extra['anchor'] = $opts['anchor'];
     }
     $mdat = array();
     foreach ($star_id ? array(new Star($star_id)) : Star::getStars($obj, $obj_id, $node, $node_id) as $s) {
         foreach ($s->getHireHistory($obj, $obj_id, $node, $node_id) as $m) {
             $o = (object) array();
             foreach (array('match_id', 'date_played', 'hiredBy', 'hiredAgainst', 'hiredByName', 'hiredAgainstName') as $k) {
                 $o->{$k} = $m->{$k};
             }
             foreach ($s->getStats(T_NODE_MATCH, $m->match_id) as $k => $v) {
                 $o->{$k} = $v;
             }
             $o->match = $lng->getTrn('common/view');
             $o->tour = get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
             $o->score = "{$m->team1_score} - {$m->team2_score}";
             $o->result = matchresult_icon($m->team1_id == $m->hiredBy && $m->team1_score > $m->team2_score || $m->team2_id == $m->hiredBy && $m->team1_score < $m->team2_score ? 'W' : ($m->team1_score == $m->team2_score ? 'D' : 'L'));
             $o->star_id = $s->star_id;
             $o->name = $s->name;
             array_push($mdat, $o);
         }
     }
     $fields = array('date_played' => array('desc' => $lng->getTrn('common/dateplayed')), 'name' => array('desc' => $lng->getTrn('common/star'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_STAR, false, false, false), 'field' => 'obj_id', 'value' => 'star_id')), 'tour' => array('desc' => $lng->getTrn('common/tournament')), 'hiredByName' => array('desc' => $lng->getTrn('profile/star/hiredby'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredBy')), 'hiredAgainstName' => array('desc' => $lng->getTrn('common/opponent'), 'href' => array('link' => urlcompile(T_URL_PROFILE, T_OBJ_TEAM, false, false, false), 'field' => 'obj_id', 'value' => 'hiredAgainst')), 'cp' => array('desc' => 'Cp'), 'td' => array('desc' => 'Td'), 'intcpt' => array('desc' => 'Int'), 'cas' => array('desc' => 'Cas'), 'bh' => array('desc' => 'BH'), 'si' => array('desc' => 'Si'), 'ki' => array('desc' => 'Ki'), 'mvp' => array('desc' => 'MVP'), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true), 'result' => array('desc' => $lng->getTrn('common/result'), 'nosort' => true), 'match' => array('desc' => $lng->getTrn('common/match'), 'href' => array('link' => 'index.php?section=matches&amp;type=report', 'field' => 'mid', 'value' => 'match_id'), 'nosort' => true));
     if ($star_id) {
         unset($fields['name']);
     }
     if ($obj && $obj_id) {
         unset($fields['hiredByName']);
     }
     $title = $lng->getTrn('common/starhh');
     if ($ANC) {
         $title = "<a name='{$opts['anchor']}'>" . $title . '<a>';
     }
     HTMLOUT::sort_table($title, $opts['url'], $mdat, $fields, sort_rule('star_HH'), isset($_GET["sort{$opts['GET_SS']}"]) ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $extra);
 }
Exemplo n.º 3
0
 private function _HHMerc($DETAILED)
 {
     global $lng;
     $team = $this;
     // Copy. Used instead of $this for readability.
     title("<a name='anc'>" . $lng->getTrn('common/merchh') . "</a>");
     $mdat = array();
     foreach (Mercenary::getMercsHiredByTeam($team->team_id, false) as $merc) {
         $o = (object) array();
         $m = new Match($merc->match_id);
         $o->date_played = $m->date_played;
         $o->opponent = $m->team1_id == $team->team_id ? $m->team1_name : $m->team2_name;
         foreach (array('match_id', 'skills', 'mvp', 'cp', 'td', 'intcpt', 'bh', 'ki', 'si') as $f) {
             $o->{$f} = $merc->{$f};
         }
         $o->cas = $o->bh + $o->ki + $o->si;
         $o->match = '[view]';
         $o->tour = get_alt_col('tours', 'tour_id', $m->f_tour_id, 'name');
         $o->score = "{$m->team1_score} - {$m->team2_score}";
         $o->result = matchresult_icon($m->team1_id == $team->team_id && $m->team1_score > $m->team2_score || $m->team2_id == $team->team_id && $m->team1_score < $m->team2_score ? 'W' : ($m->team1_score == $m->team2_score ? 'D' : 'L'));
         array_push($mdat, $o);
     }
     $fields = array('date_played' => array('desc' => $lng->getTrn('common/dateplayed')), 'tour' => array('desc' => $lng->getTrn('common/tournament')), 'opponent' => array('desc' => $lng->getTrn('common/opponent')), 'skills' => array('desc' => $lng->getTrn('common/skills')), 'cp' => array('desc' => 'Cp'), 'td' => array('desc' => 'Td'), 'intcpt' => array('desc' => 'Int'), 'cas' => array('desc' => 'Cas'), 'bh' => array('desc' => 'BH'), 'si' => array('desc' => 'Si'), 'ki' => array('desc' => 'Ki'), 'mvp' => array('desc' => 'MVP'), 'score' => array('desc' => $lng->getTrn('common/score'), 'nosort' => true), 'result' => array('desc' => $lng->getTrn('common/result'), 'nosort' => true), 'match' => array('desc' => $lng->getTrn('common/match'), 'href' => array('link' => 'index.php?section=matches&amp;type=report', 'field' => 'mid', 'value' => 'match_id'), 'nosort' => true));
     HTMLOUT::sort_table("<a name='tp_mhhanc'>" . $lng->getTrn('common/merchh') . "</a>", urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $team->team_id, false, false) . '&amp;subsec=hhmerc' . ($DETAILED ? '&amp;detailed=1' : '&amp;detailed=0'), $mdat, $fields, sort_rule('star_HH'), isset($_GET['sorttp_mhh']) ? array(($_GET['dirtp_mhh'] == 'a' ? '+' : '-') . $_GET['sorttp_mhh']) : array(), array('GETsuffix' => 'tp_mhh', 'doNr' => false));
 }
Exemplo n.º 4
0
    private function _injuryHistory()
    {
        global $lng, $T_INJS;
        $p = $this;
        // Copy. Used instead of $this for readability.
        list($injhist, $stats, $match_objs) = $p->getInjHistory();
        ?>
    <div class="row">
        <div class="boxWide">
            <div class="boxTitle<?php 
        echo T_HTMLBOX_STATS;
        ?>
"><a href='javascript:void(0);' onClick="slideToggleFast('injhist');"><b>[+/-]</b></a> &nbsp;<?php 
        echo $lng->getTrn('profile/player/injhist');
        ?>
</div>
            <div class="boxBody" id="injhist">
                <table class="common">
                    <tr>
                        <td><b><?php 
        echo $lng->getTrn('common/injs');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/tournament');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/opponent');
        ?>
</b></td>
                        <td><b>MVP</b></td>
                        <td><b>Cp</b></td>
                        <td><b>Td</b></td>
                        <td><b>Int</b></td>
                        <td><b>Cas</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/score');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/result');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/dateplayed');
        ?>
</b></td>
                        <td><b><?php 
        echo $lng->getTrn('common/match');
        ?>
</b></td>
                    </tr>
                    <?php 
        foreach (array_keys($injhist) as $mid) {
            $m = $match_objs[$mid];
            foreach ($injhist[$mid] as $k => $v) {
                $injhist[$mid][$k] = ucfirst(strtolower($T_INJS[$v]));
            }
            ?>
                        <tr>
                        <td><?php 
            echo implode(', ', $injhist[$mid]);
            ?>
</td>
                        <td><?php 
            echo get_parent_name(T_NODE_MATCH, $m->match_id, T_NODE_TOURNAMENT);
            ?>
</td>
                        <td><?php 
            echo $p->owned_by_team_id == $m->team1_id ? $m->team2_name : $m->team1_name;
            ?>
</td>
                        <td><?php 
            echo $stats[$mid]['mvp'];
            ?>
</td>
                        <td><?php 
            echo $stats[$mid]['cp'];
            ?>
</td>
                        <td><?php 
            echo $stats[$mid]['td'];
            ?>
</td>
                        <td><?php 
            echo $stats[$mid]['intcpt'];
            ?>
</td>
                        <td><?php 
            echo $stats[$mid]['bh'] + $stats[$mid]['si'] + $stats[$mid]['ki'];
            ?>
</td>
                        <td><?php 
            echo $m->team1_score . ' - ' . $m->team2_score;
            ?>
</td>
                        <td><?php 
            echo matchresult_icon($m->is_draw ? 'D' : ($m->winner == $p->owned_by_team_id ? 'W' : 'L'));
            ?>
</td>
                        <td><?php 
            echo textdate($m->date_played, false, false);
            ?>
</td>
                        <td><a href='javascript:void(0)' onClick="window.open('index.php?section=matches&amp;type=report&amp;mid=<?php 
            echo $m->match_id;
            ?>
');"><?php 
            echo $lng->getTrn('common/view');
            ?>
</a></td>
                        </tr>
                        <?php 
        }
        ?>
                </table>
            </div>
        </div>
    </div>
    <?php 
    }