if ($id) { $cm = get_coursemodule_from_id('hotpot', $id, 0, false, MUST_EXIST); $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST); $hotpot = $DB->get_record('hotpot', array('id' => $cm->instance), '*', MUST_EXIST); } else { $hotpot = $DB->get_record('hotpot', array('id' => $hp), '*', MUST_EXIST); $course = $DB->get_record('course', array('id' => $hotpot->course), '*', MUST_EXIST); $cm = get_coursemodule_from_instance('hotpot', $hotpot->id, $course->id, false, MUST_EXIST); } // Check login require_login($course, true, $cm); require_capability('mod/hotpot:attempt', $PAGE->context); hotpot_add_to_log($course->id, 'hotpot', 'attempt', 'view.php?id=' . $cm->id, $hotpot->id, $cm->id); // Set editing mode if ($PAGE->user_allowed_editing()) { hotpot::set_user_editing(); } // Create an object to represent the current HotPot activity $hotpot = hotpot::create($hotpot, $cm, $course, $PAGE->context); // initialize $PAGE (and compute blocks) $PAGE->set_url($hotpot->attempt_url()); $PAGE->set_title($hotpot->name); $PAGE->set_heading($course->fullname); // allow the HotPot activity to set its preferred page layout $hotpot->set_preferred_pagelayout($PAGE); /// Create an object to manage all the other (non-roles) access rules. //$timenow = time(); //$canignoretimelimits = has_capability('mod/hotpot:ignoretimelimits', $PAGE->context, null, false); //$accessmanager = new hotpot_access_manager($hotpot, $timenow, $canignoretimelimits); //$messages = $accessmanager->describe_rules(); // get renderer subtype (e.g. attempt_hp_6_jcloze_xml)