Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
|
Functions | |
mod_scorm_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $scorm) | |
This function will update the scorm module according to the event that has been modified. | |
mod_scorm_core_calendar_get_event_action_string (string $eventtype) | |
Callback to fetch the activity event type lang string. | |
mod_scorm_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_scorm_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, $userid=null) | |
This function receives a calendar event and returns the action associated with it, or null if there is none. | |
mod_scorm_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. | |
mod_scorm_get_fontawesome_icon_map () | |
Get icon mapping for font-awesome. | |
mod_scorm_get_path_from_pluginfile (string $filearea, array $args) | |
Given an array with a file path, it returns the itemid and the filepath for the defined filearea. | |
stdClass | scorm_add_instance ($scorm, $mform=null) |
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. | |
scorm_check_mode ($scorm, &$newattempt, &$attempt, $userid, &$mode) | |
Check and set the correct mode and attempt when entering a SCORM package. | |
scorm_check_updates_since (cm_info $cm, $from, $filter=array()) | |
Check if the module has any update that affects the current user since a given time. | |
stdClass | scorm_cron_scheduled_task () |
Function to be run periodically according to the moodle Tasks API This function searches for things that need to be done, such as sending out mail, toggling flags etc ... | |
scorm_debug_log_filename ($type, $scoid) | |
Get the filename for a temp log file. | |
scorm_debug_log_remove ($type, $scoid) | |
Remove debug log file. | |
scorm_debug_log_write ($type, $text, $scoid) | |
writes log output to a temp log file | |
stdClass | scorm_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. | |
scorm_dndupload_handle ($uploadinfo) | |
Handle a file that has been uploaded. | |
scorm_dndupload_register () | |
Register the ability to handle drag and drop file uploads. | |
scorm_extend_settings_navigation (settings_navigation $settings, navigation_node $scormnode) | |
This function extends the settings navigation block for the site. | |
scorm_get_coursemodule_info ($coursemodule) | |
Add a get_coursemodule_info function in case any SCORM type wants to add 'extra' information for the course (see resource). | |
scorm_get_file_areas ($course, $cm, $context) | |
Lists all file areas current user may browse. | |
scorm_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) | |
File browsing support for SCORM file areas. | |
scorm_get_post_actions () | |
List the actions that correspond to a post of this module. | |
stdClass | scorm_get_user_grades ($scorm, $userid=0) |
Return grade for given user or all users. | |
scorm_get_view_actions () | |
List the actions that correspond to a view of this module. | |
scorm_grade_item_delete ($scorm) | |
Delete grade item for given scorm. | |
scorm_grade_item_update ($scorm, $grades=null) | |
Update/create grade item for given scorm. | |
scorm_option2text ($scorm) | |
scorm_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. | |
scorm_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) | |
Serves scorm content, introduction images and packages. | |
scorm_print_overview () | |
scorm_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. | |
scorm_reset_course_form_defaults ($course) | |
Course reset form defaults. | |
scorm_reset_course_form_definition (&$mform) | |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the scorm. | |
stdClass | scorm_reset_gradebook ($courseid, $type='') |
Removes all grades from gradebook. | |
stdClass | scorm_reset_userdata ($data) |
Actual implementation of the reset course functionality, delete all the scorm attempts for course $data->courseid. | |
scorm_set_completion ($scorm, $userid, $completionstate=COMPLETION_COMPLETE, $grades=array()) | |
Sets activity completion state. | |
scorm_status_options ($withstrings=false) | |
Return an array of status options. | |
scorm_supports ($feature) | |
@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @uses FEATURE_GRADE_HAS_GRADE @uses FEATURE_GRADE_OUTCOMES | |
scorm_update_grades ($scorm, $userid=0, $nullifnone=true) | |
Update grades in central gradebook. | |
stdClass | scorm_update_instance ($scorm, $mform=null) |
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. | |
stdClass | scorm_user_complete ($course, $user, $mod, $scorm) |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports. | |
scorm_user_outline ($course, $user, $mod, $scorm) | |
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. | |
scorm_validate_package ($file) | |
Check that a Zip file contains a valid SCORM package. | |
scorm_version_check ($scormversion, $version='') | |
Returns the SCORM version used. | |
scorm_view ($scorm, $course, $cm, $context) | |
Trigger the course_module_viewed event. | |
mod_scorm_core_calendar_event_timestart_updated | ( | \calendar_event | $event, |
stdClass | $scorm ) |
This function will update the scorm module according to the event that has been modified.
It will set the timeopen or timeclose value of the scorm instance according to the type of event provided.
moodle_exception |
calendar_event | $event | |
stdClass | $scorm | The module instance to get the range from |
mod_scorm_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_scorm_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 date must be after this date'], [1506741172, 'The date must be before this date'] ]
calendar_event | $event | The calendar event to get the time range for |
stdClass | $instance | The module instance to get the range from |
array | Returns an array with min and max date. |
mod_scorm_core_calendar_provide_event_action | ( | calendar_event | $event, |
core_calendar\action_factory | $factory, | ||
$userid = null ) |
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 override |
core_calendar\local\event\entities\action_interface|null |
mod_scorm_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. |
mod_scorm_get_path_from_pluginfile | ( | string | $filearea, |
array | $args ) |
Given an array with a file path, it returns the itemid and the filepath for the defined filearea.
string | $filearea | The filearea. |
array | $args | The path (the part after the filearea and before the filename). |
array | The itemid and the filepath inside the $args path, for the defined filearea. |
stdClass scorm_add_instance | ( | $scorm, | |
$mform = null ) |
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 @uses CONTEXT_MODULE @uses SCORM_TYPE_LOCAL @uses SCORM_TYPE_LOCALSYNC @uses SCORM_TYPE_EXTERNAL
object | $scorm | Form data |
object | $mform |
int | new instance id |
scorm_check_mode | ( | $scorm, | |
& | $newattempt, | ||
& | $attempt, | ||
$userid, | |||
& | $mode ) |
Check and set the correct mode and attempt when entering a SCORM package.
object | $scorm | object |
string | $newattempt | should a new attempt be generated here. |
int | $attempt | the attempt number this is for. |
int | $userid | the userid of the user. |
string | $mode | the current mode that has been selected. |
scorm_check_updates_since | ( | cm_info | $cm, |
$from, | |||
$filter = array() ) |
Check if the module has any update that affects the current user since a given time.
cm_info | $cm | course module data |
int | $from | the time to check updates from |
array | $filter | if we need to check only specific updates |
stdClass | an object with the different type of areas indicating if they were updated or not |
stdClass scorm_cron_scheduled_task | ( | ) |
Function to be run periodically according to the moodle Tasks API This function searches for things that need to be done, such as sending out mail, toggling flags etc ...
@global object
boolean |
scorm_debug_log_filename | ( | $type, | |
$scoid ) |
Get the filename for a temp log file.
string | $type | - type of log(aicc,scorm12,scorm13) used as prefix for filename |
integer | $scoid | - scoid of object this log entry is for |
string | The filename as an absolute path |
scorm_debug_log_remove | ( | $type, | |
$scoid ) |
Remove debug log file.
string | $type | - type of log(aicc,scorm12,scorm13) used as prefix for filename |
integer | $scoid | - scoid of object this log entry is for |
boolean | True if the file is successfully deleted, false otherwise |
scorm_debug_log_write | ( | $type, | |
$text, | |||
$scoid ) |
writes log output to a temp log file
string | $type | - type of log(aicc,scorm12,scorm13) used as prefix for filename |
string | $text | - text to be written to file. |
integer | $scoid | - scoid of object this log entry is for. |
stdClass scorm_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.
@global object
int | $id | Scorm instance id |
boolean |
scorm_dndupload_handle | ( | $uploadinfo | ) |
Handle a file that has been uploaded.
object | $uploadinfo | details of the file / content that has been uploaded |
int | instance id of the newly created mod |
scorm_dndupload_register | ( | ) |
Register the ability to handle drag and drop file uploads.
array | containing details of the files / types the mod can handle |
scorm_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $scormnode ) |
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 object. |
navigation_node | $scormnode | navigation_node object. |
void |
scorm_get_coursemodule_info | ( | $coursemodule | ) |
Add a get_coursemodule_info function in case any SCORM 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). |
scorm_get_file_areas | ( | $course, | |
$cm, | |||
$context ) |
Lists all file areas current user may browse.
object | $course | |
object | $cm | |
object | $context |
array |
scorm_get_file_info | ( | $browser, | |
$areas, | |||
$course, | |||
$cm, | |||
$context, | |||
$filearea, | |||
$itemid, | |||
$filepath, | |||
$filename ) |
File browsing support for SCORM file areas.
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 | instance or null if not found |
scorm_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 |
stdClass scorm_get_user_grades | ( | $scorm, | |
$userid = 0 ) |
Return grade for given user or all users.
@global object
int | $scormid | id of scorm |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none |
scorm_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 |
scorm_grade_item_delete | ( | $scorm | ) |
scorm_grade_item_update | ( | $scorm, | |
$grades = null ) |
Update/create grade item for given scorm.
@uses GRADE_TYPE_VALUE @uses GRADE_TYPE_NONE
object | $scorm | object with extra cmidnumber |
mixed | $grades | optional array/object of grade(s); 'reset' means reset grades in gradebook |
object | grade_item |
scorm_option2text | ( | $scorm | ) |
object | $scorm |
object\$scorm |
scorm_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 |
scorm_pluginfile | ( | $course, | |
$cm, | |||
$context, | |||
$filearea, | |||
$args, | |||
$forcedownload, | |||
array | $options = array() ) |
Serves scorm content, introduction images and packages.
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 - just send the file |
scorm_print_overview | ( | ) |
scorm_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 scorm event in the site is checked, else only scorm events belonging to the course specified are checked.
int | $courseid | |
int | stdClass | $instance | scorm module instance or ID. |
int | stdClass | $cm | Course module object or ID. |
bool |
scorm_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
array |
scorm_reset_course_form_definition | ( | & | $mform | ) |
Implementation of the function for printing the form elements that control whether the course reset functionality affects the scorm.
MoodleQuickForm | $mform | form passed by reference |
stdClass scorm_reset_gradebook | ( | $courseid, | |
$type = '' ) |
Removes all grades from gradebook.
@global object
int | $courseid | |
string | optional type |
stdClass scorm_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the scorm attempts for course $data->courseid.
@global object
object | $data | the data submitted from the reset course. |
array | status array |
scorm_set_completion | ( | $scorm, | |
$userid, | |||
$completionstate = COMPLETION_COMPLETE, | |||
$grades = array() ) |
Sets activity completion state.
object | $scorm | object |
int | $userid | User ID |
int | $completionstate | Completion state |
array | $grades | grades array of users with grades - used when $userid = 0 |
scorm_status_options | ( | $withstrings = false | ) |
Return an array of status options.
Optionally with translated strings
bool | $with_strings | (optional) |
array |
scorm_supports | ( | $feature | ) |
@uses FEATURE_GROUPS @uses FEATURE_GROUPINGS @uses FEATURE_MOD_INTRO @uses FEATURE_COMPLETION_TRACKS_VIEWS @uses FEATURE_COMPLETION_HAS_RULES @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. |
scorm_update_grades | ( | $scorm, | |
$userid = 0, | |||
$nullifnone = true ) |
Update grades in central gradebook.
object | $scorm | |
int | $userid | specific user only, 0 mean all |
bool | $nullifnone |
stdClass scorm_update_instance | ( | $scorm, | |
$mform = null ) |
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.
@global object @uses CONTEXT_MODULE @uses SCORM_TYPE_LOCAL @uses SCORM_TYPE_LOCALSYNC @uses SCORM_TYPE_EXTERNAL
object | $scorm | Form data |
object | $mform |
bool |
stdClass scorm_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$scorm ) |
Print a detailed representation of what a user has done with a given particular instance of this module, for user activity reports.
@global object
object | $course | |
object | $user | |
object | $mod | |
object | $scorm |
boolean |
scorm_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$scorm ) |
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.
stdClass | $course | Course object |
stdClass | $user | User |
stdClass | $mod | |
stdClass | $scorm | The scorm |
mixed |
scorm_validate_package | ( | $file | ) |
Check that a Zip file contains a valid SCORM package.
$file | stored_file a Zip file. |
array | empty if no issue is found. Array of error message otherwise |
scorm_version_check | ( | $scormversion, | |
$version = '' ) |
Returns the SCORM version used.
string | $scormversion | comes from $scorm->version |
string | $version | one of the defined vars SCORM_12, SCORM_13, SCORM_AICC (or empty) |
Scorm | version. |
scorm_view | ( | $scorm, | |
$course, | |||
$cm, | |||
$context ) |
Trigger the course_module_viewed event.
stdClass | $scorm | scorm object |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |