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


PHP Player::getId方法代码示例

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


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

示例1: testDeletingCustomNewsCategoryWithPosts

 public function testDeletingCustomNewsCategoryWithPosts()
 {
     $news = News::addNews(StringMocks::SampleTitleOne, StringMocks::LargeContent, $this->player_with_create_perms->getId(), $this->newsCategory->getId());
     $this->assertArrayLengthEquals($this->newsCategory->getNews(), 1);
     $this->newsCategory->delete();
     $this->assertEquals('enabled', $this->newsCategory->getStatus());
     $this->assertArrayContainsModel($this->newsCategory, NewsCategory::getCategories());
     $this->wipe($news);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:9,代码来源:NewsCategoryTest.php

示例2: loginAsTestUserAction

 public function loginAsTestUserAction(Session $session, Player $user)
 {
     if (!$user->isTestUser()) {
         throw new Exception("The player you specified is not a test user!");
     }
     $session->set("playerId", $user->getId());
     $session->set("username", $user->getUsername());
     return $this->goHome();
 }
开发者ID:blast007,项目名称:bzion,代码行数:9,代码来源:LoginController.php

示例3: elasticSearch

 /**
  * Perform a search on messages using Elasticsearch
  *
  * @param  string    $query The query string
  * @return Message[] The results of the search
  */
 private function elasticSearch($query)
 {
     $finder = \Service::getContainer()->get('fos_elastica.finder.search');
     $boolQuery = new Bool();
     // We have only stored "active" messages and groups on Elasticsearch's
     // database, so there is no check for that again
     if ($this->player) {
         // Make sure that the parent of the message (i.e. the group that the
         // message belongs into) has the current player as its member
         $recipientQuery = new Term();
         $recipientQuery->setTerm('members', $this->player->getId());
         $parentQuery = new HasParent($recipientQuery, 'group');
         $boolQuery->addMust($parentQuery);
     }
     $fieldQuery = new Match();
     $fieldQuery->setFieldQuery('content', $query)->setFieldFuzziness('content', 'auto');
     $boolQuery->addMust($fieldQuery);
     return $finder->find($boolQuery);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:25,代码来源:MessageSearch.php

示例4: with

 /**
  * Only include matches where a specific team/player played
  *
  * @param  Team|Player $participant The team/player which played the matches
  * @param  string      $result      The outcome of the matches (win, draw or loss)
  * @return self
  */
 public function with($participant, $result = null)
 {
     if (!$participant || !$participant->isValid()) {
         return $this;
     }
     if ($participant instanceof Team) {
         $team_a_query = "team_a = ?";
         $team_b_query = "team_b = ?";
     } elseif ($participant instanceof Player) {
         $team_a_query = "FIND_IN_SET(?, team_a_players)";
         $team_b_query = "FIND_IN_SET(?, team_b_players)";
     } else {
         throw new InvalidArgumentException("Invalid model provided");
     }
     switch ($result) {
         case "wins":
         case "win":
         case "victory":
         case "victories":
             $query = "({$team_a_query} AND team_a_points > team_b_points) OR ({$team_b_query} AND team_b_points > team_a_points)";
             break;
         case "loss":
         case "lose":
         case "losses":
         case "defeat":
         case "defeats":
             $query = "({$team_a_query} AND team_b_points > team_a_points) OR ({$team_b_query} AND team_a_points > team_b_points)";
             break;
         case "draw":
         case "draws":
         case "tie":
         case "ties":
             $query = "({$team_a_query} OR {$team_b_query}) AND team_a_points = team_b_points";
             break;
         default:
             $query = "{$team_a_query} OR {$team_b_query}";
     }
     $this->conditions[] = $query;
     $this->parameters[] = $participant->getId();
     $this->parameters[] = $participant->getId();
     return $this;
 }
开发者ID:allejo,项目名称:bzion,代码行数:49,代码来源:MatchQueryBuilder.php

示例5: inviteAction

 public function inviteAction(Team $team, Player $player, Player $me)
 {
     if (!$me->canEdit($team)) {
         throw new ForbiddenException("You are not allowed to invite a player to that team!");
     } elseif ($team->isMember($player->getId())) {
         throw new ForbiddenException("The specified player is already a member of that team.");
     } elseif (Invitation::hasOpenInvitation($player->getId(), $team->getId())) {
         throw new ForbiddenException("This player has already been invited to join the team.");
     }
     return $this->showConfirmationForm(function () use($team, $player, $me) {
         $invite = Invitation::sendInvite($player->getId(), $me->getId(), $team->getId());
         Service::getDispatcher()->dispatch(Events::TEAM_INVITE, new TeamInviteEvent($invite));
         return new RedirectResponse($team->getUrl());
     }, "Are you sure you want to invite {$player->getEscapedUsername()} to {$team->getEscapedName()}?", "Player {$player->getUsername()} has been invited to {$team->getName()}");
 }
开发者ID:kleitz,项目名称:bzion,代码行数:15,代码来源:InvitationController.php

示例6: registerResult

 public function registerResult(Player $white, Player $black, $result)
 {
     $eloWhite = new Elo($white->getId(), $this->category);
     $eloBlack = new Elo($black->getId(), $this->category);
     if ($eloWhite->isProvisional()) {
         $adjustment = $this->getProvisionalAdjustment($eloBlack, $result);
         $eloWhite->appendProvisional($eloBlack->getElo() + $adjustment);
     } else {
         $adjustment = $this->getRatingAdjustmentFor($eloWhite, $eloBlack, $result);
         $eloWhite->setElo($eloWhite->getElo() + $adjustment);
     }
     $this->updateBlackElo($eloWhite, $eloBlack, $result);
     $eloWhite->commit();
     $eloBlack->commit();
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:15,代码来源:EloSetter.php

示例7: load

 public function load()
 {
     $this->clear();
     // Alfredo Rodriguez (Maryland)
     $player = new Player();
     $player->setFirstName('Alfredo');
     $player->setLastName('Rodriguez');
     $player->setHeight(72);
     $player->setWeight(180);
     $player->setBats('R');
     $player->setThrows('R');
     $player->setHometown('Oak Hill, Va.');
     $player->setCstvId(395839);
     $player->setNcaaId(993788);
     $player->save();
     print_r(sprintf("Created Player: %s (%s)\n", $player->getName(), $player->getId()));
 }
开发者ID:bigjoevtrj,项目名称:codeigniter-bootstrap,代码行数:17,代码来源:player.php

示例8: assertCanEdit

 /**
  * Make sure that a player can edit a conversation
  *
  * Throws an exception if a player is not an admin or the leader of a team
  * @throws HTTPException
  * @param  Player        $player  The player to test
  * @param  Group         $group   The team
  * @param  string        $message The error message to show
  * @return void
  */
 private function assertCanEdit(Player $player, Group $group, $message = "You are not allowed to edit the discussion")
 {
     if ($group->getCreator()->getId() != $player->getId()) {
         throw new ForbiddenException($message);
     }
 }
开发者ID:kleitz,项目名称:bzion,代码行数:16,代码来源:MessageController.php

示例9: getUser

 /**
  * Returned signed in user or empty Player instance when not signed in.
  * @return Player
  */
 public function getUser()
 {
     if (!isset($this->user)) {
         if (!$this->expired()) {
             $user = new Player($this->getUserId());
             $this->user = $user->getId() ? $user : null;
         }
         if (!isset($this->user)) {
             $this->user = new Player();
         }
     }
     return $this->user;
 }
开发者ID:manishkhanchandani,项目名称:mkgxy,代码行数:17,代码来源:Session.php

示例10: prune

 /**
  * Exclude object from result
  *
  * @param   Player $player Object to remove from the list of results
  *
  * @return PlayerQuery The current query, for fluid interface
  */
 public function prune($player = null)
 {
     if ($player) {
         $this->addUsingAlias(PlayerPeer::ID, $player->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
开发者ID:takisp,项目名称:bookingCourt,代码行数:14,代码来源:BasePlayerQuery.php

示例11: filterByPlayer

 /**
  * Filter the query by a related Player object
  *
  * @param   Player|PropelObjectCollection $player The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 PlayerCourtQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByPlayer($player, $comparison = null)
 {
     if ($player instanceof Player) {
         return $this->addUsingAlias(PlayerCourtPeer::PLAYER_ID, $player->getId(), $comparison);
     } elseif ($player instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PlayerCourtPeer::PLAYER_ID, $player->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByPlayer() only accepts arguments of type Player or PropelCollection');
     }
 }
开发者ID:takisp,项目名称:bookingCourt,代码行数:22,代码来源:BasePlayerCourtQuery.php

示例12: setPlayer

 /**
  * Declares an association between this object and a Player object.
  *
  * @param                  Player $v
  * @return PlayerCourt The current object (for fluent API support)
  * @throws PropelException
  */
 public function setPlayer(Player $v = null)
 {
     if ($v === null) {
         $this->setPlayerId(NULL);
     } else {
         $this->setPlayerId($v->getId());
     }
     $this->aPlayer = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Player object, it will not be re-added.
     if ($v !== null) {
         $v->addPlayerCourt($this);
     }
     return $this;
 }
开发者ID:takisp,项目名称:bookingCourt,代码行数:22,代码来源:BasePlayerCourt.php

示例13: setUp

 protected function setUp()
 {
     $this->connectToDatabase();
     $this->owner = $this->getNewPlayer();
     $this->key = ApiKey::createKey("Sample Key", $this->owner->getId());
 }
开发者ID:blast007,项目名称:bzion,代码行数:6,代码来源:ApiKeyTest.php

示例14: foreach

     $number_of_quests = 0;
     foreach ($config['site']['quests'] as $questName => $storageID) {
         $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
         $number_of_quests++;
         $main_content .= '<TR BGCOLOR="' . $bgcolor . '"><TD WIDTH=95%>' . $questName . '</TD>';
         if ($player->getStorage($storageID) === null) {
             $main_content .= '<TD><img src="images/false.png"/></TD></TR>';
         } else {
             $main_content .= '<TD><img src="images/true.png"/></TD></TR>';
         }
     }
     $main_content .= '</TABLE></td></tr></table><br />';
 }
 $deads = 0;
 //deaths list
 $player_deaths = $SQL->query('SELECT ' . $SQL->fieldName('id') . ', ' . $SQL->fieldName('date') . ', ' . $SQL->fieldName('level') . ' FROM ' . $SQL->tableName('player_deaths') . ' WHERE ' . $SQL->fieldName('player_id') . ' = ' . $player->getId() . ' ORDER BY ' . $SQL->fieldName('date') . ' DESC LIMIT 10');
 foreach ($player_deaths as $death) {
     $bgcolor = $number_of_rows++ % 2 == 1 ? $config['site']['darkborder'] : $config['site']['lightborder'];
     $deads++;
     $dead_add_content .= "<tr bgcolor=\"" . $bgcolor . "\"><td width=\"20%\" align=\"center\">" . date("j M Y, H:i", $death['date']) . "</td><td>";
     $killers = $SQL->query('SELECT ' . $SQL->tableName('environment_killers') . '.' . $SQL->fieldName('name') . ' AS monster_name, ' . $SQL->tableName('players') . '.' . $SQL->fieldName('name') . ' AS player_name, ' . $SQL->tableName('players') . '.' . $SQL->fieldName('deleted') . ' AS player_exists FROM ' . $SQL->tableName('killers') . ' LEFT JOIN ' . $SQL->tableName('environment_killers') . ' ON ' . $SQL->tableName('killers') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('environment_killers') . '.' . $SQL->fieldName('kill_id') . ' LEFT JOIN ' . $SQL->tableName('player_killers') . ' ON ' . $SQL->tableName('killers') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('player_killers') . '.' . $SQL->fieldName('kill_id') . ' LEFT JOIN ' . $SQL->tableName('players') . ' ON ' . $SQL->tableName('players') . '.' . $SQL->fieldName('id') . ' = ' . $SQL->tableName('player_killers') . '.' . $SQL->fieldName('player_id') . '  WHERE ' . $SQL->tableName('killers') . '.' . $SQL->fieldName('death_id') . ' = ' . $SQL->quote($death['id']) . ' ORDER BY ' . $SQL->tableName('killers') . '.' . $SQL->fieldName('final_hit') . ' DESC, ' . $SQL->tableName('killers') . '.' . $SQL->fieldName('id') . ' ASC')->fetchAll();
     $i = 0;
     $count = count($killers);
     foreach ($killers as $killer) {
         $i++;
         if ($i == 1) {
             if ($count <= 4) {
                 $dead_add_content .= "killed at level <b>" . $death['level'] . "</b> by ";
             } elseif ($count > 4 and $count < 10) {
                 $dead_add_content .= "slain at level <b>" . $death['level'] . "</b> by ";
             } elseif ($count > 9 and $count < 15) {
开发者ID:Pietia10,项目名称:Gesior-for-OTServ,代码行数:31,代码来源:characters.php

示例15: addPlayer

 public function addPlayer(Player $player)
 {
     $this->array[$player->getId()] = $player->cloneMe();
     //avoid collateral effects: when the object or array is an argument && it's saved in a structure
 }
开发者ID:Gritch69,项目名称:XG-Project,代码行数:5,代码来源:PlayerGroup.php


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