MDL-49843 navigation: Fixed fatal error when viewing reports.
authorAdrian Greeve <adrian@moodle.com>
Mon, 20 Apr 2015 07:44:22 +0000 (15:44 +0800)
committerDan Poltawski <dan@moodle.com>
Wed, 29 Apr 2015 10:28:55 +0000 (11:28 +0100)
report/log/user.php
report/outline/user.php

index 6c00278..cde26be 100644 (file)
@@ -77,14 +77,15 @@ $PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for
 $PAGE->set_title("$course->shortname: $stractivityreport");
 
 // Create the appropriate breadcrumb.
-$newusernode = $PAGE->navigation->find('user' . $user->id, null);
-$reportnode = $newusernode->add(get_string('reports'));
-$url = new moodle_url('/report/log/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode));
+$navigationnode = array(
+        'url' => new moodle_url('/report/log/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode))
+    );
 if ($mode === 'today') {
-    $reportnode->add(get_string('todaylogs'), $url, navigation_node::TYPE_SETTING);
+    $navigationnode['name'] = get_string('todaylogs');
 } else {
-    $reportnode->add(get_string('alllogs'), $url, navigation_node::TYPE_SETTING);
+    $navigationnode['name'] = get_string('alllogs');
 }
+$PAGE->add_report_nodes($user->id, $navigationnode);
 
 if ($courseid == SITEID) {
     $PAGE->set_heading(fullname($user));
index 3602e98..8ef583c 100644 (file)
@@ -68,14 +68,15 @@ $PAGE->navigation->set_userid_for_parent_checks($user->id); // see MDL-25805 for
 $PAGE->set_title("$course->shortname: $stractivityreport");
 
 // Create the appropriate breadcrumb.
-$newusernode = $PAGE->navigation->find('user' . $user->id, null);
-$reportnode = $newusernode->add(get_string('reports'));
-$url = new moodle_url('/report/outline/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode));
+$navigationnode = array(
+        'url' => new moodle_url('/report/outline/user.php', array('id' => $user->id, 'course' => $course->id, 'mode' => $mode))
+    );
 if ($mode === 'complete') {
-    $reportnode->add(get_string('completereport'), $url, navigation_node::TYPE_COURSE);
+    $navigationnode['name'] = get_string('completereport');
 } else {
-    $reportnode->add(get_string('outlinereport'), $url, navigation_node::TYPE_COURSE);
+    $navigationnode['name'] = get_string('outlinereport');
 }
+$PAGE->add_report_nodes($user->id, $navigationnode);
 
 if ($courseid == SITEID) {
     $PAGE->set_heading(fullname($user));