コード例 #1
0
ファイル: GroupJoinEvent.php プロジェクト: bchhun/bzion
 /**
  * {@inheritDoc}
  */
 public function unserialize($data)
 {
     $data = unserialize($data);
     $group = \Group::get($data['group']);
     $players = \Player::arrayIdToModel($data['players']);
     $teams = \Team::arrayIdToModel($data['teams']);
     $this->__construct($group, array_merge($players, $teams));
 }
コード例 #2
0
 /**
  * {@inheritdoc}
  */
 public function unserialize($data)
 {
     $data = unserialize($data);
     $conversation = \Conversation::get($data['conversation']);
     $players = \Player::arrayIdToModel($data['players']);
     $teams = \Team::arrayIdToModel($data['teams']);
     $this->__construct($conversation, array_merge($players, $teams));
 }
コード例 #3
0
ファイル: Conversation.php プロジェクト: allejo/bzion
 /**
  * Get the members of one of the conversation's teams that don't belong in
  * the conversation
  *
  * @todo   Use Model::createFromDatabaseResults()
  * @param  Team $team The team to check
  * @return Player[]
  */
 public function getMissingTeamMembers(Team $team)
 {
     $query = "SELECT players.id AS id FROM players\n            WHERE players.team = ?\n            AND players.id NOT IN (\n              SELECT player_conversations.player FROM player_conversations\n              WHERE player_conversations.conversation = ?\n            )";
     $results = $this->db->query($query, array($team->getId(), $this->id));
     return Player::arrayIdToModel(array_column($results, 'id'));
 }
コード例 #4
0
ファイル: Group.php プロジェクト: kleitz/bzion
 /**
  * Get a list containing each member of the group
  * @param  int|null $hide The ID of a player to ignore
  * @return Model[]  An array of players and teams
  */
 public function getMembers($hide = null)
 {
     $members = Player::arrayIdToModel($this->getPlayerIds($hide, true));
     usort($members, Player::getAlphabeticalSort());
     $teams = Team::arrayIdToModel($this->getTeamIds());
     usort($teams, Team::getAlphabeticalSort());
     return array_merge($members, $teams);
 }
コード例 #5
0
ファイル: Match.php プロジェクト: allejo/bzion
 /**
  * Get an array of players based on a string representation
  * @param string $playerString
  * @return Player[]|null Returns null if there were no players recorded for this match
  */
 private function parsePlayers($playerString)
 {
     if ($playerString == null) {
         return null;
     }
     return Player::arrayIdToModel(explode(",", $playerString));
 }
コード例 #6
0
ファイル: Role.php プロジェクト: blast007/bzion
 /**
  * Get an array of players who have this role assigned to them
  *
  * @return Player[] An array of players with this role assigned to them
  */
 public function getUsers()
 {
     return Player::arrayIdToModel(parent::fetchIds("JOIN player_roles ON player_roles.role_id = roles.id WHERE player_roles.role_id = ?", "i", array($this->getId()), "roles", "player_roles.user_id"));
 }