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


PHP Player::get方法代码示例

本文整理汇总了PHP中Player::get方法的典型用法代码示例。如果您正苦于以下问题:PHP Player::get方法的具体用法?PHP Player::get怎么用?PHP Player::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player::get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: assignResult

 /**
  * {@inheritdoc}
  */
 protected function assignResult($key)
 {
     $this->name = $key['name'];
     $this->owner = Player::get($key['owner']);
     $this->key = $key['key'];
     $this->status = $key['status'];
 }
开发者ID:blast007,项目名称:bzion,代码行数:10,代码来源:ApiKey.php

示例2: view

 public function view(SS_HTTPRequest $request)
 {
     $params = $request->params();
     $game_id = $params['ID'];
     $game = Game::get()->filter('ID', $game_id)->first();
     $teams = $game->Teams();
     $allTeams = array();
     foreach ($teams as $team) {
         $teamArr = array();
         $player_one = Player::get()->filter('ID', $team->PlayerOne)->first();
         $player_two = Player::get()->filter('ID', $team->PlayerTwo)->first();
         $teamArr['Names'] = $player_one->Name . ' & ' . $player_two->Name;
         $teamArr['GamesPlayed'] = $team->getGamesPlayed();
         $teamArr['TeamID'] = $team->ID;
         if ($allTeams == array()) {
             $allTeams['TeamOne'] = $teamArr;
         } else {
             $allTeams['TeamTwo'] = $teamArr;
         }
     }
     $link = $this->Link();
     $data = new ArrayData(array('Teams' => $allTeams, 'ParentLink' => $link, 'Winner' => $game->Winner, 'Score' => $game->ScoreTeamOne . '-' . $game->ScoreTeamTwo));
     if ($data->getField('Teams') == array()) {
         $data = new ArrayData(array('Content' => 'There are no teams assigned to this game.', 'AddNewTeam' => '<a href="' . $link . 'assignteams/' . $game_id . '" class="btn btn-success">Assign a Team to this game</a>', 'ParentLink' => $this->Link()));
         Session::set('GameID', $game_id);
     }
     return $data->renderWith(array('Game', 'Page'));
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:28,代码来源:GamesPage.php

示例3: newTeamForm

 public function newTeamForm()
 {
     $players = Player::get();
     $playerOne = DropdownField::create('PlayerOne', 'Player One', $players->map('ID', 'FirstName'));
     $playerTwo = DropdownField::create('PlayerTwo', 'Player Two', $players->map('ID', 'FirstName'));
     $fields = new FieldList($playerOne, $playerTwo);
     $actions = new FieldList(FormAction::create("doAddTeam")->setTitle("Add Team"));
     $required = new RequiredFields('PlayerOne', 'PlayerTwo');
     $form = Form::create($this, 'doAddTeam', $fields, $actions, $required);
     $form->setTemplate('forms/NewTeamForm');
     return $form;
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:12,代码来源:TeamsPage.php

示例4: doAddPlayer

 public function doAddPlayer($data, Form $form)
 {
     $player_exists = Player::get()->filter(array('FirstName' => $data['FirstName'], 'Surname' => $data['Surname']))->count() > 0 ? true : false;
     if ($player_exists) {
         // todo
         // add error message because player already exists
         return $this->redirectBack();
     } else {
         $player = Player::create();
         $player->FirstName = $data['FirstName'];
         $player->Surname = $data['Surname'];
         $player->write();
         $redirectLink = $this->Link() . '?success=1';
         return $this->redirect($redirectLink);
     }
 }
开发者ID:jackmarchant,项目名称:foosfirst,代码行数:16,代码来源:PlayersPage.php

示例5: getLastEditor

 /**
  * Get the last editor of the post
  * @return Player A Player object of the last editor
  */
 public function getLastEditor()
 {
     return Player::get($this->editor);
 }
开发者ID:blast007,项目名称:bzion,代码行数:8,代码来源:News.php

示例6: getMe

 /**
  * Gets the currently logged in player
  * @return Player
  */
 public static function getMe()
 {
     return Player::get(self::getRequest()->getSession()->get('playerId'));
 }
开发者ID:bchhun,项目名称:bzion,代码行数:8,代码来源:Controller.php

示例7: getAuthor

 /**
  * Gets the creator of the message
  * @return Player An object representing the message's author
  */
 public function getAuthor()
 {
     return Player::get($this->player_from);
 }
开发者ID:allejo,项目名称:bzion,代码行数:8,代码来源:Message.php

示例8: getTeam

 /**
  * Queries the database to get the team which a group of players belong to
  *
  * @param  int[] $players The IDs of players
  * @return Team  The team
  */
 private function getTeam($players)
 {
     $team = null;
     foreach ($players as $id) {
         $player = Player::get($id);
         if ($player->isTeamless()) {
             return Team::invalid();
         } elseif ($team == null) {
             $team = $player->getTeam();
         } elseif ($team->getId() != $player->getTeam()->getId()) {
             // This player is on a different team from the previous player!
             return Team::invalid();
         }
     }
     return $team;
 }
开发者ID:bchhun,项目名称:bzion,代码行数:22,代码来源:LeagueOverseerHookController.php

示例9: getEnteredBy

 /**
  * Get the user who entered the match
  * @return Player
  */
 public function getEnteredBy()
 {
     return Player::get($this->entered_by);
 }
开发者ID:bchhun,项目名称:bzion,代码行数:8,代码来源:Match.php

示例10: unserialize

 /**
  * {@inheritdoc}
  */
 public function unserialize($data)
 {
     $data = unserialize($data);
     $this->__construct(\Team::get($data['team']), \Player::get($data['deleter']));
 }
开发者ID:blast007,项目名称:bzion,代码行数:8,代码来源:TeamDeleteEvent.php

示例11: getFromUsername

 /**
  * Get a single player by their username
  *
  * @param  string $username The username to look for
  * @return Player
  */
 public static function getFromUsername($username)
 {
     return Player::get(self::fetchIdFrom($username, 'username', 's'));
 }
开发者ID:bchhun,项目名称:bzion,代码行数:10,代码来源:Player.php

示例12: sendEmails

 /**
  * Send emails to a list of recipients
  *
  * @param  string $subject    The subject of the messages
  * @param  int[]  $recipients The IDs of the players to which the messages will be sent
  * @param  string $template   The twig template name for the e-mail body
  * @param  array  $params     Any extra parameters to pass to twig
  * @return void
  */
 public function sendEmails($subject, $recipients, $template, $params = array())
 {
     if (!$this->from) {
         return;
     }
     $message = \Swift_Message::newInstance()->setSubject($subject)->setFrom(array($this->from => $this->siteTitle))->setBody($this->twig->render("Email/{$template}.txt.twig", $params))->addPart($this->twig->render("Email/{$template}.html.twig", $params), 'text/html');
     foreach ($recipients as $recipient) {
         $recipient = \Player::get($recipient);
         if (!$recipient->isVerified()) {
             continue;
         }
         $message->setTo($recipient->getEmailAddress());
         $this->mailer->send($message);
     }
 }
开发者ID:blast007,项目名称:bzion,代码行数:24,代码来源:EventSubscriber.php

示例13: getPlayer

 /**
  * Get the visiting player
  * @return Player
  */
 public function getPlayer()
 {
     return Player::get($this->player);
 }
开发者ID:allejo,项目名称:bzion,代码行数:8,代码来源:Visit.php

示例14: getSentBy

 /**
  * Get the sender of the invite
  *
  * @return Player
  */
 public function getSentBy()
 {
     return Player::get($this->sent_by);
 }
开发者ID:bchhun,项目名称:bzion,代码行数:9,代码来源:Invitation.php

示例15: getOwner

 /**
  * Get the owner of the server
  * @return Player
  */
 public function getOwner()
 {
     return Player::get($this->owner);
 }
开发者ID:allejo,项目名称:bzion,代码行数:8,代码来源:Server.php


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