Example of moodle2.4DIY navigation block-PHP source code

Source: Internet
Author: User
Moodle2.4DIY navigation block instance moodle2.4 DIY navigation block instance

Modify the navigationlib. php file to customize the navigation.

// Here I changed it to the following configuration file to read the data in the navigation menu // moodle/lib/navigationlib. php 1261 line or search "// Remove any empty root nodes" foreach ($ this-> rootnodes as $ node) {// Dont remove the home node if ($ node-> key! = 'Course '&&! In_array ($ node-> key, array (, 9) {$ node-> remove ();}} // moodle/lib/navigationlib. php 1068 line or search "$ this-> rootnodes ['users'] = $ this-> add (get_string ('users'), null, self: TYPE_ROOTNODE, null, 'users'); "// @ add several lines of code chmod ($ CFG-> dirroot. '/navigation. config. php', 0777); $ navigation_data = require ($ CFG-> dirroot. '/navigation. config. php '); foreach ($ navigation_data as $ key => $ value) {$ this-> rootnodes [$ key] = $ this-> add ($ value ['text'], null, self: TYPE_ROOTNODE, null, $ key ); foreach ($ value ['branch'] as $ url) {$ this-> rootnodes [$ key]-> add_node (navigation_node: create ($ url ['text'], new moodle_url ($ url ['URL']), self: NODETYPE_BRANCH, null, null, new pix_icon ($ url ['Icon '], '');} // write the configuration file navigation under the root directory. config. php
 Array ('text' => 'learning center', 'branch' => array (0 => array ('text' => 'My class ', 'URL' => '/course/', 'Icon '=>' I/db',), 1 => array ('text' => 'score ', 'URL' => '/grades/', 'Icon '=>' I/manual_item ',), 2 => array ('text' => 'Q & ', 'URL' => '/quest/', 'Icon '=>' I/feedback ',),),), 2 => array ('text' => 'account management', 'branch' => array (0 => array ('text' => 'account ', 'URL' => '/user/', 'Icon '=>' I/Lock',), 1 => array ('text' => 'order ', 'URL' => '/order/', 'Icon '=>' I/p Ayment ',); refresh the moodle page and modify the navigation to what you need. Because moodle does not contain custom functions, you can only modify

The above is the content of the moodle2.4 DIY navigation block instance. For more information, see PHP Chinese network (www.php1.cn )!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.