Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Static Public Member Functions | Static Protected Member Functions | List of all members
mod_lesson_external Class Reference
Inheritance diagram for mod_lesson_external:
external_api

Static Public Member Functions

static call_external_function ($function, $args, $ajaxonly=false)
 Call an external function validating all params/returns correctly. More...
 
static clean_returnvalue (external_description $description, $response)
 Clean response If a response attribute is unknown from the description, we just ignore the attribute. More...
 
static external_function_info ($function, $strictness=MUST_EXIST)
 Returns detailed function information. More...
 
static finish_attempt ($lessonid, $password='', $outoftime=false, $review=false)
 Finishes the current attempt. More...
 
static finish_attempt_parameters ()
 Describes the parameters for finish_attempt. More...
 
static finish_attempt_returns ()
 Describes the finish_attempt return value. More...
 
static get_attempts_overview ($lessonid, $groupid=0)
 Get a list of all the attempts made by users in a lesson. More...
 
static get_attempts_overview_parameters ()
 Describes the parameters for get_attempts_overview. More...
 
static get_attempts_overview_returns ()
 Describes the get_attempts_overview return value. More...
 
static get_content_pages_viewed ($lessonid, $lessonattempt, $userid=null)
 Return the list of content pages viewed by a user during a lesson attempt. More...
 
static get_content_pages_viewed_parameters ()
 Describes the parameters for get_content_pages_viewed. More...
 
static get_content_pages_viewed_returns ()
 Describes the get_content_pages_viewed return value. More...
 
static get_lesson ($lessonid, $password='')
 Return information of a given lesson. More...
 
static get_lesson_access_information ($lessonid)
 Return access information for a given lesson. More...
 
static get_lesson_access_information_parameters ()
 Describes the parameters for get_lesson_access_information. More...
 
static get_lesson_access_information_returns ()
 Describes the get_lesson_access_information return value. More...
 
static get_lesson_parameters ()
 Describes the parameters for get_lesson. More...
 
static get_lesson_returns ()
 Describes the get_lesson return value. More...
 
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. More...
 
static get_lessons_by_courses_parameters ()
 Describes the parameters for get_lessons_by_courses. More...
 
static get_lessons_by_courses_returns ()
 Describes the get_lessons_by_courses return value. More...
 
static get_page_data ($lessonid, $pageid, $password='', $review=false, $returncontents=false)
 Return information of a given page, including its contents. More...
 
static get_page_data_parameters ()
 Describes the parameters for get_page_data. More...
 
static get_page_data_returns ()
 Describes the get_page_data return value. More...
 
static get_pages ($lessonid, $password='')
 Return the list of pages in a lesson (based on the user permissions). More...
 
static get_pages_parameters ()
 Describes the parameters for get_pages. More...
 
static get_pages_possible_jumps ($lessonid)
 Return all the possible jumps for the pages in a given lesson. More...
 
static get_pages_possible_jumps_parameters ()
 Describes the parameters for get_pages_possible_jumps. More...
 
static get_pages_possible_jumps_returns ()
 Describes the get_pages_possible_jumps return value. More...
 
static get_pages_returns ()
 Describes the get_pages return value. More...
 
static get_questions_attempts ($lessonid, $attempt, $correct=false, $pageid=null, $userid=null)
 Return the list of page question attempts in a given lesson. More...
 
static get_questions_attempts_parameters ()
 Describes the parameters for get_questions_attempts. More...
 
static get_questions_attempts_returns ()
 Describes the get_questions_attempts return value. More...
 
static get_user_attempt ($lessonid, $userid, $lessonattempt)
 Return information about the given user attempt (including answers). More...
 
static get_user_attempt_grade ($lessonid, $lessonattempt, $userid=null)
 Return grade information in the attempt for a given user. More...
 
static get_user_attempt_grade_parameters ()
 Describes the parameters for get_user_attempt_grade. More...
 
static get_user_attempt_grade_returns ()
 Describes the get_user_attempt_grade return value. More...
 
static get_user_attempt_parameters ()
 Describes the parameters for get_user_attempt. More...
 
static get_user_attempt_returns ()
 Describes the get_user_attempt return value. More...
 
static get_user_grade ($lessonid, $userid=null)
 Return the final grade in the lesson for the given user. More...
 
static get_user_grade_parameters ()
 Describes the parameters for get_user_grade. More...
 
static get_user_grade_returns ()
 Describes the get_user_grade return value. More...
 
static get_user_timers ($lessonid, $userid=null)
 Return the timers in the current lesson for the given user. More...
 
static get_user_timers_parameters ()
 Describes the parameters for get_user_timers. More...
 
static get_user_timers_returns ()
 Describes the get_user_timers return value. More...
 
static launch_attempt ($lessonid, $password='', $pageid=0, $review=false)
 Starts a new attempt or continues an existing one. More...
 
static launch_attempt_parameters ()
 Describes the parameters for launch_attempt. More...
 
static launch_attempt_returns ()
 Describes the launch_attempt return value. More...
 
static process_page ($lessonid, $pageid, $data, $password='', $review=false)
 Processes page responses. More...
 
static process_page_parameters ()
 Describes the parameters for process_page. More...
 
static process_page_returns ()
 Describes the process_page return value. More...
 
static set_context_restriction ($context)
 Set context restriction for all following subsequent function calls. More...
 
static set_timeout ($seconds=360)
 This method has to be called before every operation that takes a longer time to finish! More...
 
static validate_context ($context)
 Makes sure user may execute functions in this context. More...
 
static validate_parameters (external_description $description, $params)
 Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown. More...
 
static view_lesson ($lessonid, $password='')
 Trigger the course module viewed event and update the module completion status. More...
 
static view_lesson_parameters ()
 Describes the parameters for view_lesson. More...
 
static view_lesson_returns ()
 Describes the view_lesson return value. More...
 

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. More...
 
static external_messages ()
 Return a external structure representing messages. More...
 
static format_lesson_messages ($lesson)
 Return lesson messages formatted according the external_messages structure. More...
 
static get_context_from_params ($param)
 Get context from passed parameters. More...
 
static get_context_parameters ()
 Returns a prepared structure to use a context parameters. More...
 
static get_lesson_summary_for_exporter ($lessonrecord, $password='')
 Return a lesson record ready for being exported. More...
 
static get_page_fields (lesson_page $page, $returncontents=false)
 Returns the fields of a page object. More...
 
static get_page_structure ($required=VALUE_REQUIRED)
 Describes the external structure for a lesson page. More...
 
static get_user_attempt_grade_structure ($required=VALUE_REQUIRED)
 Describes an attempt grade structure. More...
 
static validate_attempt (lesson $lesson, $params, $return=false)
 Validates a new attempt. More...
 
static validate_lesson ($lessonid)
 Utility function for validating a lesson. More...
 

Member Function Documentation

◆ call_external_function()

static external_api::call_external_function (   $function,
  $args,
  $ajaxonly = false 
)
staticinherited

Call an external function validating all params/returns correctly.

Note that an external function may modify the state of the current page, so this wrapper saves and restores tha PAGE and COURSE global variables before/after calling the external function.

Parameters
string$functionA webservice function name.
array$argsParams array (named params)
boolean$ajaxonlyIf true, an extra check will be peformed to see if ajax is required.
Return values
arraycontaining keys for error (bool), exception and data.

◆ check_can_view_user_data()

static mod_lesson_external::check_can_view_user_data (   $userid,
  $course,
  $cm,
  $context 
)
staticprotected

Check if the current user can retrieve lesson information (grades, attempts) about the given user.

Parameters
int$useridthe user to check
stdClass$coursecourse object
stdClass$cmcm object
stdClass$contextcontext object
Exceptions
moodle_exception
Since
Moodle 3.3

◆ clean_returnvalue()

static external_api::clean_returnvalue ( external_description  $description,
  $response 
)
staticinherited

Clean response If a response attribute is unknown from the description, we just ignore the attribute.

If a response attribute is incorrect, invalid_response_exception is thrown. Note: this function is similar to validate parameters, however it is distinct because parameters validation must be distinct from cleaning return values.

Parameters
external_description$descriptiondescription of the return values
mixed$responsethe actual response
Return values
mixedresponse with added defaults for optional items, invalid_response_exception thrown if any problem found
Author
2010 Jerome Mouneyrac
Since
Moodle 2.0

◆ external_function_info()

static external_api::external_function_info (   $function,
  $strictness = MUST_EXIST 
)
staticinherited

Returns detailed function information.

Parameters
string | object$functionname of external function or record from external_function
int$strictnessIGNORE_MISSING means compatible mode, false returned if record not found, debug message if more found; MUST_EXIST means throw exception if no record or multiple records found
Return values
stdClassdescription or false if not found or exception thrown
Since
Moodle 2.0

◆ external_messages()

static mod_lesson_external::external_messages ( )
staticprotected

Return a external structure representing messages.

Return values
external_multiple_structuremessages structure
Since
Moodle 3.3

◆ finish_attempt()

static mod_lesson_external::finish_attempt (   $lessonid,
  $password = '',
  $outoftime = false,
  $review = false 
)
static

Finishes the current attempt.

Parameters
int$lessonidlesson instance id
string$passwordoptional password (the lesson may be protected)
bool$outoftimeoptional if the user run out of time
bool$reviewif we want to review just after finishing (1 hour margin)
Return values
arrayof warnings and information about the finished attempt
Since
Moodle 3.3
Exceptions
moodle_exception

◆ finish_attempt_parameters()

static mod_lesson_external::finish_attempt_parameters ( )
static

Describes the parameters for finish_attempt.

Return values
external_function_parameters
Since
Moodle 3.3

◆ finish_attempt_returns()

static mod_lesson_external::finish_attempt_returns ( )
static

Describes the finish_attempt return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ format_lesson_messages()

static mod_lesson_external::format_lesson_messages (   $lesson)
staticprotected

Return lesson messages formatted according the external_messages structure.

Parameters
lesson$lessonlesson instance
Return values
arraymessages formatted
Since
Moodle 3.3

◆ get_attempts_overview()

static mod_lesson_external::get_attempts_overview (   $lessonid,
  $groupid = 0 
)
static

Get a list of all the attempts made by users in a lesson.

Parameters
int$lessonidlesson instance id
int$groupidgroup id, 0 means that the function will determine the user group
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_attempts_overview_parameters()

static mod_lesson_external::get_attempts_overview_parameters ( )
static

Describes the parameters for get_attempts_overview.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_attempts_overview_returns()

static mod_lesson_external::get_attempts_overview_returns ( )
static

Describes the get_attempts_overview return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_content_pages_viewed()

static mod_lesson_external::get_content_pages_viewed (   $lessonid,
  $lessonattempt,
  $userid = null 
)
static

Return the list of content pages viewed by a user during a lesson attempt.

Parameters
int$lessonidlesson instance id
int$lessonattemptlesson attempt number
int$useridonly fetch attempts of the given user
Return values
arrayof warnings and page attempts
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_content_pages_viewed_parameters()

static mod_lesson_external::get_content_pages_viewed_parameters ( )
static

Describes the parameters for get_content_pages_viewed.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_content_pages_viewed_returns()

static mod_lesson_external::get_content_pages_viewed_returns ( )
static

Describes the get_content_pages_viewed return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_context_from_params()

static external_api::get_context_from_params (   $param)
staticprotectedinherited

Get context from passed parameters.

The passed array must either contain a contextid or a combination of context level and instance id to fetch the context. For example, the context level can be "course" and instanceid can be courseid.

See context_helper::get_all_levels() for a list of valid context levels.

Parameters
array$param
Since
Moodle 2.6
Exceptions
invalid_parameter_exception
Return values
context

◆ get_context_parameters()

static external_api::get_context_parameters ( )
staticprotectedinherited

Returns a prepared structure to use a context parameters.

Return values
external_single_structure

Reimplemented in tool_lp\external, and core_competency\external.

◆ get_lesson()

static mod_lesson_external::get_lesson (   $lessonid,
  $password = '' 
)
static

Return information of a given lesson.

Parameters
int$lessonidlesson instance id
string$passwordoptional password (the lesson may be protected)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_lesson_access_information()

static mod_lesson_external::get_lesson_access_information (   $lessonid)
static

Return access information for a given lesson.

Parameters
int$lessonidlesson instance id
Return values
arrayof warnings and the access information
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_lesson_access_information_parameters()

static mod_lesson_external::get_lesson_access_information_parameters ( )
static

Describes the parameters for get_lesson_access_information.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_lesson_access_information_returns()

static mod_lesson_external::get_lesson_access_information_returns ( )
static

Describes the get_lesson_access_information return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_lesson_parameters()

static mod_lesson_external::get_lesson_parameters ( )
static

Describes the parameters for get_lesson.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_lesson_returns()

static mod_lesson_external::get_lesson_returns ( )
static

Describes the get_lesson return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_lesson_summary_for_exporter()

static mod_lesson_external::get_lesson_summary_for_exporter (   $lessonrecord,
  $password = '' 
)
staticprotected

Return a lesson record ready for being exported.

Parameters
stdClass$lessonrecordlesson record
string$passwordlesson password
Return values
stdClassthe lesson record ready for exporting.

◆ get_lessons_by_courses()

static mod_lesson_external::get_lessons_by_courses (   $courseids = array())
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.

Parameters
array$courseidsArray of course ids
Return values
arrayof lessons details
Since
Moodle 3.3

◆ get_lessons_by_courses_parameters()

static mod_lesson_external::get_lessons_by_courses_parameters ( )
static

Describes the parameters for get_lessons_by_courses.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_lessons_by_courses_returns()

static mod_lesson_external::get_lessons_by_courses_returns ( )
static

Describes the get_lessons_by_courses return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_page_data()

static mod_lesson_external::get_page_data (   $lessonid,
  $pageid,
  $password = '',
  $review = false,
  $returncontents = false 
)
static

Return information of a given page, including its contents.

Parameters
int$lessonidlesson instance id
int$pageidpage id
string$passwordoptional password (the lesson may be protected)
bool$reviewif we want to review just after finishing (1 hour margin)
bool$returncontentsif we must return the complete page contents once rendered
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_page_data_parameters()

static mod_lesson_external::get_page_data_parameters ( )
static

Describes the parameters for get_page_data.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_page_data_returns()

static mod_lesson_external::get_page_data_returns ( )
static

Describes the get_page_data return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_page_fields()

static mod_lesson_external::get_page_fields ( lesson_page  $page,
  $returncontents = false 
)
staticprotected

Returns the fields of a page object.

Parameters
lesson_page$pagethe lesson page
bool$returncontentswhether to return the page title and contents
Return values
stdClassthe fields matching the external page structure
Since
Moodle 3.3

◆ get_page_structure()

static mod_lesson_external::get_page_structure (   $required = VALUE_REQUIRED)
staticprotected

Describes the external structure for a lesson page.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_pages()

static mod_lesson_external::get_pages (   $lessonid,
  $password = '' 
)
static

Return the list of pages in a lesson (based on the user permissions).

Parameters
int$lessonidlesson instance id
string$passwordoptional password (the lesson may be protected)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_pages_parameters()

static mod_lesson_external::get_pages_parameters ( )
static

Describes the parameters for get_pages.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_pages_possible_jumps()

static mod_lesson_external::get_pages_possible_jumps (   $lessonid)
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.

Parameters
int$lessonidlesson instance id
Return values
arrayof warnings and possible jumps
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_pages_possible_jumps_parameters()

static mod_lesson_external::get_pages_possible_jumps_parameters ( )
static

Describes the parameters for get_pages_possible_jumps.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_pages_possible_jumps_returns()

static mod_lesson_external::get_pages_possible_jumps_returns ( )
static

Describes the get_pages_possible_jumps return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_pages_returns()

static mod_lesson_external::get_pages_returns ( )
static

Describes the get_pages return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_questions_attempts()

static mod_lesson_external::get_questions_attempts (   $lessonid,
  $attempt,
  $correct = false,
  $pageid = null,
  $userid = null 
)
static

Return the list of page question attempts in a given lesson.

Parameters
int$lessonidlesson instance id
int$attemptthe lesson attempt number
bool$correctonly fetch correct attempts
int$pageidonly fetch attempts at the given page
int$useridonly fetch attempts of the given user
Return values
arrayof warnings and page attempts
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_questions_attempts_parameters()

static mod_lesson_external::get_questions_attempts_parameters ( )
static

Describes the parameters for get_questions_attempts.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_questions_attempts_returns()

static mod_lesson_external::get_questions_attempts_returns ( )
static

Describes the get_questions_attempts return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_user_attempt()

static mod_lesson_external::get_user_attempt (   $lessonid,
  $userid,
  $lessonattempt 
)
static

Return information about the given user attempt (including answers).

Parameters
int$lessonidlesson instance id
int$useridthe user id
int$lessonattemptthe attempt number
Return values
arrayof warnings and page attempts
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_user_attempt_grade()

static mod_lesson_external::get_user_attempt_grade (   $lessonid,
  $lessonattempt,
  $userid = null 
)
static

Return grade information in the attempt for a given user.

Parameters
int$lessonidlesson instance id
int$lessonattemptlesson attempt number
int$useridonly fetch attempts of the given user
Return values
arrayof warnings and page attempts
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_user_attempt_grade_parameters()

static mod_lesson_external::get_user_attempt_grade_parameters ( )
static

Describes the parameters for get_user_attempt_grade.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_user_attempt_grade_returns()

static mod_lesson_external::get_user_attempt_grade_returns ( )
static

Describes the get_user_attempt_grade return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_user_attempt_grade_structure()

static mod_lesson_external::get_user_attempt_grade_structure (   $required = VALUE_REQUIRED)
staticprotected

Describes an attempt grade structure.

Parameters
int$requiredif the structure is required or optional
Return values
external_single_structurethe structure
Since
Moodle 3.3

◆ get_user_attempt_parameters()

static mod_lesson_external::get_user_attempt_parameters ( )
static

Describes the parameters for get_user_attempt.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_user_attempt_returns()

static mod_lesson_external::get_user_attempt_returns ( )
static

Describes the get_user_attempt return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_user_grade()

static mod_lesson_external::get_user_grade (   $lessonid,
  $userid = null 
)
static

Return the final grade in the lesson for the given user.

Parameters
int$lessonidlesson instance id
int$useridonly fetch grades of this user
Return values
arrayof warnings and page attempts
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_user_grade_parameters()

static mod_lesson_external::get_user_grade_parameters ( )
static

Describes the parameters for get_user_grade.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_user_grade_returns()

static mod_lesson_external::get_user_grade_returns ( )
static

Describes the get_user_grade return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ get_user_timers()

static mod_lesson_external::get_user_timers (   $lessonid,
  $userid = null 
)
static

Return the timers in the current lesson for the given user.

Parameters
int$lessonidlesson instance id
int$useridonly fetch timers of the given user
Return values
arrayof warnings and timers
Since
Moodle 3.3
Exceptions
moodle_exception

◆ get_user_timers_parameters()

static mod_lesson_external::get_user_timers_parameters ( )
static

Describes the parameters for get_user_timers.

Return values
external_function_parameters
Since
Moodle 3.3

◆ get_user_timers_returns()

static mod_lesson_external::get_user_timers_returns ( )
static

Describes the get_user_timers return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ launch_attempt()

static mod_lesson_external::launch_attempt (   $lessonid,
  $password = '',
  $pageid = 0,
  $review = false 
)
static

Starts a new attempt or continues an existing one.

Parameters
int$lessonidlesson instance id
string$passwordoptional password (the lesson may be protected)
int$pageidpage id to continue from (only when continuing an attempt)
bool$reviewif we want to review just after finishing
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ launch_attempt_parameters()

static mod_lesson_external::launch_attempt_parameters ( )
static

Describes the parameters for launch_attempt.

Return values
external_function_parameters
Since
Moodle 3.3

◆ launch_attempt_returns()

static mod_lesson_external::launch_attempt_returns ( )
static

Describes the launch_attempt return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ process_page()

static mod_lesson_external::process_page (   $lessonid,
  $pageid,
  $data,
  $password = '',
  $review = false 
)
static

Processes page responses.

Parameters
int$lessonidlesson instance id
int$pageidpage id
array$datathe data to be saved
string$passwordoptional password (the lesson may be protected)
bool$reviewif we want to review just after finishing (1 hour margin)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ process_page_parameters()

static mod_lesson_external::process_page_parameters ( )
static

Describes the parameters for process_page.

Return values
external_function_parameters
Since
Moodle 3.3

◆ process_page_returns()

static mod_lesson_external::process_page_returns ( )
static

Describes the process_page return value.

Return values
external_single_structure
Since
Moodle 3.3

◆ set_context_restriction()

static external_api::set_context_restriction (   $context)
staticinherited

Set context restriction for all following subsequent function calls.

Parameters
stdClass$contextthe context restriction
Since
Moodle 2.0

◆ set_timeout()

static external_api::set_timeout (   $seconds = 360)
staticinherited

This method has to be called before every operation that takes a longer time to finish!

Parameters
int$secondsmax expected time the next operation needs
Since
Moodle 2.0

◆ validate_attempt()

static mod_lesson_external::validate_attempt ( lesson  $lesson,
  $params,
  $return = false 
)
staticprotected

Validates a new attempt.

Parameters
lesson$lessonlesson instance
array$paramsrequest parameters
boolean$returnwhether to return the errors or throw exceptions
Return values
arraythe errors (if return set to true)
Since
Moodle 3.3

◆ validate_context()

static external_api::validate_context (   $context)
staticinherited

Makes sure user may execute functions in this context.

Parameters
stdClass$context
Since
Moodle 2.0

◆ validate_lesson()

static mod_lesson_external::validate_lesson (   $lessonid)
staticprotected

Utility function for validating a lesson.

Parameters
int$lessonidlesson instance id
Return values
arrayarray containing the lesson, course, context and course module objects
Since
Moodle 3.3

◆ validate_parameters()

static external_api::validate_parameters ( external_description  $description,
  $params 
)
staticinherited

Validates submitted function parameters, if anything is incorrect invalid_parameter_exception is thrown.

This is a simple recursive method which is intended to be called from each implementation method of external API.

Parameters
external_description$descriptiondescription of parameters
mixed$paramsthe actual parameters
Return values
mixedparams with added defaults for optional items, invalid_parameters_exception thrown if any problem found
Since
Moodle 2.0

◆ view_lesson()

static mod_lesson_external::view_lesson (   $lessonid,
  $password = '' 
)
static

Trigger the course module viewed event and update the module completion status.

Parameters
int$lessonidlesson instance id
string$passwordoptional password (the lesson may be protected)
Return values
arrayof warnings and status result
Since
Moodle 3.3
Exceptions
moodle_exception

◆ view_lesson_parameters()

static mod_lesson_external::view_lesson_parameters ( )
static

Describes the parameters for view_lesson.

Return values
external_function_parameters
Since
Moodle 3.3

◆ view_lesson_returns()

static mod_lesson_external::view_lesson_returns ( )
static

Describes the view_lesson return value.

Return values
external_single_structure
Since
Moodle 3.3

The documentation for this class was generated from the following file: