2009-09-24 08:05:55 +00:00
|
|
|
<?php
|
2008-01-18 14:44:45 +00:00
|
|
|
|
|
|
|
require_once("../../config.php");
|
|
|
|
|
|
|
|
$id = required_param('id', PARAM_INT); // Course module ID
|
|
|
|
|
2009-09-24 08:05:55 +00:00
|
|
|
$PAGE->set_url(new moodle_url($CFG->wwwroot.'/mod/lesson/grade.php', array('id'=>$id)));
|
|
|
|
|
2008-01-18 14:44:45 +00:00
|
|
|
if (! $cm = get_coursemodule_from_id('lesson', $id)) {
|
2008-06-13 05:12:50 +00:00
|
|
|
print_error('invalidcoursemodule');
|
2008-01-18 14:44:45 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 04:03:40 +00:00
|
|
|
if (! $lesson = $DB->get_record("lesson", array("id" => $cm->instance))) {
|
2008-06-13 05:12:50 +00:00
|
|
|
print_error('invalidlessonid', 'lesson');
|
2008-01-18 14:44:45 +00:00
|
|
|
}
|
|
|
|
|
2008-06-06 04:03:40 +00:00
|
|
|
if (! $course = $DB->get_record("course", array("id" => $lesson->course))) {
|
2008-06-13 05:12:50 +00:00
|
|
|
print_error('coursemisconf');
|
2008-01-18 14:44:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
require_login($course->id, false, $cm);
|
|
|
|
|
2008-09-15 11:49:42 +00:00
|
|
|
if (has_capability('mod/lesson:edit', get_context_instance(CONTEXT_MODULE, $cm->id))) {
|
2008-01-18 14:44:45 +00:00
|
|
|
redirect('report.php?id='.$cm->id);
|
|
|
|
} else {
|
|
|
|
redirect('view.php?id='.$cm->id);
|
|
|
|
}
|
|
|
|
|
2009-11-01 15:03:10 +00:00
|
|
|
|