本文整理汇总了PHP中Match::getMatches方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::getMatches方法的具体用法?PHP Match::getMatches怎么用?PHP Match::getMatches使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::getMatches方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: upcomingGames
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);
}
示例2: testMiscMethods
public function testMiscMethods()
{
$old_matches = Match::getMatches();
$this->match = Match::enterMatch($this->team_a->getId(), $this->team_b->getId(), 5, 2, 30, $this->player_a->getId());
$this->match_b = Match::enterMatch($this->team_a->getId(), $this->team_b->getId(), 5, 2, 20, $this->player_b->getId());
$this->assertEquals("now", $this->match->getTimestamp()->diffForHumans());
$this->assertEquals($this->player_a->getId(), $this->match->getEnteredBy()->getId());
$this->assertEquals(5, $this->match->getScore($this->team_a->getId()));
$this->assertEquals(2, $this->match->getOpponentScore($this->team_a->getId()));
$this->assertEquals($this->team_a->getId(), $this->match->getOpponent($this->team_b->getId())->getId());
$matches = Match::getMatches();
$this->assertArrayContainsModel($this->match, $matches);
$this->assertArrayContainsModel($this->match_b, $matches);
$this->assertEquals(2, count($matches) - count($old_matches));
}
示例3: sec_main
//.........这里部分代码省略.........
break;
case 'latestgames':
if ($box['length'] <= 0) {
break;
}
?>
<div class="boxWide">
<h3 class='boxTitle<?php
echo T_HTMLBOX_MATCH;
?>
'><?php
echo $box['title'];
?>
</h3>
<div class='boxBody'>
<table class="boxTable">
<tr>
<td style="text-align: right;" width="50%"><i><?php
echo $lng->getTrn('common/home');
?>
</i></td>
<td> </td>
<td style="text-align: left;" width="50%"><i><?php
echo $lng->getTrn('common/away');
?>
</i></td>
<td><i><?php
echo $lng->getTrn('common/date');
?>
</i></td>
<td> </td>
</tr>
<?php
list($matches, $pages) = Match::getMatches(array(1, $box['length']), $box['type'], $box['id'], false);
foreach ($matches as $m) {
echo "<tr valign='top'>\n";
$t1name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team1_id, false, false) . "'>{$m->team1_name}</a>" : $m->team1_name;
$t2name = $settings['fp_links'] ? "<a href='" . urlcompile(T_URL_PROFILE, T_OBJ_TEAM, $m->team2_id, false, false) . "'>{$m->team2_name}</a>" : $m->team2_name;
echo "<td style='text-align: right;'>{$t1name}</td>\n";
echo "<td><nobr>{$m->team1_score}—{$m->team2_score}</nobr></td>\n";
echo "<td style='text-align: left;'>{$t2name}</td>\n";
echo "<td>" . str_replace(' ', ' ', textdate($m->date_played, true)) . "</td>";
echo "<td><a href='index.php?section=matches&type=report&mid={$m->match_id}'>Show</a></td>";
echo "</tr>";
}
?>
</table>
</div>
</div>
<?php
MTS('Latest matches table generated');
break;
case 'leaders':
$f = 'mv_' . $box['field'];
list($players, ) = Stats::getRaw(T_OBJ_PLAYER, array($box['type'] => $box['id']), array(1, $box['length']), array('-' . $f), false);
?>
<div class="boxWide">
<h3 class='boxTitle<?php
echo T_HTMLBOX_STATS;
?>
'><?php
echo $box['title'];
?>
</h3>
<div class='boxBody'>
<table class="boxTable">