. /** * Prints a particular instance of lamslesson * * You can have a rather longer description of the file as well, * if you like, and it can span multiple lines. * * @package mod_lamslesson * @copyright 2011 LAMS Foundation - Ernie Ghiglione (ernieg@lamsfoundation.org) * @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL v2 */ require_once(dirname(dirname(dirname(__FILE__))).'/config.php'); require_once(dirname(__FILE__).'/lib.php'); $id = optional_param('id', 0, PARAM_INT); // course_module ID, or $n = optional_param('n', 0, PARAM_INT); // lamslesson instance ID - it should be named as the first character of the module if ($id) { $cm = get_coursemodule_from_id('lamslesson', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $lamslesson = $DB->get_record('lamslesson', array('id' => $cm->instance), '*', MUST_EXIST); } elseif ($n) { $lamslesson = $DB->get_record('lamslesson', array('id' => $n), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $lamslesson->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('lamslesson', $lamslesson->id, $course->id, false, MUST_EXIST); } else { print_error('You must specify a course_module ID or an instance ID'); } require_login($course, true, $cm); // $context = get_context_instance(CONTEXT_MODULE, $cm->id); $context = context_module::instance($cm->id); // Trigger module viewed event. if (!empty($id)) { if (! $cm = get_coursemodule_from_id('lamslesson', $id, 0, true)) { print_error('invalidcoursemodule'); } if (! $course = $DB->get_record("course", array("id" => $cm->course))) { print_error('coursemisconf'); } if (! $lamslesson = $DB->get_record("lamslesson", array("id" => $cm->instance))) { print_error('invalidcoursemodule'); } } else { print_error('missingparameter'); } lamslesson_view($lamslesson, $course, $cm, $context); /// Print the page header $PAGE->set_url('/mod/lamslesson/view.php', array('id' => $cm->id)); $PAGE->set_title($lamslesson->name); $PAGE->set_heading($course->shortname); /// $PAGE->set_button(update_module_button($cm->id, $course->id, get_string('modulename', 'lamslesson'))); // Main page $options_html = ''; $canmanage = has_capability('mod/lamslesson:manage', $context); // Log the lamslesson view. if (!empty($id)) { if (! $cm = get_coursemodule_from_id('lamslesson', $id, 0, true)) { print_error('invalidcoursemodule'); } if (! $course = $DB->get_record("course", array("id" => $cm->course))) { print_error('coursemisconf'); } if (! $lamslesson = $DB->get_record("lamslesson", array("id" => $cm->instance))) { print_error('invalidcoursemodule'); } } else { print_error('missingparameter'); } lamslesson_view($lamslesson, $course, $cm, $context); // Check capabilities $canparticipate = has_capability('mod/lamslesson:participate', $context); // Output starts here echo $OUTPUT->header(); // Main LAMS region echo $OUTPUT->heading($lamslesson->name); echo $OUTPUT->box_start('generalbox', 'instructions'); echo '
'; echo format_module_intro('lamslesson', $lamslesson, $cm->id); echo '
'; echo ''; echo get_string('lessonincompleted','lamslesson') . ' '; echo '
'; echo ''; echo get_string('youhavecompleted','lamslesson') . ' ' . $progress['activitiesCompleted'] . ' ' .get_string('outof','lamslesson'). ' ' .$progress['activityCount'] . ' ' . get_string('activities','lamslesson') . '[*]'; echo '
'; echo '