moodle2.4 DIY 导航block的实例
通过修改navigationlib.php文件来达到自定义导航的目的。
//这里我改成 这样 后面有一个配置文件 读取 导航菜单的数据 //moodle/lib/navigationlib.php 1261行 或者搜索 "// Remove any empty root nodes" foreach ($this->rootnodes as $node) { // Dont remove the home node if ( $node->key !== 'courses' &&!in_array( $node->key , array(1,2,3,4,5,6,7,8,9)) ) { $node->remove(); } } //moodle/lib/navigationlib.php 1068行 或者搜索 "$this->rootnodes['users'] = $this->add(get_string('users'), null, self::TYPE_ROOTNODE, null, 'users');" // @添加几行代码 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'] , '') )); } } //现在写个根目录下的配置文件 navigation.config.php <?php return array( 1 => array( 'text' => '学习中心', 'branch' => array( 0 => array( 'text' => '我的课程', 'url' => '/course/', 'icon' => 'i/db', ), 1 => array( 'text' => '成绩', 'url' => '/grades/', 'icon' => 'i/manual_item', ), 2 => array( 'text' =>'问答', 'url' =>'/quest/', 'icon' =>'i/feedback', ), ), ), 2 => array( 'text' => '账户管理', 'branch' => array( 0 => array( 'text' =>'账户', 'url' =>'/user/', 'icon' =>'i/lock', ), 1 => array( 'text' =>'订单', 'url' =>'/order/', 'icon' =>'i/payment', ), ), ), ); 再刷新 moodle页面,导航就被修改成自己需要的样子了。因为moodle不带自定义功能,所以只能这样修改
以上就是moodle2.4 DIY 导航block的实例的内容,更多相关内容请关注PHP中文网(www.php.cn)!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

Moondrop has released the Block true wireless earbuds for audio enthusiasts that sit comfortably in the outer ear. Unlike earbuds jammed into ear canals, the Block does not cause a plugged ear feeling or collect ear wax. The 13 mm driver is enclosed

The football navigation voice package in the "Amap Navigation" software is one of the navigation voice packages for the car version of the Amap map. The content is the navigation voice of Huang Jianxiang's football commentary version. Setting method: 1. Open the Amap software; 2. Click to enter the "More Tools" - "Navigation Voice" option; 3. Find "Huang Jianxiang Passionate Voice" and click "Download"; 4. On the pop-up page, click " Just use voice".

Both Android and iOS versions of Baidu Map App have released version 18.8.0, which introduces the traffic light radar function for the first time, leading the industry. According to the official introduction, after turning on the traffic light radar, it supports automatic detection of traffic lights while driving without having to enter a destination. Beidou High-Precision can position in real time. , 1 million+ traffic lights across the country automatically trigger green wave reminders. In addition, the new function also provides full silent navigation, making the map area more concise, key information clear at a glance, and no voice broadcast, allowing the driver to focus more on driving. Baidu Maps will launch a traffic light countdown function in October 2020, supporting real-time countdown prediction. Judgment, the navigation will automatically display the remaining seconds of the countdown when approaching a traffic light intersection, allowing users to always grasp the road conditions ahead. Traffic light countdown to December 31, 2022

The horizontal figure 8 on the navigation map means haze, moderate is a yellow 8 warning signal, and severe is an orange 8 warning signal.

According to news from this site on April 29, Amap officially announced the launch of an upgraded version of driving ETA (Note from this site: ETA is the estimated time of arrival, which refers to the estimated time it will take for the user to depart from the current moment and follow a given route to the destination. ) service, which aims to help users make more accurate route planning duration and traffic condition estimates, and assist users in making travel decisions. This map application is the latest upgraded Amap App. It introduces the "ultra-large-scale graph convolutional neural network model", which can better capture and learn traffic flow patterns, support urban road networks and highway systems, and can Accurately depict the spatiotemporal dynamic changes of traffic conditions. In addition, the new version of the map further integrates the iTransformer time series prediction model to support real-time analysis.

How to implement page jumps and navigation in uniapp. uniapp is a front-end framework that supports one-time coding and multi-end publishing. It is based on Vue.js. Developers can use uniapp to quickly develop mobile applications. In uniapp, implementing page jumps and navigation is a very common requirement. This article will introduce how to implement page jump and navigation in uniapp, and provide specific code examples. 1. Page jump Use the methods provided by uniapp to jump the page. uniapp provides a set of methods for implementation.

How to implement image browsing and thumbnail navigation through Vue? With the development of web applications, pictures play an increasingly important role in our daily lives. In many cases, we need to implement image browsing and thumbnail navigation functions. This article will introduce how to use the Vue framework to implement this function and provide code examples. In Vue, we can use the Vue plug-in to implement image browsing and thumbnail navigation functions. A popular plugin is vue-gallery, which provides a simple and easy-to-use interface

Use PHP and XML to implement web page navigation and menus. Navigation and menus are common elements in web pages. They allow users to quickly find the information or functions they need. In web development, PHP and XML are often used to process and store navigation and menu data. This article will introduce how to use PHP and XML to implement web page navigation and menus, and provide relevant code examples. 1. Create an XML menu data file First, we need to create an XML file to store our menu data. The following is an example XML file that
