本文整理汇总了PHP中Match::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Match::get方法的具体用法?PHP Match::get怎么用?PHP Match::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Match
的用法示例。
在下文中一共展示了Match::get方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate_vars
function generate_vars($section, &$vars)
{
$vars['ok'] = false;
$vars['full'] = false;
if (!isset($_GET['match_id']) || !isset($_GET['nombre_billet'])) {
return;
}
$nombre_billet = $_GET['nombre_billet'];
$match = Match::get($_GET['match_id']);
if ($match == null || $nombre_billet <= 0) {
return;
}
if ($match->places < $nombre_billet) {
$vars['full'] = true;
return;
}
$match->places = $match->places - $nombre_billet;
$match->save();
$reservation = new Reservation();
$reservation->utilisateur = $vars['userid'];
$reservation->match_id = $match->id;
$reservation->qte = $nombre_billet;
$reservation->expiration = 'now()';
$reservation->save();
$vars['ok'] = true;
}
示例2: generate_vars
function generate_vars($section, &$vars)
{
if (!isset($_GET['id'])) {
return;
}
$vars['match'] = Match::get($_GET['id']);
}
示例3: ajust_ticket_and_delete
function ajust_ticket_and_delete($reservation)
{
$match = Match::get($reservation->match_id);
$new_places = $match->places + $reservation->qte;
$match->places = $new_places;
$match->save();
$reservation->delete();
}
示例4: generate_vars
function generate_vars($section, &$vars)
{
if (!isset($_GET['match_id']) || !isset($_GET['nombre_billet'])) {
$vars['ok'] = false;
return;
}
$vars['ok'] = true;
$vars['ok_place'] = false;
if (Match::get($_GET['match_id'])->places < $_GET['nombre_billet']) {
return;
}
$vars['match_id'] = $_GET['match_id'];
$vars['nombre_billet'] = $_GET['nombre_billet'];
$vars['ok_place'] = true;
}
示例5: generate_vars
function generate_vars($section, &$vars)
{
if (!isset($_GET['id'])) {
return;
}
$vars['match'] = Match::get($_GET['id']);
$vars['arena'] = $vars['match']->getArena();
$classes = array();
for ($i = 0; $i < $vars['arena']->profondeur; $i++) {
$classes[$i] = array();
for ($j = 0; $j < $vars['arena']->largeur; $j++) {
$classes[$i][$j] = get_siege_info($vars['userid'], $_GET['id'], $i, $j);
}
}
$vars['classes'] = $classes;
}
示例6: recalculateAction
public function recalculateAction(Player $me, $match)
{
$match = Match::get($match);
// get a match even if it's deleted
if (!$me->canEdit($match)) {
throw new ForbiddenException("You are not allowed to edit that match.");
}
return $this->showConfirmationForm(function () use($match) {
$response = new StreamedResponse();
$response->headers->set('Content-Type', 'text/plain');
$response->setCallback(function () use($match) {
$this->recalculate($match);
});
$response->send();
}, "Do you want to recalculate ELO history for all teams and matches after the specified match?", "ELO history recalculated", "Recalculate ELOs", function () use($match) {
if ($match->isDeleted()) {
return new RedirectResponse($match->getURL('list'));
}
return new RedirectResponse($match->getURL('show'));
}, "Match/recalculate.html.twig", $noButton = true);
}
示例7: get_match
public function get_match()
{
return Match::get($this->id_match);
}
示例8: show
/**
* Display the specified resource.
*
* @param int $id
* @return Response
*/
public function show($id)
{
return Response::json(Match::get($id));
}
示例9: isLastMatch
/**
* Find if a specific match is the team's last one
*
* @param int|Match $match The match
* @return bool
*/
public function isLastMatch($match)
{
// Find if this team participated in any matches after the current match
return !Match::getQueryBuilder()->with($this)->where('status')->notEquals('deleted')->where('time')->isAfter(Match::get($match)->getTimestamp())->any();
}
示例10: get_match
public function get_match()
{
return Match::get($this->match_id);
}
示例11: doSyncFromFeed
public function doSyncFromFeed($data, $form)
{
$feeds = $this->Feeds();
foreach ($feeds as $feed) {
$feedreader = new ICSReader($feed->URL);
$events = $feedreader->getEvents();
foreach ($events as $event) {
// translate iCal schema into Match schema
$uid = strtok($event['UID'], '@');
if ($match = Match::get()->filter(array("UID" => $uid))->First()) {
$feedevent = $match;
} else {
$feedevent = Match::create();
$feedevent->UID = $uid;
}
$feedevent->Title = $event['SUMMARY'];
//Get opposition with some string fun
$feedevent->Opposition = trim(str_replace(array("-", "Black Doris Rovers", "vs"), "", $event['SUMMARY']));
if (preg_match('/Round/', $feedevent->Opposition)) {
$opp = explode(" ", $feedevent->Opposition);
$opp = array_slice($opp, 2);
$feedevent->Opposition = trim(implode(" ", $opp));
}
if (isset($event['DESCRIPTION']) && !empty($event['DESCRIPTION']) && $event['DESCRIPTION'] != " ") {
$scores = str_replace("Result\n", "", $event['DESCRIPTION']);
$scores = explode("-", $scores);
foreach ($scores as $score) {
$score = trim($score);
$bits = explode(" ", $score);
if (preg_match('/Black Doris Rovers/', $score)) {
$feedevent->BDRScore = end($bits);
} else {
$feedevent->OppositionScore = end($bits);
}
}
if (intval($feedevent->BDRScore) > intval($feedevent->OppositionScore)) {
$feedevent->Result = 'Win';
} elseif (intval($feedevent->BDRScore) < intval($feedevent->OppositionScore)) {
$feedevent->Result = 'Loss';
} else {
$feedevent->Result = 'Draw';
}
} else {
$feedevent->BDRScore = NULL;
$feedevent->OppositionScore = NULL;
$feedevent->Result = NULL;
}
$startdatetime = $this->iCalDateToDateTime($event['DTSTART']);
if (array_key_exists('DTEND', $event) && $event['DTEND'] != NULL) {
$enddatetime = $this->iCalDateToDateTime($event['DTEND']);
} elseif (array_key_exists('DURATION', $event) && $event['DURATION'] != NULL) {
$enddatetime = $this->iCalDurationToEndTime($event['DTSTART'], $event['DURATION']);
}
$new = false;
if ($feedevent->DateTimes()->Count() == 0) {
$cdt = CalendarDateTime::create();
$new = true;
} else {
$cdt = $feedevent->DateTimes()->First();
}
$cdt->StartDate = $startdatetime->format('Y-m-d');
$cdt->StartTime = $startdatetime->format('H:i:s');
$cdt->EndDate = $enddatetime->format('Y-m-d');
$cdt->EndTime = $enddatetime->format('H:i:s');
if ($new == true) {
$feedevent->DateTimes()->add($cdt);
} else {
$cdt->write();
}
$feedevent->ParentID = $this->ID;
$feedevent->write();
$feedevent->publish('Stage', 'Live');
}
}
$form->sessionMessage('Sync Succeeded', 'good');
$data = $this->data();
$data->LastSyncDate = date("Y-m-d H:i:s");
$data->write();
$data->publish('Stage', 'Live');
return $this->redirectBack();
}
示例12: assignLazyResult
/**
* {@inheritdoc}
*/
protected function assignLazyResult($player)
{
$this->email = $player['email'];
$this->verified = $player['verified'];
$this->receives = $player['receives'];
$this->confirmCode = $player['confirm_code'];
$this->outdated = $player['outdated'];
$this->description = $player['description'];
$this->timezone = $player['timezone'];
$this->joined = TimeDate::fromMysql($player['joined']);
$this->last_login = TimeDate::fromMysql($player['last_login']);
$this->last_match = Match::get($player['last_match']);
$this->admin_notes = $player['admin_notes'];
$this->ban = Ban::getBan($this->id);
$this->updateUserPermissions();
}