public static function get_attempts_overview($lessonid, $groupid = 0) {

        $params = array('lessonid' => $lessonid, 'groupid' => $groupid);
        $params = self::validate_parameters(self::get_attempts_overview_parameters(), $params);
        $warnings = array();

        list($lesson, $course, $cm, $context, $lessonrecord) = self::validate_lesson($params['lessonid']);
        require_capability('mod/lesson:viewreports', $context);

        if (!empty($params['groupid'])) {
            $groupid = $params['groupid'];
            // Determine is the group is visible to user.
            if (!groups_group_visible($groupid, $course, $cm)) {
                throw new moodle_exception('notingroup');
            }
        } else {
            // Check to see if groups are being used here.
            if ($groupmode = groups_get_activity_groupmode($cm)) {
                $groupid = groups_get_activity_group($cm);
                // Determine is the group is visible to user (this is particullary for the group 0 -> all groups).
                if (!groups_group_visible($groupid, $course, $cm)) {
                    throw new moodle_exception('notingroup');
                }
            } else {
                $groupid = 0;
            }
        }

        $result = array(
            'warnings' => $warnings
        );

        list($table, $data) = lesson_get_overview_report_table_and_data($lesson, $groupid);
        if ($data !== false) {
            $result['data'] = $data;
        }

        return $result;
    }
public static function get_attempts_overview($lessonid, $groupid = 0) {

        $params = array('lessonid' => $lessonid, 'groupid' => $groupid);
        $params = self::validate_parameters(self::get_attempts_overview_parameters(), $params);
        $warnings = array();

        list($lesson, $course, $cm, $context, $lessonrecord) = self::validate_lesson($params['lessonid']);
        require_capability('mod/lesson:viewreports', $context);

        if (!empty($params['groupid'])) {
            $groupid = $params['groupid'];
            // Determine is the group is visible to user.
            if (!groups_group_visible($groupid, $course, $cm)) {
                throw new moodle_exception('notingroup');
            }
        } else {
            // Check to see if groups are being used here.
            if ($groupmode = groups_get_activity_groupmode($cm)) {
                $groupid = groups_get_activity_group($cm);
                // Determine is the group is visible to user (this is particullary for the group 0 -> all groups).
                if (!groups_group_visible($groupid, $course, $cm)) {
                    throw new moodle_exception('notingroup');
                }
            } else {
                $groupid = 0;
            }
        }

        $result = array(
            'warnings' => $warnings
        );

        list($table, $data) = lesson_get_overview_report_table_and_data($lesson, $groupid);
        if ($data !== false) {
            $result['data'] = $data;
        }

        return $result;
    }
public static function get_attempts_overview ( $ lessonid , $ groupid = 0 ) { $ params = array ( 'lessonid' => $ lessonid , 'groupid' => $ groupid ) ; $ params = self :: validate_parameters ( self :: get_attempts_overview_parameters ( ) , $ params ) ; $ warnings = array ( ) ; list ( $ lesson , $ course , $ cm , $ context , $ lessonrecord ) = self :: validate_lesson ( $ params [ 'lessonid' ] ) ; require_capability ( 'mod/lesson:viewreports' , $ context ) ; if ( ! empty ( $ params [ 'groupid' ] ) ) { $ groupid = $ params [ 'groupid' ] ; // Determine is the group is visible to user. if ( ! groups_group_visible ( $ groupid , $ course , $ cm ) ) { throw new moodle_exception ( 'notingroup' ) ; } } else { // Check to see if groups are being used here. if ( $ groupmode = groups_get_activity_groupmode ( $ cm ) ) { $ groupid = groups_get_activity_group ( $ cm ) ; // Determine is the group is visible to user (this is particullary for the group 0 -> all groups). if ( ! groups_group_visible ( $ groupid , $ course , $ cm ) ) { throw new moodle_exception ( 'notingroup' ) ; } } else { $ groupid = 0 ; } } $ result = array ( 'warnings' => $ warnings ) ; list ( $ table , $ data ) = lesson_get_overview_report_table_and_data ( $ lesson , $ groupid ) ; if ( $ data !== false ) { $ result [ 'data' ] = $ data ; } return $ result ; }
Get a list of all the attempts made by users in a lesson.

@param int $lessonid lesson instance id
@param int $groupid group id, 0 means that the function will determine the user group
@return array of warnings and status result
@since Moodle 3.3
@throws moodle_exception
Get a list of all the attempts made by users in a lesson .