mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
40cb48792a
mod_assignment has been replaced with a stub that only exists to support restoring and auto upgrading to mod_assign. If you require mod_assignment for some old plugin, then overwrite with the 2.6 version manually.
32 lines
900 B
PHP
32 lines
900 B
PHP
<?php
|
|
|
|
require_once("../../config.php");
|
|
|
|
$id = optional_param('id', 0, PARAM_INT); // Course Module ID.
|
|
$a = optional_param('a', 0, PARAM_INT); // Assignment ID.
|
|
|
|
require_login();
|
|
$PAGE->set_context(context_system::instance());
|
|
|
|
if (!$id && !$a) {
|
|
print_error('invalidcoursemodule');
|
|
}
|
|
|
|
$mapping = null;
|
|
if ($id) {
|
|
$mapping = $DB->get_record('assignment_upgrade', array('oldcmid' => $id), '*', IGNORE_MISSING);
|
|
} else {
|
|
$mapping = $DB->get_record('assignment_upgrade', array('oldinstance' => $a), '*', IGNORE_MISSING);
|
|
}
|
|
|
|
if (!$mapping) {
|
|
$url = '';
|
|
if (has_capability('moodle/site:config', context_system::instance())) {
|
|
$url = new moodle_url('/admin/tool/assignmentupgrade/listnotupgraded.php');
|
|
}
|
|
print_error('assignmentneedsupgrade', 'assignment', $url);
|
|
}
|
|
|
|
$url = new moodle_url('/mod/assign/view.php', array('id' => $mapping->newcmid));
|
|
redirect($url);
|