protected static function validate_lesson($lessonid) {
        global $DB, $USER;

        // Request and permission validation.
        $lessonrecord = $DB->get_record('lesson', array('id' => $lessonid), '*', MUST_EXIST);
        list($course, $cm) = get_course_and_cm_from_instance($lessonrecord, 'lesson');

        $lesson = new lesson($lessonrecord, $cm, $course);
        $lesson->update_effective_access($USER->id);

        $context = $lesson->context;
        self::validate_context($context);

        return array($lesson, $course, $cm, $context, $lessonrecord);
    }
protected static function validate_lesson($lessonid) {
        global $DB, $USER;

        // Request and permission validation.
        $lessonrecord = $DB->get_record('lesson', array('id' => $lessonid), '*', MUST_EXIST);
        list($course, $cm) = get_course_and_cm_from_instance($lessonrecord, 'lesson');

        $lesson = new lesson($lessonrecord, $cm, $course);
        $lesson->update_effective_access($USER->id);

        $context = $lesson->context;
        self::validate_context($context);

        return array($lesson, $course, $cm, $context, $lessonrecord);
    }
protected static function validate_lesson ( $ lessonid ) { global $ DB , $ USER ; // Request and permission validation. $ lessonrecord = $ DB -> get_record ( 'lesson' , array ( 'id' => $ lessonid ) , '*' , MUST_EXIST ) ; list ( $ course , $ cm ) = get_course_and_cm_from_instance ( $ lessonrecord , 'lesson' ) ; $ lesson = new lesson ( $ lessonrecord , $ cm , $ course ) ; $ lesson -> update_effective_access ( $ USER -> id ) ; $ context = $ lesson -> context ; self :: validate_context ( $ context ) ; return array ( $ lesson , $ course , $ cm , $ context , $ lessonrecord ) ; }
Utility function for validating a lesson.

@param int $lessonid lesson instance id
@return array array containing the lesson, course, context and course module objects
@since  Moodle 3.3
Utility function for validating a lesson .