本文整理汇总了PHP中Match类的典型用法代码示例。如果您正苦于以下问题:PHP Match类的具体用法?PHP Match怎么用?PHP Match使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Match类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: OnPageLoad
function OnPageLoad()
{
if ($this->page_not_found) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
echo "<h1>" . Html::Encode($this->GetPageTitle()) . "</h1>";
require_once 'xhtml/navigation/tabs.class.php';
$tabs = array('Summary' => $this->tournament->GetNavigateUrl(), 'Tournament statistics' => '');
echo new Tabs($tabs);
?>
<div class="box tab-box">
<div class="dataFilter"></div>
<div class="box-content">
<?php
# See what stats we've got available
require_once "_summary-data-found.php";
if (!$has_player_stats) {
echo "<p>There aren't any statistics for the " . htmlentities($this->tournament->GetTitle(), ENT_QUOTES, "UTF-8", false) . ' yet.</p>
<p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>';
} else {
require_once "_summary-controls.php";
}
?>
</div>
</div>
<?php
}
示例2: generate_vars
function generate_vars($section, &$vars)
{
if (!$vars['is_logged'] || !$vars['is_admin']) {
return;
}
$matches = Match::find_all();
$vars['matches'] = $matches;
$vars['arenas'] = Arena::filter('');
if (isset($_POST['description0'])) {
for ($i = 0; $i < count($matches); $i++) {
$match = $matches[$i];
if (isset($_POST['delete' . $i])) {
$match->delete();
continue;
}
if ($match->description != $_POST['description' . $i] || $match->date != $_POST['date' . $i] || $match->arena != $_POST['arena' . $i] || $match->prix != $_POST['prix' . $i]) {
$match->description = $_POST['description' . $i];
$match->date = $_POST['date' . $i];
$match->arena = $_POST['arena' . $i];
$match->prix = $_POST['prix' . $i];
$match->save();
}
}
}
if (!empty($_POST['description-nouveau']) && !empty($_POST['date-nouveau']) && !empty($_POST['arena-nouveau']) && !empty($_POST['prix-nouveau'])) {
$match = new Match();
$match->description = $_POST['description-nouveau'];
$match->date = $_POST['date-nouveau'];
$match->arena = $_POST['arena-nouveau'];
$match->prix = $_POST['prix-nouveau'];
$match->save();
}
$matches = Match::find_all();
$vars['matches'] = $matches;
}
示例3: loadAllMatches
private function loadAllMatches()
{
$matches = getArray("\n SELECT *\n FROM matches\n WHERE matches.seasonID = '{$this->season}'\n ORDER BY date ASC;");
$lineUps = getArray("\n SELECT * FROM lineups");
if (count($matches) > 0) {
foreach ($matches as &$match) {
$newMatch = new Match($match["date"], $match["time"], $match["tournamentName"], $match["location"], $match["opposition"], $match["goalsFor"], $match["goalsAgainst"]);
if (count($matches) > 0) {
foreach ($lineUps as &$lineUp) {
if ($lineUp["date"] == $match["date"]) {
$newMatch->setLineUp($lineUp);
}
}
}
if ($match["location"] == 'Home') {
$this->homeMatches[$match["date"]] = $newMatch;
} else {
if ($match["location"] == 'Away') {
$this->awayMatches[$match["date"]] = $newMatch;
}
}
$this->allMatches[$match["date"]] = $newMatch;
$this->tournaments[$match["tournamentName"]]->addMatch($newMatch);
}
}
}
示例4: __construct
function __construct(SiteSettings $settings, Match $match)
{
if ($match->GetMatchType() != MatchType::TOURNAMENT) {
throw new Exception('No match for tournament control');
}
$this->settings = $settings;
$this->match = $match;
}
示例5: create
public static function create($server, $map, $gameMode, $timestamp = null)
{
$match = new Match(0, $timestamp ? $timestamp : time(), $server, $map, $gameMode);
$match->insert();
if ($match->getId()) {
return $match;
} else {
return null;
}
}
示例6: isBetterMatchThan
/**
* Find out whether this Match is better (aka. - has less difference) than
* the given Match.
*
* @param \forevermatt\mosaic\Match $otherMatch
* @return boolean
*/
public function isBetterMatchThan(Match $otherMatch)
{
if ($otherMatch === null) {
return true;
}
$otherMatchDifference = $otherMatch->getDifference();
if ($otherMatchDifference === null) {
return $this->difference !== null;
} else {
return $this->difference < $otherMatchDifference;
}
}
示例7: __construct
public function __construct(Match $match)
{
$this->match = $match;
$this->searchable = new SearchItem("match", "match" . $match->GetId(), $match->GetNavigateUrl());
$this->searchable->Title($match->GetTitle() . ", " . $match->GetStartTimeFormatted(true, false));
$this->searchable->Description($this->GetSearchDescription());
$this->searchable->FullText($match->GetNotes());
$this->searchable->RelatedLinksHtml('<ul>' . '<li><a href="' . $match->GetNavigateUrl() . '/statistics">Statistics</a></li>' . '<li><a href="' . $match->GetCalendarNavigateUrl() . '">Add to calendar</a></li>' . '<li><a href="' . $match->GetEditNavigateUrl() . '">Update result</a></li>' . '</ul>');
# Assign more weight to newer matches
$weight = $match->GetStartTime() / 60 / 60 / 24 / 365;
$this->searchable->WeightWithinType($weight);
}
示例8: exportMatchesCollection
/**
* export matches collection from xml node
* @param $node DOMElement xml node
* @return array of Match
*/
protected function exportMatchesCollection(DOMElement $node)
{
$out = array();
$matchesList = $node->getElementsByTagName('match');
for ($i = 0; $i < $matchesList->length; ++$i) {
$matchNode = $matchesList->item($i);
$match = new Match();
$match->initFromXmlNode($matchNode);
$out[] = $match;
}
return $out;
}
示例9: actionCreate
/**
* 录入
*
*/
public function actionCreate()
{
parent::_acl('match_create');
$model = new Match();
if (isset($_POST['Match'])) {
$model->attributes = $_POST['Match'];
if ($model->save()) {
AdminLogger::_create(array('catalog' => 'create', 'intro' => '录入房屋配套,ID:' . $model->id));
$this->redirect(array('index'));
}
}
$this->render('create', array('model' => $model));
}
示例10: OnPageLoad
function OnPageLoad()
{
# Matches this page shouldn't edit are page not found
if ($this->page_not_found) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
echo "<h1>" . Html::Encode($this->GetPageTitle()) . "</h1>";
require_once 'xhtml/navigation/tabs.class.php';
$tabs = array('Summary' => $this->match->GetNavigateUrl());
if ($this->match->GetMatchType() == MatchType::TOURNAMENT_MATCH) {
$tabs['Match statistics'] = '';
$tabs['Tournament statistics'] = $this->match->GetTournament()->GetNavigateUrl() . '/statistics';
} else {
$tabs['Statistics'] = '';
}
echo new Tabs($tabs);
?>
<div class="box tab-box">
<div class="dataFilter"></div>
<div class="box-content">
<?php
if (!$this->has_statistics) {
echo "<p>There aren't any statistics for " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . ' yet.</p>
<p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>';
} else {
?>
<div class="statsColumns">
<div class="statsColumn">
<div class="chart-js-template" id="worm-chart"></div>
</div>
<div class="statsColumn">
<div class="chart-js-template" id="run-rate-chart"></div>
</div>
</div>
<div class="statsColumns manhattan">
<h2>Scores in each over</h2>
<div class="statsColumn">
<div class="chart-js-template" id="manhattan-chart-first-innings"></div>
</div>
<div class="statsColumn">
<div class="chart-js-template" id="manhattan-chart-second-innings"></div>
</div>
</div>
<?php
}
?>
</div>
</div>
<?php
}
示例11: OnPreRender
function OnPreRender()
{
# list subscriptions to pages (which may not yet be topics)
$this->SetCssClass('subscriptions');
if (is_array($this->a_subs) and count($this->a_subs)) {
# build table
$o_table = new XhtmlElement('table');
# build header row
$o_row = new XhtmlElement('tr');
$o_row->AddControl(new XhtmlElement('th', 'What you subscribed to'));
$o_row->AddControl(new XhtmlElement('th', 'Date subscribed'));
$o_row->AddControl(new XhtmlElement('th', 'Unsubscribe'));
$o_thead = new XhtmlElement('thead', $o_row);
$o_table->AddControl($o_thead);
# build table body
$o_tbody = new XhtmlElement('tbody');
foreach ($this->a_subs as $o_sub) {
$o_item = null;
# build table row for each subscription
if ($o_sub->GetType() == ContentType::STOOLBALL_MATCH) {
$o_item = new Match($this->o_settings);
$o_item->SetShortUrl($o_sub->GetSubscribedItemUrl());
}
if (is_object($o_item)) {
$o_row = new XhtmlElement('tr');
$o_link = new XhtmlElement('a', Html::Encode($o_sub->GetTitle()));
$o_link->AddAttribute('href', $o_item->GetNavigateUrl());
$o_td_item = new XhtmlElement('td', $o_link);
if ($o_sub->GetContentDate()) {
$o_qualifier = new XhtmlElement('span', ' on ' . Html::Encode($o_sub->GetContentDate()));
$o_qualifier->SetCssClass('subscriptionQualifier');
$o_td_item->AddControl($o_qualifier);
}
$o_row->AddControl($o_td_item);
# admin cells
$o_row->AddControl($this->GetSubscribeDateCell($o_sub));
$o_row->AddControl($this->GetActionCell($o_sub));
$o_tbody->AddControl($o_row);
unset($o_item);
}
}
$o_table->AddControl($o_tbody);
$this->AddControl($o_table);
} else {
$o_p = new XhtmlElement('p', 'You have not subscribed to any email alerts.');
$o_p->SetCssClass('subscriptionNone');
$this->AddControl($o_p);
}
}
示例12: getInfo
public function getInfo()
{
$query = "SELECT m. * , c.name\n FROM matches m\n JOIN competitions c ON m.compID = c.id\n WHERE c.id = :compID";
$params = array(":compID" => $this->id);
$result = $this->helper->queryDB($query, $params, false);
$this->name = $result[0]['name'];
foreach ($result as $row) {
$match = new Match(null, null);
$match->id = $row['id'];
$match->matchNumber = $row['matchNumber'];
$match->compID = $row['compID'];
$match->getInfo();
array_push($this->matches, $match);
}
}
示例13: OnPageLoad
public function OnPageLoad()
{
# Matches this page shouldn't edit are page not found
if ($this->page_not_found) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
$edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update";
if ($this->match->GetStartTime() > gmdate('U') and !$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
$step = "";
# definitely only this step because match in future and can't change date
} else {
$step = " – step 1 of 4";
}
echo new XhtmlElement('h1', "{$edit_or_update} " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . $step);
# If result only there's room for a little help
if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
/* Create instruction panel */
$o_panel = new XhtmlElement('div');
$o_panel->SetCssClass('panel instructionPanel');
$o_title_inner1 = new XhtmlElement('div', 'Add your matches quickly:');
$o_title = new XhtmlElement('h2', $o_title_inner1);
$o_panel->AddControl($o_title);
$o_tab_tip = new XhtmlElement('ul');
$o_tab_tip->AddControl(new XhtmlElement('li', 'You can add runs, wickets and the winning team on the next few pages'));
$o_tab_tip->AddControl(new XhtmlElement('li', 'Don\'t worry if you don\'t know – fill in what you can and leave the rest blank.'));
$o_panel->AddControl($o_tab_tip);
echo $o_panel;
}
# OK to edit the match
$this->editor->SetDataObject($this->match);
echo $this->editor;
}
示例14: generate_vars
function generate_vars($section, &$vars)
{
if (!isset($_GET['id'])) {
return;
}
$vars['match'] = Match::get($_GET['id']);
}
示例15: OnPageLoad
public function OnPageLoad()
{
# Matches this page shouldn't edit are page not found
if ($this->page_not_found) {
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
$edit_or_update = ($this->b_user_is_match_admin or $this->b_user_is_match_owner) ? "Edit" : "Update";
$step = " – step " . $this->editor->GetCurrentPage() . " of 4";
echo new XhtmlElement('h1', "{$edit_or_update} " . htmlentities($this->match->GetTitle(), ENT_QUOTES, "UTF-8", false) . $step);
if ($this->IsValid()) {
/* Create instruction panel */
$panel = new XhtmlElement('div');
$panel->SetCssClass('panel instructionPanel');
$title_inner1 = new XhtmlElement('div', 'Fill in scorecards quickly:');
$title = new XhtmlElement('h2', $title_inner1, "large");
$panel->AddControl($title);
$tab_tip = new XhtmlElement('ul');
$tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> and up and down keys to move through the form', "large"));
$tab_tip->AddControl(new XhtmlElement('li', 'Use the <span class="tab">tab</span> key to select a player\'s name from the suggestions', "large"));
$tab_tip->AddControl(new XhtmlElement('li', "List everyone on the batting card, even if they didn't bat, so we know who played."));
$tab_tip->AddControl(new XhtmlElement('li', 'Don\'t worry if you don\'t know – fill in what you can and leave the rest blank.'));
$panel->AddControl($tab_tip);
echo $panel;
}
# OK to edit the match
$this->editor->SetDataObject($this->match);
echo $this->editor;
}