Merge branch 'event_monitor' of git://github.com/ankitagarwal/moodle
authorDamyon Wiese <damyon@moodle.com>
Thu, 16 Oct 2014 05:20:45 +0000 (13:20 +0800)
committerDamyon Wiese <damyon@moodle.com>
Thu, 16 Oct 2014 05:20:45 +0000 (13:20 +0800)
1  2 
lib/classes/plugin_manager.php
lib/navigationlib.php

@@@ -1052,10 -1052,6 +1052,10 @@@ class core_plugin_manager 
                  'database', 'legacy', 'standard',
              ),
  
 +            'ltiservice' => array(
 +                'profile', 'toolproxy', 'toolsettings'
 +            ),
 +
              'message' => array(
                  'airnotifier', 'email', 'jabber', 'popup'
              ),
              'tool' => array(
                  'assignmentupgrade', 'availabilityconditions', 'behat', 'capability', 'customlang',
                  'dbtransfer', 'generator', 'health', 'innodb', 'installaddon',
-                 'langimport', 'log', 'messageinbound', 'multilangupgrade', 'phpunit', 'profiling',
+                 'langimport', 'log', 'messageinbound', 'multilangupgrade', 'monitor', 'phpunit', 'profiling',
                  'replace', 'spamcleaner', 'task', 'timezoneimport',
                  'unittest', 'uploadcourse', 'uploaduser', 'unsuproles', 'xmldb'
              ),
diff --combined lib/navigationlib.php
@@@ -2092,7 -2092,7 +2092,7 @@@ class global_navigation extends navigat
          $featuresfunc = $cm->modname.'_supports';
          if (function_exists($featuresfunc) && $featuresfunc(FEATURE_ADVANCED_GRADING)) {
              require_once($CFG->dirroot.'/grade/grading/lib.php');
 -            $gradingman = get_grading_manager($cm->context, $cm->modname);
 +            $gradingman = get_grading_manager($cm->context,  'mod_'.$cm->modname);
              $gradingman->extend_navigation($this, $activity);
          }
  
@@@ -3753,7 -3753,7 +3753,7 @@@ class settings_navigation extends navig
  
          // View course reports.
          if (has_capability('moodle/site:viewreports', $coursecontext)) { // Basic capability for listing of reports.
-             $reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, null,
+             $reportnav = $coursenode->add(get_string('reports'), null, self::TYPE_CONTAINER, null, 'coursereports',
                      new pix_icon('i/stats', ''));
              $coursereports = core_component::get_plugin_list('coursereport');
              foreach ($coursereports as $report => $dir) {
                  $switchroles->add($name, $url, self::TYPE_SETTING, null, $key, new pix_icon('i/switchrole', ''));
              }
          }
+         // Let admin tools hook into course navigation.
+         $tools = get_plugin_list_with_function('tool', 'extend_navigation_course', 'lib.php');
+         foreach ($tools as $toolfunction) {
+             $toolfunction($coursenode, $course, $coursecontext);
+         }
          // Return we are done
          return $coursenode;
      }
          $featuresfunc = $this->page->activityname.'_supports';
          if (function_exists($featuresfunc) && $featuresfunc(FEATURE_ADVANCED_GRADING) && has_capability('moodle/grade:managegradingforms', $this->page->cm->context)) {
              require_once($CFG->dirroot.'/grade/grading/lib.php');
 -            $gradingman = get_grading_manager($this->page->cm->context, $this->page->activityname);
 +            $gradingman = get_grading_manager($this->page->cm->context, 'mod_'.$this->page->activityname);
              $gradingman->extend_settings_navigation($this, $modulenode);
          }
  
              if (empty($passwordchangeurl)) {
                  $passwordchangeurl = new moodle_url('/login/change_password.php', array('id'=>$course->id));
              }
-             $usersetting->add(get_string("changepassword"), $passwordchangeurl, self::TYPE_SETTING);
+             $usersetting->add(get_string("changepassword"), $passwordchangeurl, self::TYPE_SETTING, null, 'changepassword');
          }
  
          // View the roles settings
              $usersetting->add(get_string('loginas'), $url, self::TYPE_SETTING);
          }
  
+         // Let admin tools hook into user settings navigation.
+         $tools = get_plugin_list_with_function('tool', 'extend_navigation_user_settings', 'lib.php');
+         foreach ($tools as $toolfunction) {
+             $toolfunction($usersetting, $user, $usercontext, $course, $coursecontext);
+         }
          return $usersetting;
      }