original_string: public function management_heading($heading, $viewmode = null, $categoryid = null) {
          $html = html_writer::start_div('coursecat-management-header clearfix');
          if (!empty($heading)) {
              $html .= $this->heading($heading);
          }
          if ($viewmode !== null) {
              $html .= html_writer::start_div();
              $html .= $this->view_mode_selector(\core_course\management\helper::get_management_viewmodes(), $viewmode);
              if ($viewmode === 'courses') {
                  $categories = core_course_category::make_categories_list(array('moodle/category:manage', 'moodle/course:create'));
                  $nothing = false;
                  if ($categoryid === null) {
                      $nothing = array('' => get_string('selectacategory'));
                      $categoryid = '';
                  }
                  $select = new single_select($this->page->url, 'categoryid', $categories, $categoryid, $nothing);
                  $html .= $this->render($select);
              }
              $html .= html_writer::end_div();
          }
          $html .= html_writer::end_div();
          return $html;
      }
code: public function management_heading($heading, $viewmode = null, $categoryid = null) {
          $html = html_writer::start_div('coursecat-management-header clearfix');
          if (!empty($heading)) {
              $html .= $this->heading($heading);
          }
          if ($viewmode !== null) {
              $html .= html_writer::start_div();
              $html .= $this->view_mode_selector(\core_course\management\helper::get_management_viewmodes(), $viewmode);
              if ($viewmode === 'courses') {
                  $categories = core_course_category::make_categories_list(array('moodle/category:manage', 'moodle/course:create'));
                  $nothing = false;
                  if ($categoryid === null) {
                      $nothing = array('' => get_string('selectacategory'));
                      $categoryid = '';
                  }
                  $select = new single_select($this->page->url, 'categoryid', $categories, $categoryid, $nothing);
                  $html .= $this->render($select);
              }
              $html .= html_writer::end_div();
          }
          $html .= html_writer::end_div();
          return $html;
      }
code_tokens: public function management_heading ( $ heading , $ viewmode = null , $ categoryid = null ) { $ html = html_writer :: start_div ( 'coursecat-management-header clearfix' ) ; if ( ! empty ( $ heading ) ) { $ html .= $ this -> heading ( $ heading ) ; } if ( $ viewmode !== null ) { $ html .= html_writer :: start_div ( ) ; $ html .= $ this -> view_mode_selector ( \ core_course \ management \ helper :: get_management_viewmodes ( ) , $ viewmode ) ; if ( $ viewmode === 'courses' ) { $ categories = core_course_category :: make_categories_list ( array ( 'moodle/category:manage' , 'moodle/course:create' ) ) ; $ nothing = false ; if ( $ categoryid === null ) { $ nothing = array ( '' => get_string ( 'selectacategory' ) ) ; $ categoryid = '' ; } $ select = new single_select ( $ this -> page -> url , 'categoryid' , $ categories , $ categoryid , $ nothing ) ; $ html .= $ this -> render ( $ select ) ; } $ html .= html_writer :: end_div ( ) ; } $ html .= html_writer :: end_div ( ) ; return $ html ; }
docstring: Displays a heading for the management pages.
  
  @param string $heading The heading to display
  @param string|null $viewmode The current view mode if there are options.
  @param int|null $categoryid The currently selected category if there is one.
  @return string
docstring_tokens: Displays a heading for the management pages .