/** * Adds controls to edit a team score * * @param XhtmlElement $o_container * @param string $s_id_prefix * @param Match $o_match * @param Team $o_team * @param int $i_runs * @param int $i_wickets */ private function CreateTeamScoreControls($o_container, $s_team_role, Match $o_match, Team $o_team = null, $i_runs, $i_wickets) { $o_box = new XhtmlElement('div'); $o_runs = new TextBox($this->GetNamingPrefix() . $s_team_role . 'Runs', $i_runs); $o_runs->SetCssClass("numeric"); if ($i_runs == null) { $o_runs->PopulateData(); } $s_runs_label = (is_null($o_team) ? $s_team_role : $o_team->GetName()) . ' score'; $o_part = new FormPart($s_runs_label, $o_box); $o_box->AddControl($o_runs); $o_part->GetLabel()->AddAttribute('for', $o_runs->GetXhtmlId()); $o_wickets = new XhtmlSelect($this->GetNamingPrefix() . $s_team_role . 'Wickets', ' for '); $o_wickets->SetBlankFirst(true); $max_wickets = $o_match->GetMaximumPlayersPerTeam() - 2; $season_dates = Season::SeasonDates($o_match->GetStartTime()); # working with GMT if (Date::Year($season_dates[0]) != Date::Year($season_dates[1])) { # outdoor needs maximum-2, but indoor needs maximum-1 cos last batter can play on. # if there's any chance it's indoor use maximum-1 $max_wickets = $o_match->GetMaximumPlayersPerTeam() - 1; } for ($i = 0; $i <= $max_wickets; $i++) { $o_wickets->AddControl(new XhtmlOption($i)); } $o_wickets->AddControl(new XhtmlOption('all out', -1)); $o_wickets->SelectOption($i_wickets); $o_box->AddControl($o_wickets); $o_container->AddControl($o_part); }