3 require_once("../../config.php");
5 $id = optional_param('id',0,PARAM_INT
); // Course Module ID, or
6 $l = optional_param('l',0,PARAM_INT
); // Label ID
9 if (! $cm = get_coursemodule_from_id('label', $id)) {
10 error("Course Module ID was incorrect");
13 if (! $course = get_record("course", "id", $cm->course
)) {
14 error("Course is misconfigured");
17 if (! $label = get_record("label", "id", $cm->instance
)) {
18 error("Course module is incorrect");
22 if (! $label = get_record("label", "id", $l)) {
23 error("Course module is incorrect");
25 if (! $course = get_record("course", "id", $label->course
)) {
26 error("Course is misconfigured");
28 if (! $cm = get_coursemodule_from_instance("label", $label->id
, $course->id
)) {
29 error("Course Module ID was incorrect");
33 require_login($course->id
);
35 redirect("$CFG->wwwroot/course/view.php?id=$course->id");