original_string: protected function setup_tabs($options = array()) {
          global $CFG, $PAGE;
          $groupmode = groups_get_activity_groupmode($this->cm);
  
          if (empty($CFG->usecomments) || !has_capability('mod/wiki:viewcomment', $PAGE->context)){
              unset($this->tabs['comments']);
          }
  
          if (!has_capability('mod/wiki:editpage', $PAGE->context)){
              unset($this->tabs['edit']);
          }
  
          if ($groupmode and $groupmode == VISIBLEGROUPS) {
              $currentgroup = groups_get_activity_group($this->cm);
              $manage = has_capability('mod/wiki:managewiki', $this->modcontext);
              $edit = has_capability('mod/wiki:editpage', $PAGE->context);
              if (!$manage and !($edit and groups_is_member($currentgroup))) {
                  unset($this->tabs['edit']);
              }
          }
  
          if (empty($options)) {
              $this->tabs_options = array('activetab' => substr(get_class($this), 10));
          } else {
              $this->tabs_options = $options;
          }
  
      }
code: protected function setup_tabs($options = array()) {
          global $CFG, $PAGE;
          $groupmode = groups_get_activity_groupmode($this->cm);
  
          if (empty($CFG->usecomments) || !has_capability('mod/wiki:viewcomment', $PAGE->context)){
              unset($this->tabs['comments']);
          }
  
          if (!has_capability('mod/wiki:editpage', $PAGE->context)){
              unset($this->tabs['edit']);
          }
  
          if ($groupmode and $groupmode == VISIBLEGROUPS) {
              $currentgroup = groups_get_activity_group($this->cm);
              $manage = has_capability('mod/wiki:managewiki', $this->modcontext);
              $edit = has_capability('mod/wiki:editpage', $PAGE->context);
              if (!$manage and !($edit and groups_is_member($currentgroup))) {
                  unset($this->tabs['edit']);
              }
          }
  
          if (empty($options)) {
              $this->tabs_options = array('activetab' => substr(get_class($this), 10));
          } else {
              $this->tabs_options = $options;
          }
  
      }
code_tokens: protected function setup_tabs ( $ options = array ( ) ) { global $ CFG , $ PAGE ; $ groupmode = groups_get_activity_groupmode ( $ this -> cm ) ; if ( empty ( $ CFG -> usecomments ) || ! has_capability ( 'mod/wiki:viewcomment' , $ PAGE -> context ) ) { unset ( $ this -> tabs [ 'comments' ] ) ; } if ( ! has_capability ( 'mod/wiki:editpage' , $ PAGE -> context ) ) { unset ( $ this -> tabs [ 'edit' ] ) ; } if ( $ groupmode and $ groupmode == VISIBLEGROUPS ) { $ currentgroup = groups_get_activity_group ( $ this -> cm ) ; $ manage = has_capability ( 'mod/wiki:managewiki' , $ this -> modcontext ) ; $ edit = has_capability ( 'mod/wiki:editpage' , $ PAGE -> context ) ; if ( ! $ manage and ! ( $ edit and groups_is_member ( $ currentgroup ) ) ) { unset ( $ this -> tabs [ 'edit' ] ) ; } } if ( empty ( $ options ) ) { $ this -> tabs_options = array ( 'activetab' => substr ( get_class ( $ this ) , 10 ) ) ; } else { $ this -> tabs_options = $ options ; } }
docstring: Setup page tabs, if options is empty, will set up active tab automatically
  @param array $options, tabs options
docstring_tokens: Setup page tabs if options is empty will set up active tab automatically