/**
  * Creates an extras/totals row at the bottom of the batting card
  * @param string $id
  * @param string $label
  * @param string $row_class
  * @param string $box_class
  * @param int $value
  * @return void
  */
 private function CreateExtrasRow($id, $label, $row_class, $box_class, $value)
 {
     $extras_header = new XhtmlCell(true, $label);
     $extras_header->SetColumnSpan(4);
     $extras = new TextBox($id, $value, $this->IsValidSubmit());
     $extras->AddAttribute("autocomplete", "off");
     $extras->SetCssClass($box_class);
     $extras->AddAttribute("type", "number");
     $balls_column = new XhtmlCell(false, null);
     $extras_row = new XhtmlRow(array($extras_header, $extras, $balls_column));
     $extras_row->SetCssClass($row_class);
     return $extras_row;
 }
 /**
  * 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);
 }
    /**
     * Creates the controls when the editor is in its team view
     *
     */
    private function CreateTeamControls(Match $match, XhtmlElement $match_box)
    {
        $css_class = 'TournamentEdit';
        $match_box->SetCssClass($css_class);
        $this->SetCssClass('');
        $match_box->SetXhtmlId($this->GetNamingPrefix());
        $this->AddControl($match_box);
        # Preserve match title and date, because we need them for the page title when "add" is clicked
        $title = new TextBox($this->GetNamingPrefix() . 'Title', $match->GetTitle(), $this->IsValidSubmit());
        $title->SetMode(TextBoxMode::Hidden());
        $match_box->AddControl($title);
        $date = new TextBox($this->GetNamingPrefix() . 'Start', $match->GetStartTime(), $this->IsValidSubmit());
        $date->SetMode(TextBoxMode::Hidden());
        $match_box->AddControl($date);
        $match_box->AddControl(<<<HTML
        
        <div class="panel"><div><div>
            <h2 class="large"><span><span><span>How many teams do you have room for?</span></span></span></h2>
            <p>Tell us how many teams you have room for and who's coming, and we'll list your tournament with how many spaces are left.</p>
HTML
);
        $max = new TextBox($this->GetNamingPrefix() . 'MaxTeams', $match->GetMaximumTeamsInTournament(), $this->IsValidSubmit());
        $max->SetMode(TextBoxMode::Number());
        $max->SetCssClass('max-teams numeric');
        $match_box->AddControl(new FormPart("Maximum teams", new XhtmlElement('div', $max)));
        $match_box->AddControl("</div></div></div>");
        # Teams editor
        $this->EnsureAggregatedEditors();
        $this->teams_editor->DataObjects()->SetItems($match->GetAwayTeams());
        $match_box->AddControl($this->teams_editor);
        # Change Save button to "Next" button
        if ($this->show_step_number) {
            $this->SetButtonText('Next &raquo;');
        }
    }