当前位置: 首页>>代码示例>>PHP>>正文


PHP Match::get方法代码示例

本文整理汇总了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;
}
开发者ID:pheze,项目名称:ydtp2,代码行数:26,代码来源:reservation_billet.php

示例2: 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

示例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();
}
开发者ID:pheze,项目名称:ydtp2,代码行数:8,代码来源:util.php

示例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;
}
开发者ID:pheze,项目名称:ydtp2,代码行数:15,代码来源:confirmation_achat_billet.php

示例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;
}
开发者ID:pheze,项目名称:ydtp3,代码行数:16,代码来源:match_detail.php

示例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);
 }
开发者ID:blast007,项目名称:bzion,代码行数:21,代码来源:MatchController.php

示例7: get_match

 public function get_match()
 {
     return Match::get($this->id_match);
 }
开发者ID:pheze,项目名称:ydtp3,代码行数:4,代码来源:reservation.inc.php

示例8: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     return Response::json(Match::get($id));
 }
开发者ID:mvanwit,项目名称:sf4_tracker,代码行数:10,代码来源:MatchController.php

示例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();
 }
开发者ID:allejo,项目名称:bzion,代码行数:11,代码来源:Team.php

示例10: get_match

 public function get_match()
 {
     return Match::get($this->match_id);
 }
开发者ID:pheze,项目名称:ydtp2,代码行数:4,代码来源:reservation.inc.php

示例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();
 }
开发者ID:andrewandante,项目名称:blackdorisrovers,代码行数:81,代码来源:Season.php

示例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();
 }
开发者ID:allejo,项目名称:bzion,代码行数:19,代码来源:Player.php


注:本文中的Match::get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。