/**
  * Renders a custom menu object (located in outputcomponents.php)
  *
  * The custom menu this method override the render_custom_menu function
  * in outputrenderers.php
  * @staticvar int $menucount
  * @param custom_menu $menu
  * @return string
  */
 protected function render_custom_menu(custom_menu $menu)
 {
     // Generate custom My Courses dropdown.
     $mycourses = $this->page->navigation->get('mycourses');
     $mycoursetitle = $this->page->theme->settings->mycoursetitle;
     if (isloggedin() && $mycourses && $mycourses->has_children()) {
         $branchurl = new moodle_url('/my/index.php');
         $branchsort = 10000;
         if ($mycoursetitle == 'module') {
             $branchlabel = get_string('mymodules', 'theme_rocket');
         } else {
             if ($mycoursetitle == 'unit') {
                 $branchlabel = get_string('myunits', 'theme_rocket');
             } else {
                 if ($mycoursetitle == 'class') {
                     $branchlabel = get_string('myclasses', 'theme_rocket');
                 } else {
                     $branchlabel = get_string('mycourses', 'theme_rocket');
                 }
             }
         }
         $branchtitle = $branchlabel;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         foreach ($mycourses->children as $coursenode) {
             $branch->add($coursenode->get_content(), $coursenode->action, $coursenode->get_title());
         }
     } else {
         if ($mycoursetitle == 'module') {
             $branchlabel = get_string('allmodules', 'theme_rocket');
         } else {
             if ($mycoursetitle == 'unit') {
                 $branchlabel = get_string('allunits', 'theme_rocket');
             } else {
                 if ($mycoursetitle == 'class') {
                     $branchlabel = get_string('allclasses', 'theme_rocket');
                 } else {
                     $branchlabel = get_string('allcourses', 'theme_rocket');
                 }
             }
         }
         $branchtitle = $branchlabel;
         $branchurl = new moodle_url('/course/index.php');
         $branchsort = 10000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     }
     // If the menu has no children return an empty string.
     if (!$menu->has_children()) {
         return '';
     }
     // Initialise this custom menu.
     $content = html_writer::start_tag('ul', array('class' => 'dropdown dropdown-horizontal'));
     // Render each child.
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item);
     }
     // Close the open tags.
     $content .= html_writer::end_tag('ul');
     // Return the custom menu.
     return $content;
 }
 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);
 }
 /**
  * Renders a custom menu object (located in outputcomponents.php)
  *
  * The custom menu this method override the render_custom_menu function
  * in outputrenderers.php
  * @staticvar int $menucount
  * @param custom_menu $menu
  * @return string
  */
 protected function render_custom_menu(custom_menu $menu)
 {
     // If the menu has no children return an empty string
     if (!$menu->has_children()) {
         return '';
     }
     // Add a login or logout link
     if (isloggedin()) {
         $branchlabel = get_string('logout');
         $branchurl = new moodle_url('/login/logout.php');
     } else {
         $branchlabel = get_string('login');
         $branchurl = new moodle_url('/login/index.php');
     }
     $branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
     // Initialise this custom menu
     $content = html_writer::start_tag('ul', array('class' => 'dropdown dropdown-horizontal'));
     // Render each child
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item);
     }
     // Close the open tags
     $content .= html_writer::end_tag('ul');
     // Return the custom menu
     return $content;
 }
示例#4
0
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
 protected function render_custom_menu(custom_menu $menu)
 {
     $langs = get_string_manager()->get_list_of_translations();
     $haslangmenu = $this->lang_menu() != '';
     if (!$menu->has_children() && !$haslangmenu) {
         return '';
     }
     if ($haslangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     $children = $menu->get_children();
     if (count($children) == 0) {
         return false;
     }
     $content = '';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content;
 }
示例#6
0
 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);
 }
示例#7
0
 protected function render_header_toggle_menu(custom_menu $menu)
 {
     $headertoggle = html_writer::tag('i', '', array('class' => 'headertoggle fa fa-expand'));
     $menu->add($headertoggle, new moodle_url('#'), get_string('headertoggle', 'theme_campus'), 10001);
     $content = html_writer::start_tag('ul', array('class' => 'nav headertogglemenu'));
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     $content .= html_writer::end_tag('ul');
     return $content;
 }
 /**
  * Outputs the goto bottom menu.
  * @return custom_menu object
  */
 public function custom_menu_goto_bottom()
 {
     $html = '';
     if ($this->page->pagelayout == 'course' || $this->page->pagelayout == 'incourse' || $this->page->pagelayout == 'admin') {
         // Go to bottom.
         $menu = new custom_menu();
         $gotobottom = html_writer::tag('i', '', array('class' => 'fa fa-arrow-circle-o-down'));
         $menu->add($gotobottom, new moodle_url('#region-main'), get_string('gotobottom', 'theme_essential'));
         $html = $this->render_custom_menu($menu);
     }
     return $html;
 }
 protected function render_user_menu(custom_menu $menu)
 {
     global $CFG, $USER, $DB;
     $addusermenu = true;
     $addlangmenu = true;
     $addmessagemenu = false;
     if (!isloggedin() || isguestuser()) {
         $addmessagemenu = false;
     }
     if ($addmessagemenu) {
         $messages = $this->get_user_messages();
         $messagecount = count($messages);
         $messagemenu = $menu->add($messagecount . ' ' . get_string('messages', 'message'), new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
         foreach ($messages as $message) {
             if (!$message->from) {
                 // Workaround for issue #103.
                 continue;
             }
             $senderpicture = new user_picture($message->from);
             $senderpicture->link = false;
             $senderpicture = $this->render($senderpicture);
             $messagecontent = $senderpicture;
             $messagecontent .= html_writer::start_span('msg-body');
             $messagecontent .= html_writer::start_span('msg-title');
             $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
             $messagecontent .= $message->text;
             $messagecontent .= html_writer::end_span();
             $messagecontent .= html_writer::start_span('msg-time');
             $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
             $messagecontent .= html_writer::span($message->date);
             $messagecontent .= html_writer::end_span();
             $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
             $messagemenu->add($messagecontent, $messageurl, $message->state);
         }
     }
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
         foreach ($langs as $langtype => $langname) {
             $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     if ($addusermenu) {
         if (isloggedin()) {
             $usermenu = $menu->add(fullname($USER), new moodle_url('#'), fullname($USER), 10001);
             $usermenu->add('<span class="glyphicon glyphicon-off"></span>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout'));
             $usermenu->add('<span class="glyphicon glyphicon-user"></span>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
             $usermenu->add('<span class="glyphicon glyphicon-cog"></span>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
         }
     }
     $content = '<ul class="nav navbar-nav navbar-right">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     // Add a login or logout link
     //     if (isloggedin()) {
     //            $branchlabel = get_string('logout');
     //            $branchurl   = new moodle_url('/login/logout.php');
     //        } else {
     //            $branchlabel = get_string('login');
     //            $branchurl   = new moodle_url('/login/index.php');
     //        }
     //        $branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
     //
     // Add My Courses to the menu
     // if (isloggedin() && !isguestuser() && $mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
     // $mycoursesmenu = $menu->add(get_string('mycourses'), new moodle_url('#'), get_string('mycourses'), 8000);// lower numbers = higher priority e.g. move this item to the left on the Custom Menu
     // foreach ($mycourses as $mycourse) {
     // $mycoursesmenu->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
     // }
     // }
     // Add My Courses to the menu form http://docs.moodle.org/dev/Adding_courses_and_categories_to_the_custom_menu
     if (isloggedin() && !isguestuser() && ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC'))) {
         //which does work
         $branchlabel = get_string('mycourses');
         $branchurl = new moodle_url('/course/index.php');
         $branchtitle = $branchlabel;
         $branchsort = 8000;
         // lower numbers = higher priority e.g. move this item to the left on the Custom Menu
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         foreach ($mycourses as $mycourse) {
             $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
         }
     }
     // Add a custom link to top navigation
     $branchlabel = "Navigation";
     $branchurl = new moodle_url('/courses.php');
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add('<i class="icon-user"></i>' . get_string('profile') . ' ', new moodle_url('/user/profile.php'), get_string('profile'));
     // Add a custom link to top navigation
     $branchlabel = "Categories";
     $branchurl = new moodle_url('/courses');
     $branch = $menu->add($branchlabel, $branchurl);
     // Add a custom link to top navigation
     $branchlabel = "Links";
     $branchurl = new moodle_url('/courses.php');
     $branch = $menu->add($branchlabel, $branchurl);
     // Add a custom link to top navigation
     $branchlabel = "Help";
     $branchurl = new moodle_url('/course/');
     $branch = $menu->add($branchlabel, $branchurl);
     // Add a custom link to top navigation
     $branchlabel = '<i class="fa fa-cog fa-lg"></i>';
     $branchurl = new moodle_url('/course/');
     //$branchtitle = get_string('mydashboard', 'theme_essential');
     //$branchsort  = 10000;
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add('<i class="icon-user"></i>' . get_string('profile') . ' ', new moodle_url('/user/profile.php'), get_string('profile'));
     $branch->add('<i class="icon-calendar"></i>' . get_string('pluginname', 'block_calendar_month') . ' ', new moodle_url('/calendar/view.php'), get_string('pluginname', 'block_calendar_month'));
     $branch->add('<i class="icon-envelope"></i>' . get_string('pluginname', 'block_messages') . ' ', new moodle_url('/message/index.php'), get_string('pluginname', 'block_messages'));
     $branch->add('<i class="icon-certificate"></i>' . get_string('badges') . ' ', new moodle_url('/badges/mybadges.php'), get_string('badges'));
     $branch->add('<i class="icon-file"></i>' . get_string('privatefiles', 'block_private_files') . ' ', new moodle_url('/user/files.php'), get_string('privatefiles', 'block_private_files'));
     $branch->add('<i class="icon-signout"></i>' . get_string('logout') . ' ', new moodle_url('/login/logout.php'), get_string('logout'));
     // Add a custom link to top navigation
     $branchlabel = '<i class="fa fa-arrows-h fa-lg"></i>';
     $branchurl = new moodle_url('/course/');
     $branchtitle = "Hide sidebars";
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle);
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
示例#11
0
    protected function render_user_menu(custom_menu $menu, $user) {
        global $USER, $DB, $SESSION;

        if (empty($user)) {
            $user = $USER;
        }

        $menuclass = 'guest';

        if (isloggedin() && !isguestuser()) {
            $menuclass = 'loggedin';
            $userpicture = new user_picture($user);
            $userpicture->link = false;
            $userpicture->size = 30;
            $picture = html_writer::tag('span', $this->render($userpicture), array('class' => 'picspan'));
            $name = fullname($user);
            $name = html_writer::tag('span', $name, array('class' => 'username hidden-sm'));
            $usermenu = $menu->add($name . $picture, new moodle_url('#'), fullname($user), 10001);

  
            $usermenu->add(
                $this->glyphicon('dashboard')  . get_string('myhome'),
                new moodle_url('/my'),
                get_string('myhome')
            );

            $usermenu->add(
                '#######',
                new moodle_url('/'),
                '#######'
            );

            $usermenu->add(
                $this->glyphicon('user') . get_string('profile'),
                new moodle_url('/user/profile.php', array('id' => $user->id)),

                get_string('profile')
            );

            $usermenu->add(
                $this->glyphicon('list-alt') . get_string('grades'),
                new moodle_url('/grade/report/overview/index.php'),
                get_string('grades')
            );
        
            $usermenu->add(
                $this->glyphicon('inbox') . get_string('messages', 'message'),
                new moodle_url('/message/index.php'),

                get_string('messages', 'message')
            );

            $usermenu->add(
                $this->glyphicon('cog') . get_string('preferences'),
                new moodle_url('/user/preferences.php'),

                get_string('preferences')
            );
        
            $usermenu->add(
                '#######',
                new moodle_url('/'),
                '#######'
            );

            $usermenu->add(
                $this->glyphicon('sign-out') . get_string('logout'),
                new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')),
                get_string('logout')
            );
        } else {
            $menu->add(
                $this->glyphicon('sign-in')  . get_string('login'),
                new moodle_url('/login/index.php', array('alt' => get_string('login'))),
                get_string('login')
            );
        }

        $content = html_writer::start_tag('ul', array('class' => 'nav pull-left usermenu ' . $menuclass, 'role' => 'menubar'));
        foreach ($menu->get_children() as $item) {
            $content .= $this->render_custom_menu_item($item, 1, 'pull-right');
        }
        $content .= html_writer::end_tag('ul');

        return $content;
    }
 private function message_menu()
 {
     global $OUTPUT, $USER;
     $menu = new custom_menu();
     $messages = $this->get_user_messages();
     $messagecount = 0;
     foreach ($messages as $message) {
         if (!$message->from) {
             // Workaround for issue #103.
             continue;
         }
         $messagecount++;
     }
     if ($messagecount == 0) {
         $messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>';
     } else {
         $messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>';
     }
     $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
     foreach ($messages as $message) {
         if (!$message->from) {
             // Workaround for issue #103.
             continue;
         }
         $senderpicture = new user_picture($message->from);
         $senderpicture->link = false;
         $senderpicture = $OUTPUT->render($senderpicture);
         $messagecontent = $senderpicture;
         $messagecontent .= html_writer::start_span('msg-body');
         $messagecontent .= html_writer::start_span('msg-title');
         $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
         $messagecontent .= $message->text;
         $messagecontent .= html_writer::end_span();
         $messagecontent .= html_writer::start_span('msg-time');
         $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
         $messagecontent .= html_writer::span($message->date);
         $messagecontent .= html_writer::end_span();
         $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
         $messagemenu->add($messagecontent, $messageurl, $message->text);
     }
     $content = '';
     foreach ($menu->get_children() as $item) {
         $content .= $OUTPUT->render_custom_menu_item($item, 1);
     }
     return $content;
 }
 /**
  * Adds a simple message menu to the page navbar.
  */
 private function message_menu()
 {
     global $USER, $PAGE, $CFG;
     if (!isloggedin() || isguestuser()) {
         return false;
     }
     // Check to see if messaging is enabled.
     if (!$CFG->messaging) {
         return false;
     }
     // Changed from $OUTPUT -> bsrender because of bug when selecting this theme
     // for the first time.
     $bsrender = $PAGE->get_renderer('theme_elegance', 'core');
     $menu = new custom_menu();
     $messages = $this->get_user_messages();
     $messagecount = 0;
     foreach ($messages as $message) {
         if (!$message->from) {
             // Workaround for issue #103.
             continue;
         }
         $messagecount++;
     }
     if ($messagecount == 0) {
         $messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>';
     } else {
         $messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>';
     }
     $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
     foreach ($messages as $message) {
         if (!$message->from) {
             // Workaround for issue #103.
             continue;
         }
         $senderpicture = new user_picture($message->from);
         $senderpicture->link = false;
         $senderpicture = $bsrender->render($senderpicture);
         $messagecontent = $senderpicture;
         $messagecontent .= html_writer::start_span('msg-body');
         $messagecontent .= html_writer::start_span('msg-title');
         $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
         $messagecontent .= $message->text;
         $messagecontent .= html_writer::end_span();
         $messagecontent .= html_writer::start_span('msg-time');
         $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
         $messagecontent .= html_writer::span($message->date);
         $messagecontent .= html_writer::end_span();
         $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
         $messagemenu->add($messagecontent, $messageurl, $message->text);
     }
     $content = '';
     foreach ($menu->get_children() as $item) {
         $content .= $bsrender->render_custom_menu_item($item, 1);
     }
     return $content;
 }
 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);
 }
示例#15
0
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     //navigation mycourses is no supported since 2.4
     if (isloggedin() && !isguestuser() && ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC'))) {
         $branchlabel = get_string('mycourses');
         $branchurl = new moodle_url('/course/index.php');
         $branchtitle = $branchlabel;
         $branchsort = 8000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         foreach ($mycourses as $mycourse) {
             $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
         }
     }
     $course_id = $this->page->course->id;
     if (isloggedin() && $course_id > 1) {
         $branchlabel = get_string('grades');
         $branchurl = new moodle_url('/grade/report/index.php?id=' . $this->page->course->id);
         $branchtitle = $branchlabel;
         $branchsort = 10000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     }
     return parent::render_custom_menu($menu);
 }
 protected function render_user_menu(custom_menu $menu)
 {
     global $CFG, $USER, $DB, $PAGE;
     $addusermenu = true;
     $addlangmenu = true;
     $addmessagemenu = true;
     if (!isloggedin() || isguestuser()) {
         $addmessagemenu = false;
     }
     if ($addmessagemenu) {
         $messages = $this->get_user_messages();
         $messagecount = count($messages);
         $messagemenu = $menu->add('<i class="fa fa-envelope-o"></i>' . html_writer::tag('ot', $messagecount), new moodle_url('#'), get_string('messages', 'message'), 9999);
         foreach ($messages as $message) {
             if (!$message->from) {
                 continue;
             }
             $senderpicture = new user_picture($message->from);
             $senderpicture->link = false;
             $senderpicture = $this->render($senderpicture);
             $messagecontent = $senderpicture;
             $messagecontent .= html_writer::start_span('msg-body');
             $messagecontent .= html_writer::start_span('msg-title');
             $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
             $messagecontent .= $message->text;
             $messagecontent .= html_writer::end_span();
             $messagecontent .= html_writer::start_span('msg-time');
             $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
             $messagecontent .= html_writer::span($message->date);
             $messagecontent .= html_writer::end_span();
             $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
             $messagemenu->add($messagecontent, $messageurl, $message->state);
         }
     }
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
         foreach ($langs as $langtype => $langname) {
             $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     if ($addusermenu) {
         if (isloggedin() && !isguestuser()) {
             $usermenu = $menu->add('<img class="profilepic" src="' . $CFG->wwwroot . '/user/pix.php?file=/' . $USER->id . '/f1.jpg" width="80" height="80" title="' . $USER->firstname . ' ' . $USER->lastname . '" alt="' . $USER->firstname . ' ' . $USER->lastname . '" />' . fullname($USER), new moodle_url('#'), fullname($USER), 10001);
             if (!empty($PAGE->theme->settings->enablemy)) {
                 $usermenu->add('<i class="fa fa-file"></i>' . get_string('enablemy', 'theme_keats'), new moodle_url('/my', array('id' => $USER->id)), get_string('enablemy', 'theme_keats'));
             }
             if (!empty($PAGE->theme->settings->enableprofile)) {
                 $usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
             }
             if (!empty($PAGE->theme->settings->enableeditprofile)) {
                 $usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
             }
             if (!empty($PAGE->theme->settings->enablemessages)) {
                 $usermenu->add('<i class="fa fa-comments"></i>' . get_string('enablemessages', 'theme_keats'), new moodle_url('/message/index.php', array()), get_string('enablemessages', 'theme_keats'));
             }
             if (!empty($PAGE->theme->settings->enableprivatefiles)) {
                 $usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files'));
             }
             if (!empty($PAGE->theme->settings->enablebadges)) {
                 $usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges'));
             }
             if (!empty($PAGE->theme->settings->enablecalendar)) {
                 $usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month'));
             }
             // Add custom links to menu
             $customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks;
             if ($customlinksnum != 0) {
                 foreach (range(1, $customlinksnum) as $customlinksnumber) {
                     $cli = "customlinkicon{$customlinksnumber}";
                     $cln = "customlinkname{$customlinksnumber}";
                     $clu = "customlinkurl{$customlinksnumber}";
                     if (!empty($PAGE->theme->settings->enablecalendar)) {
                         $usermenu->add('<i class="fa fa-' . $PAGE->theme->settings->{$cli} . '"></i>' . $PAGE->theme->settings->{$cln}, new moodle_url($PAGE->theme->settings->{$clu}, array('id' => $USER->id)), $PAGE->theme->settings->{$cln});
                     }
                 }
             }
             $usermenu->add('<i class="fa fa-lock"></i>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'loginpage' => '1')), get_string('logout'));
         } else {
             echo '<a href="' . $CFG->wwwroot . '/login/index.php">' . get_string('login') . '</a>';
         }
     }
     $content = '<ul class="nav navbar-nav navbar-right">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
示例#17
0
 public function lang_menu()
 {
     global $CFG;
     $langmenu = new custom_menu();
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $langmenu->add('<i class="fa fa-flag"></i><span class="langdesc">' . $currentlang . '</span>', new moodle_url('#'), $strlang, 100);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     return $this->render_custom_menu($langmenu);
 }
示例#18
0
 protected function render_user_menu(custom_menu $menu)
 {
     global $CFG, $USER, $DB;
     $addusermenu = true;
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
         foreach ($langs as $langtype => $langname) {
             $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     if ($addusermenu) {
         if (isloggedin()) {
             $usermenu = $menu->add(fullname($USER), new moodle_url('#'), fullname($USER), 10001);
             $usermenu->add('<span class="glyphicon glyphicon-off"></span>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout'));
             $usermenu->add('<span class="glyphicon glyphicon-user"></span>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
             $usermenu->add('<span class="glyphicon glyphicon-cog"></span>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
         } else {
             $usermenu = $menu->add(get_string('login'), new moodle_url('/login/index.php'), get_string('login'), 10001);
         }
     }
     $content = '<ul class="nav navbar-nav navbar-right">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
示例#19
0
 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);
 }
示例#20
0
文件: renderers.php 项目: JOANMM/bcu
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG, $PAGE, $OUTPUT, $COURSE;
     if (isloggedin() && !isguestuser()) {
         $branchtitle = get_string('home');
         $branchlabel = '<i class="fa fa-home"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/');
         $branchsort = 9998;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $branchtitle = get_string('myhome');
         $branchlabel = '<i class="fa fa-dashboard"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/my/index.php');
         $branchsort = 9999;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $mycoursetitle = "Events";
         $branchtitle = "Events";
         $branchlabel = '<i class="fa fa-calendar"></i> ' . $branchtitle;
         $branchurl = new moodle_url('/calendar/view.php');
         $branchsort = 10000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $mycoursetitle = "我的课程";
         $branchtitle = "我的课程";
         $branchlabel = '<i class="fa fa-briefcase"></i>' . $branchtitle;
         $branchurl = new moodle_url('/my/index.php');
         $branchsort = 10001;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         list($sortedcourses, $sitecourses, $totalcourses) = block_course_overview_get_sorted_courses();
         if ($sortedcourses) {
             foreach ($sortedcourses 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_bcu');
             $branch->add('<em>' . $noenrolments . '</em>', new moodle_url('/'), $noenrolments);
         }
         if (isset($COURSE->id) && $COURSE->id > 1) {
             $branchtitle = get_string('thiscourse', 'theme_bcu');
             $branchlabel = '<i class="fa fa-sitemap"></i>' . $branchtitle;
             $branchurl = new moodle_url('#');
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, 10002);
             $branchtitle = "People";
             $branchlabel = '<i class="fa fa-users"></i>' . $branchtitle;
             $branchurl = new moodle_url('/user/index.php', array('id' => $PAGE->course->id));
             $branch->add($branchlabel, $branchurl, $branchtitle, 100003);
             $branchtitle = "Grades";
             $branchlabel = $OUTPUT->pix_icon('i/grades', '', '', array('class' => 'icon')) . $branchtitle;
             $branchurl = new moodle_url('/grade/report/index.php', array('id' => $PAGE->course->id));
             $branch->add($branchlabel, $branchurl, $branchtitle, 100004);
             $data = theme_bcu_get_course_activities();
             foreach ($data as $modname => $modfullname) {
                 if ($modname === 'resources') {
                     $icon = $OUTPUT->pix_icon('icon', '', 'mod_page', array('class' => 'icon'));
                     $branch->add($icon . $modfullname, new moodle_url('/course/resources.php', array('id' => $PAGE->course->id)));
                 } else {
                     $icon = '<img src="' . $OUTPUT->pix_url('icon', $modname) . '" class="icon" alt="" />';
                     $branch->add($icon . $modfullname, new moodle_url('/mod/' . $modname . '/index.php', array('id' => $PAGE->course->id)));
                 }
             }
         }
         if (!empty($PAGE->theme->settings->enablehelp)) {
             $mycoursetitle = "Help";
             $branchtitle = "Help";
             $branchlabel = '<i class="fa fa-life-ring"></i>' . $branchtitle;
             $branchurl = new moodle_url($PAGE->theme->settings->enablehelp);
             $branchsort = 10003;
             $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         }
     }
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
 protected function render_user_menu(custom_menu $menu)
 {
     global $CFG, $USER, $DB, $PAGE;
     //Elegance add $PAGE;
     $addusermenu = true;
     $addlangmenu = true;
     $addmessagemenu = true;
     //Elegance add Check for messaging start
     if (!$CFG->messaging) {
         $addmessagemenu = false;
     } else {
         // Check whether or not the "popup" message output is enabled
         // This is after we check if messaging is enabled to possibly save a DB query
         $popup = $DB->get_record('message_processors', array('name' => 'popup'));
         if (!$popup) {
             $addmessagemenu = false;
         }
     }
     //Elegance add Check for messaging end
     if (!isloggedin() || isguestuser()) {
         $addmessagemenu = false;
     }
     if ($addmessagemenu) {
         $messages = $this->get_user_messages();
         $messagecount = 0;
         foreach ($messages as $message) {
             if (!$message->from) {
                 // Workaround for issue #103.
                 continue;
             }
             $messagecount++;
         }
         $messagemenutext = $messagecount . ' ';
         if ($messagecount == 1) {
             $messagemenutext .= get_string('message', 'message');
         } else {
             $messagemenutext .= get_string('messages', 'message');
         }
         $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999);
         foreach ($messages as $message) {
             if (!$message->from) {
                 // Workaround for issue #103.
                 continue;
             }
             $senderpicture = new user_picture($message->from);
             $senderpicture->link = false;
             $senderpicture = $this->render($senderpicture);
             $messagecontent = $senderpicture;
             $messagecontent .= html_writer::start_span('msg-body');
             $messagecontent .= html_writer::start_span('msg-title');
             $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender');
             $messagecontent .= $message->text;
             $messagecontent .= html_writer::end_span();
             $messagecontent .= html_writer::start_span('msg-time');
             $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time'));
             $messagecontent .= html_writer::span($message->date);
             $messagecontent .= html_writer::end_span();
             $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id));
             $messagemenu->add($messagecontent, $messageurl, $message->text);
         }
     }
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
         foreach ($langs as $langtype => $langname) {
             $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     if ($addusermenu) {
         if (isloggedin()) {
             $usermenu = $menu->add('<i class="fa fa-user"></i>' . fullname($USER), new moodle_url('#'), fullname($USER), 10001);
             if (!empty($PAGE->theme->settings->enablemy)) {
                 $usermenu->add('<i class="fa fa-briefcase"></i>' . get_string('mydashboard', 'theme_elegance'), new moodle_url('/my', array('id' => $USER->id)), get_string('mydashboard', 'theme_elegance'));
             }
             if (!empty($PAGE->theme->settings->enableprofile)) {
                 $usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile'));
             }
             if (!empty($PAGE->theme->settings->enableeditprofile)) {
                 $usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile'));
             }
             if (!empty($PAGE->theme->settings->enableprivatefiles)) {
                 $usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files'));
             }
             if (!empty($PAGE->theme->settings->enablebadges)) {
                 $usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges'));
             }
             if (!empty($PAGE->theme->settings->enablecalendar)) {
                 $usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month'));
             }
             // Add custom links to menu
             $customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks;
             if ($customlinksnum != 0) {
                 foreach (range(1, $customlinksnum) as $customlinksnumber) {
                     $cli = "customlinkicon{$customlinksnumber}";
                     $cln = "customlinkname{$customlinksnumber}";
                     $clu = "customlinkurl{$customlinksnumber}";
                     if (!empty($PAGE->theme->settings->enablecalendar)) {
                         $usermenu->add('<i class="fa fa-' . $PAGE->theme->settings->{$cli} . '"></i>' . $PAGE->theme->settings->{$cln}, new moodle_url($PAGE->theme->settings->{$clu}, array('id' => $USER->id)), $PAGE->theme->settings->{$cln});
                     }
                 }
             }
             $usermenu->add('<i class="fa fa-lock"></i>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout'));
         } else {
             $usermenu = $menu->add('<i class="fa fa-key"></i>' . get_string('login'), new moodle_url('/login/index.php'), get_string('login'), 10001);
         }
     }
     $content = '<ul class="nav navbar-nav navbar-right">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
 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)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     // Add a login or logout link
     //     if (isloggedin()) {
     //            $branchlabel = get_string('logout');
     //            $branchurl   = new moodle_url('/login/logout.php');
     //        } else {
     //            $branchlabel = get_string('login');
     //            $branchurl   = new moodle_url('/login/index.php');
     //        }
     //        $branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
     //
     // Add My Courses to the menu form http://docs.moodle.org/dev/Adding_courses_and_categories_to_the_custom_menu
     if (isloggedin() && !isguestuser() && ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC'))) {
         //which does work
         $branchlabel = "My Moodle";
         $branchurl = new moodle_url('/my');
         $branchtitle = $branchlabel;
         $branchsort = 1000;
         // lower numbers = higher priority e.g. move this item to the left on the Custom Menu
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         $branch->add('Overview', new moodle_url('/my'));
         foreach ($mycourses as $mycourse) {
             $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
         }
     }
     // Add a custom link to top navigation
     $branchlabel = "Categories";
     $branchurl = new moodle_url('/course');
     $branchtitle = "categories";
     $branchsort = 2000;
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     $branch->add('All Categories', new moodle_url('/course'));
     $branch->add('Arts', new moodle_url('/course/index.php?categoryid=3'));
     $branch->add('Medicine', new moodle_url('/course/index.php?categoryid=31'));
     $branch->add('Science', new moodle_url('/course/index.php?categoryid=50'));
     $branch->add('Social Sciences', new moodle_url('/course/index.php?categoryid=60'));
     $branch->add('Interdisciplinary/Cross-Faculty', new moodle_url('/course/index.php?categoryid=28'));
     $branch->add('Services', new moodle_url('/course/index.php?categoryid=56'));
     $branch->add('Sandbox', new moodle_url('/course/index.php?categoryid=51'));
     // Add a custom link to top navigation
     $branchlabel = "Help";
     $branchurl = new moodle_url('/');
     $branchtitle = "help";
     $branchsort = 3000;
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     $branch->add("Medical School Help Pages", new moodle_url('http://www2.warwick.ac.uk/fac/med/study/cpd/current/moodle'), "medschool_help_cat_nav");
     //$branch->add("Physics Help Pages", new moodle_url('http://www2.warwick.ac.uk/fac/sci/physics/current/teach/module_pages/moodle'),"physics_help_cat_nav");
     $branch->add("Life Sciences Help Pages", new moodle_url('http://www2.warwick.ac.uk/fac/sci/lifesci/intranet/staffpg/moodle'), "life_sciences_help_cat_nav");
     $branch->add("Moodle Support Pages", new moodle_url('http://www2.warwick.ac.uk/services/its/servicessupport/academictechnology/our-services/moodle/support-for-moodle/helpcontacts/'), "moodle_help_nav");
     // Add a custom link to top navigation
     //$branchlabel = '<i class="fa fa-link fa-lg"></i>';
     $branchlabel = "Links";
     $branchurl = new moodle_url('/');
     $branchtitle = "links";
     $branchsort = 5000;
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     $branch->add("Email", new moodle_url('http://go.warwick.ac.uk/mymail/'), "insite_link");
     $branch->add("Insite", new moodle_url('http://www2.warwick.ac.uk/insite/'), "insite_link");
     $branch->add("Mahara", new moodle_url('http://mahara.warwick.ac.uk/'), "mahara)link");
     $branch->add("Start.Warwick", new moodle_url('/'), "start_warwick_link");
     $branch->add("Tabula", new moodle_url('https://tabula.warwick.ac.uk/'), "tabula_link");
     // Add a custom link to top navigation
     //   $branchlabel = '<i class="fa fa-cog fa-lg"></i>';
     //            $branchurl   = new moodle_url('/course/');
     //			$branchtitle = "settings";
     //			$branchsort  = 6000;
     //
     //       $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     // 			$branch->add('<i class="icon-user"></i>'.get_string('profile').' ',new moodle_url('/user/profile.php'),get_string('profile'));
     //			$branch->add('<i class="fa fa-user"></i>'." View Profile", new moodle_url('/user/profile.php/'),"view_profile_link");
     //			$branch->add('<i class="fa fa-pencil-square-o"></i>'." Edit Profile", new moodle_url('/user/edit.php'),"edit_profile_link");
     //			$branch->add('<i class="fa fa-comments"></i>'." View My Forum Posts", new moodle_url('/mod/forum/user.php/'),"forumposts_link");
     //			$branch->add('<i class="fa fa-envelope"></i>'." View My Messages", new moodle_url('/message/index.php'),"view_messages_link");
     //			$branch->add('<i class="fa fa-bullhorn"></i>'." Notification Settings", new moodle_url('/message/edit.php'),"notification_settings_link");;
     //			$branch->add('<i class="fa fa-sign-out"></i>'." Sign Out", new moodle_url('/login/logout.php'),"signout_link");
     //
     // Add a custom settings icon link to top navigation
     //   $branchlabel = '<i class="fa fa-arrows-h fa-lg"></i>';
     //            $branchurl   = new moodle_url('/course/');
     //			$branchtitle = "maximise";
     //			$branchsort  = 7000;
     //
     //$branch = $menu->add($branchlabel, $branchurl,$branchtitle, $branchsort);
     //$branch = $menu->add('<div id="icondiv">'.$branchlabel.'</div>', $branchurl, $branchtitle) ;
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
示例#24
0
    protected function render_custom_menu(custom_menu $menu) {
        global $CFG,$USER;

        // TODO: eliminate this duplicated logic, it belongs in core, not
        // here. See MDL-39565.
        $addlangmenu = true;
        $langs = get_string_manager()->get_list_of_translations();
        if (count($langs) < 2
            or empty($CFG->langmenu)
            or ($this->page->course != SITEID and !empty($this->page->course->lang))) {
            $addlangmenu = false;
        }

        if (!$menu->has_children() && $addlangmenu === false) {
            return '';
        }

        if ($addlangmenu) {
            $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000);
            foreach ($langs as $langtype => $langname) {
                $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
            }
        }

        $content = '<ul class="nav">';
        foreach ($menu->get_children() as $item) {
            $content .= $this->render_custom_menu_item($item, 1);
        }
        
        
        return $content;
      //  ."<li class='dropdown open'><span id='quicklinks'><img src= $CFG->wwwroot/theme/co/pix/quicklinks.png /></span></li></ul>";
    }
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if (!$menu->has_children() && $addlangmenu === false) {
         return '';
     }
     if ($addlangmenu) {
         $strlang = get_string('language');
         $currentlang = current_language();
         if (isset($langs[$currentlang])) {
             $currentlang = $langs[$currentlang];
         } else {
             $currentlang = $strlang;
         }
         $this->language = $menu->add($currentlang, new moodle_url('#'), $strlang, 10000);
         foreach ($langs as $langtype => $langname) {
             $this->language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     // Add a login or logout link
     //     if (isloggedin()) {
     //            $branchlabel = get_string('logout');
     //            $branchurl   = new moodle_url('/login/logout.php');
     //        } else {
     //            $branchlabel = get_string('login');
     //            $branchurl   = new moodle_url('/login/index.php');
     //        }
     //        $branch = $menu->add($branchlabel, $branchurl, $branchlabel, -1);
     //
     // Add My Courses to the menu form http://docs.moodle.org/dev/Adding_courses_and_categories_to_the_custom_menu
     if (isloggedin() && !isguestuser() && ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC'))) {
         //which does work
         $branchlabel = get_string('mycourses');
         $branchurl = new moodle_url('/course/index.php');
         $branchtitle = $branchlabel;
         $branchsort = 8000;
         // lower numbers = higher priority e.g. move this item to the left on the Custom Menu
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         foreach ($mycourses as $mycourse) {
             $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
         }
     }
     //****************************https://moodle.org/mod/forum/discuss.php?d=219352***************************************
     //global $CFG;
     //require_once($CFG->dirroot.'/course/lib.php');
     //
     //$branch = $menu->add(get_string('courses', 'theme_warwickclean'), null, null, 1);
     //
     //$categorytree = get_course_category_tree();
     //foreach ($categorytree as $category) {
     //$this->add_category_to_custommenu($branch, $category);
     //}
     //
     //$this->render_mycourses_custom_menu($menu, 0.5) ;
     //return parent::render_custom_menu($menu);
     //}
     //
     //protected function add_category_to_custommenu(custom_menu_item $parent, stdClass $category) {
     //$branch = $parent->add($category->name, new moodle_url('/course/category.php', array('id' => $category->id)));
     //if (!empty($category->categories)) {
     //foreach ($category->categories as $subcategory) {
     //$this->add_category_to_custommenu($branch, $subcategory);
     //}
     //}
     //if (!empty($category->courses)) {
     //foreach ($category->courses as $course) {
     //$branch->add($course->shortname, new moodle_url('/course/view.php', array('id' => $course->id)), $course->fullname);
     //}
     //}
     //}
     //
     //protected function render_mycourses_custom_menu(custom_menu_item $menu, $position) { //this function adds the mycourses branch to the navbar.
     //
     //
     //if (isloggedin() && !isguestuser() && $mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC')) {
     //
     //$branchlabel = get_string('mycourses') ;
     //$branchurl = new moodle_url('/course/index.php');
     //$branchtitle = $branchlabel;
     //$branch = $menu->add($branchlabel, $branchurl, $branchtitle);
     //
     //foreach ($mycourses as $mycourse) {
     //$branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
     //}
     //}
     //
     //*******************************************************************
     // Add a custom link to top navigation
     $branchlabel = "Navigation";
     $branchurl = new moodle_url('/courses.php');
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add("Nothing Here Yet", new moodle_url('/'), "Nothing Here Yet");
     // Add a custom link to top navigation
     $branchlabel = "Categories";
     $branchurl = new moodle_url('/course');
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add('All Categories', new moodle_url('/course'));
     $branch->add('Helix', new moodle_url('/course/index.php?categoryid=10'));
     $branch->add('Miscellaneous', new moodle_url('/course/index.php?categoryid=1'));
     $branch->add(' Medicine MBChB', new moodle_url('/course/index.php?categoryid=6'));
     $branch->add('Richard', new moodle_url('/course/index.php?categoryid=4'));
     $branch->add('Templates', new moodle_url('/course/index.php?categoryid=3'));
     // Add a custom link to top navigation
     $branchlabel = "Links";
     $branchurl = new moodle_url('/courses.php');
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add("Insite", new moodle_url('/'), "Insite");
     $branch->add("Mahara", new moodle_url('/'), "Mahara");
     $branch->add("Start.Warwick", new moodle_url('/'), "Tabula");
     $branch->add("Tabula", new moodle_url('/'), "Tabula");
     // Add a custom link to top navigation
     $branchlabel = "Help";
     $branchurl = new moodle_url('/course/');
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add("Help1", new moodle_url('/'), "Insite");
     $branch->add("Help2", new moodle_url('/'), "Mahara");
     // Add a custom link to top navigation
     $branchlabel = "Help Dept";
     $branchurl = new moodle_url('/course/');
     $branchtitle = "Chemistry";
     $branchsort = 10000;
     $branch = $menu->add($branchlabel, $branchurl);
     $branch->add("Chem Help1", new moodle_url('/'), "Chem Help1");
     $branch->add("Chem Help2", new moodle_url('/'), "Chem Help2");
     // Add a custom link to top navigation
     $branchlabel = '<i class="fa fa-cog fa-lg"></i>';
     $branchurl = new moodle_url('/course/');
     $branchtitle = "settings";
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle);
     $branch->add('<i class="icon-user"></i>' . get_string('profile') . ' ', new moodle_url('/user/profile.php'), get_string('profile'));
     $branch->add('<i class="icon-calendar"></i>' . get_string('pluginname', 'block_calendar_month') . ' ', new moodle_url('/calendar/view.php'), get_string('pluginname', 'block_calendar_month'));
     $branch->add('<i class="icon-envelope"></i>' . get_string('pluginname', 'block_messages') . ' ', new moodle_url('/message/index.php'), get_string('pluginname', 'block_messages'));
     $branch->add('<i class="icon-certificate"></i>' . get_string('badges') . ' ', new moodle_url('/badges/mybadges.php'), get_string('badges'));
     $branch->add('<i class="icon-file"></i>' . get_string('privatefiles', 'block_private_files') . ' ', new moodle_url('/user/files.php'), get_string('privatefiles', 'block_private_files'));
     $branch->add('<i class="icon-signout"></i>' . get_string('logout') . ' ', new moodle_url('/login/logout.php'), get_string('logout'));
     // Add a custom settings icon link to top navigation
     $branchlabel = '<i class="fa fa-arrows-h fa-lg"></i>';
     $branchurl = new moodle_url('/course/');
     $branchtitle = "maximise";
     $branch = $menu->add($branchlabel, $branchurl, $branchtitle);
     //$branch = $menu->add('<div id="icondiv">'.$branchlabel.'</div>', $branchurl, $branchtitle) ;
     $content = '<ul class="nav">';
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
 protected function render_custom_menu(custom_menu $menu)
 {
     global $CFG;
     require_once $CFG->dirroot . '/course/lib.php';
     //navigation mycourses is no supported since 2.4
     if (isloggedin() && !isguestuser() && ($mycourses = enrol_get_my_courses(NULL, 'visible DESC, fullname ASC'))) {
         $branchlabel = get_string('mycourses');
         $branchurl = new moodle_url('/course/index.php');
         $branchtitle = $branchlabel;
         $branchsort = 8000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
         foreach ($mycourses as $mycourse) {
             $branch->add($mycourse->shortname, new moodle_url('/course/view.php', array('id' => $mycourse->id)), $mycourse->fullname);
         }
     }
     $course_id = $this->page->course->id;
     if (isloggedin() && $course_id > 1) {
         $branchlabel = get_string('grades');
         $branchurl = new moodle_url('/grade/report/index.php?id=' . $this->page->course->id);
         $branchtitle = $branchlabel;
         $branchsort = 9000;
         $branch = $menu->add($branchlabel, $branchurl, $branchtitle, $branchsort);
     }
     //From boostrapbase
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $addlangmenu = true;
     $langs = get_string_manager()->get_list_of_translations();
     if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) {
         $addlangmenu = false;
     }
     if ($addlangmenu) {
         $branchlabel = get_string('language');
         $branchurl = new moodle_url('#');
         $branch = $menu->add($branchlabel, $branchurl, $branchlabel, 10000);
         foreach ($langs as $langtype => $langname) {
             $branch->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname);
         }
     }
     return parent::render_custom_menu($menu);
 }