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


PHP Player::canEdit方法代码示例

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


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

示例1: editAction

 public function editAction(Player $player, Player $me)
 {
     if (!$me->canEdit($player)) {
         throw new ForbiddenException("You are not allowed to edit other players");
     }
     $params = array('me' => $player, 'self' => false);
     return $this->forward('edit', $params, 'Profile');
 }
开发者ID:bchhun,项目名称:bzion,代码行数:8,代码来源:PlayerController.php

示例2: showAction

 public function showAction(Server $server, Player $me, Request $request)
 {
     if ($server->staleInfo()) {
         $server->forceUpdate();
     }
     if ($request->get('forced') && $me->canEdit($server)) {
         $server->forceUpdate();
     }
     return array("server" => $server);
 }
开发者ID:kleitz,项目名称:bzion,代码行数:10,代码来源:ServerController.php

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

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

示例5: canEdit

 /**
  * Find whether a player can edit a model
  *
  * @param  Player          $player The player who wants to delete the model
  * @param  PermissionModel $model  The model which will be edited
  * @return bool
  */
 protected function canEdit($player, $model)
 {
     return $player->canEdit($model);
 }
开发者ID:allejo,项目名称:bzion,代码行数:11,代码来源:CRUDController.php

示例6: teamLeaveAction

 public function teamLeaveAction(Player $me, Conversation $conversation)
 {
     $team = $me->getTeam();
     if (!$me->canEdit($team)) {
         throw new ForbiddenException("You are not allowed to remove your team from this conversation.");
     } elseif (!$conversation->isMember($team)) {
         throw new ForbiddenException("That team is not participating in this conversation.");
     }
     return $this->showConfirmationForm(function () use($conversation, $team) {
         $conversation->removeMember($team);
         $event = new ConversationAbandonEvent($conversation, $team);
         Service::getDispatcher()->dispatch(Events::CONVERSATION_ABANDON, $event);
         return new RedirectResponse($conversation->getURL());
     }, "Are you sure you want to remove {$team->getEscapedName()} from this conversation?", "Your team is no longer participating in that conversation.", "Remove team");
 }
开发者ID:allejo,项目名称:bzion,代码行数:15,代码来源:MessageController.php

示例7: assertCanEdit

 /**
  * Make sure that a player can edit a team
  *
  * 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  Team          $team    The team
  * @param  string        $message The error message to show
  * @return void
  */
 private function assertCanEdit(Player $player, Team $team, $message = "You are not allowed to edit that team")
 {
     if (!$player->canEdit($team)) {
         throw new ForbiddenException($message);
     }
 }
开发者ID:kleitz,项目名称:bzion,代码行数:16,代码来源:TeamController.php


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