protected function get_course_header($element) {
        global $OUTPUT;

        $icon = '';
        // If object is a category, display expand/contract icon.
        if ($element['type'] == 'category') {
            // Load language strings.
            $strswitchminus = $this->get_lang_string('aggregatesonly', 'grades');
            $strswitchplus  = $this->get_lang_string('gradesonly', 'grades');
            $strswitchwhole = $this->get_lang_string('fullmode', 'grades');

            $url = new moodle_url($this->gpr->get_return_url(null, array('target' => $element['eid'], 'sesskey' => sesskey())));

            if (in_array($element['object']->id, $this->collapsed['aggregatesonly'])) {
                $url->param('action', 'switch_plus');
                $icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_plus', $strswitchplus), null, null);
                $showing = get_string('showingaggregatesonly', 'grades');
            } else if (in_array($element['object']->id, $this->collapsed['gradesonly'])) {
                $url->param('action', 'switch_whole');
                $icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_whole', $strswitchwhole), null, null);
                $showing = get_string('showinggradesonly', 'grades');
            } else {
                $url->param('action', 'switch_minus');
                $icon = $OUTPUT->action_icon($url, new pix_icon('t/switch_minus', $strswitchminus), null, null);
                $showing = get_string('showingfullmode', 'grades');
            }
        }

        $name = $element['object']->get_name();
        $courseheaderid = 'courseheader_' . clean_param($name, PARAM_ALPHANUMEXT);
        $courseheader = html_writer::tag('span', $name, array('id' => $courseheaderid,
                'title' => $name, 'class' => 'gradeitemheader'));
        $courseheader .= html_writer::label($showing, $courseheaderid, false, array('class' => 'accesshide'));
        $courseheader .= $icon;

        return $courseheader;
    }