original_string: public function html() {
          global $OUTPUT;
  
          if (!empty($this->initerrors)) {
              $warnings = '';
              foreach ($this->initerrors as $mesg) {
                  $warnings .= $OUTPUT->notification($mesg);
              }
              return $warnings;
          }
          $table = new html_table();
  
          $table->head = $this->headers();
  
          $summary = $this->summary();
          if (!empty($summary)) {
              $table->summary = $summary;
          }
  
          // To be used for extra formatting.
          $this->index = 0;
          $this->total = count($this->items);
  
          foreach ($this->items as $item) {
              if ($this->index >= ($this->perpage * $this->page) &&
                  $this->index < ($this->perpage * ($this->page + 1))) {
                  $table->data[] = $this->format_line($item);
              }
              $this->index++;
          }
  
          $underlying = get_class($this);
  
          $data = new stdClass();
          $data->table = $table;
          $data->instance = $this;
  
          $buttonattr = array('class' => 'singleview_buttons submit');
          $buttonhtml = implode(' ', $this->buttons());
  
          $buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
          $selectview = new select($this->courseid, $this->itemid, $this->groupid);
  
          $sessionvalidation = html_writer::empty_tag('input',
              array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
  
          $html = $selectview->html();
          $html .= html_writer::tag('form',
              $buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
              array('method' => 'POST')
          );
          $html .= $selectview->html();
          return $html;
      }
code: public function html() {
          global $OUTPUT;
  
          if (!empty($this->initerrors)) {
              $warnings = '';
              foreach ($this->initerrors as $mesg) {
                  $warnings .= $OUTPUT->notification($mesg);
              }
              return $warnings;
          }
          $table = new html_table();
  
          $table->head = $this->headers();
  
          $summary = $this->summary();
          if (!empty($summary)) {
              $table->summary = $summary;
          }
  
          // To be used for extra formatting.
          $this->index = 0;
          $this->total = count($this->items);
  
          foreach ($this->items as $item) {
              if ($this->index >= ($this->perpage * $this->page) &&
                  $this->index < ($this->perpage * ($this->page + 1))) {
                  $table->data[] = $this->format_line($item);
              }
              $this->index++;
          }
  
          $underlying = get_class($this);
  
          $data = new stdClass();
          $data->table = $table;
          $data->instance = $this;
  
          $buttonattr = array('class' => 'singleview_buttons submit');
          $buttonhtml = implode(' ', $this->buttons());
  
          $buttons = html_writer::tag('div', $buttonhtml, $buttonattr);
          $selectview = new select($this->courseid, $this->itemid, $this->groupid);
  
          $sessionvalidation = html_writer::empty_tag('input',
              array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
  
          $html = $selectview->html();
          $html .= html_writer::tag('form',
              $buttons . html_writer::table($table) . $this->bulk_insert() . $buttons . $sessionvalidation,
              array('method' => 'POST')
          );
          $html .= $selectview->html();
          return $html;
      }
code_tokens: public function html ( ) { global $ OUTPUT ; if ( ! empty ( $ this -> initerrors ) ) { $ warnings = '' ; foreach ( $ this -> initerrors as $ mesg ) { $ warnings .= $ OUTPUT -> notification ( $ mesg ) ; } return $ warnings ; } $ table = new html_table ( ) ; $ table -> head = $ this -> headers ( ) ; $ summary = $ this -> summary ( ) ; if ( ! empty ( $ summary ) ) { $ table -> summary = $ summary ; } // To be used for extra formatting. $ this -> index = 0 ; $ this -> total = count ( $ this -> items ) ; foreach ( $ this -> items as $ item ) { if ( $ this -> index >= ( $ this -> perpage * $ this -> page ) && $ this -> index < ( $ this -> perpage * ( $ this -> page + 1 ) ) ) { $ table -> data [ ] = $ this -> format_line ( $ item ) ; } $ this -> index ++ ; } $ underlying = get_class ( $ this ) ; $ data = new stdClass ( ) ; $ data -> table = $ table ; $ data -> instance = $ this ; $ buttonattr = array ( 'class' => 'singleview_buttons submit' ) ; $ buttonhtml = implode ( ' ' , $ this -> buttons ( ) ) ; $ buttons = html_writer :: tag ( 'div' , $ buttonhtml , $ buttonattr ) ; $ selectview = new select ( $ this -> courseid , $ this -> itemid , $ this -> groupid ) ; $ sessionvalidation = html_writer :: empty_tag ( 'input' , array ( 'type' => 'hidden' , 'name' => 'sesskey' , 'value' => sesskey ( ) ) ) ; $ html = $ selectview -> html ( ) ; $ html .= html_writer :: tag ( 'form' , $ buttons . html_writer :: table ( $ table ) . $ this -> bulk_insert ( ) . $ buttons . $ sessionvalidation , array ( 'method' => 'POST' ) ) ; $ html .= $ selectview -> html ( ) ; return $ html ; }
docstring: Get the HTML for the whole table
  @return string
docstring_tokens: Get the HTML for the whole table