/** * 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 */ 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) { if ($viewmode === 'courses') { $categories = coursecat::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 .= $this->view_mode_selector(\core_course\management\helper::get_management_viewmodes(), $viewmode); } $html .= html_writer::end_div(); return $html; }