本文整理汇总了PHP中Match类的典型用法代码示例。如果您正苦于以下问题:PHP Match类的具体用法?PHP Match怎么用?PHP Match使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Match类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:28,代码来源:summary-tournament.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;
}
开发者ID:pheze,项目名称:ydtp3,代码行数:35,代码来源:admin_matches.php
示例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);
}
}
}
开发者ID:roarher,项目名称:real-madrid-web,代码行数:26,代码来源:MatchContainer.php
示例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;
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:8,代码来源:tournament-control.class.php
示例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;
}
}
开发者ID:vampirefrog,项目名称:frogmod-justice,代码行数:10,代码来源:Match.php
示例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;
}
}
开发者ID:forevermatt,项目名称:mosaic,代码行数:19,代码来源:Match.php
示例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);
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:12,代码来源:match-search-adapter.class.php
示例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;
}
开发者ID:andhis2,项目名称:QuizResults,代码行数:17,代码来源:MatchingSurveyQuestion.class.php
示例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));
}
开发者ID:zywh,项目名称:maplecity,代码行数:17,代码来源:MatchController.php
示例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
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:51,代码来源:summary-match.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);
}
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:49,代码来源:subscription-grid.class.php
示例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);
}
}
开发者ID:CtrlZ-FRC4096,项目名称:FRC-Scout-2016,代码行数:15,代码来源:Competition.php
示例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;
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:33,代码来源:matchedit.php
示例14: generate_vars
function generate_vars($section, &$vars)
{
if (!isset($_GET['id'])) {
return;
}
$vars['match'] = Match::get($_GET['id']);
}
开发者ID:pheze,项目名称:ydtp2,代码行数:7,代码来源:match_detail.php
示例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;
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:29,代码来源:scorecard.php
示例16: run
public function run()
{
DB::table('matches')->delete();
Match::create(array('myChar' => 'Akuma', 'opponentChar' => 'Cammy', 'result' => 'Win'));
Match::create(array('myChar' => 'Juri', 'opponentChar' => 'Chun-li', 'result' => 'Draw'));
Match::create(array('myChar' => 'Ryu', 'opponentChar' => 'Rose', 'result' => 'Loss'));
}
开发者ID:mvanwit,项目名称:sf4_tracker,代码行数:7,代码来源:MatchTableSeeder.php
示例17: OnPageLoad
function OnPageLoad()
{
echo '<h1>' . htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false) . '</h1>';
if (is_object($this->match)) {
echo "<p>Thank you. You have added the following match:</p>";
echo new MatchListControl(array($this->match));
echo "<p>Don't worry if you made a mistake, just <a href=\"" . htmlentities($this->match->GetEditNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">edit this match</a>
or <a href="' . htmlentities($this->match->GetDeleteNavigateUrl(), ENT_QUOTES, "UTF-8", false) . '">delete this match</a>.</p>';
$this->edit->SetHeading('Add another {0}');
# Configure edit control
$this->edit->SetCssClass('panel addAnotherPanel');
} else {
/* Create instruction panel */
$o_panel = new XhtmlElement('div');
$o_panel->SetCssClass('panel instructionPanel large');
$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', 'Use the <span class="tab">tab</span> key on your keyboard to move through the form'));
$o_tab_tip->AddControl(new XhtmlElement('li', 'Type the first letter or number to select from a dropdown list'));
if ($this->i_match_type != MatchType::TOURNAMENT_MATCH) {
$o_tab_tip->AddControl(new XhtmlElement('li', 'If you\'re not sure when the match starts, leave the time blank'));
}
$o_panel->AddControl($o_tab_tip);
echo $o_panel;
# Configure edit control
$this->edit->SetCssClass('panel');
}
# display the match to edit
echo $this->edit;
parent::OnPageLoad();
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:33,代码来源:matchadd.php
示例18: OnPageLoad
function OnPageLoad()
{
if (!$this->tournament instanceof Match or !$this->b_is_tournament) {
http_response_code(404);
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
echo new XhtmlElement('h1', htmlentities($this->GetPageTitle(), ENT_QUOTES, "UTF-8", false));
# check permission
if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
?>
<p>Sorry, you can't edit a tournament unless you added it.</p>
<p><a href="<?php
echo htmlentities($this->tournament->GetNavigateUrl(), ENT_QUOTES, "UTF-8", false);
?>
">Go back
to tournament</a></p>
<?php
return;
}
# OK to edit the match
$o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings());
$this->editor->SetDataObject($o_match);
echo $this->editor;
echo '<p class="facebook-tournaments">You can also list your tournament on the <a href="https://www.facebook.com/groups/1451559361817258/">Sussex Stoolball tournaments Facebook group</a>.</p>';
parent::OnPageLoad();
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:27,代码来源:seasons.php
示例19: store
/**
* Creates a new entry, puts the id into the session and
* redirects back to the index page.
*/
public function store()
{
if (Entry::canCreateOrEdit() === false) {
return Redirect::route('entry.index')->withMessage("Sorry, the competition has now started and new entries cannot be created.");
}
$input = Input::all();
$validator = Validator::make($input, Entry::$entry_rules);
if ($validator->fails()) {
return Redirect::route('entry.create')->withInput()->withErrors($validator);
}
DB::beginTransaction();
$entry = new Entry();
$entry->email = $input['email'];
$entry->secret = Hash::make($input['secret']);
$entry->confirmation = uniqid('', true);
$entry->first_name = $input['first_name'];
$entry->last_name = $input['last_name'];
$entry->peer_group = $input['peer_group'];
$entry->save();
$matches = Match::all();
foreach ($matches as $match) {
$match_prediction = new MatchPrediction();
$match_prediction->team_a = $match->team_a;
$match_prediction->team_b = $match->team_b;
$match_prediction->pool = $match->pool;
$match_prediction->match_date = $match->match_date;
$entry->matchPredictions()->save($match_prediction);
}
DB::commit();
$this->sendConfirmationEmail($entry);
$this->putEntryIdIntoSession($entry->id);
return View::make('entry.edit')->with('entry', $entry);
}
开发者ID:ajwgibson,项目名称:rugby-world-cup-laravel,代码行数:37,代码来源:EntryController.php
示例20: OnPageLoad
function OnPageLoad()
{
if (!$this->tournament instanceof Match or !$this->b_is_tournament) {
http_response_code(404);
require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
return;
}
echo new XhtmlElement('h1', Html::Encode($this->GetPageTitle()));
# check permission
if (!$this->b_user_is_match_admin and !$this->b_user_is_match_owner) {
?>
<p>Sorry, you can't edit a tournament unless you added it.</p>
<p><a href="<?php
echo Html::Encode($this->tournament->GetNavigateUrl());
?>
">Go back
to tournament</a></p>
<?php
return;
}
# OK to edit the match
$o_match = is_object($this->tournament) ? $this->tournament : new Match($this->GetSettings());
$this->editor->SetDataObject($o_match);
echo $this->editor;
parent::OnPageLoad();
}
开发者ID:stoolball-england,项目名称:stoolball-england-website,代码行数:26,代码来源:edit.php
注:本文中的Match类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论