moodle/mod/assignment/view.php
Damyon Wiese 40cb48792a MDL-33952 Assignment - bon voyage!
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.
2014-01-08 14:51:06 +08:00

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);