forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathview.php
31 lines (24 loc) · 900 Bytes
/
view.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?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);