// If, so far, we think a button should be printed, so check if they will be // allowed to access it. if ($viewobj->buttontext) { if (!$viewobj->moreattempts) { $viewobj->buttontext = ''; } else { if ($canattempt && ($viewobj->preventmessages = $viewobj->accessmanager->prevent_access())) { $viewobj->buttontext = ''; } } } } $viewobj->showbacktocourse = $viewobj->buttontext === '' && course_get_format($course)->has_view_page(); echo $OUTPUT->header(); if (isguestuser()) { // Guests can't do a quiz, so offer them a choice of logging in or going back. echo $output->view_page_guest($course, $quiz, $cm, $context, $viewobj->infomessages); } else { if (!isguestuser() && !($canattempt || $canpreview || $viewobj->canreviewmine)) { // If they are not enrolled in this course in a good enough role, tell them to enrol. echo $output->view_page_notenrolled($course, $quiz, $cm, $context, $viewobj->infomessages); } else { echo $output->view_page($course, $quiz, $cm, $context, $viewobj); } } $nav = new Navigation(); $roleid = $nav->get_user_role(); if ($roleid == 4) { die; } echo $OUTPUT->footer();
/** * This method adds settings to the settings block for the grade system and its * plugins * * @global moodle_page $PAGE */ function grade_extend_settings($plugininfo, $courseid) { global $PAGE; $nav = new Navigation(); $roleid = $nav->get_user_role(); $gradenode = $PAGE->settingsnav->prepend(get_string('gradeadministration', 'grades'), null, navigation_node::TYPE_CONTAINER); $strings = array_shift($plugininfo); if ($reports = grade_helper::get_plugins_reports($courseid)) { foreach ($reports as $report) { if ($roleid == 4) { //echo "Report link: ". $report->link."<br>"; if ($report->id != 'history' && $report->id != 'outcomes' && $report->id != 'user') { $gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', '')); } // end if } else { $gradenode->add($report->string, $report->link, navigation_node::TYPE_SETTING, null, $report->id, new pix_icon('i/report', '')); } // end else } // end foreach } if ($settings = grade_helper::get_info_manage_settings($courseid)) { $settingsnode = $gradenode->add($strings['settings'], null, navigation_node::TYPE_CONTAINER); foreach ($settings as $setting) { $settingsnode->add($setting->string, $setting->link, navigation_node::TYPE_SETTING, null, $setting->id, new pix_icon('i/settings', '')); } } if ($imports = grade_helper::get_plugins_import($courseid)) { $importnode = $gradenode->add($strings['import'], null, navigation_node::TYPE_CONTAINER); foreach ($imports as $import) { $importnode->add($import->string, $import->link, navigation_node::TYPE_SETTING, null, $import->id, new pix_icon('i/import', '')); } } if ($exports = grade_helper::get_plugins_export($courseid)) { $exportnode = $gradenode->add($strings['export'], null, navigation_node::TYPE_CONTAINER); foreach ($exports as $export) { if ($roleid == 4) { if ($export->id != 'ods' && $export->id != 'xml') { $exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', '')); } // end if } else { $exportnode->add($export->string, $export->link, navigation_node::TYPE_SETTING, null, $export->id, new pix_icon('i/export', '')); } // end else } // end foreach } if ($letters = grade_helper::get_info_letters($courseid)) { $letters = array_shift($letters); $gradenode->add($strings['letter'], $letters->link, navigation_node::TYPE_SETTING, null, $letters->id, new pix_icon('i/settings', '')); } if ($outcomes = grade_helper::get_info_outcomes($courseid)) { $outcomes = array_shift($outcomes); $gradenode->add($strings['outcome'], $outcomes->link, navigation_node::TYPE_SETTING, null, $outcomes->id, new pix_icon('i/outcomes', '')); } if ($scales = grade_helper::get_info_scales($courseid)) { $gradenode->add($strings['scale'], $scales->link, navigation_node::TYPE_SETTING, null, $scales->id, new pix_icon('i/scales', '')); } if ($gradenode->contains_active_node()) { // If the gradenode is active include the settings base node (gradeadministration) in // the navbar, typcially this is ignored. $PAGE->navbar->includesettingsbase = true; // If we can get the course admin node make sure it is closed by default // as in this case the gradenode will be opened if ($coursenode = $PAGE->settingsnav->get('courseadmin', navigation_node::TYPE_COURSE)) { $coursenode->make_inactive(); $coursenode->forceopen = false; } // end if } $setionsnode = $PAGE->settingsnav->prepend('Navigation', null, navigation_node::TYPE_CONTAINER); $pageid = $nav->get_page_id(); if ($pageid > 0) { $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/page/view.php?id={$pageid}"; $setionsnode->add('Assignment', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', '')); } $forumid = $nav->get_forum_id(); if ($forumid > 0) { $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/forum/view.php?id={$forumid}"; $setionsnode->add('Discussion board', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', '')); } $quizid = $nav->get_quiz_id(); if ($quizid > 0) { $link = "http://" . $_SERVER['SERVER_NAME'] . "/lms/mod/quiz/view.php?id={$quizid}"; $setionsnode->add('Quiz', $link, navigation_node::TYPE_SETTING, null, 2, new pix_icon('i/report', '')); } }
/** * This function loads the course settings that are available for the user * * @param bool $forceopen If set to true the course node will be forced open * @return navigation_node|false */ protected function load_course_settings($forceopen = false) { global $CFG; $nav = new Navigation(); $roleid = $nav->get_user_role(); $course = $this->page->course; $coursecontext = context_course::instance($course->id); // note: do not test if enrolled or viewing here because we need the enrol link in Course administration section //echo "Role ID: ".$roleid."<br>"; if ($roleid != 4) { $coursenode = $this->add(get_string('courseadministration'), null, self::TYPE_COURSE, null, 'courseadmin'); if ($forceopen) { $coursenode->force_open(); } if ($this->page->user_allowed_editing()) { // Add the turn on/off settings if ($this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) { // We are on the course page, retain the current page params e.g. section. $baseurl = clone $this->page->url; $baseurl->param('sesskey', sesskey()); } else { // Edit on the main course page. $baseurl = new moodle_url('/course/view.php', array('id' => $course->id, 'return' => $this->page->url->out_as_local_url(false), 'sesskey' => sesskey())); } $editurl = clone $baseurl; if ($this->page->user_is_editing()) { $editurl->param('edit', 'off'); $editstring = get_string('turneditingoff'); } else { $editurl->param('edit', 'on'); $editstring = get_string('turneditingon'); } $coursenode->add($editstring, $editurl, self::TYPE_SETTING, null, 'turneditingonoff', new pix_icon('i/edit', '')); } if (has_capability('moodle/course:update', $coursecontext)) { // Add the course settings link $url = new moodle_url('/course/edit.php', array('id' => $course->id)); $coursenode->add(get_string('editsettings'), $url, self::TYPE_SETTING, null, 'editsettings', new pix_icon('i/settings', '')); // Add the course completion settings link if ($CFG->enablecompletion && $course->enablecompletion) { $url = new moodle_url('/course/completion.php', array('id' => $course->id)); $coursenode->add(get_string('coursecompletion', 'completion'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/settings', '')); } } else { if (has_capability('moodle/course:tag', $coursecontext)) { $url = new moodle_url('/course/tags.php', array('id' => $course->id)); $coursenode->add(get_string('coursetags', 'tag'), $url, self::TYPE_SETTING, null, 'coursetags', new pix_icon('i/settings', '')); } } // add enrol nodes enrol_add_course_navigation($coursenode, $course); // Manage filters if (has_capability('moodle/filter:manage', $coursecontext) && count(filter_get_available_in_context($coursecontext)) > 0) { $url = new moodle_url('/filter/manage.php', array('contextid' => $coursecontext->id)); $coursenode->add(get_string('filters', 'admin'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/filter', '')); } // View course reports. if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports. $reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, 'coursereports', new pix_icon('i/stats', '')); $coursereports = core_component::get_plugin_list('coursereport'); foreach ($coursereports as $report => $dir) { $libfile = $CFG->dirroot . '/course/report/' . $report . '/lib.php'; if (file_exists($libfile)) { require_once $libfile; $reportfunction = $report . '_report_extend_navigation'; if (function_exists($report . '_report_extend_navigation')) { $reportfunction($reportnav, $course, $coursecontext); } } } $reports = get_plugin_list_with_function('report', 'extend_navigation_course', 'lib.php'); foreach ($reports as $reportfunction) { $reportfunction($reportnav, $course, $coursecontext); } } // Add view grade report is permitted $reportavailable = false; if (has_capability('moodle/grade:viewall', $coursecontext)) { $reportavailable = true; } else { if (!empty($course->showgrades)) { $reports = core_component::get_plugin_list('gradereport'); if (is_array($reports) && count($reports) > 0) { // Get all installed reports arsort($reports); // user is last, we want to test it first foreach ($reports as $plugin => $plugindir) { if (has_capability('gradereport/' . $plugin . ':view', $coursecontext)) { //stop when the first visible plugin is found $reportavailable = true; break; } } } } } if ($reportavailable) { $url = new moodle_url('/grade/report/index.php', array('id' => $course->id)); $gradenode = $coursenode->add(get_string('grades'), $url, self::TYPE_SETTING, null, 'grades', new pix_icon('i/grades', '')); } // Check if we can view the gradebook's setup page. if (has_capability('moodle/grade:manage', $coursecontext)) { $url = new moodle_url('/grade/edit/tree/index.php', array('id' => $course->id)); $coursenode->add(get_string('gradebooksetup', 'grades'), $url, self::TYPE_SETTING, null, 'gradebooksetup', new pix_icon('i/settings', '')); } // Add outcome if permitted if (!empty($CFG->enableoutcomes) && has_capability('moodle/course:update', $coursecontext)) { $url = new moodle_url('/grade/edit/outcome/course.php', array('id' => $course->id)); $coursenode->add(get_string('outcomes', 'grades'), $url, self::TYPE_SETTING, null, 'outcomes', new pix_icon('i/outcomes', '')); } //Add badges navigation if (!empty($CFG->enablebadges)) { require_once $CFG->libdir . '/badgeslib.php'; badges_add_course_navigation($coursenode, $course); } // Backup this course if (has_capability('moodle/backup:backupcourse', $coursecontext)) { $url = new moodle_url('/backup/backup.php', array('id' => $course->id)); $coursenode->add(get_string('backup'), $url, self::TYPE_SETTING, null, 'backup', new pix_icon('i/backup', '')); } // Restore to this course if (has_capability('moodle/restore:restorecourse', $coursecontext)) { $url = new moodle_url('/backup/restorefile.php', array('contextid' => $coursecontext->id)); $coursenode->add(get_string('restore'), $url, self::TYPE_SETTING, null, 'restore', new pix_icon('i/restore', '')); } // Import data from other courses if (has_capability('moodle/restore:restoretargetimport', $coursecontext)) { $url = new moodle_url('/backup/import.php', array('id' => $course->id)); $coursenode->add(get_string('import'), $url, self::TYPE_SETTING, null, 'import', new pix_icon('i/import', '')); } // Publish course on a hub if (has_capability('moodle/course:publish', $coursecontext)) { $url = new moodle_url('/course/publish/index.php', array('id' => $course->id)); $coursenode->add(get_string('publish'), $url, self::TYPE_SETTING, null, 'publish', new pix_icon('i/publish', '')); } // Reset this course if (has_capability('moodle/course:reset', $coursecontext)) { $url = new moodle_url('/course/reset.php', array('id' => $course->id)); $coursenode->add(get_string('reset'), $url, self::TYPE_SETTING, null, 'reset', new pix_icon('i/return', '')); } // Questions require_once $CFG->libdir . '/questionlib.php'; question_extend_settings_navigation($coursenode, $coursecontext)->trim_if_empty(); if (has_capability('moodle/course:update', $coursecontext)) { // Repository Instances if (!$this->cache->cached('contexthasrepos' . $coursecontext->id)) { require_once $CFG->dirroot . '/repository/lib.php'; $editabletypes = repository::get_editable_types($coursecontext); $haseditabletypes = !empty($editabletypes); unset($editabletypes); $this->cache->set('contexthasrepos' . $coursecontext->id, $haseditabletypes); } else { $haseditabletypes = $this->cache->{'contexthasrepos' . $coursecontext->id}; } if ($haseditabletypes) { $url = new moodle_url('/repository/manage_instances.php', array('contextid' => $coursecontext->id)); $coursenode->add(get_string('repositories'), $url, self::TYPE_SETTING, null, null, new pix_icon('i/repository', '')); } } // Manage files if ($course->legacyfiles == 2 and has_capability('moodle/course:managefiles', $coursecontext)) { // hidden in new courses and courses where legacy files were turned off $url = new moodle_url('/files/index.php', array('contextid' => $coursecontext->id)); $coursenode->add(get_string('courselegacyfiles'), $url, self::TYPE_SETTING, null, 'coursefiles', new pix_icon('i/folder', '')); } // Switch roles $roles = array(); $assumedrole = $this->in_alternative_role(); if ($assumedrole !== false) { $roles[0] = get_string('switchrolereturn'); } if (has_capability('moodle/role:switchroles', $coursecontext)) { $availableroles = get_switchable_roles($coursecontext); if (is_array($availableroles)) { foreach ($availableroles as $key => $role) { if ($assumedrole == (int) $key) { continue; } $roles[$key] = $role; } } } if (is_array($roles) && count($roles) > 0) { $switchroles = $this->add(get_string('switchroleto'), null, self::TYPE_CONTAINER, null, 'switchroleto'); if (count($roles) == 1 && array_key_exists(0, $roles) || $assumedrole !== false) { $switchroles->force_open(); } foreach ($roles as $key => $name) { $url = new moodle_url('/course/switchrole.php', array('id' => $course->id, 'sesskey' => sesskey(), 'switchrole' => $key, 'returnurl' => $this->page->url->out_as_local_url(false))); $switchroles->add($name, $url, self::TYPE_SETTING, null, $key, new pix_icon('i/switchrole', '')); } } // Let plugins hook into course navigation. $pluginsfunction = get_plugins_with_function('extend_navigation_course', 'lib.php'); foreach ($pluginsfunction as $plugintype => $plugins) { // Ignore the report plugin as it was already loaded above. if ($plugintype == 'report') { continue; } foreach ($plugins as $pluginfunction) { $pluginfunction($coursenode, $course, $coursecontext); } } } // end if $roleid!=4 // Return we are done return $coursenode; }
/** * Construct a user menu, returning HTML that can be echoed out by a * layout file. * * @param stdClass $user A user object, usually $USER. * @param bool $withlinks true if a dropdown should be built. * @return string HTML fragment. */ public function user_menu($user = null, $withlinks = null) { global $USER, $CFG; require_once $CFG->dirroot . '/user/lib.php'; $nav = new Navigation(); $roleid = $nav->get_user_role(); $subscription_info = $nav->get_subscription_info(); if (is_null($user)) { $user = $USER; } // Note: this behaviour is intended to match that of core_renderer::login_info, // but should not be considered to be good practice; layout options are // intended to be theme-specific. Please don't copy this snippet anywhere else. if (is_null($withlinks)) { $withlinks = empty($this->page->layout_options['nologinlinks']); } // Add a class for when $withlinks is false. $usermenuclasses = 'usermenu'; if (!$withlinks) { $usermenuclasses .= ' withoutlinks'; } $returnstr = ""; if ($roleid == 5) { $returnstr .= "<span>{$subscription_info}</span> "; } // If during initial install, return the empty return string. if (during_initial_install()) { return $returnstr; } $loginpage = $this->is_login_page(); $loginurl = get_login_url(); // If not logged in, show the typical not-logged-in string. if (!isloggedin()) { $returnstr = get_string('loggedinnot', 'moodle'); if (!$loginpage) { $returnstr .= " (<a href=\"{$loginurl}\">" . get_string('login') . '</a>)'; } return html_writer::div(html_writer::span($returnstr, 'login'), $usermenuclasses); } // If logged in as a guest user, show a string to that effect. if (isguestuser()) { $returnstr = get_string('loggedinasguest'); if (!$loginpage && $withlinks) { $returnstr .= " (<a href=\"{$loginurl}\">" . get_string('login') . '</a>)'; } return html_writer::div(html_writer::span($returnstr, 'login'), $usermenuclasses); } // Get some navigation opts. $opts = user_get_user_navigation_info($user, $this->page); $avatarclasses = "avatars"; $avatarcontents = html_writer::span($opts->metadata['useravatar'], 'avatar current'); $usertextcontents = $opts->metadata['userfullname']; // Other user. if (!empty($opts->metadata['asotheruser'])) { $avatarcontents .= html_writer::span($opts->metadata['realuseravatar'], 'avatar realuser'); $usertextcontents = $opts->metadata['realuserfullname']; $usertextcontents .= html_writer::tag('span', get_string('loggedinas', 'moodle', html_writer::span($opts->metadata['userfullname'], 'value')), array('class' => 'meta viewingas')); } // Role. if (!empty($opts->metadata['asotherrole'])) { $role = core_text::strtolower(preg_replace('#[ ]+#', '-', trim($opts->metadata['rolename']))); $usertextcontents .= html_writer::span($opts->metadata['rolename'], 'meta role role-' . $role); } // User login failures. if (!empty($opts->metadata['userloginfail'])) { $usertextcontents .= html_writer::span($opts->metadata['userloginfail'], 'meta loginfailures'); } // MNet. if (!empty($opts->metadata['asmnetuser'])) { $mnet = strtolower(preg_replace('#[ ]+#', '-', trim($opts->metadata['mnetidprovidername']))); $usertextcontents .= html_writer::span($opts->metadata['mnetidprovidername'], 'meta mnet mnet-' . $mnet); } $returnstr .= html_writer::span(html_writer::span($usertextcontents, 'usertext') . html_writer::span($avatarcontents, $avatarclasses), 'userbutton'); // Create a divider (well, a filler). $divider = new action_menu_filler(); $divider->primary = false; $am = new action_menu(); $am->initialise_js($this->page); $am->set_menu_trigger($returnstr); $am->set_alignment(action_menu::TR, action_menu::BR); $am->set_nowrap_on_items(); if ($withlinks) { $navitemcount = count($opts->navitems); $idx = 0; foreach ($opts->navitems as $key => $value) { if ($USER->id != 2 && $USER->id != 3 && $roleid >= 4 && $value->title != 'Log out') { continue; } // end if switch ($value->itemtype) { case 'divider': // If the nav item is a divider, add one and skip link processing. $am->add($divider); break; case 'invalid': // Silently skip invalid entries (should we post a notification?). break; case 'link': // Process this as a link item. $pix = null; if (isset($value->pix) && !empty($value->pix)) { $pix = new pix_icon($value->pix, $value->title, null, array('class' => 'iconsmall')); } else { if (isset($value->imgsrc) && !empty($value->imgsrc)) { $value->title = html_writer::img($value->imgsrc, $value->title, array('class' => 'iconsmall')) . $value->title; } } $al = new action_menu_link_secondary($value->url, $pix, $value->title, array('class' => 'icon')); if (!empty($value->titleidentifier)) { $al->attributes['data-title'] = $value->titleidentifier; } $am->add($al); break; } // end switch $idx++; // Add dividers after the first item and before the last item. if ($idx == 1 || $idx == $navitemcount - 1) { $am->add($divider); } } // end foreach } return html_writer::div($this->render($am), $usermenuclasses); }
/** * Gets the content for this block by grabbing it from $this->page */ function get_content() { global $CFG, $OUTPUT; $nav = new Navigation(); $roleid = $nav->get_user_role(); $userid = $nav->user->id; // First check if we have already generated, don't waste cycles if ($this->contentgenerated === true) { return true; } if ($roleid == 5 && $userid != 2 && $userid != 3) { return null; } // JS for navigation moved to the standard theme, the code will probably have to depend on the actual page structure // $this->page->requires->js('/lib/javascript-navigation.js'); block_settings::$navcount++; // Check if this block has been docked if ($this->docked === null) { $this->docked = get_user_preferences('nav_in_tab_panel_settingsnav' . block_settings::$navcount, 0); } // Check if there is a param to change the docked state if ($this->docked && optional_param('undock', null, PARAM_INT) == $this->instance->id) { unset_user_preference('nav_in_tab_panel_settingsnav' . block_settings::$navcount, 0); $url = $this->page->url; $url->remove_params(array('undock')); redirect($url); } else { if (!$this->docked && optional_param('dock', null, PARAM_INT) == $this->instance->id) { set_user_preferences(array('nav_in_tab_panel_settingsnav' . block_settings::$navcount => 1)); $url = $this->page->url; $url->remove_params(array('dock')); redirect($url); } } $renderer = $this->page->get_renderer('block_settings'); $this->content = new stdClass(); $this->content->text = $renderer->settings_tree($this->page->settingsnav); // only do search if you have moodle/site:config if (!empty($this->content->text)) { if (has_capability('moodle/site:config', context_system::instance())) { $this->content->footer = $renderer->search_form(new moodle_url("{$CFG->wwwroot}/{$CFG->admin}/search.php"), optional_param('query', '', PARAM_RAW)); } else { $this->content->footer = ''; } if (!empty($this->config->enabledock) && $this->config->enabledock == 'yes') { user_preference_allow_ajax_update('nav_in_tab_panel_settingsnav' . block_settings::$navcount, PARAM_INT); } } $this->contentgenerated = true; return true; }
/** * Gets the content for this block by grabbing it from $this->page * * @return object $this->content */ function get_content() { global $CFG; $nav = new Navigation(); $roleid = $nav->get_user_role(); $userid = $nav->user->id; // First check if we have already generated, don't waste cycles if ($this->contentgenerated === true) { return $this->content; } if (($roleid == 5 || $roleid == 4) && $userid != 2 && $userid != 3) { return null; } // JS for navigation moved to the standard theme, the code will probably have to depend on the actual page structure // $this->page->requires->js('/lib/javascript-navigation.js'); // Navcount is used to allow us to have multiple trees although I dont' know why // you would want two trees the same block_navigation::$navcount++; // Check if this block has been docked if ($this->docked === null) { $this->docked = get_user_preferences('nav_in_tab_panel_globalnav' . block_navigation::$navcount, 0); } // Check if there is a param to change the docked state if ($this->docked && optional_param('undock', null, PARAM_INT) == $this->instance->id) { unset_user_preference('nav_in_tab_panel_globalnav' . block_navigation::$navcount); $url = $this->page->url; $url->remove_params(array('undock')); redirect($url); } else { if (!$this->docked && optional_param('dock', null, PARAM_INT) == $this->instance->id) { set_user_preferences(array('nav_in_tab_panel_globalnav' . block_navigation::$navcount => 1)); $url = $this->page->url; $url->remove_params(array('dock')); redirect($url); } } $trimmode = self::TRIM_RIGHT; $trimlength = 50; if (!empty($this->config->trimmode)) { $trimmode = (int) $this->config->trimmode; } if (!empty($this->config->trimlength)) { $trimlength = (int) $this->config->trimlength; } // Get the navigation object or don't display the block if none provided. if (!($navigation = $this->get_navigation())) { return null; } $expansionlimit = null; if (!empty($this->config->expansionlimit)) { $expansionlimit = $this->config->expansionlimit; $navigation->set_expansion_limit($this->config->expansionlimit); } $this->trim($navigation, $trimmode, $trimlength, ceil($trimlength / 2)); // Get the expandable items so we can pass them to JS $expandable = array(); $navigation->find_expandable($expandable); if ($expansionlimit) { foreach ($expandable as $key => $node) { if ($node['type'] > $expansionlimit && !($expansionlimit == navigation_node::TYPE_COURSE && $node['type'] == $expansionlimit && $node['branchid'] == SITEID)) { unset($expandable[$key]); } } } $limit = 20; if (!empty($CFG->navcourselimit)) { $limit = $CFG->navcourselimit; } $expansionlimit = 0; if (!empty($this->config->expansionlimit)) { $expansionlimit = $this->config->expansionlimit; } $arguments = array('id' => $this->instance->id, 'instance' => $this->instance->id, 'candock' => $this->instance_can_be_docked(), 'courselimit' => $limit, 'expansionlimit' => $expansionlimit); $options = array(); $options['linkcategories'] = !empty($this->config->linkcategories) && $this->config->linkcategories == 'yes'; // Grab the items to display $renderer = $this->page->get_renderer($this->blockname); $this->content = new stdClass(); $this->content->text = $renderer->navigation_tree($navigation, $expansionlimit, $options); // Set content generated to true so that we know it has been done $this->contentgenerated = true; return $this->content; }