Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-52237

Add a callback to inject nodes in the user profile navigation

    XMLWordPrintable

    Details

    • Testing Instructions:
      Hide

      Really hard to find simple testing instructions but here's how I was able to test the fix rapidly :

      • In the plugin "tool_monitor" (admin/tool/monitor/), comment the function (tool_monitor_extend_navigation_user_settings) in lib.php
      • Add the following code in lib.php :

        function tool_monitor_extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context,
                                                     stdClass $course, $coursecontext) {
         
            $url = new moodle_url('/admin/tool/monitor/index.php');
            $subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url,
                    navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));
         
            if (isset($subsnode) && !empty($parentnode)) {
                $parentnode->add_node($subsnode);
            }
        }
         
        function tool_monitor_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) {
            $url = new moodle_url('/admin/tool/monitor/index.php');
            $node = new core_user\output\myprofile\node('miscellaneous', 'monitor',
                                                        get_string('managesubscriptions', 'tool_monitor'), null, $url);
            $tree->add_node($node);
         
            return true;
        }
        

      • Purge caches
      • As an admin, activate "Event monitoring rules"
      • Go to "User > Profile" and assert that "Event monitoring" link is displayed in the "Miscellaneous".
      • Click on the "Event monitoring" link and assert that the breadcrumb is working accordingly (Dashboard > Profile > Event monitoring)
      • Go to the a user's profile in the participants list of a course and assert that "Event monitoring" link is displayed in the "Miscellaneous".
      • Click on the "Event monitoring" link and assert that the breadcrumb is working (Dashboard > Profile > Event monitoring) Note : We would need to use "$PAGE->extend_for_user" to display the right breadcrumb.
      Show
      Really hard to find simple testing instructions but here's how I was able to test the fix rapidly : In the plugin "tool_monitor" (admin/tool/monitor/), comment the function (tool_monitor_extend_navigation_user_settings) in lib.php Add the following code in lib.php : function tool_monitor_extend_navigation_user(navigation_node $parentnode, stdClass $user, context_user $context, stdClass $course, $coursecontext) {   $url = new moodle_url('/admin/tool/monitor/index.php'); $subsnode = navigation_node::create(get_string('managesubscriptions', 'tool_monitor'), $url, navigation_node::TYPE_SETTING, null, 'monitor', new pix_icon('i/settings', ''));   if (isset($subsnode) && !empty($parentnode)) { $parentnode->add_node($subsnode); } }   function tool_monitor_myprofile_navigation(core_user\output\myprofile\tree $tree, $user, $iscurrentuser, $course) { $url = new moodle_url('/admin/tool/monitor/index.php'); $node = new core_user\output\myprofile\node('miscellaneous', 'monitor', get_string('managesubscriptions', 'tool_monitor'), null, $url); $tree->add_node($node);   return true; } Purge caches As an admin, activate "Event monitoring rules" Go to "User > Profile" and assert that "Event monitoring" link is displayed in the "Miscellaneous". Click on the "Event monitoring" link and assert that the breadcrumb is working accordingly (Dashboard > Profile > Event monitoring) Go to the a user's profile in the participants list of a course and assert that "Event monitoring" link is displayed in the "Miscellaneous". Click on the "Event monitoring" link and assert that the breadcrumb is working (Dashboard > Profile > Event monitoring) Note : We would need to use "$PAGE->extend_for_user" to display the right breadcrumb.
    • Affected Branches:
      MOODLE_30_STABLE
    • Fixed Branches:
      MOODLE_31_STABLE
    • Pull Master Branch:
      MDL-52237-master

      Description

      This callback is needed for the competency-based education plugin to be able to define the navigation in the user profile (See MDL-52237_1.png).

      Note : The documentation will need to be updated after the integration (https://docs.moodle.org/dev/Navigation_API#Plugin_Callbacks)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              gaudreaj Jean-Philippe Gaudreau
              Reporter:
              gaudreaj Jean-Philippe Gaudreau
              Peer reviewer:
              Damyon Wiese
              Integrator:
              David Monllaó
              Tester:
              John Okely
              Participants:
              Component watchers:
              Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan, Adrian Greeve, Jake Dallimore, Mathew May, Mihail Geshoski, Peter Dias, Sujith Haridasan
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Fix Release Date:
                23/May/16