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


PHP Game::player_high_scores方法代码示例

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


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

示例1: stats

 public static function stats()
 {
     $player = self::get_user_logged_in();
     $url = $_SERVER['REQUEST_URI'];
     $stripped_url = preg_replace("/[^A-Za-z0-9 ]/", '', $url);
     if ($player) {
         $stripped_url .= $player->playerid;
     }
     // Fetch page from cache
     $cached_page = Cache::getPage($stripped_url);
     if ($cached_page != null && Cache::on()) {
         // Use cached page (which is up to date because outdated pages are deleted)
         echo $cached_page;
     } else {
         // Make page from scratch
         $high_scores = null;
         if ($player) {
             $high_scores = Game::player_high_scores($player->playerid);
         }
         $game_count = Game::count_all();
         $throw_count = Score::count_all();
         $latest_game = Game::latest_game();
         $popular_courses = Course::popular_courses_all_players();
         $page_html = View::make("stats/stats.html", array('game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'popular_courses' => $popular_courses, 'player' => $player, 'high_scores' => $high_scores));
         if (Cache::on()) {
             // Don't include the page message in the cached file
             $page_html = Cache::strip_tags_content($page_html, "message-success");
             Cache::store($stripped_url, $page_html);
         }
     }
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:31,代码来源:stats_controller.php

示例2: stats

 public static function stats()
 {
     $game_count = Game::count_all();
     $throw_count = Score::count_all();
     $latest_game = Game::latest_game();
     $player_game_count = null;
     $player_throw_count = null;
     $player_latest_game = null;
     $high_scores = null;
     if (isset($_SESSION['user'])) {
         $playerid = $_SESSION['user'];
         $player_game_count = Game::count_all_player_games($playerid);
         $player_throw_count = Score::count_all_player_scores($playerid);
         $player_latest_game = Game::latest_player_game($playerid);
         $high_scores = Game::player_high_scores($playerid);
     }
     View::make("stats/stats.html", array('game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'player_game_count' => $player_game_count, 'player_throw_count' => $player_throw_count, 'player_latest_game' => $player_latest_game, 'high_scores' => $high_scores));
 }
开发者ID:rryanburton,项目名称:Tsoha-Bootstrap,代码行数:18,代码来源:stats_controller.php

示例3: index

 public static function index()
 {
     $url = $_SERVER['REQUEST_URI'];
     $stripped_url = preg_replace("/[^A-Za-z0-9 ]/", '', $url);
     // Fetch page from cache
     $cached_page = Cache::getPage($stripped_url);
     if ($cached_page != null && Cache::on()) {
         // Use cached page (which is up to date because outdated pages are deleted)
         echo $cached_page;
     } else {
         // Make page from scratch
         $player = Player::find($_GET['player']);
         $game_count = Game::count_all_player_games($player->playerid);
         $latest_game = Game::latest_player_game($player->playerid);
         $high_scores = Game::player_high_scores($player->playerid);
         $years = Game::game_years();
         $popular_courses = Course::popular_courses($player->playerid);
         $throw_count = Score::count_all_player_scores($player->playerid);
         $birdies = Score::players_birdies($player->playerid);
         $aces = Score::players_aces($player->playerid);
         $courses_avg_scores = array();
         $names_done = false;
         foreach ($years as $year) {
             $avg_scores_by_year = Course::average_player_scoring_by_year($player->playerid, $year);
             for ($i = 0; $i < count($avg_scores_by_year); $i++) {
                 if (!$names_done) {
                     $averages = array();
                     $averages[] = $avg_scores_by_year[$i]['name'];
                     $courses_avg_scores[] = $averages;
                 }
                 if ($avg_scores_by_year[$i]['avg_score'] != null) {
                     $courses_avg_scores[$i][] = $avg_scores_by_year[$i]['avg_score'] . " (" . str_replace(" ", "", $avg_scores_by_year[$i]['to_par']) . ")";
                 } else {
                     $courses_avg_scores[$i][] = "";
                 }
             }
             $names_done = true;
         }
         $page_html = View::make('player/index.html', array('player' => $player, 'players' => Player::all(), 'game_count' => $game_count, 'throw_count' => $throw_count, 'latest_game' => $latest_game, 'high_scores' => $high_scores, 'popular_courses' => $popular_courses, 'birdies' => $birdies, 'aces' => $aces, 'years' => $years, 'courses_avg_scores' => $courses_avg_scores));
         if (Cache::on()) {
             Cache::store($stripped_url, $page_html);
         }
     }
 }
开发者ID:virtalas,项目名称:disc-golf-stats,代码行数:44,代码来源:player_controller.php


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