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

Add a callback to inject nodes in the user profile navigation

    XMLWordPrintable

Details

    • MOODLE_30_STABLE
    • MOODLE_31_STABLE
    • MDL-52237-master
    • 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.

    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

              gaudreaj Jean-Philippe Gaudreau
              gaudreaj Jean-Philippe Gaudreau
              Damyon Wiese Damyon Wiese
              David Monllaó David Monllaó
              John Okely John Okely
              Jean-Philippe Gaudreau, Steve Massicotte, Serge Gauthier, Issam Taboubi, Ilya Tregubov, Kevin Percy, Mathew May, Mihail Geshoski, Shamim Rezaie, David Woloszyn, Huong Nguyen, Jake Dallimore, Meirza, Michael Hawkins, Raquel Ortega, Safat Shahin, Stevani Andolo
              Votes:
              0 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                23/May/16