original_string: protected function show_categories($ismycourse = false) {
          global $CFG, $DB;
          if ($ismycourse) {
              return $this->show_my_categories();
          }
          if ($this->showcategories === null) {
              $show = false;
              if ($this->page->context->contextlevel == CONTEXT_COURSECAT) {
                  $show = true;
              } else if (!empty($CFG->navshowcategories) && $DB->count_records('course_categories') > 1) {
                  $show = true;
              }
              $this->showcategories = $show;
          }
          return $this->showcategories;
      }
code: protected function show_categories($ismycourse = false) {
          global $CFG, $DB;
          if ($ismycourse) {
              return $this->show_my_categories();
          }
          if ($this->showcategories === null) {
              $show = false;
              if ($this->page->context->contextlevel == CONTEXT_COURSECAT) {
                  $show = true;
              } else if (!empty($CFG->navshowcategories) && $DB->count_records('course_categories') > 1) {
                  $show = true;
              }
              $this->showcategories = $show;
          }
          return $this->showcategories;
      }
code_tokens: protected function show_categories ( $ ismycourse = false ) { global $ CFG , $ DB ; if ( $ ismycourse ) { return $ this -> show_my_categories ( ) ; } if ( $ this -> showcategories === null ) { $ show = false ; if ( $ this -> page -> context -> contextlevel == CONTEXT_COURSECAT ) { $ show = true ; } else if ( ! empty ( $ CFG -> navshowcategories ) && $ DB -> count_records ( 'course_categories' ) > 1 ) { $ show = true ; } $ this -> showcategories = $ show ; } return $ this -> showcategories ; }
docstring: Returns true if courses should be shown within categories on the navigation.
  
  @param bool $ismycourse Set to true if you are calculating this for a course.
  @return bool
docstring_tokens: Returns true if courses should be shown within categories on the navigation .