当前位置: 首页>>代码示例>>PHP>>正文


PHP custom_menu::get_children方法代码示例

本文整理汇总了PHP中custom_menu::get_children方法的典型用法代码示例。如果您正苦于以下问题:PHP custom_menu::get_children方法的具体用法?PHP custom_menu::get_children怎么用?PHP custom_menu::get_children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在custom_menu的用法示例。


在下文中一共展示了custom_menu::get_children方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: render_custom_menu

 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;
 }
开发者ID:nzn-openapp,项目名称:moodle-theme_elegance,代码行数:30,代码来源:core_renderer.php

示例2: render_custom_menu

 protected function render_custom_menu(custom_menu $menu)
 {
     // TODO: eliminate this duplicated logic, it belongs in core, not
     // here. See MDL-39565.
     $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;
 }
开发者ID:sbourget,项目名称:moodle-theme_elegance,代码行数:14,代码来源:core_renderer.php

示例3: render_custom_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;
 }
开发者ID:nadavkav,项目名称:Moodle2-Hebrew-plugins,代码行数:35,代码来源:renderers.php

示例4: render_custom_menu

 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>';
 }
开发者ID:OctaveBabel,项目名称:moodle-itop,代码行数:32,代码来源:renderers.php

示例5: render_custom_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'));
     // Insert "Home" icon link into menu
     $content .= html_writer::start_tag('li', array('class' => 'first'));
     $content .= html_writer::tag('a', html_writer::empty_tag('img', array('src' => $this->pix_url('home_icon', 'theme'), 'alt' => 'Home')), array('href' => '/'));
     $content .= html_writer::end_tag('li');
     // Render each child from theme settings custom menu
     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;
 }
开发者ID:MoodleMetaData,项目名称:MoodleMetaData,代码行数:40,代码来源:renderers.php

示例6: render_custom_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 '';
        }
        // 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;
    }
开发者ID:roelmann,项目名称:Flexi_ii,代码行数:26,代码来源:renderers.php

示例7: render_custom_menu

 protected function render_custom_menu(custom_menu $menu)
 {
     foreach ($menu->get_children() as $item) {
         $items[] = $this->render_custom_menu_item($item);
     }
     if (isset($items)) {
         return html::ul('nav', $items);
     } else {
         return '';
     }
 }
开发者ID:rbclark,项目名称:moodle-theme_bootstrap_renderers,代码行数:11,代码来源:core_renderer.php

示例8: render_header_toggle_menu

 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;
 }
开发者ID:amsibsam,项目名称:moodle3,代码行数:11,代码来源:core_renderer.php

示例9: render_custom_menu

 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.
     // Start custom add category and courses to menu
     //http://docs.moodle.org/dev/Adding_courses_and_categories_to_the_custom_menu
     /* require_once($CFG->dirroot.'/course/lib.php');
        $branch = $menu->add(get_string('courses', 'theme_parksboot2'), null, null, 10000);
        $categorytree = get_course_category_tree();
        */
     // -- end --
     $content = '<ul class="nav navbar-nav">';
     $content .= '<li><a href="' . $CFG->wwwroot . '">Home</a></li>';
     // Start custom add category and courses to menu
     /*foreach ($categorytree as $category) {
           $content .= $this->add_category_to_custommenu($branch, $category);
       }*/
     // -- end --
     foreach ($menu->get_children() as $item) {
         $content .= $this->render_custom_menu_item($item, 1);
     }
     return $content . '</ul>';
 }
开发者ID:adonm,项目名称:learning,代码行数:24,代码来源:core_renderer.php

示例10: render_user_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>';
 }
开发者ID:simonsCatalyst,项目名称:simonsCatalyst-keats,代码行数:91,代码来源:renderers.php

示例11: render_custom_menu

 /**
  * Renders a custom menu object (located in outputcomponents.php)
  *
  * The custom menu this method produces makes use of the YUI3 menunav widget
  * and requires very specific html elements and classes.
  *
  * @staticvar int $menucount
  * @param custom_menu $menu
  * @return string
  */
 protected function render_custom_menu(custom_menu $menu) {
     static $menucount = 0;
     // If the menu has no children return an empty string
     if (!$menu->has_children()) {
         return '';
     }
     // Increment the menu count. This is used for ID's that get worked with
     // in JavaScript as is essential
     $menucount++;
     // Initialise this custom menu (the custom menu object is contained in javascript-static
     $jscode = js_writer::function_call_with_Y('M.core_custom_menu.init', array('custom_menu_'.$menucount));
     $jscode = "(function(){{$jscode}})";
     $this->page->requires->yui_module('node-menunav', $jscode);
     // Build the root nodes as required by YUI
     $content = html_writer::start_tag('div', array('id'=>'custom_menu_'.$menucount, 'class'=>'yui3-menu yui3-menu-horizontal javascript-disabled custom-menu'));
     $content .= html_writer::start_tag('div', array('class'=>'yui3-menu-content'));
     $content .= html_writer::start_tag('ul');
     // 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');
     $content .= html_writer::end_tag('div');
     $content .= html_writer::end_tag('div');
     // Return the custom menu
     return $content;
 }
开发者ID:afgal,项目名称:moodle-1,代码行数:38,代码来源:outputrenderers.php

示例12: render_user_menu


//.........这里部分代码省略.........
             $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>';
 }
开发者ID:noelchavez,项目名称:moodle-theme_elegance,代码行数:101,代码来源:core_renderer.php

示例13: render_custom_menu


//.........这里部分代码省略.........
         $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>';
 }
开发者ID:digitalquest,项目名称:moodle_themex,代码行数:101,代码来源:core_rendererback161214.php

示例14: render_custom_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)
 {
     // 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;
 }
开发者ID:Herrerapan,项目名称:moodle-theme_rocket,代码行数:69,代码来源:renderers.php

示例15: message_menu

 /**
  * 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;
 }
开发者ID:scara,项目名称:moodle-theme_elegance,代码行数:59,代码来源:elegance_renderer.php


注:本文中的custom_menu::get_children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。