mirror of
https://github.com/moodle/moodle.git
synced 2025-08-07 01:46:45 +02:00
MDL-70801 core_my: Add a new courses page
This commit is contained in:
parent
c69c33b14d
commit
6ca9c2154a
33 changed files with 417 additions and 51 deletions
|
@ -1328,7 +1328,14 @@ class global_navigation extends navigation_node {
|
|||
$this->rootnodes['site'] = $this->add_course($SITE);
|
||||
$this->rootnodes['myprofile'] = $this->add(get_string('profile'), null, self::TYPE_USER, null, 'myprofile');
|
||||
$this->rootnodes['currentcourse'] = $this->add(get_string('currentcourse'), null, self::TYPE_ROOTNODE, null, 'currentcourse');
|
||||
$this->rootnodes['mycourses'] = $this->add(get_string('mycourses'), null, self::TYPE_ROOTNODE, null, 'mycourses', new pix_icon('i/course', ''));
|
||||
$this->rootnodes['mycourses'] = $this->add(
|
||||
get_string('mycourses'),
|
||||
new moodle_url('/my/courses.php'),
|
||||
self::TYPE_ROOTNODE,
|
||||
null,
|
||||
'mycourses',
|
||||
new pix_icon('i/course', '')
|
||||
);
|
||||
$this->rootnodes['courses'] = $this->add(get_string('courses'), new moodle_url('/course/index.php'), self::TYPE_ROOTNODE, null, 'courses');
|
||||
if (!core_course_category::user_top()) {
|
||||
$this->rootnodes['courses']->hide();
|
||||
|
@ -1521,7 +1528,7 @@ class global_navigation extends navigation_node {
|
|||
foreach ($this->rootnodes as $node) {
|
||||
// Dont remove the home node
|
||||
/** @var navigation_node $node */
|
||||
if (!in_array($node->key, ['home', 'myhome']) && !$node->has_children() && !$node->isactive) {
|
||||
if (!in_array($node->key, ['home', 'mycourses', 'myhome']) && !$node->has_children() && !$node->isactive) {
|
||||
$node->remove();
|
||||
}
|
||||
}
|
||||
|
@ -2880,6 +2887,9 @@ class global_navigation extends navigation_node {
|
|||
// This required as there are not other guaranteed nodes that may be loaded.
|
||||
$coursenode->add('frontpageloaded', null, self::TYPE_CUSTOM, null, 'frontpageloaded')->display = false;
|
||||
|
||||
// Add My courses to the site pages within the navigation structure so the block can read it.
|
||||
$coursenode->add(get_string('mycourses'), new moodle_url('/my/courses.php'), self::TYPE_CUSTOM, null, 'mycourses');
|
||||
|
||||
// Participants.
|
||||
if ($navoptions->participants) {
|
||||
$coursenode->add(get_string('participants'), new moodle_url('/user/index.php?id='.$course->id), self::TYPE_CUSTOM, get_string('participants'), 'participants');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue