protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_evolved'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_evolved'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_evolved'); } else { $branchtitle = get_string('mycourses', 'theme_evolved'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses as $course) { if ($course->visible) { $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname)); } } } else { $noenrolments = get_string('noenrolments', 'theme_evolved'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } /* * This code replaces adds the My Dashboard * functionality to the custommenu. */ $hasdisplaymydashboard = empty($this->page->theme->settings->displaymydashboard) ? false : $this->page->theme->settings->displaymydashboard; if (isloggedin() && !isguestuser() && $hasdisplaymydashboard) { $branchlabel = '<i class="fa fa-dashboard"></i>' . get_string('mydashboard', 'theme_evolved'); $branchurl = new moodle_url('/my/index.php'); $branchtitle = get_string('mydashboard', 'theme_evolved'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $branch->add(get_string('profile') . '</em>', new moodle_url('/user/profile.php'), get_string('profile')); $branch->add(get_string('pluginname', 'block_calendar_month') . '</em>', new moodle_url('/calendar/view.php'), get_string('pluginname', 'block_calendar_month')); $branch->add(get_string('pluginname', 'block_messages') . '</em>', new moodle_url('/message/index.php'), get_string('pluginname', 'block_messages')); $branch->add(get_string('badges') . '</em>', new moodle_url('/badges/mybadges.php'), get_string('badges')); $branch->add(get_string('privatefiles', 'block_private_files') . '</em>', new moodle_url('/user/files.php'), get_string('privatefiles', 'block_private_files')); $branch->add(get_string('logout') . '</em>', new moodle_url('/login/logout.php'), get_string('logout')); } return parent::render_custom_menu($menu); }
protected function render_custom_menu(custom_menu $menu) { global $CFG; $hasdisplaymycourses = theme_lambda_get_setting('mycourses_dropdown'); if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $branchlabel = get_string('mycourses'); $branchurl = new moodle_url('#'); $branchtitle = $branchlabel; $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) { foreach ($mycourses as $mycourse) { $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname); } } else { $hometext = get_string('myhome'); $homelabel = $hometext; $branch->add($homelabel, new moodle_url('/my/index.php'), $hometext); } } return parent::render_custom_menu($menu); }
protected function render_custom_menu(custom_menu $menu) { global $CFG, $USER; /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_essential'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_essential'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_essential'); } else { $branchtitle = get_string('mycourses', 'theme_essential'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses as $course) { if ($course->visible) { $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname)); } } } else { $noenrolments = get_string('noenrolments', 'theme_essential'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } /* * This code replaces adds the My Dashboard * functionality to the custommenu. */ $hasdisplaymydashboard = empty($this->page->theme->settings->displaymydashboard) ? false : $this->page->theme->settings->displaymydashboard; if (isloggedin() && !isguestuser() && $hasdisplaymydashboard) { $branchlabel = '<i class="fa fa-dashboard"></i>' . get_string('mydashboard', 'theme_essential'); $branchurl = new moodle_url('/my/index.php'); $branchtitle = get_string('mydashboard', 'theme_essential'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $branch->add('<em><i class="fa fa-user"></i>' . get_string('profile') . '</em>', new moodle_url('/user/profile.php'), get_string('profile')); $branch->add('<em><i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month') . '</em>', new moodle_url('/calendar/view.php'), get_string('pluginname', 'block_calendar_month')); // Check if messaging is enabled. if (!empty($CFG->messaging)) { $branch->add('<em><i class="fa fa-envelope"></i>' . get_string('pluginname', 'block_messages') . '</em>', new moodle_url('/message/index.php'), get_string('pluginname', 'block_messages')); } // Check if badges are enabled. if (!empty($CFG->enablebadges)) { $branch->add('<em><i class="fa fa-certificate"></i>' . get_string('badges') . '</em>', new moodle_url('/badges/mybadges.php'), get_string('badges')); } $branch->add('<em><i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files') . '</em>', new moodle_url('/user/files.php'), get_string('privatefiles', 'block_private_files')); $branch->add('<i class="fa fa-list-alt"></i>' . get_string('forumposts', 'mod_forum'), new moodle_url('/mod/forum/user.php?id=' . $USER->id)); $branch->add('<i class="fa fa-list"></i>' . get_string('discussions', 'mod_forum'), new moodle_url('/mod/forum/user.php?id=' . $USER->id . '&mode=discussions')); $branch->add('<em><i class="fa fa-sign-out"></i>' . get_string('logout') . '</em>', new moodle_url('/login/logout.php'), get_string('logout')); } /* * This code adds the Theme colors selector to the custommenu. */ if (isloggedin() && !isguestuser()) { $alternativethemes = array(); foreach (range(1, 3) as $alternativethemenumber) { if (!empty($this->page->theme->settings->{'enablealternativethemecolors' . $alternativethemenumber})) { $alternativethemes[] = $alternativethemenumber; } } if (!empty($alternativethemes)) { $branchtitle = get_string('themecolors', 'theme_essential'); $branchlabel = '<i class="fa fa-th-large"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 11000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $defaultthemecolorslabel = get_string('defaultcolors', 'theme_essential'); $branch->add('<i class="fa fa-square colours-default"></i>' . $defaultthemecolorslabel, new moodle_url($this->page->url, array('essentialcolours' => 'default')), $defaultthemecolorslabel); foreach ($alternativethemes as $alternativethemenumber) { if (!empty($this->page->theme->settings->{'alternativethemename' . $alternativethemenumber})) { $alternativethemeslabel = $this->page->theme->settings->{'alternativethemename' . $alternativethemenumber}; } else { $alternativethemeslabel = get_string('alternativecolors', 'theme_essential', $alternativethemenumber); } $branch->add('<i class="fa fa-square colours-alternative' . $alternativethemenumber . '"></i>' . $alternativethemeslabel, new moodle_url($this->page->url, array('essentialcolours' => 'alternative' . $alternativethemenumber)), $alternativethemeslabel); } } } return parent::render_custom_menu($menu); }
protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_evolved'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_evolved'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_evolved'); } else { $branchtitle = get_string('mycourses', 'theme_evolved'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses as $course) { if ($course->visible) { $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname)); } } } else { $noenrolments = get_string('noenrolments', 'theme_evolved'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } return parent::render_custom_menu($menu); }
protected function render_custom_menu(custom_menu $menu) { /* * This code replaces adds the current enrolled * courses to the custommenu. */ $hasdisplaymycourses = empty($this->page->theme->settings->displaymycourses) ? false : $this->page->theme->settings->displaymycourses; if (isloggedin() && !isguestuser() && $hasdisplaymycourses) { //Disable course section for Site Admin global $USER; $context = get_context_instance(CONTEXT_SYSTEM); $roles = get_user_roles($context, $USER->id, false); $role = key($roles); $roleid = $roles[$role]->roleid; if ($roleid != '14') { $mycoursetitle = $this->page->theme->settings->mycoursetitle; if ($mycoursetitle == 'module') { $branchtitle = get_string('mymodules', 'theme_gourmet'); } else { if ($mycoursetitle == 'unit') { $branchtitle = get_string('myunits', 'theme_gourmet'); } else { if ($mycoursetitle == 'class') { $branchtitle = get_string('myclasses', 'theme_gourmet'); } else { $branchtitle = get_string('mycourses', 'theme_gourmet'); } } } $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle; $branchurl = new moodle_url('/my/index.php'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); if ($courses = enrol_get_my_courses(NULL, 'fullname ASC')) { foreach ($courses as $course) { if ($course->visible) { $branch->add(format_string($course->fullname), new moodle_url('/course/view.php?id=' . $course->id), format_string($course->shortname)); } } } else { $noenrolments = get_string('noenrolments', 'theme_gourmet'); $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments); } } } /* * This code replaces adds the My Dashboard * functionality to the custommenu. */ $hasdisplaymydashboard = empty($this->page->theme->settings->displaymydashboard) ? false : $this->page->theme->settings->displaymydashboard; if (isloggedin() && !isguestuser() && $hasdisplaymydashboard) { $branchlabel = '<i class="fa fa-dashboard"></i>' . get_string('mydashboard', 'theme_gourmet'); $branchurl = new moodle_url('/my/index.php'); $branchtitle = get_string('mydashboard', 'theme_gourmet'); $branchsort = 10000; $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort); $branch->add('<em><i class="fa fa-home"></i>' . get_string('myhome') . '</em>', new moodle_url('/my/index.php'), get_string('myhome')); $branch->add('<em><i class="fa fa-user"></i>' . get_string('profile') . '</em>', new moodle_url('/user/profile.php'), get_string('profile')); //GWL - Remove Items From Menu //$branch->add('<em><i class="fa fa-calendar"></i>'.get_string('pluginname', 'block_calendar_month').'</em>',new moodle_url('/calendar/view.php'),get_string('pluginname', 'block_calendar_month')); // GWL - Remove calendar from Menu //$branch->add('<em><i class="fa fa-envelope"></i>'.get_string('pluginname', 'block_messages').'</em>',new moodle_url('/message/index.php'),get_string('pluginname', 'block_messages')); // Remove message from menu //$branch->add('<em><i class="fa fa-certificate"></i>'.get_string('badges').'</em>',new moodle_url('/badges/mybadges.php'),get_string('badges')); // GWL - Remove Badges from menu //$branch->add('<em><i class="fa fa-file"></i>'.get_string('privatefiles', 'block_private_files').'</em>',new moodle_url('/user/files.php'),get_string('privatefiles', 'block_private_files')); // GWL - Remove Private Files from menu $branch->add('<em><i class="fa fa-sign-out"></i>' . get_string('logout') . '</em>', new moodle_url('/login/logout.php'), get_string('logout')); } return parent::render_custom_menu($menu); }