mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-24924 course/import - plugin not available anymore. Killed!
This commit is contained in:
parent
dc2abd4020
commit
96c726b663
@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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 '<div class="plugin">';
|
||||
include($importdir.'/mod.php');
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
echo $OUTPUT->footer();
|
||||
|
@ -1,106 +0,0 @@
|
||||
<?php
|
||||
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* 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();
|
||||
|
@ -1,100 +0,0 @@
|
||||
<?php
|
||||
|
||||
if (!defined('MOODLE_INTERNAL')) {
|
||||
die('Direct access to this script is forbidden.'); /// It must be included from a Moodle page
|
||||
}
|
||||
|
||||
require_once($CFG->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('<b>'.get_string('searchresults').'</b>','','');
|
||||
foreach ($courses as $scourse) {
|
||||
if ($course->id != $scourse->id) {
|
||||
$table->data[] = array('',format_string($scourse->fullname),
|
||||
'<a href="'.$CFG->wwwroot.'/course/import/activities/index.php?id='.$course->id.'&fromcourse='.$scourse->id.'">'.get_string('usethiscourse').'</a>');
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
$table->data[] = array('',get_string('noresults'),'');
|
||||
}
|
||||
}
|
||||
if (!empty($table)) {
|
||||
echo html_writer::table($table);
|
||||
}
|
||||
|
@ -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.<br /> 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';
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user