예제 #1
0
 /**
  * Overides setup to ensure it will only run a single time.
  */
 public function setup()
 {
     // Check if the setup function has been called before, we should not run it twice.
     // If we do the sortorder of the table will be broken.
     if (!empty($this->setup)) {
         return;
     }
     parent::setup();
 }
예제 #2
0
 /**
  * setup_report_table
  *
  * @param xxx $tablecolumns
  * @param xxx $baseurl
  * @param xxx $usercount (optional, default value = 10)
  */
 function setup_report_table($tablecolumns, $baseurl, $usercount = 10)
 {
     // generate headers (using "header_xxx()" methods below)
     $tableheaders = array();
     foreach ($tablecolumns as $tablecolumn) {
         $tableheaders[] = $this->format_header($tablecolumn);
     }
     $this->define_columns($tablecolumns);
     $this->define_headers($tableheaders);
     $this->define_baseurl($baseurl);
     if ($this->has_column('fullname')) {
         $this->pageable(true);
         $this->sortable(true);
         $this->initialbars($usercount > 20);
         // this information is only printed once per user
         $this->column_suppress('fullname');
         $this->column_suppress('picture');
         $this->column_suppress('grade');
         // special css class for "picture" column
         $this->column_class('picture', 'picture');
     } else {
         $this->pageable(false);
         $this->sortable(false);
         // you can set specific columns to be unsortable:
         // $this->no_sorting('columnname');
     }
     // basically all columns are centered
     $this->column_style_all('text-align', 'center');
     // some columns are not centered
     if ($this->has_column('fullname')) {
         $this->column_style('fullname', 'text-align', '');
     }
     if ($this->has_column('responsefield')) {
         $this->column_style('responsefield', 'text-align', 'right');
     }
     // attributes in the table tag
     $this->set_attribute('id', 'attempts');
     $this->set_attribute('align', 'center');
     $this->set_attribute('class', $this->output->mode);
     parent::setup();
 }