本文整理汇总了PHP中Match::getRounds方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::getRounds方法的具体用法?PHP Match::getRounds怎么用?PHP Match::getRounds使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::getRounds方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: userSched
public static function userSched()
{
global $lng, $coach, $settings, $leagues, $divisions, $tours;
if (!is_object($coach)) {
status(false, "You must be logged in to schedule games");
return;
}
if (isset($_POST['creategame'])) {
// Test input
$trid = (int) $_POST['trid'];
$round = (int) $_POST['round'];
$own_team = (int) $_POST['own_team'];
$errmsg = '';
// Logged in coach has access to the tour?
if (!in_array($trid, array_keys($tours))) {
$errmsg = 'You do not have access to the tournament ' . $tours[$trid]['tname'];
}
// Is the team is really owned by the logged in coach?
if ($coach->coach_id != get_alt_col('teams', 'team_id', $own_team, 'owned_by_coach_id')) {
$errmsg = 'The team ' . get_alt_col('teams', 'team_id', $own_team, 'name') . ' is not owned by you';
}
// Create match
if (!$errmsg) {
list($exitStatus, $mid) = Match::create(array('team1_id' => $own_team, 'team2_id' => get_alt_col('teams', 'name', $_POST['opposing_team_autocomplete'], 'team_id'), 'round' => $round, 'f_tour_id' => $trid));
$backFromMatchLink = Mobile::isMobile() ? "index.php?mobile=1" : "index.php?section=matches&type=report&mid={$mid}";
status(!$exitStatus, $exitStatus ? Match::$T_CREATE_ERROR_MSGS[$exitStatus] : "<a href='{$backFromMatchLink}'>Click here</a> to open the match report");
if (!$exitStatus) {
echo "<br>";
}
} else {
status(false, $errmsg);
}
}
$trid = isset($_GET['trid']) && is_numeric($_GET['trid']) ? (int) $_GET['trid'] : 0;
$lid = $trid ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : false;
$lname = $lid ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_LEAGUE) : '- N/A -';
$did = $trid && get_alt_col('leagues', 'lid', $lid, 'tie_teams') == 1 ? get_parent_id(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
$dname = $did ? get_parent_name(T_NODE_TOURNAMENT, $trid, T_NODE_DIVISION) : false;
$_DISABLED = !$trid ? 'DISABLED' : '';
#print_r(array($trid, $lid, $lname, $did));
title($lng->getTrn('menu/matches_menu/usersched'));
$LOCK_FORMS = false;
?>
<div class='boxCommon'>
<h3 class='boxTitle<?php
echo T_HTMLBOX_MATCH;
?>
'><?php
echo $lng->getTrn('menu/matches_menu/usersched');
?>
</h3>
<div class='boxBody'>
<form method="POST" id="usersched">
<?php
echo "In tournament ";
echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid', array(T_NODE_TOURNAMENT => array('locked' => 0, 'type' => TT_FFA, 'allow_sched' => 1)), array(), array('sel_id' => $trid, 'extra_tags' => array('onChange="document.location.href = \'' . getFormAction('?section=matches&type=usersched') . '&trid=\' + $(this).val();"'), 'init_option' => '<option value="0">- ' . $lng->getTrn('matches/usersched/selecttour') . " -</option>\n"));
echo ' as ';
echo '<select name="round" id="round" ' . $_DISABLED . '>';
$T_ROUNDS = Match::getRounds();
foreach ($T_ROUNDS as $r => $d) {
echo "<option value='{$r}' " . ($r == 1 ? 'SELECTED' : '') . ">" . $d . "</option>\n";
}
?>
</select>
<br><br>
Your team
<?php
$teams = array();
foreach ($coach->getTeams($lid, $did, array('sortby' => 'team_id DESC')) as $t) {
if (!$t->rdy || $t->is_retired) {
continue;
}
$teams[] = $t;
}
?>
<select name='own_team' id='own_team' <?php
echo $_DISABLED;
?>
>
<?php
echo "<optgroup class='leagues' label='{$lname}'>\n";
if ($dname) {
echo "<optgroup class='divisions' label=' {$dname}'>\n";
}
foreach ($teams as $t) {
echo "<option style='background-color: white; margin-left: -1em;' value='{$t->team_id}'> {$t->name}</option>\n";
}
?>
</select>
VS.
<input type="text" id='opposing_team_autoselect' name="opposing_team_autocomplete" size="30" maxlength="50" <?php
echo $_DISABLED;
?>
>
<script>
$(document).ready(function(){
var options, b;
options = {
//.........这里部分代码省略.........
示例2: 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);
}
示例3: foreach
<?php
global $hrs;
foreach ($hrs as $idx => $r) {
echo "<option value='{$idx}'>#{$idx} " . Tour::getRSstr($idx) . "</option>\n";
}
?>
</select>
<br><br>
</div> <!-- /OPTS_NEW_TOUR -->
<?php
$body = '';
// FFA settings.
$body .= $lng->getTrn('admin/schedule/as_type') . '<br>';
$body .= '<select name="round">';
$T_ROUNDS = Match::getRounds();
foreach ($T_ROUNDS as $r => $d) {
$body .= "<option value='{$r}' " . ($addMatchToFFA && isset($_POST['round']) && $r == $_POST['round'] ? 'SELECTED' : '') . ">" . $d . "</option>\n";
}
$body .= '</select>';
echo "<div id='OPTS_FFA_TOUR_SETS'>{$body}</div>\n";
// Round robin seed multiplier.
$body = '';
$body .= $lng->getTrn('admin/schedule/rrobin_rnds') . "<br><select name='rounds'>";
foreach (range(1, 10) as $i) {
$body .= "<option value='{$i}'>{$i}</option>\n";
}
$body .= "</select> " . $lng->getTrn('admin/schedule/times') . "\n";
echo "<div id='OPTS_RR_TOUR_SETS'>{$body}</div>\n";
?>
<div id='OPTS_FFA_SINGLE_SETS'>