function OnPageLoad() { echo "<h1>" . htmlentities($this->statistic->Title(), ENT_QUOTES, "UTF-8", false) . " " . htmlentities($this->filter, ENT_QUOTES, "UTF-8", false) . "</h1>"; $this->GetTheData("large"); if ($this->statistic->ShowDescription()) { require_once "markup/xhtml-markup.class.php"; echo XhtmlMarkup::ApplyParagraphs($this->statistic->Description()); } ?> <p> The statistics below are based on scorecards added to this website. If you know someone who's played better, add the scorecard for that match – see <a href="/play/manage/website/how-to-add-match-results/">How to add match results</a>. </p> <?php echo $this->filter_control; ?> <div class="pagedTable"> <?php echo $this->paging->GetNavigationBar(); switch ($this->which_statistic) { case "individual-scores": require_once 'stoolball/statistics/batting-innings-table.class.php'; echo new BattingInningsTable($this->data, true, $this->paging->GetFirstResultOnPage()); break; case "bowling-performances": require_once 'stoolball/statistics/bowling-performance-table.class.php'; echo new BowlingPerformanceTable($this->data, true, $this->paging->GetFirstResultOnPage()); break; case "most-catches-in-innings": require_once 'stoolball/statistics/player-performance-table.class.php'; $table = new PlayerPerformanceTable("Number of catches, highest first", $this->data, $this->paging->GetFirstResultOnPage(), true); $table->SetCssClass($table->GetCssClass() . " " . $this->statistic->CssClass()); echo $table; break; case "most-run-outs-in-innings": require_once 'stoolball/statistics/player-performance-table.class.php'; $table = new PlayerPerformanceTable("Number of run-outs, highest first", $this->data, $this->paging->GetFirstResultOnPage(), true); $table->SetCssClass($table->GetCssClass() . " " . $this->statistic->CssClass()); echo $table; break; case "most-wickets-by-bowler-and-catcher": require_once 'stoolball/statistics/bowler-catcher-table.class.php'; echo new BowlerCatcherTable($this->data, $this->paging->GetFirstResultOnPage()); break; case "player-performances": case "player-of-match": require_once 'stoolball/statistics/player-performance-table.class.php'; echo new PlayerPerformanceTable("Player performances, most recent first", $this->data, $this->paging->GetFirstResultOnPage(), false); break; default: require_once 'stoolball/statistics/player-statistics-table.class.php'; $headers = $this->statistic->ColumnHeaders(); $table = new PlayerStatisticsTable($this->statistic->Title(), $headers[0], $this->data, true, $this->paging->GetFirstResultOnPage()); $table->SetCssClass($table->GetCssClass() . " " . $this->statistic->CssClass()); echo $table; break; } if ($this->paging->GetTotalResults()) { echo $this->paging->GetNavigationBar(); } ?> </div> <?php $this->GetTheData("small"); }
} } } if ($has_catch_stats or $has_run_outs) { echo '<h2>Fielding statistics</h2>'; if ($has_catch_stats) { $table = new PlayerStatisticsTable("Most catches", "Catches", $this->statistics["most_catches"]); $table->SetCssClass("bowling"); echo $table; if ($has_catch_stats >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-catches' . $statistics_query . '">Most catches – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/most-catches-in-innings' . $statistics_query . '">Most catches in an innings</a></p>'; } if ($has_run_outs) { $table = new PlayerStatisticsTable("Most run-outs", "Run-outs", $this->statistics["most_run_outs"]); $table->SetCssClass("bowling"); echo $table; if ($has_run_outs >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-run-outs' . $statistics_query . '">Most run-outs – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/most-run-outs-in-innings' . $statistics_query . '">Most run-outs in an innings</a></p>'; } } echo '<h2>All-round performance statistics</h2>'; if ($has_player_of_match_stats) { echo new PlayerStatisticsTable("Most player of the match nominations", "Nominations", $this->statistics["most_player_of_match"]); if ($has_player_of_match_stats >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-player-of-match' . $statistics_query . '">Most player of the match nominations – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/player-of-match' . $statistics_query . '">Player of the match nominations</a></p>';
function OnPageLoad() { require_once 'stoolball/statistics-calculator.class.php'; $calculator = new StatisticsCalculator(); $calculator->AnalyseMatchData($this->stats, $this->team); $title = "Team statistics for " . $this->team->GetNameAndType(); if ($this->season) { $title .= " in the {$this->season} season"; } echo "<h1>" . htmlentities($title, ENT_QUOTES, "UTF-8", false) . "</h1>"; # See what stats we've got available $has_team_stats = $calculator->EnoughDataForStats($this->season); $has_most_runs = count($this->most_runs); $has_most_wickets = count($this->most_wickets); $has_catch_stats = count($this->most_catches); $has_run_outs = count($this->most_run_outs); $has_player_of_match_stats = count($this->most_player_of_match); $has_player_stats = ($has_most_runs or $has_most_wickets or $has_catch_stats or $has_run_outs or $has_player_of_match_stats); require_once 'xhtml/navigation/tabs.class.php'; $tabs = array('Summary' => $this->team->GetNavigateUrl()); if ($has_player_stats) { $tabs['Players'] = $this->team->GetPlayersNavigateUrl(); } $tabs['Statistics'] = ''; echo new Tabs($tabs); ?> <div class="box tab-box"> <div class="dataFilter"></div> <div class="box-content"> <?php if (!$has_team_stats and !$has_player_stats) { $scope = $this->team->GetNameAndType(); if ($this->season) { $scope .= " in the {$this->season} season"; } $scope = htmlentities($scope, ENT_QUOTES, "UTF-8", false); echo "<p>There aren't any statistics for {$scope} yet.</p>" . '<p>To find out how to add them, see <a href="/play/manage/website/matches-and-results-why-you-should-add-yours/">Matches and results - why you should add yours</a>.</p>'; } else { require_once 'stoolball/team-runs-table.class.php'; require_once 'stoolball/statistics/player-statistics-table.class.php'; echo '<div class="statsGroup">'; if ($has_team_stats or $has_most_runs) { echo '<div class="statsColumns"> <h2>Batting statistics</h2> <div class="statsColumn">'; if ($has_most_runs) { echo new PlayerStatisticsTable("Most runs", "Runs", $this->most_runs, false); if ($has_most_runs >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-runs' . $this->statistics_query . '">Most runs – view all and filter</a></p>'; } } echo "</div><div class=\"statsColumn\">"; if ($has_team_stats) { echo new TeamRunsTable($calculator->TotalMatchesWithRunData($this->season), $calculator->RunsScored($this->season), $calculator->RunsConceded($this->season), $calculator->HighestInnings($this->season), $calculator->LowestInnings($this->season), $calculator->AverageInnings($this->season)); } if ($has_most_runs) { echo '<p class="statsViewAll"><a href="/play/statistics/individual-scores' . $this->statistics_query . '">Individual scores</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/most-scores-of-100' . $this->statistics_query . '">Most scores of 100 or more</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/most-scores-of-50' . $this->statistics_query . '">Most scores of 50 or more</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/batting-average' . $this->statistics_query . '">Batting averages</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/batting-strike-rate' . $this->statistics_query . '">Batting strike rates</a></p>'; } echo "</div></div>"; } if ($has_most_wickets or $has_team_stats) { echo '<div class="statsColumns"> <h2>Bowling statistics and match results</h2> <div class="statsColumn">'; if ($has_most_wickets) { # Show top bowlers $table = new PlayerStatisticsTable("Most wickets", "Wickets", $this->most_wickets, false); $table->SetCssClass($table->GetCssClass() . " bowling"); echo $table; if ($has_most_wickets >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-wickets' . $this->statistics_query . '">Most wickets – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/most-5-wickets' . $this->statistics_query . '">Most times taking 5 wickets in an innings</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/most-wickets-by-bowler-and-catcher' . $this->statistics_query . '">Most wickets by a bowling and catching combination</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/bowling-performances' . $this->statistics_query . '">Bowling performances</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/bowling-average' . $this->statistics_query . '">Bowling averages</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/economy-rate' . $this->statistics_query . '">Economy rates</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/bowling-strike-rate' . $this->statistics_query . '">Bowling strike rates</a></p>'; } ?> </div><div class="statsColumn"> <span class="chart-js-template" id="all-results-chart"></span> <span class="chart-js-template" id="home-results-chart"></span> <span class="chart-js-template" id="away-results-chart"></span> </div></div> <?php } ?> <span class="chart-js-template" id="opponents-chart"></span><?php if ($has_catch_stats or $has_run_outs) { echo '<div class="statsColumns"> <h2>Fielding statistics</h2> <div class="statsColumn">'; if ($has_catch_stats) { # Show top catchers $table = new PlayerStatisticsTable("Most catches", "Catches", $this->most_catches, false); $table->SetCssClass($table->GetCssClass() . " bowling"); echo $table; if ($has_catch_stats >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-catches' . $this->statistics_query . '">Most catches – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/most-catches-in-innings' . $this->statistics_query . '">Most catches in an innings – view all and filter</a></p>'; } echo "</div><div class=\"statsColumn\">"; if ($has_run_outs) { $table = new PlayerStatisticsTable("Most run-outs", "Run-outs", $this->most_run_outs, false); $table->SetCssClass($table->GetCssClass() . " bowling"); echo $table; if ($has_run_outs >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-run-outs' . $this->statistics_query . '">Most run-outs – view all and filter</a></p>'; } echo '<p class="statsViewAll"><a href="/play/statistics/most-run-outs-in-innings' . $this->statistics_query . '">Most run-outs in an innings – view all and filter</a></p>'; } echo "</div></div>"; } echo '<h2>All-round performance statistics</h2>'; if ($has_player_of_match_stats) { echo new PlayerStatisticsTable("Most player of the match nominations", "Nominations", $this->most_player_of_match, false); echo '<p class="statsViewAll"><a href="/play/statistics/player-performances' . $this->statistics_query . '">Player performances – view all and filter</a></p>'; echo '<p class="statsViewAll"><a href="/play/statistics/player-of-match' . $this->statistics_query . '">Player of the match nominations – view all and filter</a></p>'; if ($has_player_of_match_stats >= 10) { echo '<p class="statsViewAll"><a href="/play/statistics/most-player-of-match' . $this->statistics_query . '">Most player of the match nominations – view all and filter</a></p>'; } } else { echo '<p><a href="/play/statistics/player-performances' . $this->statistics_query . '">Player performances – view all and filter</a></p>'; } echo "</div>"; # close statsGroup # Link to other seasons if (count($calculator->SeasonYears()) > 1) { echo new XhtmlElement('h2', 'More statistics for ' . htmlentities($this->team->GetName(), ENT_QUOTES, "UTF-8", false)); echo '<div class="season-list"><ul>'; if ($this->season) { echo "<li><a href=\"" . htmlentities($this->team->GetStatsNavigateUrl(), ENT_QUOTES, "UTF-8", false) . "\">All seasons</a></li>"; } foreach ($calculator->SeasonYears() as $season_years) { $season_url = str_replace("/", "-", $season_years); # Link to season if it's not the current season. Important to use !== because # we're comparing numeric strings and with != 2009-10 is equal to 2009 if (!isset($_GET['params']) or $season_url !== $_GET["params"]) { echo "<li><a href=\"" . htmlentities($this->team->GetStatsNavigateUrl() . "/" . $season_url, ENT_QUOTES, "UTF-8", false) . "\">" . htmlentities($season_years, ENT_QUOTES, "UTF-8", false) . " season</a></li>"; } } echo "</ul></div>"; } } ?> </div> </div> <?php }