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 )!