Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.
/course/ -> report.php (source)
   1  <?php
   2        // Display all the interfaces for importing data into a specific course
   3  
   4      require_once('../config.php');
   5  
   6      $id = required_param('id', PARAM_INT);   // course id to import TO
   7      $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
   8  
   9      $PAGE->set_pagelayout('standard');
  10      require_login($course);
  11  
  12      $context = context_course::instance($course->id);
  13      require_capability('moodle/site:viewreports', $context); // basic capability for listing of reports
  14  
  15      $strreports = get_string('reports');
  16  
  17      $PAGE->set_url(new moodle_url('/course/report.php', array('id'=>$id)));
  18      $PAGE->set_title($course->fullname.': '.$strreports);
  19      $PAGE->set_heading($course->fullname.': '.$strreports);
  20      echo $OUTPUT->header();
  21  
  22      $reports = core_component::get_plugin_list('coursereport');
  23  
  24      foreach ($reports as $report => $reportdirectory) {
  25          $pluginfile = $reportdirectory.'/mod.php';
  26          if (file_exists($pluginfile)) {
  27              ob_start();
  28              include($pluginfile);  // Fragment for listing
  29              $html = ob_get_contents();
  30              ob_end_clean();
  31              // add div only if plugin accessible
  32              if ($html !== '') {
  33                  echo '<div class="plugin">';
  34                  echo $html;
  35                  echo '</div>';
  36              }
  37          }
  38      }
  39  
  40      echo $OUTPUT->footer();
  41