コード例 #1
0
ファイル: Game.php プロジェクト: virtalas/disc-golf-stats
 public function load_high_scorers()
 {
     $high_scorers_array = array();
     foreach ($this->scores as $playerid => $scores) {
         // playerid is i.e. 'player4'
         $playerid_int = (int) str_replace("player", "", $playerid);
         if (Score::new_high_score($this->gameid, $playerid_int, $this->courseid)) {
             $player = Player::find($playerid_int);
             $high_scorers_array[] = $player->firstname;
         }
     }
     $i = 1;
     $high_scorers_string = "";
     foreach ($high_scorers_array as $high_scorer) {
         $high_scorers_string .= $high_scorer;
         if ($i < count($high_scorers_array)) {
             $high_scorers_string .= ", ";
         }
         $i++;
     }
     $this->high_scorers = $high_scorers_string;
 }