From 96c726b663b188649119f2c703cf83dc60be5505 Mon Sep 17 00:00:00 2001 From: Eloy Lafuente Date: Thu, 11 Nov 2010 22:52:17 +0000 Subject: [PATCH] MDL-24924 course/import - plugin not available anymore. Killed! --- course/import.php | 74 -------------------- course/import/activities/index.php | 106 ----------------------------- course/import/activities/mod.php | 100 --------------------------- lang/en/moodle.php | 5 -- lib/moodlelib.php | 1 - 5 files changed, 286 deletions(-) delete mode 100644 course/import.php delete mode 100644 course/import/activities/index.php delete mode 100644 course/import/activities/mod.php diff --git a/course/import.php b/course/import.php deleted file mode 100644 index 3af9e796c61..00000000000 --- a/course/import.php +++ /dev/null @@ -1,74 +0,0 @@ -. - -/** - * Display all the interfaces for importing data into a specific course - * - * @copyright 1999 Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package course - */ - -require_once('../config.php'); - -$id = required_param('id', PARAM_INT); // course id to import TO - -$PAGE->set_url('/course/import.php', array('id'=>$id)); - -if (!$course = $DB->get_record('course', array('id'=>$id))) { - print_error("That's an invalid course id"); -} - -require_login($course->id); - -require_capability('moodle/restore:restoretargetimport', get_context_instance(CONTEXT_COURSE, $id)); - -/// Always we begin an import, we delete all backup/restore/import session structures -if (isset($SESSION->course_header)) { - unset ($SESSION->course_header); -} -if (isset($SESSION->info)) { - unset ($SESSION->info); -} -if (isset($SESSION->backupprefs)) { - unset ($SESSION->backupprefs); -} -if (isset($SESSION->restore)) { - unset ($SESSION->restore); -} -if (isset($SESSION->import_preferences)) { - unset ($SESSION->import_preferences); -} - -$strimport = get_string('import'); - -$PAGE->set_title($course->fullname.': '.$strimport); -$PAGE->set_heading($course->fullname.': '.$strimport); -$PAGE->navbar->add($strimport); - -echo $OUTPUT->header(); - -$imports = get_plugin_list('import'); - -foreach ($imports as $import => $importdir) { - echo '
'; - include($importdir.'/mod.php'); - echo '
'; -} - -echo $OUTPUT->footer(); - diff --git a/course/import/activities/index.php b/course/import/activities/index.php deleted file mode 100644 index 9b15f054676..00000000000 --- a/course/import/activities/index.php +++ /dev/null @@ -1,106 +0,0 @@ -. - -/** - * preliminary page to find a course to import data from & interface with the - * backup/restore functionality - * - * @copyright 1999 Martin Dougiamas http://dougiamas.com - * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later - * @package course - */ - -require_once('../../../config.php'); -require_once('../../lib.php'); -require_once($CFG->dirroot.'/backup/lib.php'); -require_once($CFG->dirroot.'/backup/restorelib.php'); - -$id = required_param('id', PARAM_INT); // course id to import TO -$fromcourse = optional_param('fromcourse', 0, PARAM_INT); -$fromcoursesearch = optional_param('fromcoursesearch', '', PARAM_RAW); -$page = optional_param('page', 0, PARAM_INT); -$filename = optional_param('filename', 0, PARAM_PATH); - -$url = new moodle_url('/course/import/activities/index.php', array('id'=>$id)); -if ($fromcourse !== 0) { - $url->param('fromcourse', $fromcourse); -} -if ($fromcoursesearch !== '') { - $url->param('fromcoursesearch', $fromcoursesearch); -} -if ($page !== 0) { - $url->param('page', $page); -} -if ($filename !== 0) { - $url->param('filename', $filename); -} -$PAGE->set_url($url); - -$strimportactivities = get_string('importactivities'); - -if (! ($course = $DB->get_record("course", array("id"=>$id)))) { - print_error("invalidcourseid"); -} - -$site = get_site(); - -require_login($course->id); -$tocontext = get_context_instance(CONTEXT_COURSE, $id); -if ($fromcourse) { - $fromcontext = get_context_instance(CONTEXT_COURSE, $fromcourse); -} -$syscontext = get_context_instance(CONTEXT_SYSTEM); - -if (!has_capability('moodle/course:manageactivities', $tocontext)) { - print_error('nopermissiontoimportact'); -} - -// if we're not a course creator , we can only import from our own courses. -if (has_capability('moodle/course:create', $syscontext)) { - $creator = true; -} - -if ($from = $DB->get_record('course', array('id'=>$fromcourse))) { - if (!has_capability('moodle/course:manageactivities', $fromcontext)) { - print_error('nopermissiontoimportact'); - } - if (!empty($filename) && file_exists($CFG->dataroot.'/'.$filename) && !empty($SESSION->import_preferences)) { - $restore = backup_to_restore_array($SESSION->import_preferences); - $restore->restoreto = RESTORETO_CURRENT_ADDING; - $restore->course_id = $id; - $restore->importing = 1; // magic variable so we know that we're importing rather than just restoring. - - $SESSION->restore = $restore; - redirect($CFG->wwwroot.'/backup/restore.php?file='.$filename.'&id='.$fromcourse.'&to='.$id); - } - else { - redirect($CFG->wwwroot.'/backup/backup.php?id='.$from->id.'&to='.$course->id); - } -} - -$PAGE->navbar->add($course->shortname, new moodle_url('/course/view.php', array('id'=>$course->id))); -$PAGE->navbar->add(get_string('import'), new moodle_url('/course/import.php', array('id'=>$course->id))); -$PAGE->navbar->add($strimportactivities); - -$PAGE->set_title("$course->shortname: $strimportactivities"); -$PAGE->set_heading($course->fullname); -echo $OUTPUT->header(); - -require_once('mod.php'); - -echo $OUTPUT->footer(); - diff --git a/course/import/activities/mod.php b/course/import/activities/mod.php deleted file mode 100644 index 399674c341f..00000000000 --- a/course/import/activities/mod.php +++ /dev/null @@ -1,100 +0,0 @@ -dirroot.'/course/lib.php'); - require_once($CFG->dirroot.'/backup/restorelib.php'); - - $syscontext = get_context_instance(CONTEXT_SYSTEM); - - // if we're not a course creator , we can only import from our own courses. - if (has_capability('moodle/course:create', $syscontext)) { - $creator = true; - } - - $strimport = get_string("importdata"); - - $tcourseids = array(); - - if ($teachers = get_user_capability_course('moodle/course:update')) { - foreach ($teachers as $teacher) { - if ($teacher->id != $course->id && $teacher->id != SITEID){ - $tcourseids[] = $teacher->id; - } - } - } - - $taught_courses = array(); - if (!empty($tcourseids)) { - $taught_courses = $DB->get_records_list('course', 'id', $tcourseids, 'sortorder', 'id, fullname'); - } - - if (!empty($creator)) { - $cat_courses = get_courses($course->category, $sort="c.sortorder ASC", $fields="c.id, c.fullname"); - } else { - $cat_courses = array(); - } - - echo $OUTPUT->heading(get_string("importactivities")); - - $options = array(); - foreach ($taught_courses as $tcourse) { - if ($tcourse->id != $course->id && $tcourse->id != SITEID){ - $options[$tcourse->id] = format_string($tcourse->fullname); - } - } - - if (empty($options) && empty($creator)) { - echo $OUTPUT->notification(get_string('courseimportnotaught')); - return; // yay , this will pass control back to the file that included or required us. - } - - // quick forms - include_once('import_form.php'); - - $mform_post = new course_import_activities_form_1($CFG->wwwroot.'/course/import/activities/index.php', array('options'=>$options, 'courseid' => $course->id, 'text'=> get_string('coursestaught'))); - $mform_post ->display(); - - unset($options); - $options = array(); - - foreach ($cat_courses as $ccourse) { - if ($ccourse->id != $course->id && $ccourse->id != SITEID) { - $options[$ccourse->id] = format_string($ccourse->fullname); - } - } - $cat = $DB->get_record("course_categories", array("id"=>$course->category)); - - if (count($options) > 0) { - $mform_post = new course_import_activities_form_1($CFG->wwwroot.'/course/import/activities/index.php', array('options'=>$options, 'courseid' => $course->id, 'text' => get_string('coursescategory'))); - $mform_post ->display(); - } - - if (!empty($creator)) { - $mform_post = new course_import_activities_form_2($CFG->wwwroot.'/course/import/activities/index.php', array('courseid' => $course->id)); - $mform_post ->display(); - } - - if (!empty($fromcoursesearch) && !empty($creator)) { - $totalcount = 0; - $courses = get_courses_search(explode(" ",$fromcoursesearch),"fullname ASC",$page,50,$totalcount); - $table = new html_table(); - if (is_array($courses) and count($courses) > 0) { - $table->data[] = array(''.get_string('searchresults').'','',''); - foreach ($courses as $scourse) { - if ($course->id != $scourse->id) { - $table->data[] = array('',format_string($scourse->fullname), - ''.get_string('usethiscourse').''); - } - } - } - else { - $table->data[] = array('',get_string('noresults'),''); - } - } - if (!empty($table)) { - echo html_writer::table($table); - } - diff --git a/lang/en/moodle.php b/lang/en/moodle.php index cc43180e6c5..d9ec54d3598 100644 --- a/lang/en/moodle.php +++ b/lang/en/moodle.php @@ -307,7 +307,6 @@ $string['coursehelpnewsitemsnumber'] = 'Number of recent items appearing on the $string['coursehelpnumberweeks'] = 'Number of weeks/topics displayed on the course main page.'; $string['coursehelpshowgrades'] = 'Enable the display of the gradebook. It does not prevent grades from being displayed within the individual activities.'; $string['coursehidden'] = 'This course is currently unavailable to students'; -$string['courseimportnotaught'] = 'You don\'t seem to be an editing teacher in any other courses, there are no courses for you to import from.'; $string['courseinfo'] = 'Course info'; $string['coursemessage'] = 'Message course users'; $string['coursenotaccessible'] = 'This course does not allow public access'; @@ -341,13 +340,11 @@ $string['courserequestsuccess'] = 'Successfully saved your course request. Expec $string['courserequestsupport'] = 'Supporting information to help the administrator evaluate this request'; $string['courserestore'] = 'Course restore'; $string['courses'] = 'Courses'; -$string['coursescategory'] = 'Courses in the same category'; $string['coursesectionsummaries'] = 'Course section summaries'; $string['coursesettings'] = 'Course default settings'; $string['coursesmovedout'] = 'Courses moved out from {$a}'; $string['coursespending'] = 'Courses pending approval'; $string['coursestart'] = 'Course start'; -$string['coursestaught'] = 'Courses I have taught'; $string['coursesummary'] = 'Course summary'; $string['coursesummary_help'] = 'The course summary is displayed in the list of courses. A course search searches course summary text in addition to course names.'; $string['courseupdates'] = 'Course updates'; @@ -860,7 +857,6 @@ The ID number can also be set in the gradebook, though it can only be edited on $string['idnumbertaken'] = 'This ID number is already taken'; $string['imagealt'] = 'Picture description'; $string['import'] = 'Import'; -$string['importactivities'] = 'Import activities from another course'; $string['importdata'] = 'Import course data'; $string['importdataexported'] = 'Exported data from \'from\' course successfully.
Continue to import into your \'to\' course.'; $string['importdatafinished'] = 'Import complete! Continue to your course'; @@ -1726,7 +1722,6 @@ $string['userswithfiles'] = 'Users with files'; $string['useruploadtype'] = 'User upload type: {$a}'; $string['userviewingsettings'] = 'Profile settings for {$a}'; $string['userzones'] = 'User zones'; -$string['usethiscourse'] = 'Use this course'; $string['usingexistingcourse'] = 'Using existing course'; $string['valuealreadyused'] = 'This value has already been used.'; $string['version'] = 'Version'; diff --git a/lib/moodlelib.php b/lib/moodlelib.php index 20a64b38a56..bb300f200c4 100644 --- a/lib/moodlelib.php +++ b/lib/moodlelib.php @@ -7181,7 +7181,6 @@ function get_plugin_types($fullpaths=true) { 'filter' => 'filter', 'editor' => 'lib/editor', 'format' => 'course/format', - 'import' => 'course/import', 'profilefield' => 'user/profile/field', 'report' => $CFG->admin.'/report', 'coursereport' => 'course/report', // must be after system reports