Merge branch 'MDL-38821_master' of git://github.com/dmonllao/moodle
[moodle.git] / course / report.php
blob5cf8d7a6b52db5f75ffa3893066cedc2e9b9698b
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 = 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>';
40 echo $OUTPUT->footer();