Fixed a backwards logic bug preventing format changes sometimes MDL-7961
[moodle.git] / course / import.php
blob809d8e626ddf669017a0330fe399e27bbf713909
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_capability('moodle/site:import', get_context_instance(CONTEXT_COURSE, $id));
14 /// Always we begin an import, we delete all backup/restore/import session structures
15 if (isset($SESSION->course_header)) {
16 unset ($SESSION->course_header);
18 if (isset($SESSION->info)) {
19 unset ($SESSION->info);
21 if (isset($SESSION->backupprefs)) {
22 unset ($SESSION->backupprefs);
24 if (isset($SESSION->restore)) {
25 unset ($SESSION->restore);
27 if (isset($SESSION->import_preferences)) {
28 unset ($SESSION->import_preferences);
31 $strimport = get_string('import');
33 print_header($course->fullname.': '.$strimport, $course->fullname.': '.$strimport,
34 '<a href="view.php?id='.$course->id.'">'.$course->shortname.'</a> -> '.$strimport);
36 $directories = get_list_of_plugins('course/import');
38 foreach ($directories as $directory) {
39 echo '<div class="plugin">';
40 include_once($CFG->dirroot.'/course/import/'.$directory.'/mod.php');
41 echo '</div>';
44 print_footer();