public function OnPageLoad()
 {
     if ($this->not_found) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
         return;
     }
     if ($this->regenerating) {
         echo $this->regenerating_control;
         return;
     }
     # Container element for structured data
     echo '<div typeof="schema:Person" about="' . htmlentities($this->player->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false) . '">';
     $querystring = '?player=' . $this->player->GetId();
     if ($_SERVER["QUERY_STRING"]) {
         $querystring = htmlspecialchars('?' . $_SERVER["QUERY_STRING"]);
     }
     require_once "stoolball/statistics/player-summary-control.class.php";
     echo new \Stoolball\Statistics\PlayerSummaryControl($this->player, $this->filter, $this->filter_matched_nothing, $querystring);
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         require_once 'xhtml/navigation/tabs.class.php';
         $tabs = array('Batting' => '', 'Bowling and fielding' => $this->player->GetPlayerUrl() . '/bowling');
         echo new Tabs($tabs);
         ?>
         <div class="box tab-box">
             <div class="dataFilter"></div>
             <div class="box-content">
         <?php 
     }
     # Filter control
     echo $this->filter_control;
     # Batting stats
     if ($this->player->TotalBattingInnings()) {
         //echo "<h2>Batting</h2>";
         # Overview table
         $batting_table = new XhtmlTable();
         $batting_table->SetCssClass("numeric");
         $batting_table->SetCaption("Batting");
         $batting_heading_row = new XhtmlRow(array('<abbr title="Innings" class="small">Inn</abbr><span class="large">Innings</span>', "Not out", "Runs", "50s", "100s", "Best", '<abbr title="Average" class="small">Avg</abbr><span class="large">Average</span>', '<abbr title="Strike rate" class="small">S/R</abbr><span class="large">Strike rate</span>'));
         $batting_heading_row->SetIsHeader(true);
         $batting_table->AddRow($batting_heading_row);
         $batting_table->AddRow(new XhtmlRow(array($this->player->TotalBattingInnings(), $this->player->NotOuts(), $this->player->TotalRuns(), $this->player->Fifties(), $this->player->Centuries(), $this->player->BestBatting(), is_null($this->player->BattingAverage()) ? "&#8211;" : $this->player->BattingAverage(), is_null($this->player->BattingStrikeRate()) ? "&#8211;" : $this->player->BattingStrikeRate())));
         echo $batting_table;
         if ($this->player->TotalBattingInnings()) {
             echo '<p class="statsViewAll"><a href="/play/statistics/individual-scores' . $querystring . '">Individual scores &#8211; view all and filter</a></p>';
         }
         ?>
         <span class="chart-js-template" id="score-spread-chart"></span>
         <span class="chart-js-template" id="batting-form-chart"></span>
         <span class="chart-js-template" id="dismissals-chart"></span>
         <?php 
     }
     $this->ShowSocial();
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         ?>
         </div>
         </div>
         <?php 
     }
     # End container for structured data
     echo "</div>";
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         $has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $this->player->Team()->GetLinkedDataUri());
         $has_admin_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_PLAYERS);
         if ($has_permission) {
             $this->AddSeparator();
             $panel = new UserEditPanel($this->GetSettings());
             $panel->AddLink("rename this player", $this->player->GetEditUrl());
             if ($has_admin_permission) {
                 $panel->AddLink("delete this player", $this->player->GetDeleteUrl());
             }
             echo $panel;
         }
     }
 }
 /**
  * Sets up controls for pages 2/3 of the wizard
  * @param Match $match
  * @param Team $batting_team
  * @param Collection $batting_data
  * @param Team $bowling_team
  * @param Collection $bowling_data
  * @param int $total
  * @param int $wickets_taken
  * @return void
  */
 private function CreateScorecardControls(Match $match, Team $batting_team, Collection $batting_data, Team $bowling_team, Collection $bowling_data, $total, $wickets_taken)
 {
     require_once "xhtml/tables/xhtml-table.class.php";
     $batting_table = new XhtmlTable();
     $batting_table->SetCaption($batting_team->GetName() . "'s batting");
     $batting_table->SetCssClass("scorecard scorecardEditor batting");
     $out_by_header = new XhtmlCell(true, '<span class="small">Fielder</span><span class="large">Caught<span class="wrapping-hair-space"> </span>/<span class="wrapping-hair-space"> </span><span class="nowrap">run-out by</span></span>');
     $out_by_header->SetCssClass("dismissedBy");
     $bowler_header = new XhtmlCell(true, "Bowler");
     $bowler_header->SetCssClass("bowler");
     $score_header = new XhtmlCell(true, "Runs");
     $score_header->SetCssClass("numeric");
     $balls_header = new XhtmlCell(true, "Balls");
     $balls_header->SetCssClass("numeric");
     $batting_headings = new XhtmlRow(array("Batsman", "How out", $out_by_header, $bowler_header, $score_header, $balls_header));
     $batting_headings->SetIsHeader(true);
     $batting_table->AddRow($batting_headings);
     $batting_data->ResetCounter();
     $byes = null;
     $wides = null;
     $no_balls = null;
     $bonus = null;
     # Loop = max players + 4, because if you have a full scorecard you have to keep looping to get the 4 extras players
     for ($i = 1; $i <= $match->GetMaximumPlayersPerTeam() + 4; $i++) {
         $batting = $batting_data->MoveNext() ? $batting_data->GetItem() : null;
         /* @var $batting Batting */
         # Grab the scores for extras players to use later
         if (!is_null($batting)) {
             switch ($batting->GetPlayer()->GetPlayerRole()) {
                 case Player::BYES:
                     $byes = $batting->GetRuns();
                     break;
                 case Player::WIDES:
                     $wides = $batting->GetRuns();
                     break;
                 case Player::NO_BALLS:
                     $no_balls = $batting->GetRuns();
                     break;
                 case Player::BONUS_RUNS:
                     $bonus = $batting->GetRuns();
                     break;
             }
         }
         # Don't write a table row for the last four loops, we'll do that next because they're different
         if ($i <= $match->GetMaximumPlayersPerTeam()) {
             $player = new TextBox("batName{$i}", (is_null($batting) or !$batting->GetPlayer()->GetPlayerRole() == Player::PLAYER) ? "" : $batting->GetPlayer()->GetName(), $this->IsValidSubmit());
             $player->SetMaxLength(100);
             $player->AddAttribute("autocomplete", "off");
             $player->AddCssClass("player batsman team" . $batting_team->GetId());
             $how = new XhtmlSelect("batHowOut{$i}", null, $this->IsValidSubmit());
             $how->SetCssClass("howOut");
             $how->AddOptions(array(Batting::DID_NOT_BAT => Batting::Text(Batting::DID_NOT_BAT), Batting::NOT_OUT => Batting::Text(Batting::NOT_OUT), Batting::CAUGHT => Batting::Text(Batting::CAUGHT), Batting::BOWLED => Batting::Text(Batting::BOWLED), Batting::CAUGHT_AND_BOWLED => str_replace(" and ", "/", Batting::Text(Batting::CAUGHT_AND_BOWLED)), Batting::RUN_OUT => Batting::Text(Batting::RUN_OUT), Batting::BODY_BEFORE_WICKET => "bbw", Batting::HIT_BALL_TWICE => Batting::Text(Batting::HIT_BALL_TWICE), Batting::TIMED_OUT => Batting::Text(Batting::TIMED_OUT), Batting::RETIRED_HURT => Batting::Text(Batting::RETIRED_HURT), Batting::RETIRED => Batting::Text(Batting::RETIRED), Batting::UNKNOWN_DISMISSAL => Batting::Text(Batting::UNKNOWN_DISMISSAL)), null);
             if (!is_null($batting) and $batting->GetPlayer()->GetPlayerRole() == Player::PLAYER and $this->IsValidSubmit()) {
                 $how->SelectOption($batting->GetHowOut());
             }
             $out_by = new TextBox("batOutBy{$i}", (is_null($batting) or is_null($batting->GetDismissedBy()) or !$batting->GetDismissedBy()->GetPlayerRole() == Player::PLAYER) ? "" : $batting->GetDismissedBy()->GetName(), $this->IsValidSubmit());
             $out_by->SetMaxLength(100);
             $out_by->AddAttribute("autocomplete", "off");
             $out_by->AddCssClass("player team" . $bowling_team->GetId());
             $bowled_by = new TextBox("batBowledBy{$i}", (is_null($batting) or is_null($batting->GetBowler()) or !$batting->GetBowler()->GetPlayerRole() == Player::PLAYER) ? "" : $batting->GetBowler()->GetName(), $this->IsValidSubmit());
             $bowled_by->SetMaxLength(100);
             $bowled_by->AddAttribute("autocomplete", "off");
             $bowled_by->AddCssClass("player team" . $bowling_team->GetId());
             $runs = new TextBox("batRuns{$i}", (is_null($batting) or $batting->GetPlayer()->GetPlayerRole() != Player::PLAYER) ? "" : $batting->GetRuns(), $this->IsValidSubmit());
             $runs->SetCssClass("numeric runs");
             $runs->AddAttribute("type", "number");
             $runs->AddAttribute("min", "0");
             $runs->AddAttribute("autocomplete", "off");
             $balls = new TextBox("batBalls{$i}", (is_null($batting) or $batting->GetPlayer()->GetPlayerRole() != Player::PLAYER) ? "" : $batting->GetBallsFaced(), $this->IsValidSubmit());
             $balls->SetCssClass("numeric balls");
             $balls->AddAttribute("type", "number");
             $balls->AddAttribute("min", "0");
             $balls->AddAttribute("autocomplete", "off");
             $batting_row = new XhtmlRow(array($player, $how, $out_by, $bowled_by, $runs, $balls));
             $batting_row->GetFirstCell()->SetCssClass("batsman");
             $batting_table->AddRow($batting_row);
         }
     }
     $batting_table->AddRow($this->CreateExtrasRow("batByes", "Byes", "extras", "numeric runs", $byes));
     $batting_table->AddRow($this->CreateExtrasRow("batWides", "Wides", "extras", "numeric runs", $wides));
     $batting_table->AddRow($this->CreateExtrasRow("batNoBalls", "No balls", "extras", "numeric runs", $no_balls));
     $batting_table->AddRow($this->CreateExtrasRow("batBonus", "Bonus or penalty runs", "extras", "numeric runs", $bonus));
     $batting_table->AddRow($this->CreateExtrasRow("batTotal", "Total", "totals", "numeric", $total));
     $batting_table->AddRow($this->CreateWicketsRow($match, $wickets_taken));
     $this->AddControl($batting_table);
     $total_batsmen = new TextBox("batRows", $match->GetMaximumPlayersPerTeam(), $this->IsValidSubmit());
     $total_batsmen->SetMode(TextBoxMode::Hidden());
     $this->AddControl($total_batsmen);
     $bowling_table = new XhtmlTable();
     $bowling_table->SetCaption($bowling_team->GetName() . "'s bowling, over-by-over");
     $bowling_table->SetCssClass("scorecard scorecardEditor bowling-scorecard bowling");
     $over_header = new XhtmlCell(true, 'Balls bowled <span class="qualifier">(excluding extras)</span>');
     $over_header->SetCssClass("numeric balls");
     $wides_header = new XhtmlCell(true, "Wides");
     $wides_header->SetCssClass("numeric");
     $no_balls_header = new XhtmlCell(true, "No balls");
     $no_balls_header->SetCssClass("numeric");
     $runs_header = new XhtmlCell(true, "Over total");
     $runs_header->SetCssClass("numeric");
     $bowling_headings = new XhtmlRow(array("Bowler", $over_header, $wides_header, $no_balls_header, $runs_header));
     $bowling_headings->SetIsHeader(true);
     $bowling_table->AddRow($bowling_headings);
     $bowling_data->ResetCounter();
     for ($i = 1; $i <= $match->GetOvers(); $i++) {
         $bowling = $bowling_data->MoveNext() ? $bowling_data->GetItem() : null;
         /* @var $bowling Over */
         $blank_row = (is_null($bowling) or is_null($bowling->GetOverNumber()));
         // don't list records generated from batting card to record wickets taken
         $player = new TextBox("bowlerName{$i}", $blank_row ? "" : $bowling->GetPlayer()->GetName(), $this->IsValidSubmit());
         $player->SetMaxLength(100);
         $player->AddAttribute("autocomplete", "off");
         $player->AddCssClass("player team" . $bowling_team->GetId());
         $balls = new TextBox("bowlerBalls{$i}", $blank_row ? "" : $bowling->GetBalls(), $this->IsValidSubmit());
         $balls->AddAttribute("autocomplete", "off");
         $balls->AddAttribute("type", "number");
         $balls->AddAttribute("min", "0");
         $balls->AddAttribute("max", "10");
         $balls->SetCssClass("numeric balls");
         $wides = new TextBox("bowlerWides{$i}", $blank_row ? "" : $bowling->GetWides(), $this->IsValidSubmit());
         $wides->AddAttribute("autocomplete", "off");
         $wides->AddAttribute("type", "number");
         $wides->AddAttribute("min", "0");
         $wides->SetCssClass("numeric wides");
         $no_balls = new TextBox("bowlerNoBalls{$i}", $blank_row ? "" : $bowling->GetNoBalls(), $this->IsValidSubmit());
         $no_balls->AddAttribute("autocomplete", "off");
         $no_balls->AddAttribute("type", "number");
         $no_balls->AddAttribute("min", "0");
         $no_balls->SetCssClass("numeric no-balls");
         $runs = new TextBox("bowlerRuns{$i}", $blank_row ? "" : $bowling->GetRunsInOver(), $this->IsValidSubmit());
         $runs->AddAttribute("autocomplete", "off");
         $runs->AddAttribute("type", "number");
         $runs->AddAttribute("min", "0");
         $runs->SetCssClass("numeric runs");
         $bowling_row = new XhtmlRow(array($player, $balls, $wides, $no_balls, $runs));
         $bowling_row->GetFirstCell()->SetCssClass("bowler");
         $bowling_table->AddRow($bowling_row);
     }
     $this->AddControl($bowling_table);
     $total_overs = new TextBox("bowlerRows", $match->GetOvers(), $this->IsValidSubmit());
     $total_overs->SetMode(TextBoxMode::Hidden());
     $this->AddControl($total_overs);
     if ($match->GetLastAudit() != null) {
         require_once "data/audit-control.class.php";
         $this->AddControl(new AuditControl($match->GetLastAudit(), "match"));
     }
     $home_batted_first = "";
     if (!is_null($match->Result()->GetHomeBattedFirst())) {
         $home_batted_first = (int) $match->Result()->GetHomeBattedFirst();
     }
     $teams = new TextBox("teams", $home_batted_first . ScorecardEditControl::DATA_SEPARATOR . $match->GetHomeTeamId() . ScorecardEditControl::DATA_SEPARATOR . $match->GetHomeTeam()->GetName() . ScorecardEditControl::DATA_SEPARATOR . $match->GetAwayTeamId() . ScorecardEditControl::DATA_SEPARATOR . $match->GetAwayTeam()->GetName() . ScorecardEditControl::DATA_SEPARATOR . $match->GetTitle());
     $teams->SetMode(TextBoxMode::Hidden());
     $this->AddControl($teams);
 }
 /**
  * Creates a bowling scorecard for one innings with as much data as is available
  * @param Match $match
  * @param bool $is_home_innings
  * @return void
  */
 private function CreateBowlingCard(Match $match, $is_home_innings)
 {
     $overs_data = $is_home_innings ? $match->Result()->AwayOvers() : $match->Result()->HomeOvers();
     $bowling_data = $is_home_innings ? $match->Result()->AwayBowling() : $match->Result()->HomeBowling();
     $bowling_team = $is_home_innings ? $match->GetAwayTeam() : $match->GetHomeTeam();
     # First, bowler's figures
     if ($bowling_data->GetCount()) {
         $bowling_table = new XhtmlTable();
         $bowling_table->SetCaption(htmlentities($bowling_team->GetName() . "'s bowlers", ENT_QUOTES, "UTF-8", false));
         $bowling_table->SetCssClass("bowling scorecard");
         $over_header = new XhtmlCell(true, '<abbr title="Overs" class="small">Ov</abbr><span class="large">Overs</span>');
         $over_header->SetCssClass("numeric");
         $maidens_header = new XhtmlCell(true, '<abbr title="Maiden overs" class="small">Md</abbr><abbr title="Maiden overs" class="large">Mdns</abbr>');
         $maidens_header->SetCssClass("numeric");
         $runs_header = new XhtmlCell(true, "Runs");
         $runs_header->SetCssClass("numeric");
         $wickets_header = new XhtmlCell(true, '<abbr title="Wickets" class="small">Wk</abbr><abbr title="Wickets" class="large">Wkts</abbr>');
         $wickets_header->SetCssClass("numeric");
         $economy_header = new XhtmlCell(true, '<abbr title="Economy" class="small">Econ</abbr><span class="large">Economy</span>');
         $economy_header->SetCssClass("numeric");
         $average_header = new XhtmlCell(true, '<abbr title="Average" class="small">Avg</abbr><span class="large">Average</span>');
         $average_header->SetCssClass("numeric");
         $strike_header = new XhtmlCell(true, '<abbr title="Strike rate" class="small">S/R</abbr><span class="large">Strike rate</span>');
         $strike_header->SetCssClass("numeric");
         $bowling_headings = new XhtmlRow(array("Bowler", $over_header, $maidens_header, $runs_header, $wickets_header, $economy_header, $average_header, $strike_header));
         $bowling_headings->SetIsHeader(true);
         $bowling_table->AddRow($bowling_headings);
         $bowling_data->ResetCounter();
         while ($bowling_data->MoveNext()) {
             $bowling = $bowling_data->GetItem();
             /* @var $bowling Bowling */
             $player = new XhtmlCell(false, '<a property="schema:name" rel="schema:url" href="' . htmlentities($bowling->GetPlayer()->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($bowling->GetPlayer()->GetName(), ENT_QUOTES, "UTF-8", false) . '</a>');
             $player->AddCssClass("bowler");
             $player->AddAttribute("typeof", "schema:Person");
             $player->AddAttribute("about", $bowling->GetPlayer()->GetLinkedDataUri());
             $over_data = new XhtmlCell(false, htmlentities($bowling->GetOvers(), ENT_QUOTES, "UTF-8", false));
             $over_data->SetCssClass("numeric");
             $maidens_data = new XhtmlCell(false, htmlentities($bowling->GetMaidens(), ENT_QUOTES, "UTF-8", false));
             $maidens_data->SetCssClass("numeric");
             $runs_data = new XhtmlCell(false, htmlentities($bowling->GetRunsConceded(), ENT_QUOTES, "UTF-8", false));
             $runs_data->SetCssClass("numeric");
             $wickets_data = new XhtmlCell(false, htmlentities($bowling->GetWickets(), ENT_QUOTES, "UTF-8", false));
             $wickets_data->SetCssClass("numeric");
             $economy = StoolballStatistics::BowlingEconomy($bowling->GetOvers(), $bowling->GetRunsConceded());
             $economy_data = new XhtmlCell(false, is_null($economy) ? "&#8211;" : htmlentities($economy, ENT_QUOTES, "UTF-8", false));
             $economy_data->SetCssClass("numeric");
             $average = StoolballStatistics::BowlingAverage($bowling->GetRunsConceded(), $bowling->GetWickets());
             $average_data = new XhtmlCell(false, is_null($average) ? "&#8211;" : htmlentities($average, ENT_QUOTES, "UTF-8", false));
             $average_data->SetCssClass("numeric");
             $strike = StoolballStatistics::BowlingStrikeRate($bowling->GetOvers(), $bowling->GetWickets());
             $strike_data = new XhtmlCell(false, is_null($strike) ? "&#8211;" : htmlentities($strike, ENT_QUOTES, "UTF-8", false));
             $strike_data->SetCssClass("numeric");
             $bowling_row = new XhtmlRow(array($player, $over_data, $maidens_data, $runs_data, $wickets_data, $economy_data, $average_data, $strike_data));
             $bowling_row->GetFirstCell()->SetCssClass("bowler");
             $bowling_table->AddRow($bowling_row);
         }
         $this->AddControl($bowling_table);
     }
     # Now over-by-over
     if ($overs_data->GetCount()) {
         $overs_table = new XhtmlTable();
         $overs_table->SetCaption(htmlentities($bowling_team->GetName() . "'s bowling, over-by-over", ENT_QUOTES, "UTF-8", false));
         $overs_table->SetCssClass("scorecard bowling-scorecard bowling overs");
         $balls_header = new XhtmlCell(true, "Balls");
         $balls_header->SetCssClass("numeric");
         $wides_header = new XhtmlCell(true, "Wides");
         $wides_header->SetCssClass("numeric");
         $no_balls_header = new XhtmlCell(true, "No balls");
         $no_balls_header->SetCssClass("numeric");
         $runs_in_over_header = new XhtmlCell(true, "Runs");
         $runs_in_over_header->SetCssClass("numeric");
         $total_header = new XhtmlCell(true, "Total");
         $total_header->SetCssClass("numeric");
         $overs_headings = new XhtmlRow(array("Bowler", $balls_header, $wides_header, $no_balls_header, $runs_in_over_header, $total_header));
         $overs_headings->SetIsHeader(true);
         $overs_table->AddRow($overs_headings);
         $overs_data->ResetCounter();
         $total = 0;
         while ($overs_data->MoveNext()) {
             $bowling = $overs_data->GetItem();
             /* @var $bowling Over */
             $player = new XhtmlCell(false, '<a property="schema:name" rel="schema:url" href="' . htmlentities($bowling->GetPlayer()->GetPlayerUrl(), ENT_QUOTES, "UTF-8", false) . '">' . htmlentities($bowling->GetPlayer()->GetName(), ENT_QUOTES, "UTF-8", false) . '</a>');
             $player->AddCssClass("bowler");
             $player->AddAttribute("typeof", "schema:Person");
             $player->AddAttribute("about", $bowling->GetPlayer()->GetLinkedDataUri());
             $balls_data = new XhtmlCell(false, htmlentities($bowling->GetBalls(), ENT_QUOTES, "UTF-8", false));
             $balls_data->SetCssClass("numeric");
             $wides_data = new XhtmlCell(false, htmlentities($bowling->GetWides(), ENT_QUOTES, "UTF-8", false));
             $wides_data->SetCssClass("numeric");
             $no_balls_data = new XhtmlCell(false, htmlentities($bowling->GetNoBalls(), ENT_QUOTES, "UTF-8", false));
             $no_balls_data->SetCssClass("numeric");
             $runs_in_over_data = new XhtmlCell(false, htmlentities($bowling->GetRunsInOver(), ENT_QUOTES, "UTF-8", false));
             $runs_in_over_data->SetCssClass("numeric");
             $total += $bowling->GetRunsInOver();
             $total_data = new XhtmlCell(false, htmlentities($total, ENT_QUOTES, "UTF-8", false));
             $total_data->SetCssClass("numeric");
             $bowling_row = new XhtmlRow(array($player, $balls_data, $wides_data, $no_balls_data, $runs_in_over_data, $total_data));
             $bowling_row->GetFirstCell()->SetCssClass("bowler");
             $overs_table->AddRow($bowling_row);
         }
         $this->AddControl($overs_table);
     }
 }
 public function OnPageLoad()
 {
     if ($this->not_found) {
         require_once $_SERVER['DOCUMENT_ROOT'] . "/wp-content/themes/stoolball/section-404.php";
         return;
     }
     if ($this->regenerating) {
         echo $this->regenerating_control;
         return;
     }
     # Container element for structured data
     echo '<div typeof="schema:Person" about="' . htmlentities($this->player->GetLinkedDataUri(), ENT_QUOTES, "UTF-8", false) . '">';
     $querystring = '?player=' . $this->player->GetId();
     if ($_SERVER["QUERY_STRING"]) {
         $querystring = htmlspecialchars('?' . $_SERVER["QUERY_STRING"]);
     }
     require_once "stoolball/statistics/player-summary-control.class.php";
     echo new \Stoolball\Statistics\PlayerSummaryControl($this->player, $this->filter, $this->filter_matched_nothing, $querystring);
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         require_once 'xhtml/navigation/tabs.class.php';
         $tabs = array('Batting' => $this->player->GetPlayerUrl(), 'Bowling and fielding' => '');
         echo new Tabs($tabs);
         ?>
         <div class="box tab-box">
             <div class="dataFilter"></div>
             <div class="box-content">
         <?php 
     }
     # Filter control
     echo $this->filter_control;
     if ($this->player->Bowling()->GetCount()) {
         //			echo "<h2>Bowling</h2>";
         # Overview table
         $bowling_table = new XhtmlTable();
         $bowling_table->SetCssClass("numeric");
         $bowling_table->SetCaption("Bowling");
         $bowling_heading_row = new XhtmlRow(array('<abbr title="Innings" class="small">Inn</abbr><span class="large">Innings</span>', '<abbr title="Overs" class="small">Ov</abbr><span class="large">Overs</span>', '<abbr title="Maiden overs" class="small">Md</abbr><abbr title="Maiden overs" class="large">Mdns</abbr>', "Runs", '<abbr title="Wickets" class="small">Wk</abbr><abbr title="Wickets" class="large">Wkts</abbr>', "Best", '<abbr title="Economy" class="small">Econ</abbr><span class="large">Economy</span>', '<abbr title="Average" class="small">Avg</abbr><span class="large">Average</span>', '<abbr title="Strike rate" class="small">S/R</abbr><span class="large">Strike rate</span>', '<abbr title="5 wickets" class="small">5 wk</abbr><abbr title="5 wickets" class="large">5 wkts</abbr>'));
         $bowling_heading_row->SetIsHeader(true);
         $bowling_table->AddRow($bowling_heading_row);
         $bowling_table->AddRow(new XhtmlRow(array($this->player->BowlingInnings(), $this->player->Overs(), $this->player->MaidenOvers(), $this->player->RunsAgainst(), $this->player->WicketsTaken(), is_null($this->player->BestBowling()) ? "&#8211;" : $this->player->BestBowling(), is_null($this->player->BowlingEconomy()) ? "&#8211;" : $this->player->BowlingEconomy(), is_null($this->player->BowlingAverage()) ? "&#8211;" : $this->player->BowlingAverage(), is_null($this->player->BowlingStrikeRate()) ? "&#8211;" : $this->player->BowlingStrikeRate(), $this->player->FiveWicketHauls())));
         echo $bowling_table;
         echo '<p class="statsViewAll"><a href="/play/statistics/bowling-performances' . $querystring . '">Bowling performances &#8211; view all and filter</a></p>';
     }
     ?>
     <span class="chart-js-template" id="economy-chart"></span>
     <span class="chart-js-template" id="bowling-average-chart"></span>
     <span class="chart-js-template" id="wickets-chart"></span>
     <?php 
     # Fielding
     $catches = $this->player->GetCatches();
     $run_outs = $this->player->GetRunOuts();
     if ($catches or $run_outs) {
         $fielding_table = new XhtmlTable();
         $fielding_table->SetCssClass("numeric");
         $fielding_table->SetCaption("Fielding");
         $fielding_heading_row = new XhtmlRow(array('Catches', "Run-outs"));
         $fielding_heading_row->SetIsHeader(true);
         $fielding_table->AddRow($fielding_heading_row);
         $fielding_table->AddRow(new XhtmlRow(array($catches, $run_outs)));
         echo $fielding_table;
     }
     $this->ShowSocial();
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         ?>
         </div>
         </div>
         <?php 
     }
     # End container for structured data
     echo "</div>";
     if ($this->player->GetPlayerRole() == Player::PLAYER) {
         $has_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_TEAMS, $this->player->Team()->GetLinkedDataUri());
         $has_admin_permission = AuthenticationManager::GetUser()->Permissions()->HasPermission(PermissionType::MANAGE_PLAYERS);
         if ($has_permission) {
             $this->AddSeparator();
             $panel = new UserEditPanel($this->GetSettings());
             $panel->AddLink("rename this player", $this->player->GetEditUrl());
             if ($has_admin_permission) {
                 $panel->AddLink("delete this player", $this->player->GetDeleteUrl());
             }
             echo $panel;
         }
     }
 }