Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Namespaces | |
namespace | mod_lesson |
| |
namespace | mod_lesson\analytics\indicator |
| |
namespace | mod_lesson\cache |
| |
namespace | mod_lesson\completion |
| |
namespace | mod_lesson\event |
| |
namespace | mod_lesson\external |
| |
namespace | mod_lesson\local\numeric |
| |
namespace | mod_lesson\output |
| |
namespace | mod_lesson\privacy |
| |
namespace | mod_lesson\search |
| |
Functions | |
lesson_add_fake_blocks ($page, $cm, $lesson, $timer=null) | |
lesson_add_header_buttons ($cm, $context, $extraeditbuttons=false, $lessonpageid=null) | |
Adds header buttons to the page for the lesson. | |
object | lesson_add_instance ($data, $mform) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance. | |
lesson_check_updates_since (cm_info $cm, $from, $filter=array()) | |
lesson_clock_block_contents ($cmid, $lesson, $timer, $page) | |
If a timed lesson and not a teacher, then return a block_contents containing the clock. | |
stdClass | lesson_cron () |
Function to be run periodically according to the moodle cron This function searches for things that need to be done, such as sending out mail, toggling flags etc ... | |
object | lesson_delete_instance ($id) |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it. | |
lesson_display_teacher_warning ($lesson) | |
Any other lesson functions go here. | |
lesson_displayleftif ($lesson) | |
Determines if a user can view the left menu. | |
lesson_extend_settings_navigation (settings_navigation $settings, navigation_node $lessonnode) | |
This function extends the settings navigation block for the site. | |
lesson_get_completion_state ($course, $cm, $userid, $type) | |
Obtains the automatic completion state for this lesson based on any conditions in lesson settings. | |
lesson_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any lesson type wants to add 'extra' information for the course (see resource). | |
lesson_get_file_areas () | |
Returns an array of file areas. | |
stdClass | lesson_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) |
Returns a file_info_stored object for the file being requested here. | |
lesson_get_group_override_priorities ($lessonid) | |
Calculates the priorities of timeopen and timeclose values for group overrides for a lesson. | |
lesson_get_import_export_formats ($type) | |
Get list of available import or export formats. | |
object | lesson_get_media_html ($lesson, $context) |
This is a function used to detect media types and generate html code. | |
lesson_get_overview_report_table_and_data (lesson $lesson, $currentgroup) | |
Return the overview report table and data. | |
lesson_get_post_actions () | |
List the actions that correspond to a post of this module. | |
lesson_get_user_deadline ($courseid) | |
Return user's deadline for all lessons in a course, hereby taking into account group and user overrides. | |
lesson_get_user_detailed_report_data (lesson $lesson, $userid, $attempt) | |
Return information about one user attempt (including answers) | |
stdClass | lesson_get_user_grades ($lesson, $userid=0) |
Return grade for given user or all users. | |
lesson_get_view_actions () | |
List the actions that correspond to a view of this module. | |
lesson_grade ($lesson, $ntries, $userid=0) | |
Calculates a user's grade for a lesson. | |
lesson_grade_item_update ($lesson, $grades=null) | |
Create grade item for given lesson. | |
lesson_import_question_files ($field, $data, $answer, $contextid) | |
Import files embedded into answer or response. | |
lesson_mediafile_block_contents ($cmid, $lesson) | |
If there is a media file associated with this lesson, return a block_contents that displays it. | |
lesson_menu_block_contents ($cmid, $lesson) | |
If left menu is turned on, then this will print the menu in a block. | |
lesson_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
lesson_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) | |
Serves the lesson attachments. | |
lesson_print_overview () | |
lesson_process_group_deleted_in_course ($courseid, $groupid=null) | |
Logic to happen when a/some group(s) has/have been deleted in a course. | |
object | lesson_process_post_save (&$lesson) |
Runs any processes that must be run after a lesson insert/update. | |
object | lesson_process_pre_save (&$lesson) |
Runs any processes that must run before a lesson insert/update. | |
lesson_random_question_jump ($lesson, $pageid) | |
Handles the random jump between a branch table and end of branch or end of lesson (LESSON_RANDOMPAGE). | |
lesson_refresh_events ($courseid=0, $instance=null, $cm=null) | |
This standard function will check all instances of this module and make sure there are up-to-date events created for each of them. | |
lesson_reset_course_form_defaults ($course) | |
Course reset form defaults. | |
lesson_reset_course_form_definition (&$mform) | |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the lesson. | |
stdClass | lesson_reset_gradebook ($courseid, $type='') |
Removes all grades from gradebook. | |
stdClass | lesson_reset_userdata ($data) |
Actual implementation of the reset course functionality, delete all the lesson attempts for course $data->courseid. | |
lesson_save_question_options ($question, $lesson, $contextid) | |
Given some question info and some data about the the answers this function parses, organises and saves the question. | |
lesson_supports ($feature) | |
@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES | |
lesson_unseen_branch_jump ($lesson, $userid) | |
Handles the unseen branch table jump. | |
lesson_unseen_question_jump ($lesson, $user, $pageid) | |
Interprets the LESSON_UNSEENBRANCHPAGE jump. | |
lesson_update_events ($lesson, $override=null) | |
This function updates the events associated to the lesson. | |
lesson_update_grades ($lesson, $userid=0, $nullifnone=true) | |
Update grades in central gradebook. | |
object | lesson_update_instance ($data, $mform) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data. | |
lesson_update_media_file ($lessonid, $context, $draftitemid) | |
Update the lesson activity to include any file that was uploaded, or if there is none, set the mediafile field to blank. | |
object | lesson_user_complete ($course, $user, $mod, $lesson) |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports. | |
object | lesson_user_outline ($course, $user, $mod, $lesson) |
Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports. | |
mod_lesson_cm_info_dynamic (cm_info $cm) | |
Sets dynamic information about a course module. | |
mod_lesson_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $lesson) | |
This function will update the lesson module according to the event that has been modified. | |
mod_lesson_core_calendar_get_event_action_string (string $eventtype) | |
Callback to fetch the activity event type lang string. | |
mod_lesson_core_calendar_get_valid_event_timestart_range (\calendar_event $event, stdClass $instance) | |
This function calculates the minimum and maximum cutoff values for the timestart of the given event. | |
mod_lesson_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0) | |
This function receives a calendar event and returns the action associated with it, or null if there is none. | |
mod_lesson_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. | |
mod_lesson_get_fontawesome_icon_map () | |
Get icon mapping for font-awesome. | |
stdClass | xmldb_lesson_upgrade ($oldversion) |
$CFG @global moodle_database $DB | |
Variables | |
$attemptscount = $DB->count_records('lesson_grades', array('lessonid'=>$lesson->id)) | |
user attempt count for reports link hover (completed attempts - much faster) | |
$capabilities | |
global | $DB |
This file to be included so we can assume config.php has already been included. | |
$definitions | |
$functions | |
$logs | |
$messageproviders | |
$observers | |
$plugin = 2023041800 | |
$row [] = new tabobject('view', "$CFG->wwwroot/mod/lesson/view.php?id=$cm->id", get_string('preview', 'lesson'), get_string('previewlesson', 'lesson', format_string($lesson->name))) | |
if(empty( $lesson)) if(!isset($currenttab)) if(!isset( $cm)) if(!isset($course)) | $tabs = $row = $inactive = $activated = array() |
if(has_capability( 'mod/lesson:viewreports', $context)) if(has_capability('mod/lesson:grade', $context)) | $tabs [] = $row |
$plugin | component = 'mod_lesson' |
$plugin | cron = 0 |
const | LESSON_ANSWER_HTML "HTML" |
Answer format is HTML. | |
const | LESSON_CLUSTERJUMP -80 |
Cluster Jump. | |
const | LESSON_EOL -9 |
End of Lesson. | |
const | LESSON_EVENT_TYPE_CLOSE 'close' |
const | LESSON_EVENT_TYPE_OPEN 'open' |
const | LESSON_MAX_EVENT_LENGTH "432000" |
LESSON_MAX_EVENT_LENGTH = 432000 ; 5 days maximum. | |
const | LESSON_NEXTPAGE -1 |
Jump to Next Page. | |
const | LESSON_OTHER_ANSWERS "@#wronganswer#@" |
Placeholder answer for all other answers. | |
const | LESSON_PAGE_BRANCHTABLE "20" |
Branch Table page. | |
const | LESSON_PAGE_CLUSTER "30" |
Start of Cluster page. | |
const | LESSON_PAGE_ENDOFBRANCH "21" |
End of Branch page. | |
const | LESSON_PAGE_ENDOFCLUSTER "31" |
End of Cluster page. | |
const | LESSON_PAGE_ESSAY "10" |
Essay question type. | |
const | LESSON_PAGE_MATCHING "5" |
Matching question type. | |
const | LESSON_PAGE_MULTICHOICE "3" |
Multichoice question type. | |
const | LESSON_PAGE_NUMERICAL "8" |
Numerical question type. | |
const | LESSON_PAGE_SHORTANSWER "1" |
Short answer question type. | |
const | LESSON_PAGE_TRUEFALSE "2" |
True/False question type. | |
const | LESSON_PREVIOUSPAGE -40 |
Jump to Previous Page. | |
const | LESSON_RANDOMBRANCH -70 |
Jump to a random Branch. | |
const | LESSON_RANDOMPAGE -60 |
Jump to a random page within a branch and end of branch or end of lesson. | |
const | LESSON_THISPAGE 0 |
Include the files that are required by this module. | |
const | LESSON_UNANSWEREDPAGE 2 |
Next page -> any page not answered correctly. | |
const | LESSON_UNDEFINED -99 |
Undefined. | |
const | LESSON_UNSEENBRANCHPAGE -50 |
Jump to an unseen page within a branch and end of branch or end of lesson. | |
const | LESSON_UNSEENPAGE 1 |
Next page -> any page not seen before. | |
$plugin | version = 2023042400 |
lesson_add_fake_blocks | ( | $page, | |
$cm, | |||
$lesson, | |||
$timer = null ) |
$cm | |
$lesson | |
$page |
unknown_type |
lesson_add_header_buttons | ( | $cm, | |
$context, | |||
$extraeditbuttons = false, | |||
$lessonpageid = null ) |
Adds header buttons to the page for the lesson.
object | $cm | |
object | $context | |
bool | $extraeditbuttons | |
int | $lessonpageid |
object lesson_add_instance | ( | $data, | |
$mform ) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will create a new instance and return the id number of the new instance.
@global object
object | $lesson | Lesson post data from the form |
int |
lesson_clock_block_contents | ( | $cmid, | |
$lesson, | |||
$timer, | |||
$page ) |
If a timed lesson and not a teacher, then return a block_contents containing the clock.
int | $cmid | Course Module ID for this lesson |
object | $lesson | Full lesson record object |
object | $timer | Full timer record object |
block_contents |
stdClass lesson_cron | ( | ) |
Function to be run periodically according to the moodle cron This function searches for things that need to be done, such as sending out mail, toggling flags etc ...
bool | true |
object lesson_delete_instance | ( | $id | ) |
Given an ID of an instance of this module, this function will permanently delete the instance and any data that depends on it.
int | $id |
bool |
lesson_display_teacher_warning | ( | $lesson | ) |
Any other lesson functions go here.
Each of them must have a name that starts with lesson_ Checks to see if a LESSON_CLUSTERJUMP or a LESSON_UNSEENBRANCHPAGE is used in a lesson.
This function is only executed when a teacher is checking the navigation for a lesson.
stdClass | $lesson | Id of the lesson that is to be checked. |
boolean | True or false. |
lesson_displayleftif | ( | $lesson | ) |
Determines if a user can view the left menu.
The determining factor is whether a user has a grade greater than or equal to the lesson setting of displayleftif
object | $lesson | Lesson object of the current lesson |
boolean | 0 if the user cannot see, or $lesson->displayleft to keep displayleft unchanged |
lesson_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $lessonnode ) |
This function extends the settings navigation block for the site.
It is safe to rely on PAGE here as we will only ever be within the module context when this is called
settings_navigation | $settings | |
navigation_node | $lessonnode |
lesson_get_completion_state | ( | $course, | |
$cm, | |||
$userid, | |||
$type ) |
Obtains the automatic completion state for this lesson based on any conditions in lesson settings.
stdClass | $course | Course |
cm_info | stdClass | $cm | course-module |
int | $userid | User ID |
bool | $type | Type of comparison (or/and; can be used as return value if no conditions) |
bool | True if completed, false if not, $type if conditions not set. |
lesson_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any lesson type wants to add 'extra' information for the course (see resource).
Given a course_module object, this function returns any "extra" information that may be needed when printing this activity in a course listing. See get_array_of_activities() in course/lib.php.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info | An object on information that the courses will know about (most noticeably, an icon). |
lesson_get_file_areas | ( | ) |
Returns an array of file areas.
array | a list of available file areas |
stdClass lesson_get_file_info | ( | $browser, | |
$areas, | |||
$course, | |||
$cm, | |||
$context, | |||
$filearea, | |||
$itemid, | |||
$filepath, | |||
$filename ) |
Returns a file_info_stored object for the file being requested here.
$CFG
file_browser | $browser | file browser instance |
array | $areas | file areas |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
string | $filearea | file area |
int | $itemid | item ID |
string | $filepath | file path |
string | $filename | file name |
file_info_stored |
lesson_get_group_override_priorities | ( | $lessonid | ) |
Calculates the priorities of timeopen and timeclose values for group overrides for a lesson.
int | $lessonid | The lesson ID. |
array|null | Array of group override priorities for open and close times. Null if there are no group overrides. |
lesson_get_import_export_formats | ( | $type | ) |
Get list of available import or export formats.
Copied and modified from lib/questionlib.php
string | $type | 'import' if import list, otherwise export list assumed |
array | sorted list of import/export formats available |
object lesson_get_media_html | ( | $lesson, | |
$context ) |
This is a function used to detect media types and generate html code.
$CFG @global object $PAGE
object | $lesson | |
object | $context |
string\$code | the html code of media |
lesson_get_overview_report_table_and_data | ( | lesson | $lesson, |
$currentgroup ) |
Return the overview report table and data.
lesson | $lesson | lesson instance |
mixed | $currentgroup | false if not group used, 0 for all groups, group id (int) to filter by that groups |
mixed | false if there is no information otherwise html_table and stdClass with the table and data |
lesson_get_post_actions | ( | ) |
List the actions that correspond to a post of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = ('c' || 'u' || 'd') and edulevel = LEVEL_PARTICIPATING will be considered as post action.
array |
lesson_get_user_deadline | ( | $courseid | ) |
Return user's deadline for all lessons in a course, hereby taking into account group and user overrides.
int | $courseid | the course id. |
object | An object with of all lessonsids and close unixdates in this course, taking into account the most lenient overrides, if existing and 0 if no close date is set. |
lesson_get_user_detailed_report_data | ( | lesson | $lesson, |
$userid, | |||
$attempt ) |
Return information about one user attempt (including answers)
lesson | $lesson | lesson instance |
int | $userid | the user id |
int | $attempt | the attempt number |
array | the user answers (array) and user data stats (object) |
stdClass lesson_get_user_grades | ( | $lesson, | |
$userid = 0 ) |
Return grade for given user or all users.
@global object
int | $lessonid | id of lesson |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none |
lesson_get_view_actions | ( | ) |
List the actions that correspond to a view of this module.
This is used by the participation report.
Note: This is not used by new logging system. Event with crud = 'r' and edulevel = LEVEL_PARTICIPATING will be considered as view action.
array |
lesson_grade | ( | $lesson, | |
$ntries, | |||
$userid = 0 ) |
Calculates a user's grade for a lesson.
object | $lesson | The lesson that the user is taking. |
int | $retries | The attempt number. |
int | $userid | Id of the user (optional, default current user). |
object | { nquestions => number of questions answered attempts => number of question attempts total => max points possible earned => points earned by student grade => calculated percentage grade nmanual => number of manually graded questions manualpoints => point value for manually graded questions } |
lesson_grade_item_update | ( | $lesson, | |
$grades = null ) |
Create grade item for given lesson.
@uses GRADE_TYPE_VALUE @uses GRADE_TYPE_NONE
object | $lesson | object with extra cmidnumber |
array | object | $grades | optional array/object of grade(s); 'reset' means reset grades in gradebook |
int | 0 if ok, error code otherwise |
lesson_import_question_files | ( | $field, | |
$data, | |||
$answer, | |||
$contextid ) |
Import files embedded into answer or response.
string | $field | nfield name (answer or response) |
array | $data | imported data |
object | $answer | answer object |
int | $contextid |
lesson_mediafile_block_contents | ( | $cmid, | |
$lesson ) |
If there is a media file associated with this lesson, return a block_contents that displays it.
int | $cmid | Course Module ID for this lesson |
object | $lesson | Full lesson record object |
block_contents |
lesson_menu_block_contents | ( | $cmid, | |
$lesson ) |
If left menu is turned on, then this will print the menu in a block.
int | $cmid | Course Module ID for this lesson |
lesson | $lesson | Full lesson record object |
void |
lesson_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext ) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
lesson_pluginfile | ( | $course, | |
$cm, | |||
$context, | |||
$filearea, | |||
$args, | |||
$forcedownload, | |||
array | $options = array() ) |
Serves the lesson attachments.
Implements needed access control ;-)
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
string | $filearea | file area |
array | $args | extra arguments |
bool | $forcedownload | whether or not force download |
array | $options | additional options affecting the file serving |
bool | false if file not found, does not return if found - justsend the file |
lesson_print_overview | ( | ) |
lesson_process_group_deleted_in_course | ( | $courseid, | |
$groupid = null ) |
Logic to happen when a/some group(s) has/have been deleted in a course.
int | $courseid | The course ID. |
int | $groupid | The group id if it is known |
void |
object lesson_process_post_save | ( | & | $lesson | ) |
Runs any processes that must be run after a lesson insert/update.
object | $lesson | Lesson form data |
void |
object lesson_process_pre_save | ( | & | $lesson | ) |
Runs any processes that must run before a lesson insert/update.
object | $lesson | Lesson form data |
void |
lesson_random_question_jump | ( | $lesson, | |
$pageid ) |
Handles the random jump between a branch table and end of branch or end of lesson (LESSON_RANDOMPAGE).
lesson | $lesson | |
int | $pageid | The id of the page that we are jumping from (?) |
int | The pageid of a random page that is within a branch table |
lesson_refresh_events | ( | $courseid = 0, | |
$instance = null, | |||
$cm = null ) |
This standard function will check all instances of this module and make sure there are up-to-date events created for each of them.
If courseid = 0, then every lesson event in the site is checked, else only lesson events belonging to the course specified are checked. This function is used, in its new format, by restore_refresh_events()
int | $courseid | |
int | stdClass | $instance | Lesson module instance or ID. |
int | stdClass | $cm | Course module object or ID (not used in this module). |
bool |
lesson_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
object | $course |
array |
lesson_reset_course_form_definition | ( | & | $mform | ) |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the lesson.
MoodleQuickForm | $mform | form passed by reference |
stdClass lesson_reset_gradebook | ( | $courseid, | |
$type = '' ) |
Removes all grades from gradebook.
@global object
int | $courseid | |
string | optional type |
stdClass lesson_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the lesson attempts for course $data->courseid.
@global object
object | $data | the data submitted from the reset course. |
array | status array |
lesson_save_question_options | ( | $question, | |
$lesson, | |||
$contextid ) |
Given some question info and some data about the the answers this function parses, organises and saves the question.
This is only used when IMPORTING questions and is only called from format.php Lifted from mod/quiz/lib.php -
object | $question | Contains question data like question, type and answers. |
object | $lesson | |
int | $contextid |
object | Returns $result->error or $result->notice. |
lesson_supports | ( | $feature | ) |
@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES
string | $feature | FEATURE_xx constant for requested feature |
mixed | True if module supports feature, false if not, null if doesn't know or string for the module purpose. |
lesson_unseen_branch_jump | ( | $lesson, | |
$userid ) |
Handles the unseen branch table jump.
lesson | $lesson | |
int | $userid | User id. |
int | Will return the page id of a branch table or end of lesson |
lesson_unseen_question_jump | ( | $lesson, | |
$user, | |||
$pageid ) |
Interprets the LESSON_UNSEENBRANCHPAGE jump.
will return the pageid of a random unseen page that is within a branch
lesson | $lesson | |
int | $userid | Id of the user. |
int | $pageid | Id of the page from which we are jumping. |
int | Id of the next page. |
lesson_update_events | ( | $lesson, | |
$override = null ) |
This function updates the events associated to the lesson.
If $override is non-zero, then it updates only the events associated with the specified override.
@uses LESSON_MAX_EVENT_LENGTH
object | $lesson | the lesson object. |
object | $override | (optional) limit to a specific override |
lesson_update_grades | ( | $lesson, | |
$userid = 0, | |||
$nullifnone = true ) |
Update grades in central gradebook.
object | $lesson | |
int | $userid | specific user only, 0 means all |
bool | $nullifnone |
object lesson_update_instance | ( | $data, | |
$mform ) |
Given an object containing all the necessary data, (defined by the form in mod_form.php) this function will update an existing instance with new data.
object | $lesson | Lesson post data from the form |
boolean |
lesson_update_media_file | ( | $lessonid, | |
$context, | |||
$draftitemid ) |
Update the lesson activity to include any file that was uploaded, or if there is none, set the mediafile field to blank.
int | $lessonid | the lesson id |
stdClass | $context | the context |
int | $draftitemid | the draft item |
object lesson_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$lesson ) |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports.
object | $course | |
object | $user | |
object | $mod | |
object | $lesson |
bool |
object lesson_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$lesson ) |
Return a small object with summary information about what a user has done with a given particular instance of this module Used for user activity reports.
$return->time = the time they did it $return->info = a short text description
object | $course | |
object | $user | |
object | $mod | |
object | $lesson |
object |
mod_lesson_cm_info_dynamic | ( | cm_info | $cm | ) |
mod_lesson_core_calendar_event_timestart_updated | ( | \calendar_event | $event, |
stdClass | $lesson ) |
This function will update the lesson module according to the event that has been modified.
It will set the available or deadline value of the lesson instance according to the type of event provided.
moodle_exception |
calendar_event | $event | |
stdClass | $lesson | The module instance to get the range from |
mod_lesson_core_calendar_get_event_action_string | ( | string | $eventtype | ) |
Callback to fetch the activity event type lang string.
string | $eventtype | The event type. |
lang_string | The event type lang string. |
mod_lesson_core_calendar_get_valid_event_timestart_range | ( | \calendar_event | $event, |
stdClass | $instance ) |
This function calculates the minimum and maximum cutoff values for the timestart of the given event.
It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.
If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.
A minimum and maximum cutoff return value will look like: [ [1505704373, 'The due date must be after the start date'], [1506741172, 'The due date must be before the cutoff date'] ]
calendar_event | $event | The calendar event to get the time range for |
stdClass | $instance | The module instance to get the range from |
array |
mod_lesson_core_calendar_provide_event_action | ( | calendar_event | $event, |
core_calendar\action_factory | $factory, | ||
int | $userid = 0 ) |
This function receives a calendar event and returns the action associated with it, or null if there is none.
This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar\local\event\entities\action_interface|null |
mod_lesson_get_completion_active_rule_descriptions | ( | $cm | ) |
Callback which returns human-readable strings describing the active completion custom rules for the module instance.
cm_info | stdClass | $cm | object with fields ->completion and ->customdata['customcompletionrules'] |
array\$descriptions | the array of descriptions for the custom rules. |
stdClass xmldb_lesson_upgrade | ( | $oldversion | ) |
$definitions |
$logs |
$messageproviders |
$observers |
const LESSON_THISPAGE 0 |
Include the files that are required by this module.
This page