|
30 | 30 | // Verify course context. |
31 | 31 | $cm = get_coursemodule_from_id('hvp', $id); |
32 | 32 | if (!$cm) { |
33 | | - print_error('invalidcoursemodule'); |
| 33 | + throw new \moodle_exception('invalidcoursemodule'); |
34 | 34 | } |
35 | 35 | $course = $DB->get_record('course', array('id' => $cm->course)); |
36 | 36 | if (!$course) { |
37 | | - print_error('coursemisconf'); |
| 37 | + throw new \moodle_exception('coursemisconf'); |
38 | 38 | } |
39 | 39 | require_course_login($course, true, $cm); |
40 | 40 | $context = context_module::instance($cm->id); |
|
43 | 43 | // Check if Hub registered, if not redirect to hub registration. |
44 | 44 | if (empty(get_config('mod_hvp', 'site_uuid')) || empty(get_config('mod_hvp', 'hub_secret'))) { |
45 | 45 | if (!has_capability('mod/hvp:contenthubregistration', \context_system::instance())) { |
46 | | - print_error('nohubregistration', 'mod_hvp'); |
| 46 | + throw new \moodle_exception('nohubregistration'); |
47 | 47 | } |
48 | 48 | redirect(new moodle_url('/mod/hvp/content_hub_registration.php')); |
49 | 49 | } |
|
60 | 60 | } |
61 | 61 | $token = required_param('_token', PARAM_RAW); |
62 | 62 | if (!\H5PCore::validToken('share_' . $id, $token)) { |
63 | | - print_error('invalidtoken', 'mod_hvp'); |
| 63 | + throw new \moodle_exception('invalidtoken'); |
64 | 64 | } |
65 | 65 | if (empty($content['contentHubId']) || $content['shared'] !== '1') { |
66 | | - print_error('contentnotshared', 'mod_hvp'); |
| 66 | + throw new \moodle_exception('contentnotshared'); |
67 | 67 | } |
68 | 68 |
|
69 | 69 | $core = \mod_hvp\framework::instance(); |
|
0 commit comments