Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Lesson external functions. More...
Static Public Member Functions | |
static | finish_attempt ($lessonid, $password='', $outoftime=false, $review=false) |
Finishes the current attempt. | |
static | finish_attempt_parameters () |
Describes the parameters for finish_attempt. | |
static | finish_attempt_returns () |
Describes the finish_attempt return value. | |
static | get_attempts_overview ($lessonid, $groupid=0) |
Get a list of all the attempts made by users in a lesson. | |
static | get_attempts_overview_parameters () |
Describes the parameters for get_attempts_overview. | |
static | get_attempts_overview_returns () |
Describes the get_attempts_overview return value. | |
static | get_content_pages_viewed ($lessonid, $lessonattempt, $userid=null) |
Return the list of content pages viewed by a user during a lesson attempt. | |
static | get_content_pages_viewed_parameters () |
Describes the parameters for get_content_pages_viewed. | |
static | get_content_pages_viewed_returns () |
Describes the get_content_pages_viewed return value. | |
static | get_lesson ($lessonid, $password='') |
Return information of a given lesson. | |
static | get_lesson_access_information ($lessonid) |
Return access information for a given lesson. | |
static | get_lesson_access_information_parameters () |
Describes the parameters for get_lesson_access_information. | |
static | get_lesson_access_information_returns () |
Describes the get_lesson_access_information return value. | |
static | get_lesson_parameters () |
Describes the parameters for get_lesson. | |
static | get_lesson_returns () |
Describes the get_lesson return value. | |
static | get_lessons_by_courses ($courseids=array()) |
Returns a list of lessons in a provided list of courses, if no list is provided all lessons that the user can view will be returned. | |
static | get_lessons_by_courses_parameters () |
Describes the parameters for get_lessons_by_courses. | |
static | get_lessons_by_courses_returns () |
Describes the get_lessons_by_courses return value. | |
static | get_page_data ($lessonid, $pageid, $password='', $review=false, $returncontents=false) |
Return information of a given page, including its contents. | |
static | get_page_data_parameters () |
Describes the parameters for get_page_data. | |
static | get_page_data_returns () |
Describes the get_page_data return value. | |
static | get_pages ($lessonid, $password='') |
Return the list of pages in a lesson (based on the user permissions). | |
static | get_pages_parameters () |
Describes the parameters for get_pages. | |
static | get_pages_possible_jumps ($lessonid) |
Return all the possible jumps for the pages in a given lesson. | |
static | get_pages_possible_jumps_parameters () |
Describes the parameters for get_pages_possible_jumps. | |
static | get_pages_possible_jumps_returns () |
Describes the get_pages_possible_jumps return value. | |
static | get_pages_returns () |
Describes the get_pages return value. | |
static | get_questions_attempts ($lessonid, $attempt, $correct=false, $pageid=null, $userid=null) |
Return the list of page question attempts in a given lesson. | |
static | get_questions_attempts_parameters () |
Describes the parameters for get_questions_attempts. | |
static | get_questions_attempts_returns () |
Describes the get_questions_attempts return value. | |
static | get_user_attempt ($lessonid, $userid, $lessonattempt) |
Return information about the given user attempt (including answers). | |
static | get_user_attempt_grade ($lessonid, $lessonattempt, $userid=null) |
Return grade information in the attempt for a given user. | |
static | get_user_attempt_grade_parameters () |
Describes the parameters for get_user_attempt_grade. | |
static | get_user_attempt_grade_returns () |
Describes the get_user_attempt_grade return value. | |
static | get_user_attempt_parameters () |
Describes the parameters for get_user_attempt. | |
static | get_user_attempt_returns () |
Describes the get_user_attempt return value. | |
static | get_user_grade ($lessonid, $userid=null) |
Return the final grade in the lesson for the given user. | |
static | get_user_grade_parameters () |
Describes the parameters for get_user_grade. | |
static | get_user_grade_returns () |
Describes the get_user_grade return value. | |
static | get_user_timers ($lessonid, $userid=null) |
Return the timers in the current lesson for the given user. | |
static | get_user_timers_parameters () |
Describes the parameters for get_user_timers. | |
static | get_user_timers_returns () |
Describes the get_user_timers return value. | |
static | launch_attempt ($lessonid, $password='', $pageid=0, $review=false) |
Starts a new attempt or continues an existing one. | |
static | launch_attempt_parameters () |
Describes the parameters for launch_attempt. | |
static | launch_attempt_returns () |
Describes the launch_attempt return value. | |
static | process_page ($lessonid, $pageid, $data, $password='', $review=false) |
Processes page responses. | |
static | process_page_parameters () |
Describes the parameters for process_page. | |
static | process_page_returns () |
Describes the process_page return value. | |
static | view_lesson ($lessonid, $password='') |
Trigger the course module viewed event and update the module completion status. | |
static | view_lesson_parameters () |
Describes the parameters for view_lesson. | |
static | view_lesson_returns () |
Describes the view_lesson return value. | |
Static Protected Member Functions | |
static | check_can_view_user_data ($userid, $course, $cm, $context) |
Check if the current user can retrieve lesson information (grades, attempts) about the given user. | |
static | external_messages () |
Return a external structure representing messages. | |
static | format_lesson_messages ($lesson) |
Return lesson messages formatted according the external_messages structure. | |
static | get_lesson_summary_for_exporter ($lessonrecord, $password='') |
Return a lesson record ready for being exported. | |
static | get_page_fields (lesson_page $page, $returncontents=false) |
Returns the fields of a page object. | |
static | get_page_structure ($required=VALUE_REQUIRED) |
Describes the external structure for a lesson page. | |
static | get_user_attempt_grade_structure ($required=VALUE_REQUIRED) |
Describes an attempt grade structure. | |
static | validate_attempt (lesson $lesson, $params, $return=false) |
Validates a new attempt. | |
static | validate_lesson ($lessonid) |
Utility function for validating a lesson. | |
Lesson external functions.
|
staticprotected |
Check if the current user can retrieve lesson information (grades, attempts) about the given user.
int | $userid | the user to check |
stdClass | $course | course object |
stdClass | $cm | cm object |
stdClass | $context | context object |
moodle_exception |
|
staticprotected |
Return a external structure representing messages.
external_multiple_structure | messages structure |
|
static |
Finishes the current attempt.
int | $lessonid | lesson instance id |
string | $password | optional password (the lesson may be protected) |
bool | $outoftime | optional if the user run out of time |
bool | $review | if we want to review just after finishing (1 hour margin) |
array | of warnings and information about the finished attempt |
moodle_exception |
|
static |
Describes the parameters for finish_attempt.
external_function_parameters |
|
static |
Describes the finish_attempt return value.
external_single_structure |
|
staticprotected |
Return lesson messages formatted according the external_messages structure.
lesson | $lesson | lesson instance |
array | messages formatted |
|
static |
Get a list of all the attempts made by users in a lesson.
int | $lessonid | lesson instance id |
int | $groupid | group id, 0 means that the function will determine the user group |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for get_attempts_overview.
external_function_parameters |
|
static |
Describes the get_attempts_overview return value.
external_single_structure |
|
static |
Return the list of content pages viewed by a user during a lesson attempt.
int | $lessonid | lesson instance id |
int | $lessonattempt | lesson attempt number |
int | $userid | only fetch attempts of the given user |
array | of warnings and page attempts |
moodle_exception |
|
static |
Describes the parameters for get_content_pages_viewed.
external_function_parameters |
|
static |
Describes the get_content_pages_viewed return value.
external_single_structure |
|
static |
Return information of a given lesson.
int | $lessonid | lesson instance id |
string | $password | optional password (the lesson may be protected) |
array | of warnings and status result |
moodle_exception |
|
static |
Return access information for a given lesson.
int | $lessonid | lesson instance id |
array | of warnings and the access information |
moodle_exception |
|
static |
Describes the parameters for get_lesson_access_information.
external_function_parameters |
|
static |
Describes the get_lesson_access_information return value.
external_single_structure |
|
static |
Describes the parameters for get_lesson.
external_function_parameters |
|
static |
Describes the get_lesson return value.
external_single_structure |
|
staticprotected |
Return a lesson record ready for being exported.
stdClass | $lessonrecord | lesson record |
string | $password | lesson password |
stdClass | the lesson record ready for exporting. |
|
static |
Returns a list of lessons in a provided list of courses, if no list is provided all lessons that the user can view will be returned.
array | $courseids | Array of course ids |
array | of lessons details |
|
static |
Describes the parameters for get_lessons_by_courses.
external_function_parameters |
|
static |
Describes the get_lessons_by_courses return value.
external_single_structure |
|
static |
Return information of a given page, including its contents.
int | $lessonid | lesson instance id |
int | $pageid | page id |
string | $password | optional password (the lesson may be protected) |
bool | $review | if we want to review just after finishing (1 hour margin) |
bool | $returncontents | if we must return the complete page contents once rendered |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for get_page_data.
external_function_parameters |
|
static |
Describes the get_page_data return value.
external_single_structure |
|
staticprotected |
Returns the fields of a page object.
lesson_page | $page | the lesson page |
bool | $returncontents | whether to return the page title and contents |
stdClass | the fields matching the external page structure |
|
staticprotected |
Describes the external structure for a lesson page.
external_single_structure |
|
static |
Return the list of pages in a lesson (based on the user permissions).
int | $lessonid | lesson instance id |
string | $password | optional password (the lesson may be protected) |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for get_pages.
external_function_parameters |
|
static |
Return all the possible jumps for the pages in a given lesson.
You may expect different results on consecutive executions due to the random nature of the lesson module.
int | $lessonid | lesson instance id |
array | of warnings and possible jumps |
moodle_exception |
|
static |
Describes the parameters for get_pages_possible_jumps.
external_function_parameters |
|
static |
Describes the get_pages_possible_jumps return value.
external_single_structure |
|
static |
Describes the get_pages return value.
external_single_structure |
|
static |
Return the list of page question attempts in a given lesson.
int | $lessonid | lesson instance id |
int | $attempt | the lesson attempt number |
bool | $correct | only fetch correct attempts |
int | $pageid | only fetch attempts at the given page |
int | $userid | only fetch attempts of the given user |
array | of warnings and page attempts |
moodle_exception |
|
static |
Describes the parameters for get_questions_attempts.
external_function_parameters |
|
static |
Describes the get_questions_attempts return value.
external_single_structure |
|
static |
Return information about the given user attempt (including answers).
int | $lessonid | lesson instance id |
int | $userid | the user id |
int | $lessonattempt | the attempt number |
array | of warnings and page attempts |
moodle_exception |
|
static |
Return grade information in the attempt for a given user.
int | $lessonid | lesson instance id |
int | $lessonattempt | lesson attempt number |
int | $userid | only fetch attempts of the given user |
array | of warnings and page attempts |
moodle_exception |
|
static |
Describes the parameters for get_user_attempt_grade.
external_function_parameters |
|
static |
Describes the get_user_attempt_grade return value.
external_single_structure |
|
staticprotected |
Describes an attempt grade structure.
int | $required | if the structure is required or optional |
external_single_structure | the structure |
|
static |
Describes the parameters for get_user_attempt.
external_function_parameters |
|
static |
Describes the get_user_attempt return value.
external_single_structure |
|
static |
Return the final grade in the lesson for the given user.
int | $lessonid | lesson instance id |
int | $userid | only fetch grades of this user |
array | of warnings and page attempts |
moodle_exception |
|
static |
Describes the parameters for get_user_grade.
external_function_parameters |
|
static |
Describes the get_user_grade return value.
external_single_structure |
|
static |
Return the timers in the current lesson for the given user.
int | $lessonid | lesson instance id |
int | $userid | only fetch timers of the given user |
array | of warnings and timers |
moodle_exception |
|
static |
Describes the parameters for get_user_timers.
external_function_parameters |
|
static |
Describes the get_user_timers return value.
external_single_structure |
|
static |
Starts a new attempt or continues an existing one.
int | $lessonid | lesson instance id |
string | $password | optional password (the lesson may be protected) |
int | $pageid | page id to continue from (only when continuing an attempt) |
bool | $review | if we want to review just after finishing |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for launch_attempt.
external_function_parameters |
|
static |
Describes the launch_attempt return value.
external_single_structure |
|
static |
Processes page responses.
int | $lessonid | lesson instance id |
int | $pageid | page id |
array | $data | the data to be saved |
string | $password | optional password (the lesson may be protected) |
bool | $review | if we want to review just after finishing (1 hour margin) |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for process_page.
external_function_parameters |
|
static |
Describes the process_page return value.
external_single_structure |
|
staticprotected |
Validates a new attempt.
lesson | $lesson | lesson instance |
array | $params | request parameters |
boolean | $return | whether to return the errors or throw exceptions |
array | the errors (if return set to true) |
|
staticprotected |
Utility function for validating a lesson.
int | $lessonid | lesson instance id |
array | array containing the lesson, course, context and course module objects |
|
static |
Trigger the course module viewed event and update the module completion status.
int | $lessonid | lesson instance id |
string | $password | optional password (the lesson may be protected) |
array | of warnings and status result |
moodle_exception |
|
static |
Describes the parameters for view_lesson.
external_function_parameters |
|
static |
Describes the view_lesson return value.
external_single_structure |