/**
  * @return void
  * @param XhtmlElement[] $a_controls
  * @desc Sets the array of child elements for this element
  */
 public function SetControls($a_controls)
 {
     parent::SetControls($a_controls);
     $this->InvalidateXhtml();
 }
 /**
  * Create a table row to add or edit a match
  *
  * @param object $data_object
  * @param int $i_row_count
  * @param int $i_total_rows
  */
 protected function AddItemToTable($data_object = null, $i_row_count = null, $i_total_rows = null)
 {
     /* @var $data_object Match */
     $b_has_data_object = !is_null($data_object);
     // Which match?
     if (is_null($i_row_count)) {
         $order = $this->CreateTextBox(null, 'MatchOrder', null, $i_total_rows);
         $order->AddAttribute("type", "number");
         $order->SetCssClass("numeric");
         $this->max_sort_order++;
         $order->SetText($this->max_sort_order);
         $home_control = $this->AddTeamList('HomeTeamId', $b_has_data_object ? $data_object->GetHomeTeamId() : '', $i_total_rows);
         $away_control = $this->AddTeamList('AwayTeamId', $b_has_data_object ? $data_object->GetAwayTeamId() : '', $i_total_rows);
         $match_control = new Placeholder();
         $match_control->AddControl($home_control);
         $match_control->AddControl(" v ");
         $match_control->AddControl($away_control);
         $this->AddRowToTable(array($order, $match_control));
     } else {
         # Display the match title. When the add button is used, we need to get the team names for the new match because they weren't posted.
         if ($b_has_data_object) {
             $this->EnsureTeamName($data_object->GetHomeTeam());
             $this->EnsureTeamName($data_object->GetAwayTeam());
         }
         $match_order = $b_has_data_object ? $data_object->GetOrderInTournament() : null;
         if (is_null($match_order)) {
             $match_order = $this->max_sort_order + 1;
         }
         if ($match_order > $this->max_sort_order) {
             $this->max_sort_order = $match_order;
         }
         $order = $this->CreateTextBox($match_order, 'MatchOrder', $i_row_count, $i_total_rows);
         $order->AddAttribute("type", "number");
         $order->SetCssClass("numeric");
         $match_control = $this->CreateNonEditableText($b_has_data_object ? $data_object->GetId() : null, $b_has_data_object ? $data_object->GetTitle() : '', 'MatchId', $i_row_count, $i_total_rows);
         # If the add button is used, remember the team ids until the final save is requested
         $home_team_id = $this->CreateTextBox($data_object->GetHomeTeamId(), 'HomeTeamId', $i_row_count, $i_total_rows);
         $home_team_id->SetMode(TextBoxMode::Hidden());
         $away_team_id = $this->CreateTextBox($data_object->GetAwayTeamId(), 'AwayTeamId', $i_row_count, $i_total_rows);
         $away_team_id->SetMode(TextBoxMode::Hidden());
         $container = new Placeholder();
         $container->SetControls(array($match_control, $home_team_id, $away_team_id));
         $this->AddRowToTable(array($order, $container));
     }
 }