MDL-67264 core_course: Activity chooser new feature
[moodle.git] / course / report.php
1 <?php
2       // Display all the interfaces for importing data into a specific course
4     require_once('../config.php');
6     $id = required_param('id', PARAM_INT);   // course id to import TO
7     $course = $DB->get_record('course', array('id'=>$id), '*', MUST_EXIST);
9     $PAGE->set_pagelayout('standard');
10     require_login($course);
12     $context = context_course::instance($course->id);
13     require_capability('moodle/site:viewreports', $context); // basic capability for listing of reports
15     $strreports = get_string('reports');
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();
22     $reports = core_component::get_plugin_list('coursereport');
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     }
40     echo $OUTPUT->footer();