/**
  * Renders the HTML table that contains the data and the
  * links to other pages to do stuff to individual items.
  */
 protected function render_data_table()
 {
     /*
      * The table.
      */
     $rows_html_table = new HTMLTags_Table();
     $rows_html_table->set_attribute_str('class', 'table_pages');
     /*
      * ----------------------------------------
      * The caption for the HTML table displaying the products.
      * ----------------------------------------
      */
     $caption_str = $this->get_data_table_caption_content();
     $rows_html_table->append_tag_to_content(new HTMLTags_Caption($caption_str));
     /*
      * ----------------------------------------
      * The heading row of the HTML table that displays the products.
      * ----------------------------------------
      */
     $thead = new HTMLTags_THead();
     $sort_href = $this->get_current_base_url();
     $sort_href->set_get_variable('limit', $this->get_current_limit());
     $sort_href->set_get_variable('offset', $this->get_current_offset());
     $heading_row = new Database_SortableHeadingTR($sort_href, $this->get_current_direction());
     $fields = $this->get_data_table_fields();
     #print_r($fields);
     foreach ($fields as $field) {
         if (isset($field['sortable']) && strtolower($field['sortable']) == 'no') {
             $heading_row->append_nonsortable_field_name($field['col_name'], isset($field['title']) ? $field['title'] : NULL);
         } else {
             $heading_row->append_sortable_field_name($field['col_name'], isset($field['title']) ? $field['title'] : NULL);
         }
     }
     foreach ($this->get_data_table_action_ths() as $action_th) {
         $heading_row->append_tag_to_content($action_th);
     }
     $thead->append_tag_to_content($heading_row);
     $rows_html_table->append_tag_to_content($thead);
     /*
      * ----------------------------------------
      * Fetch the rows from the database table.
      * ----------------------------------------
      */
     $tbody = new HTMLTags_TBody();
     $rows = $this->get_matching_rows();
     /*
      * Display some of the contents of the table.
      */
     foreach ($rows as $row) {
         $data_tr = $this->get_data_html_table_tr($row);
         $tbody->append_tag_to_content($data_tr);
     }
     $rows_html_table->append_tag_to_content($tbody);
     echo $rows_html_table->get_as_string();
 }