Beispiel #1
0
 /**
  * Renders mr_html_tabs
  *
  * @param mr_html_tabs $tabs mr_html_tabs instance
  * @return string
  */
 protected function render_mr_html_tabs(mr_html_tabs $tabs)
 {
     $rows = $tabs->get_rows();
     $output = '';
     if (!empty($rows)) {
         $inactive = $active = array();
         if (count($rows) == 2 and !empty($tabs->subtab) and !empty($rows[1][$tabs->subtab])) {
             $active[] = $tabs->toptab;
             $currenttab = $tabs->subtab;
         } else {
             $currenttab = $tabs->toptab;
         }
         $output = html_writer::tag('div', print_tabs($rows, $currenttab, $inactive, $active, true), array('class' => 'mr_html_tabs'));
     }
     return $output;
 }
Beispiel #2
0
 /**
  * Setup controller tabs
  *
  * This goes through all of the controllers
  * and calls the add_tabs() method to get all
  * the available tabs.
  *
  * @return void
  */
 protected function init_tabs()
 {
     global $CFG;
     $url = $this->new_url();
     $url->remove_params('controller');
     $this->tabs = new mr_html_tabs($url, $this->component);
     $this->tabs->set($this->name, $this->action);
     // Restirct to only files and single depth
     $files = get_directory_list("{$CFG->dirroot}/{$this->plugin}/controller", '', false);
     foreach ($files as $file) {
         $name = pathinfo($file, PATHINFO_FILENAME);
         $this->helper->load->file("controller/{$name}");
         $classname = $this->helper->load->classname("controller/{$name}");
         call_user_func_array(array($classname, 'add_tabs'), array($this, &$this->tabs));
     }
 }