public static function upcomingGames($obj, $obj_id, $node, $node_id, $opp_obj, $opp_obj_id, array $opts) { /* Make upcoming 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']); } if ($obj && $obj_id) { list($matches, $pages) = Stats::getMatches($obj, $obj_id, $node, $node_id, $opp_obj, $opp_obj_id, $N, true, true); } else { list($matches, $pages) = Match::getMatches($N, $node ? $node : false, $node ? $node_id : false, true); } $extra['page'] = $N[0]; $extra['pages'] = $pages; foreach ($matches as $m) { $m->date_created_disp = textdate($m->date_created, true); $m->mlink = "<a href='index.php?section=matches&type=report&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 (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> <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> <i>(<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_COACH, $m->coach2_id, false, false) . "'>{$m->coach2_name}</a>)</i>"; } $fields = array('date_created_disp' => array('desc' => $lng->getTrn('common/datecreated'), '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), 'mlink' => array('desc' => $lng->getTrn('common/match'), 'nosort' => true)); HTMLOUT::sort_table($lng->getTrn('common/upcomingmatches'), $opts['url'], $matches, $fields, array('+round', '+date_created'), isset($_GET["sort{$opts['GET_SS']}"]) ? array(($_GET["dir{$opts['GET_SS']}"] == 'a' ? '+' : '-') . $_GET["sort{$opts['GET_SS']}"]) : array(), $extra); }
public static function sec_mobile_main() { global $coach, $lng, $T_INJS; $teams = $coach->getTeams(); $selectedTeamId = Mobile_HTMLOUT::getSelectedTeamId(); $_SESSION["SelectedTeam"] = $selectedTeamId; foreach ($teams as $team) { if ($team->team_id == $selectedTeamId) { $selectedTeam = $team; } } if (!$selectedTeam) { echo $lng->getTrn('mobile/team/noteams'); return; } $playersOnSelectedTeam = $selectedTeam->getPlayers(); // Filter players depending on settings and view mode. $tmp_players = array(); foreach ($playersOnSelectedTeam as $player) { if ($player->is_dead || $player->is_sold) { continue; } array_push($tmp_players, $player); } $playersOnSelectedTeam = $tmp_players; foreach ($playersOnSelectedTeam as $player) { Player_HTMLOUT::setChoosableSkillsTranslations($player); } list($recentMatches, $pages) = Stats::getMatches(T_OBJ_TEAM, $selectedTeamId, false, false, false, false, array(), true, false); list($upcomingMatches, $pages) = Stats::getMatches(T_OBJ_TEAM, $selectedTeamId, false, false, false, false, array(), true, true); $allMatches = array_merge($recentMatches, $upcomingMatches); ?> <script type="text/javascript"> $(document).ready(function() { var playersOnSelectedTeam = <?php echo json_encode($playersOnSelectedTeam); ?> ; var matches = <?php echo json_encode($allMatches); ?> ; var injuryTable = <?php echo json_encode($T_INJS); ?> ; $('#tabs').tabs(); $('#SelectedTeam').change(function() { this.form.submit(); }); var mobileViewModel = new MobileViewModel(playersOnSelectedTeam, matches); mobileViewModel.matchDialogViewModel.selectedPlayerViewModel.injuryTable(injuryTable); mobileViewModel.matchDialogViewModel.myTeamId(<?php echo $selectedTeamId; ?> ); ko.applyBindings(mobileViewModel); }); </script> <div class="main"> <form method="post" action="<?php echo getFormAction(''); ?> "> <select id="SelectedTeam" name="SelectedTeam"> <?php foreach ($teams as $team) { $isThisTeam = $team->team_id == $selectedTeamId; echo '<option value="' . $team->team_id . '"' . ($isThisTeam ? ' selected="selected"' : '') . '>' . $team->name . '</option>'; } ?> </select> <span class="button-panel"> <img id="open-menu" src="images/menu.svg" alt="Menu" class="icon ui-button ui-state-default ui-corner-all" data-bind="click: showMenu" /> <ul id="menu" class="ui-state-default ui-corner-left ui-corner-left ui-corner-br" data-bind="visible: isMenuVisible"> <li><a href="<?php echo getFormAction('?section=management'); ?> "><?php echo $lng->getTrn('mobile/team/management'); ?> </a></li> <li><a href="index.php"><?php echo $lng->getTrn('mobile/team/desktop_site'); ?> </a></li> <li><a href="<?php echo getFormAction('?logout=1'); ?> "><?php echo $lng->getTrn('menu/logout'); ?> </a></li> </ul> </span> </form> <div> <?php echo 'TV' . $selectedTeam->tv / 1000 . ', ' . $selectedTeam->treasury / 1000 . 'k, FF' . $selectedTeam->rg_ff; ?> <?php if ($selectedTeam->apothecary) { echo ', ' . $lng->getTrn('common/apothecary'); } ?> </div> <div id="tabs"> <ul> <li><a href="#Teams"><?php echo $lng->getTrn('common/team'); ?> </a></li> <li><a href="#Games"><?php echo $lng->getTrn('menu/matches_menu/name'); ?> </a></li> </ul> <?php Mobile_HTMLOUT::teamSummaryView($playersOnSelectedTeam); ?> <?php Mobile_HTMLOUT::matchSummaryView($recentMatches, $upcomingMatches); ?> </div> </div> <?php }