Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
mod_scorm

Namespaces

namespace  mod_scorm
  
 
namespace  mod_scorm\analytics\indicator
  
 
namespace  mod_scorm\completion
  
 
namespace  mod_scorm\event
  
 
namespace  mod_scorm\output
  
 
namespace  mod_scorm\plugininfo
  
 
namespace  mod_scorm\privacy
  
 
namespace  mod_scorm\search
  
 
namespace  mod_scorm\task
  
 

Classes

class  backup_scorm_activity_structure_step
 Define all the backup steps that will be used by the backup_scorm_activity_task. More...
 
class  backup_scorm_activity_task
 Provides the steps to perform one complete backup of the SCORM instance. More...
 
class  mod_scorm\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_scorm\analytics\indicator\cognitive_depth
 Cognitive depth indicator - scorm. More...
 
class  mod_scorm\analytics\indicator\social_breadth
 Social breadth indicator - scorm. More...
 
class  mod_scorm\completion\custom_completion
 
class  mod_scorm\dates
 Class for fetching the important dates in mod_scorm for a given module instance and a user. More...
 
class  mod_scorm\event\cmielement_submitted
 
class  mod_scorm\event\course_module_instance_list_viewed
 The mod_scorm instance list viewed event class. More...
 
class  mod_scorm\event\course_module_viewed
 The mod_scorm course module viewed event class. More...
 
class  mod_scorm\event\report_viewed
 
class  mod_scorm\event\scoreraw_submitted
 
class  mod_scorm\event\status_submitted
 
class  mod_scorm\event\tracks_viewed
 
class  mod_scorm\output\actionbar
 
class  mod_scorm\output\userreportsactionbar
 
class  mod_scorm\plugininfo\scormreport
 
class  mod_scorm\privacy\provider
 
class  mod_scorm\report
 
class  mod_scorm\search\activity
 Search area for mod_scorm activities. More...
 
class  mod_scorm\task\cron_task
 A cron_task class to be used by Tasks API. More...
 
class  mod_scorm_attempt_bar
 Component representing a SCORM attempts bar. More...
 
class  mod_scorm_external
 SCORM module external functions. More...
 
class  mod_scorm_generator
 mod_scorm data generator class. More...
 
class  mod_scorm_renderer
 The renderer for the scorm module. More...
 
class  moodle1_mod_scorm_handler
 Scorm conversion handler. More...
 
class  restore_scorm_activity_structure_step
 Define all the restore steps that will be used by the restore_scorm_activity_task. More...
 
class  restore_scorm_activity_task
 scorm restore task that provides all the settings and steps to perform one complete restore of the activity More...
 
class  scorm_package_file_info
 
class  xml2Array
 

Functions

 get_scorm_default (&$userdata, $scorm, $scoid, $attempt, $mode)
 Sets up $userdata array and default values for AICC package.
 
 get_scorm_question_count ($scormid)
 Returns The maximum numbers of Questions associated with an Scorm Pack.
 
 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_add_time ($a, $b)
 
 scorm_aicc_confirm_hacp_session ($hacpsession)
 Check the hacp_session for whether it is valid.
 
 scorm_aicc_generate_simple_sco ($scorm)
 generate a simple single activity AICC object structure to wrap around and externally linked AICC package URL
 
 scorm_aicc_get_hacp_session ($scormid)
 Given a scormid creates an AICC Session record to allow HACP.
 
 scorm_array_search ($item, $needle, $haystacks, $strict=false)
 
 scorm_check_launchable_sco ($scorm, $scoid)
 Check if the current sco is launchable If not, find the next launchable sco.
 
 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.
 
 scorm_check_url ($url)
 Check for the availability of a resource by URL.
 
 scorm_count_launchable ($scormid, $organization='')
 
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
 
 scorm_debugging ($scorm)
 Figure out with this is a debug situation.
 
 scorm_delete_attempt ($userid, $scorm, $attemptid)
 Delete Scorm tracks for selected users.
 
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_delete_responses ($attemptids, $scorm)
 Delete Scorm tracks for selected users.
 
 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_element_cmp ($a, $b)
 Build up the JavaScript representation of an array element.
 
 scorm_eval_prerequisites ($prerequisites, $usertracks)
 This is really a little language parser for AICC_SCRIPT evaluates the expression and returns a boolean answer see 2.3.2.5.1.
 
 scorm_extend_settings_navigation (settings_navigation $settings, navigation_node $scormnode)
 This function extends the settings navigation block for the site.
 
 scorm_external_link ($link)
 
 scorm_find_common_ancestor ($ancestors, $sco)
 
 scorm_forge_cols_regexp ($columns, $remodule='(".*")?,')
 Given a colums array return a string containing the regular expression to match the columns in a text row.
 
 scorm_format_duration ($duration)
 Converts SCORM duration notation to human-readable format The function works with both SCORM 1.2 and SCORM 2004 time formats.
 
 scorm_format_interactions ($trackdata)
 helper function to return a formatted list of interactions for reports.
 
 scorm_format_toc_for_droplist ($scorm, $scoes, $usertracks, $currentorg='', $organizationsco=null, $children=false, $level=0, $tocmenus=array())
 
 scorm_format_toc_for_treeview ($user, $scorm, $scoes, $usertracks, $cmid, $toclink=TOCJSLINK, $currentorg='', $attempt='', $play=false, $organizationsco=null, $children=false)
 
 scorm_get_adlnav_json ($scoes, &$adlnav=array(), $parentscoid=null)
 
 scorm_get_aicc_columns ($row, $mastername='system_id')
 Take the header row of an AICC definition file and returns sequence of columns and a pointer to the sco identifier column.
 
 scorm_get_all_attempts ($scormid, $userid)
 Returns the full list of attempts a user has made.
 
 scorm_get_ancestors ($sco)
 
 scorm_get_attempt_count ($userid, $scorm, $returnobjects=false, $ignoremissingcompletion=false)
 Get SCORM attempt count.
 
 scorm_get_attempt_status ($user, $scorm, $cm='')
 Generate the user attempt status string.
 
 scorm_get_attempts_array ()
 Returns an array of the array of attempt options.
 
 scorm_get_attemptstatus_array ()
 Returns an array of the attempt status options.
 
 scorm_get_availability_status ($scorm, $checkviewreportcap=false, $context=null, $userid=null)
 Check if a SCORM is available for the current user.
 
 scorm_get_available_children ($sco)
 
 scorm_get_available_descendent ($descend, $sco)
 
 scorm_get_children ($sco)
 
 scorm_get_completion_state ($course, $cm, $userid, $type)
 Obtains the automatic completion state for this scorm based on any conditions in scorm settings.
 
 scorm_get_count_users ($scormid, $groupingid=null)
 
 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_first_attempt ($scormid, $userid)
 Returns the first attempt used - if no attempts yet, returns 1 for first attempt.
 
 scorm_get_forceattempt_array ()
 Returns an array of the force attempt options.
 
 scorm_get_grade_method_array ()
 Returns an array of the array of what grade options.
 
 scorm_get_hidetoc_array ()
 Returns an array of the array of hide table of contents options.
 
 scorm_get_last_attempt ($scormid, $userid)
 Returns the last attempt used - if no attempts yet, returns 1 for first attempt.
 
 scorm_get_last_completed_attempt ($scormid, $userid)
 Returns the last completed attempt used - if no completed attempts yet, returns 1 for first attempt.
 
 scorm_get_manifest ($blocks, $scoes)
 
 scorm_get_navigation_display_array ()
 Returns an array of the array of navigation buttons display options.
 
 scorm_get_parent ($sco)
 
 scorm_get_popup_display_array ()
 Returns an array of the array of popup display options.
 
 scorm_get_popup_options_array ()
 Returns an array of the popup options for SCORM and each options default value.
 
 scorm_get_post_actions ()
 List the actions that correspond to a post of this module.
 
 scorm_get_preorder (&$preorder=array(), $sco=null)
 
 scorm_get_resources ($blocks)
 
 scorm_get_sco ($id, $what=SCO_ALL)
 Returns an object containing all datas relative to the given sco ID.
 
 scorm_get_sco_and_launch_url ($scorm, $scoid, $context)
 Return a SCO object and the SCO launch URL.
 
 scorm_get_sco_runtime ($scormid, $scoid, $userid, $attempt=1)
 
 scorm_get_scoes ($id, $organisation=false)
 Returns an object (array) containing all the scoes data related to the given sco ID.
 
 scorm_get_siblings ($sco)
 
 scorm_get_skip_view_array ()
 Returns an array of the array of skip view options.
 
 scorm_get_toc ($user, $scorm, $cmid, $toclink=TOCJSLINK, $currentorg='', $scoid='', $mode='normal', $attempt='', $play=false, $tocheader=false)
 
 scorm_get_toc_get_parent_child (&$result, $currentorg)
 
 scorm_get_toc_object ($user, $scorm, $currentorg='', $scoid='', $mode='normal', $attempt='', $play=false, $organizationsco=null)
 
 scorm_get_tracks ($scoid, $userid, $attempt='')
 
 scorm_get_updatefreq_array ()
 Returns an array of the array of update frequency options.
 
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_get_what_grade_array ()
 Returns an array of the array of what grade options.
 
 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_grade_user ($scorm, $userid)
 
 scorm_grade_user_attempt ($scorm, $userid, $attempt=1)
 
 scorm_has_tracks ($scormid, $userid)
 simple quick function to return true/false if this user has tracks in this scorm
 
 scorm_insert_track ($userid, $scormid, $scoid, $attempt, $element, $value, $forcecompleted=false, $trackdata=null)
 
 scorm_is_leaf ($sco)
 
 scorm_isset ($userdata, $param, $ifempty='')
 Check for a parameter in userdata and return it if it's set or return the value from $ifempty if its empty.
 
 scorm_launch_sco ($scorm, $sco, $cm, $context, $scourl)
 Trigger the scorm_launched event.
 
 scorm_option2text ($scorm)
 
 scorm_optionals_data ($item, $standarddata)
 
 scorm_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 scorm_parse ($scorm, $full)
 Extracts scrom package, sets up all variables.
 
 scorm_parse_aicc (&$scorm)
 Sets up AICC packages Called whenever package changes.
 
 scorm_parse_scorm (&$scorm, $manifest)
 Sets up SCORM 1.2/2004 packages using the manifest file.
 
 scorm_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 Serves scorm content, introduction images and packages.
 
 scorm_print_launch ($user, $scorm, $action, $cm)
 Displays the entry form and toc if required.
 
 scorm_print_overview ()
 
 scorm_reconstitute_array_element ($sversion, $userdata, $elementname, $children)
 Build up the JavaScript representation of an array element.
 
 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_repeater ($what, $times)
 
 scorm_report_list ($context)
 
 scorm_require_available ($scorm, $checkviewreportcap=false, $context=null)
 Requires a SCORM package to be available for the current user.
 
 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_simple_play ($scorm, $user, $context, $cmid)
 
 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_calendar (stdClass $scorm, $cmid)
 Update the calendar entries for this scorm activity.
 
 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.
 
moodle_database xmldb_scorm_upgrade ($oldversion)
 $DB
 

Variables

 $capabilities
 
global mod_scorm\privacy::$CFG
 
 $functions
 
 $logs
 
 $plugin = 2023041800
 
 $tasks
 
const AVERAGEATTEMPT '1'
 
$plugin component = 'mod_scorm'
 
const FIRSTATTEMPT '2'
 
const GRADEAVERAGE '2'
 
const GRADEHIGHEST '1'
 
const GRADESCOES '0'
 
const GRADESUM '3'
 
const HIGHESTATTEMPT '0'
 
const LASTATTEMPT '3'
 
const SCO_ALL 0
 
const SCO_DATA 1
 
const SCO_ONLY 2
 
const SCORM_12 1
 
const SCORM_13 2
 
const SCORM_AICC 3
 
const SCORM_DISPLAY_ATTEMPTSTATUS_ALL 1
 
const SCORM_DISPLAY_ATTEMPTSTATUS_ENTRY 3
 
const SCORM_DISPLAY_ATTEMPTSTATUS_MY 2
 
const SCORM_DISPLAY_ATTEMPTSTATUS_NO 0
 
const SCORM_EVENT_TYPE_CLOSE 'close'
 
const SCORM_EVENT_TYPE_OPEN 'open'
 
const SCORM_FORCEATTEMPT_ALWAYS 2
 
const SCORM_FORCEATTEMPT_NO 0
 
const SCORM_FORCEATTEMPT_ONCOMPLETE 1
 
const SCORM_NAV_DISABLED 0
 
const SCORM_NAV_FLOATING 2
 
const SCORM_NAV_UNDER_CONTENT 1
 
const SCORM_SKIPVIEW_ALWAYS '2'
 
const SCORM_SKIPVIEW_FIRST '1'
 
const SCORM_SKIPVIEW_NEVER '0'
 
const SCORM_TOC_DISABLED 3
 
const SCORM_TOC_HIDDEN 1
 
const SCORM_TOC_POPUP 2
 
const SCORM_TOC_SIDE 0
 
const SCORM_TYPE_AICCURL 'aiccurl'
 SCORM_TYPE_AICCURL = external AICC url.
 
const SCORM_TYPE_EXTERNAL 'external'
 SCORM_TYPE_EXTERNAL = external.
 
const SCORM_TYPE_LOCAL 'local'
 SCORM_TYPE_LOCAL = local.
 
const SCORM_TYPE_LOCALSYNC 'localsync'
 SCORM_TYPE_LOCALSYNC = localsync.
 
const SCORM_UPDATE_EVERYDAY '2'
 
const SCORM_UPDATE_EVERYTIME '3'
 
const SCORM_UPDATE_NEVER '0'
 
const TOCFULLURL 2
 
const TOCJSLINK 1
 
$plugin version = 2023042400
 

Detailed Description

Function Documentation

◆ get_scorm_default()

get_scorm_default ( & $userdata,
$scorm,
$scoid,
$attempt,
$mode )

Sets up $userdata array and default values for AICC package.

Parameters
stdClass$userdataan empty stdClass variable that should be set up with user values
object$scormpackage record
string$scoidSCO Id
string$attemptattempt number for the user
string$modescorm display mode type
Return values
arrayThe default values that should be used for AICC package

◆ get_scorm_question_count()

get_scorm_question_count ( $scormid)

Returns The maximum numbers of Questions associated with an Scorm Pack.

Parameters
intScorm ID
Return values
intan integer representing the question count

◆ mod_scorm_core_calendar_event_timestart_updated()

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.

Exceptions
moodle_exception
Parameters
calendar_event$event
stdClass$scormThe module instance to get the range from

◆ mod_scorm_core_calendar_get_event_action_string()

mod_scorm_core_calendar_get_event_action_string ( string $eventtype)

Callback to fetch the activity event type lang string.

Parameters
string$eventtypeThe event type.
Return values
lang_stringThe event type lang string.

◆ mod_scorm_core_calendar_get_valid_event_timestart_range()

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'] ]

Parameters
calendar_event$eventThe calendar event to get the time range for
stdClass$instanceThe module instance to get the range from
Return values
arrayReturns an array with min and max date.

◆ mod_scorm_core_calendar_provide_event_action()

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.

Parameters
calendar_event$event
core_calendar\action_factory$factory
int$useridUser id override
Return values
core_calendar\local\event\entities\action_interface|null

◆ mod_scorm_get_completion_active_rule_descriptions()

mod_scorm_get_completion_active_rule_descriptions ( $cm)

Callback which returns human-readable strings describing the active completion custom rules for the module instance.

Parameters
cm_info | stdClass$cmobject with fields ->completion and ->customdata['customcompletionrules']
Return values
array\$descriptionsthe array of descriptions for the custom rules.

◆ mod_scorm_get_path_from_pluginfile()

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.

Parameters
string$fileareaThe filearea.
array$argsThe path (the part after the filearea and before the filename).
Return values
arrayThe itemid and the filepath inside the $args path, for the defined filearea.

◆ scorm_add_instance()

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

Parameters
object$scormForm data
object$mform
Return values
intnew instance id

◆ scorm_aicc_confirm_hacp_session()

scorm_aicc_confirm_hacp_session ( $hacpsession)

Check the hacp_session for whether it is valid.

Parameters
string$hacpsessionThe hacpsession value to check (optional). Normally leave this blank and this function will do required_param('sesskey', ...).
Return values
mixed- false if invalid, otherwise returns record from scorm_aicc_session table.

◆ scorm_aicc_generate_simple_sco()

scorm_aicc_generate_simple_sco ( $scorm)

generate a simple single activity AICC object structure to wrap around and externally linked AICC package URL

Parameters
object$scormpackage record

◆ scorm_aicc_get_hacp_session()

scorm_aicc_get_hacp_session ( $scormid)

Given a scormid creates an AICC Session record to allow HACP.

Parameters
int$scormid- id from scorm table
Return values
stringhacpsession

◆ scorm_check_launchable_sco()

scorm_check_launchable_sco ( $scorm,
$scoid )

Check if the current sco is launchable If not, find the next launchable sco.

Parameters
stdClass$scormScorm object
integer$scoidid of scorm_scoes record.
Return values
integerscoid of correct sco to launch or empty if one cannot be found, which will trigger first sco.

◆ scorm_check_mode()

scorm_check_mode ( $scorm,
& $newattempt,
& $attempt,
$userid,
& $mode )

Check and set the correct mode and attempt when entering a SCORM package.

Parameters
object$scormobject
string$newattemptshould a new attempt be generated here.
int$attemptthe attempt number this is for.
int$useridthe userid of the user.
string$modethe current mode that has been selected.

◆ scorm_check_updates_since()

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.

Parameters
cm_info$cmcourse module data
int$fromthe time to check updates from
array$filterif we need to check only specific updates
Return values
stdClassan object with the different type of areas indicating if they were updated or not
Since
Moodle 3.2

◆ scorm_check_url()

scorm_check_url ( $url)

Check for the availability of a resource by URL.

Check is performed using an HTTP HEAD call.

Parameters
$urlstring A valid URL
Return values
bool|stringTrue if no issue is found. The error string message, otherwise

◆ scorm_cron_scheduled_task()

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

Return values
boolean

◆ scorm_debug_log_filename()

scorm_debug_log_filename ( $type,
$scoid )

Get the filename for a temp log file.

Parameters
string$type- type of log(aicc,scorm12,scorm13) used as prefix for filename
integer$scoid- scoid of object this log entry is for
Return values
stringThe filename as an absolute path

◆ scorm_debug_log_remove()

scorm_debug_log_remove ( $type,
$scoid )

Remove debug log file.

Parameters
string$type- type of log(aicc,scorm12,scorm13) used as prefix for filename
integer$scoid- scoid of object this log entry is for
Return values
booleanTrue if the file is successfully deleted, false otherwise

◆ scorm_debug_log_write()

scorm_debug_log_write ( $type,
$text,
$scoid )

writes log output to a temp log file

Parameters
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.

◆ scorm_debugging()

scorm_debugging ( $scorm)

Figure out with this is a debug situation.

Parameters
object$scorma moodle scrom object - mdl_scorm
Return values
boolean- debugging true/false

◆ scorm_delete_attempt()

scorm_delete_attempt ( $userid,
$scorm,
$attemptid )

Delete Scorm tracks for selected users.

Parameters
int$useridID of User
stdClass$scormScorm object
int$attemptiduser attempt that need to be deleted
Return values
booltrue suceeded

◆ scorm_delete_instance()

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

Parameters
int$idScorm instance id
Return values
boolean

◆ scorm_delete_responses()

scorm_delete_responses ( $attemptids,
$scorm )

Delete Scorm tracks for selected users.

Parameters
array$attemptidslist of attempts that need to be deleted
stdClass$scorminstance
Return values
booltrue deleted all responses, false failed deleting an attempt - stopped here

◆ scorm_dndupload_handle()

scorm_dndupload_handle ( $uploadinfo)

Handle a file that has been uploaded.

Parameters
object$uploadinfodetails of the file / content that has been uploaded
Return values
intinstance id of the newly created mod

◆ scorm_dndupload_register()

scorm_dndupload_register ( )

Register the ability to handle drag and drop file uploads.

Return values
arraycontaining details of the files / types the mod can handle

◆ scorm_element_cmp()

scorm_element_cmp ( $a,
$b )

Build up the JavaScript representation of an array element.

Parameters
string$aleft array element
string$bright array element
Return values
comparator- 0,1,-1

◆ scorm_eval_prerequisites()

scorm_eval_prerequisites ( $prerequisites,
$usertracks )

This is really a little language parser for AICC_SCRIPT evaluates the expression and returns a boolean answer see 2.3.2.5.1.

Sequencing/Navigation Today - from the SCORM 1.2 spec (CAM). Also used by AICC packages.

Parameters
string$prerequisitesthe aicc_script prerequisites expression
array$usertracksthe tracked user data of each SCO visited
Return values
boolean

◆ scorm_extend_settings_navigation()

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

Parameters
settings_navigation$settingsnavigation_node object.
navigation_node$scormnodenavigation_node object.
Return values
void

◆ scorm_forge_cols_regexp()

scorm_forge_cols_regexp ( $columns,
$remodule = '(".*")?,
'  )

Given a colums array return a string containing the regular expression to match the columns in a text row.

Parameters
array$columnThe header columns
string$remoduleThe regular expression module for a single column
Return values
string

◆ scorm_format_duration()

scorm_format_duration ( $duration)

Converts SCORM duration notation to human-readable format The function works with both SCORM 1.2 and SCORM 2004 time formats.

Parameters
$durationstring SCORM duration
Return values
stringhuman-readable date/time

◆ scorm_format_interactions()

scorm_format_interactions ( $trackdata)

helper function to return a formatted list of interactions for reports.

Parameters
array$trackdatathe records from scorm_scoes_track table
Return values
objectformatted list of interactions

◆ scorm_get_aicc_columns()

scorm_get_aicc_columns ( $row,
$mastername = 'system_id' )

Take the header row of an AICC definition file and returns sequence of columns and a pointer to the sco identifier column.

Parameters
string$rowAICC header row
string$masternameAICC sco identifier column
Return values
mixed

◆ scorm_get_all_attempts()

scorm_get_all_attempts ( $scormid,
$userid )

Returns the full list of attempts a user has made.

Parameters
int$scormidthe id of the scorm.
int$useridthe id of the user.
Return values
arrayarray of attemptids

◆ scorm_get_attempt_count()

scorm_get_attempt_count ( $userid,
$scorm,
$returnobjects = false,
$ignoremissingcompletion = false )

Get SCORM attempt count.

Parameters
object$userCurrent context user
object$scorma moodle scrom object - mdl_scorm
bool$returnobjectsif true returns a object with attempts, if false returns count of attempts.
bool$ignoremissingcompletion- ignores attempts that haven't reported a grade/completion.
Return values
int- no. of attempts so far

◆ scorm_get_attempt_status()

scorm_get_attempt_status ( $user,
$scorm,
$cm = '' )

Generate the user attempt status string.

Parameters
object$userCurrent context user
object$scorma moodle scrom object - mdl_scorm
Return values
string- Attempt status string

◆ scorm_get_attempts_array()

scorm_get_attempts_array ( )

Returns an array of the array of attempt options.

Return values
arrayan array of attempt options

◆ scorm_get_attemptstatus_array()

scorm_get_attemptstatus_array ( )

Returns an array of the attempt status options.

Return values
arrayan array of attempt status options

◆ scorm_get_availability_status()

scorm_get_availability_status ( $scorm,
$checkviewreportcap = false,
$context = null,
$userid = null )

Check if a SCORM is available for the current user.

Parameters
stdClass$scormSCORM record
boolean$checkviewreportcapCheck the scorm:viewreport cap
stdClass$contextModule context, required if $checkviewreportcap is set to true
int$useridUser id override
Return values
arraystatus (available or not and possible warnings)
Since
Moodle 3.0

◆ scorm_get_completion_state()

scorm_get_completion_state ( $course,
$cm,
$userid,
$type )

Obtains the automatic completion state for this scorm based on any conditions in scorm settings.

Deprecated
since Moodle 3.11
Todo
MDL-71196 Final deprecation in Moodle 4.3
See also
mod_scorm\completion\custom_completion
Parameters
stdClass$courseCourse
cm_info | stdClass$cmCourse-module
int$useridUser ID
bool$typeType of comparison (or/and; can be used as return value if no conditions)
Return values
boolTrue if completed, false if not. (If no conditions, then return value depends on comparison type)

◆ scorm_get_coursemodule_info()

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.

Parameters
stdClass$coursemoduleThe coursemodule object (record).
Return values
cached_cm_infoAn object on information that the courses will know about (most noticeably, an icon).

◆ scorm_get_file_areas()

scorm_get_file_areas ( $course,
$cm,
$context )

Lists all file areas current user may browse.

Parameters
object$course
object$cm
object$context
Return values
array

◆ scorm_get_file_info()

scorm_get_file_info ( $browser,
$areas,
$course,
$cm,
$context,
$filearea,
$itemid,
$filepath,
$filename )

File browsing support for SCORM file areas.

Parameters
file_browser$browserfile browser instance
array$areasfile areas
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
string$fileareafile area
int$itemiditem ID
string$filepathfile path
string$filenamefile name
Return values
file_infoinstance or null if not found

◆ scorm_get_first_attempt()

scorm_get_first_attempt ( $scormid,
$userid )

Returns the first attempt used - if no attempts yet, returns 1 for first attempt.

Parameters
int$scormidthe id of the scorm.
int$useridthe id of the user.
Return values
intThe first attempt number.

◆ scorm_get_forceattempt_array()

scorm_get_forceattempt_array ( )

Returns an array of the force attempt options.

Return values
arrayan array of attempt options

◆ scorm_get_grade_method_array()

scorm_get_grade_method_array ( )

Returns an array of the array of what grade options.

Return values
arrayan array of what grade options

◆ scorm_get_hidetoc_array()

scorm_get_hidetoc_array ( )

Returns an array of the array of hide table of contents options.

Return values
arrayan array of hide table of contents options

◆ scorm_get_last_attempt()

scorm_get_last_attempt ( $scormid,
$userid )

Returns the last attempt used - if no attempts yet, returns 1 for first attempt.

Parameters
int$scormidthe id of the scorm.
int$useridthe id of the user.
Return values
intThe attempt number to use.

◆ scorm_get_last_completed_attempt()

scorm_get_last_completed_attempt ( $scormid,
$userid )

Returns the last completed attempt used - if no completed attempts yet, returns 1 for first attempt.

Parameters
int$scormidthe id of the scorm.
int$useridthe id of the user.
Return values
intThe attempt number to use.

◆ scorm_get_navigation_display_array()

scorm_get_navigation_display_array ( )

Returns an array of the array of navigation buttons display options.

Return values
arrayan array of navigation buttons display options

◆ scorm_get_popup_display_array()

scorm_get_popup_display_array ( )

Returns an array of the array of popup display options.

Return values
arrayan array of popup display options

◆ scorm_get_popup_options_array()

scorm_get_popup_options_array ( )

Returns an array of the popup options for SCORM and each options default value.

Return values
arrayan array of popup options as the key and their defaults as the value

◆ scorm_get_post_actions()

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.

Return values
array

◆ scorm_get_sco()

scorm_get_sco ( $id,
$what = SCO_ALL )

Returns an object containing all datas relative to the given sco ID.

Parameters
integer$idThe sco ID
Return values
mixed(false if sco id does not exists)

◆ scorm_get_sco_and_launch_url()

scorm_get_sco_and_launch_url ( $scorm,
$scoid,
$context )

Return a SCO object and the SCO launch URL.

Parameters
stdClass$scormSCORM object
int$scoidThe SCO id in database
stdClass$contextcontext object
Return values
arraythe SCO object and URL
Since
Moodle 3.1

◆ scorm_get_scoes()

scorm_get_scoes ( $id,
$organisation = false )

Returns an object (array) containing all the scoes data related to the given sco ID.

Parameters
integer$idThe sco ID
integer$organisationan organisation ID - defaults to false if not required
Return values
mixed(false if there are no scoes or an array)

◆ scorm_get_skip_view_array()

scorm_get_skip_view_array ( )

Returns an array of the array of skip view options.

Return values
arrayan array of skip view options

◆ scorm_get_updatefreq_array()

scorm_get_updatefreq_array ( )

Returns an array of the array of update frequency options.

Return values
arrayan array of update frequency options

◆ scorm_get_user_grades()

stdClass scorm_get_user_grades ( $scorm,
$userid = 0 )

Return grade for given user or all users.

@global object

Parameters
int$scormidid of scorm
int$useridoptional user id, 0 means all users
Return values
arrayarray of grades, false if none

◆ scorm_get_view_actions()

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.

Return values
array

◆ scorm_get_what_grade_array()

scorm_get_what_grade_array ( )

Returns an array of the array of what grade options.

Return values
arrayan array of what grade options

◆ scorm_grade_item_delete()

scorm_grade_item_delete ( $scorm)

Delete grade item for given scorm.

Parameters
object$scormobject
Return values
objectgrade_item

◆ scorm_grade_item_update()

scorm_grade_item_update ( $scorm,
$grades = null )

Update/create grade item for given scorm.

@uses GRADE_TYPE_VALUE @uses GRADE_TYPE_NONE

Parameters
object$scormobject with extra cmidnumber
mixed$gradesoptional array/object of grade(s); 'reset' means reset grades in gradebook
Return values
objectgrade_item

◆ scorm_has_tracks()

scorm_has_tracks ( $scormid,
$userid )

simple quick function to return true/false if this user has tracks in this scorm

Parameters
integer$scormidThe scorm ID
integer$useridthe users id
Return values
boolean(false if there are no tracks)

◆ scorm_isset()

scorm_isset ( $userdata,
$param,
$ifempty = '' )

Check for a parameter in userdata and return it if it's set or return the value from $ifempty if its empty.

Parameters
stdClass$userdataContains user's data
string$paramparameter that should be checked
string$ifemptyvalue to be replaced with if $param is not set
Return values
stringvalue from $userdata->$param if its not empty, or $ifempty

◆ scorm_launch_sco()

scorm_launch_sco ( $scorm,
$sco,
$cm,
$context,
$scourl )

Trigger the scorm_launched event.

Parameters
stdClass$scormscorm object
stdClass$scosco object
stdClass$cmcourse module object
stdClass$contextcontext object
string$scourlSCO URL
Since
Moodle 3.1

◆ scorm_option2text()

scorm_option2text ( $scorm)
Parameters
object$scorm
Return values
object\$scorm

◆ scorm_page_type_list()

scorm_page_type_list ( $pagetype,
$parentcontext,
$currentcontext )

Return a list of page types.

Parameters
string$pagetypecurrent page type
stdClass$parentcontextBlock's parent context
stdClass$currentcontextCurrent context of block

◆ scorm_parse()

scorm_parse ( $scorm,
$full )

Extracts scrom package, sets up all variables.

Called whenever scorm changes

Parameters
object$scorminstance - fields are updated and changes saved into database
bool$fullforce full update if true
Return values
void

◆ scorm_parse_aicc()

scorm_parse_aicc ( & $scorm)

Sets up AICC packages Called whenever package changes.

Parameters
object$scorminstance - fields are updated and changes saved into database
Return values
bool

◆ scorm_parse_scorm()

scorm_parse_scorm ( & $scorm,
$manifest )

Sets up SCORM 1.2/2004 packages using the manifest file.

Called whenever SCORM changes

Parameters
object$scorminstance - fields are updated and changes saved into database
stored_file | string$manifest- path to manifest file or stored_file.
Return values
bool

◆ scorm_pluginfile()

scorm_pluginfile ( $course,
$cm,
$context,
$filearea,
$args,
$forcedownload,
array $options = array() )

Serves scorm content, introduction images and packages.

Implements needed access control ;-)

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
string$fileareafile area
array$argsextra arguments
bool$forcedownloadwhether or not force download
array$optionsadditional options affecting the file serving
Return values
boolfalse if file not found, does not return if found - just send the file

◆ scorm_print_launch()

scorm_print_launch ( $user,
$scorm,
$action,
$cm )

Displays the entry form and toc if required.

Parameters
stdClass$useruser object
stdClass$scormscorm object
string$actionbase URL for the organizations select box
stdClass$cmcourse module object

◆ scorm_print_overview()

scorm_print_overview ( )
Deprecated
since Moodle 3.3, when the block_course_overview block was removed.

◆ scorm_reconstitute_array_element()

scorm_reconstitute_array_element ( $sversion,
$userdata,
$elementname,
$children )

Build up the JavaScript representation of an array element.

Parameters
string$sversionSCORM API version
array$userdataUser track data
string$elementnameName of array element to get values for
array$childrenlist of sub elements of this array element that also need instantiating
Return values
Javascriptarray elements

◆ scorm_refresh_events()

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.

Parameters
int$courseid
int | stdClass$instancescorm module instance or ID.
int | stdClass$cmCourse module object or ID.
Return values
bool

◆ scorm_require_available()

scorm_require_available ( $scorm,
$checkviewreportcap = false,
$context = null )

Requires a SCORM package to be available for the current user.

Parameters
stdClass$scormSCORM record
boolean$checkviewreportcapCheck the scorm:viewreport cap
stdClass$contextModule context, required if $checkviewreportcap is set to true
Exceptions
moodle_exception
Since
Moodle 3.0

◆ scorm_reset_course_form_defaults()

scorm_reset_course_form_defaults ( $course)

Course reset form defaults.

Return values
array

◆ scorm_reset_course_form_definition()

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.

Parameters
MoodleQuickForm$mformform passed by reference

◆ scorm_reset_gradebook()

stdClass scorm_reset_gradebook ( $courseid,
$type = '' )

Removes all grades from gradebook.

@global object

Parameters
int$courseid
stringoptional type

◆ scorm_reset_userdata()

stdClass scorm_reset_userdata ( $data)

Actual implementation of the reset course functionality, delete all the scorm attempts for course $data->courseid.

@global object

Parameters
object$datathe data submitted from the reset course.
Return values
arraystatus array

◆ scorm_set_completion()

scorm_set_completion ( $scorm,
$userid,
$completionstate = COMPLETION_COMPLETE,
$grades = array() )

Sets activity completion state.

Parameters
object$scormobject
int$useridUser ID
int$completionstateCompletion state
array$gradesgrades array of users with grades - used when $userid = 0

◆ scorm_status_options()

scorm_status_options ( $withstrings = false)

Return an array of status options.

Optionally with translated strings

Parameters
bool$with_strings(optional)
Return values
array

◆ scorm_supports()

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

Parameters
string$featureFEATURE_xx constant for requested feature
Return values
mixedTrue if module supports feature, false if not, null if doesn't know or string for the module purpose.

◆ scorm_update_calendar()

scorm_update_calendar ( stdClass $scorm,
$cmid )

Update the calendar entries for this scorm activity.

Parameters
stdClass$scormthe row from the database table scorm.
int$cmidThe coursemodule id
Return values
bool

◆ scorm_update_grades()

scorm_update_grades ( $scorm,
$userid = 0,
$nullifnone = true )

Update grades in central gradebook.

Parameters
object$scorm
int$useridspecific user only, 0 mean all
bool$nullifnone

◆ scorm_update_instance()

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

Parameters
object$scormForm data
object$mform
Return values
bool

◆ scorm_user_complete()

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

Parameters
object$course
object$user
object$mod
object$scorm
Return values
boolean

◆ scorm_user_outline()

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.

Parameters
stdClass$courseCourse object
stdClass$userUser
stdClass$mod
stdClass$scormThe scorm
Return values
mixed

◆ scorm_validate_package()

scorm_validate_package ( $file)

Check that a Zip file contains a valid SCORM package.

Parameters
$filestored_file a Zip file.
Return values
arrayempty if no issue is found. Array of error message otherwise

◆ scorm_version_check()

scorm_version_check ( $scormversion,
$version = '' )

Returns the SCORM version used.

Parameters
string$scormversioncomes from $scorm->version
string$versionone of the defined vars SCORM_12, SCORM_13, SCORM_AICC (or empty)
Return values
Scormversion.

◆ scorm_view()

scorm_view ( $scorm,
$course,
$cm,
$context )

Trigger the course_module_viewed event.

Parameters
stdClass$scormscorm object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.0

◆ xmldb_scorm_upgrade()

moodle_database xmldb_scorm_upgrade ( $oldversion)

$DB

Parameters
int$oldversion
Return values
bool

Variable Documentation

◆ $functions

$functions
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
Since
Moodle 3.0

◆ $logs

$logs
Initial value:
= array(
array('module' => 'scorm', 'action' => 'view', 'mtable' => 'scorm', 'field' => 'name'),
array('module' => 'scorm', 'action' => 'review', 'mtable' => 'scorm', 'field' => 'name'),
array('module' => 'scorm', 'action' => 'update', 'mtable' => 'scorm', 'field' => 'name'),
array('module' => 'scorm', 'action' => 'add', 'mtable' => 'scorm', 'field' => 'name'),
)

◆ $tasks

$tasks
Initial value:
= array(
array(
'classname' => 'mod_scorm\task\cron_task',
'blocking' => 0,
'minute' => '*/5',
'hour' => '*',
'day' => '*',
'month' => '*',
'dayofweek' => '*'
)
)