Merge branch 'MDL-58835_master' of git://github.com/dmonllao/moodle
authorDan Poltawski <dan@moodle.com>
Tue, 12 Sep 2017 08:44:56 +0000 (09:44 +0100)
committerDan Poltawski <dan@moodle.com>
Tue, 12 Sep 2017 08:44:56 +0000 (09:44 +0100)
1  2 
lib/classes/analytics/target/no_teaching.php

@@@ -63,25 -63,21 +63,24 @@@ class no_teaching extends \core_analyti
       * @return \core_analytics\prediction_action[]
       */
      public function prediction_actions(\core_analytics\prediction $prediction, $includedetailsaction = false) {
 +        global $CFG;
 +
 +        require_once($CFG->dirroot . '/course/lib.php');
  
-         // No need to call the parent as the parent's action is view details and this target only have 1 feature.
-         $actions = array();
          $sampledata = $prediction->get_sample_data();
          $course = $sampledata['course'];
  
+         $actions = array();
          $url = new \moodle_url('/course/view.php', array('id' => $course->id));
          $pix = new \pix_icon('i/course', get_string('course'));
-         $actions['viewcourse'] = new \core_analytics\prediction_action('viewcourse', $prediction,
+         $actions[] = new \core_analytics\prediction_action('viewcourse', $prediction,
              $url, $pix, get_string('view'));
  
 -        if (has_any_capability(['moodle/course:viewparticipants', 'moodle/course:enrolreview'], $sampledata['context'])) {
 +        if (course_can_view_participants($sampledata['context'])) {
              $url = new \moodle_url('/user/index.php', array('id' => $course->id));
              $pix = new \pix_icon('i/cohort', get_string('participants'));
-             $actions['viewparticipants'] = new \core_analytics\prediction_action('viewparticipants', $prediction,
+             $actions[] = new \core_analytics\prediction_action('viewparticipants', $prediction,
                  $url, $pix, get_string('participants'));
          }