Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / course / import.php
blob3c30c3832388f0e9e0497a40f8f6d37cefb4a116
1 <?php // $Id$
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
8 if (!$course = get_record('course', 'id', $id)) {
9 error("That's an invalid course id");
12 require_login($course->id);
14 require_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $id));
16 /// Always we begin an import, we delete all backup/restore/import session structures
17 if (isset($SESSION->course_header)) {
18 unset ($SESSION->course_header);
20 if (isset($SESSION->info)) {
21 unset ($SESSION->info);
23 if (isset($SESSION->backupprefs)) {
24 unset ($SESSION->backupprefs);
26 if (isset($SESSION->restore)) {
27 unset ($SESSION->restore);
29 if (isset($SESSION->import_preferences)) {
30 unset ($SESSION->import_preferences);
33 $strimport = get_string('import');
34 $navlinks = array();
35 $navlinks[] = array('name' => $strimport, 'link' => null, 'type' => 'misc');
36 $navigation = build_navigation($navlinks);
38 print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport, $navigation);
40 $directories = get_list_of_plugins('course/import');
42 foreach ($directories as $directory) {
43 echo '<div class="plugin">';
44 include_once($CFG->dirroot.'/course/import/'.$directory.'/mod.php');
45 echo '</div>';
48 print_footer();