Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.
/mod/data/ -> lib.php (source)

Differences Between: [Versions 310 and 400] [Versions 311 and 400] [Versions 39 and 400] [Versions 400 and 401] [Versions 400 and 402] [Versions 400 and 403]

(no description)

Copyright: 1999 onwards Martin Dougiamas {@link http://moodle.com}
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 4859 lines (175 kb)
Included or required: 6 times
Referenced: 4 times
Includes or requires: 1 file
 mod/data/deprecatedlib.php

Defines 4 classes

data_field_base:: (67 methods):
  __construct()
  define_default_field()
  define_field()
  insert_field()
  update_field()
  delete_field()
  display_add_field()
  display_edit_field()
  validate()
  display_browse_field()
  update_content()
  delete_content()
  notemptyfield()
  print_before_form()
  print_after_form()
  get_sort_field()
  get_sort_sql()
  name()
  image()
  text_export_supported()
  export_text_value()
  file_ok()
  get_priority()
  get_content_value()
  get_config_for_external()
  data_generate_default_template()
  data_generate_tag_form()
  data_replace_field_in_templates()
  data_append_new_field_to_templates()
  data_get_field_from_name()
  data_get_field_from_id()
  data_get_field_new()
  data_get_field()
  data_isowner()
  data_atmaxentries()
  data_numentries()
  data_add_record()
  data_tags_check()
  data_add_instance()
  data_update_instance()
  data_delete_instance()
  data_user_outline()
  data_user_complete()
  data_get_user_grades()
  data_update_grades()
  data_grade_item_update()
  data_grade_item_delete()
  data_print_template()
  data_rating_permissions()
  data_rating_validate()
  mod_data_rating_can_see_item_ratings()
  data_print_preference_form()
  data_print_ratings()
  data_get_view_actions()
  data_get_post_actions()
  data_fieldname_exists()
  data_convert_arrays_to_strings()
  data_convert_to_roles()
  data_preset_name()
  data_get_available_presets()
  data_get_available_site_presets()
  data_delete_site_preset()
  data_print_header()
  data_user_can_add_entry()
  data_user_can_manage_entry()
  data_in_readonly_period()
  is_directory_a_preset()

data_preset_importer:: (6 methods):
  __construct()
  get_directory()
  data_preset_get_file_contents()
  get_preset_settings()
  import()
  cleanup()

data_preset_upload_importer:: (2 methods):
  __construct()
  cleanup()

data_preset_existing_importer:: (45 methods):
  __construct()
  get_userid()
  data_preset_path()
  data_reset_course_form_definition()
  data_reset_course_form_defaults()
  data_reset_gradebook()
  data_reset_userdata()
  data_get_extra_capabilities()
  data_supports()
  data_import_csv()
  data_export_csv()
  data_export_xls()
  data_export_ods()
  data_get_exportdata()
  data_get_file_areas()
  data_get_file_info()
  data_pluginfile()
  data_extend_navigation()
  data_extend_settings_navigation()
  data_presets_save()
  data_presets_generate_xml()
  data_presets_export()
  data_comment_permissions()
  data_comment_validate()
  data_page_type_list()
  data_get_all_recordids()
  data_get_advance_search_ids()
  data_get_recordids()
  data_get_advanced_search_sql()
  data_user_can_delete_preset()
  data_delete_record()
  data_process_submission()
  data_refresh_events()
  data_get_config()
  data_set_config()
  data_update_completion_state()
  data_view()
  mod_data_get_fontawesome_icon_map()
  data_check_updates_since()
  mod_data_core_calendar_provide_event_action()
  data_get_coursemodule_info()
  mod_data_get_completion_active_rule_descriptions()
  mod_data_core_calendar_get_valid_event_timestart_range()
  mod_data_core_calendar_event_timestart_updated()
  mod_data_core_calendar_get_event_action_string()


Class: data_field_base  - X-Ref


__construct($field=0, $data=0, $cm=0)   X-Ref
Constructor function

param: int $field
param: int $data
param: int $cm

define_default_field()   X-Ref
This field just sets up a default field object

return: bool

define_field($data)   X-Ref
Set up the field object according to data in an object.  Now is the time to clean it!

return: bool

insert_field()   X-Ref
Insert a new field in the database
We assume the field object is already defined as $this->field

return: bool

update_field()   X-Ref
Update a field in the database

return: bool

delete_field()   X-Ref
Delete a field completely

return: bool

display_add_field($recordid=0, $formdata=null)   X-Ref
Print the relevant form element in the ADD template for this field

return: string
param: int $recordid

display_edit_field()   X-Ref
Print the relevant form element to define the attributes for this field
viewable by teachers only.

return: void Output is echo'd

validate(stdClass $fieldinput)   X-Ref
Validates params of fieldinput data. Overwrite to validate fieldtype specific data.

You are expected to return an array like ['paramname' => 'Error message for paramname param'] if there is an error,
return an empty array if everything is fine.

return: array $errors if empty validation was fine, otherwise contains one or more error messages
param: stdClass $fieldinput The field input data to check

display_browse_field($recordid, $template)   X-Ref
Display the content of the field in browse mode

return: bool|string
param: int $recordid
param: object $template

update_content($recordid, $value, $name='')   X-Ref
Update the content of one data field in the data_content table

return: bool
param: int $recordid
param: mixed $value
param: string $name

delete_content($recordid=0)   X-Ref
Delete all content associated with the field

return: bool
param: int $recordid

notemptyfield($value, $name)   X-Ref
Check if a field from an add form is empty

return: bool
param: mixed $value
param: mixed $name

print_before_form()   X-Ref
Just in case a field needs to print something before the whole form


print_after_form()   X-Ref
Just in case a field needs to print something after the whole form


get_sort_field()   X-Ref
Returns the sortable field for the content. By default, it's just content
but for some plugins, it could be content 1 - content4

return: string

get_sort_sql($fieldname)   X-Ref
Returns the SQL needed to refer to the column.  Some fields may need to CAST() etc.

return: string $fieldname
param: string $fieldname

name()   X-Ref
Returns the name/type of the field

return: string

image()   X-Ref
Prints the respective type icon

return: string

text_export_supported()   X-Ref
Per default, it is assumed that fields support text exporting.
Override this (return false) on fields not supporting text exporting.

return: bool true

export_text_value($record)   X-Ref
Per default, return the record's text value only from the "content" field.
Override this in fields class if necesarry.

return: string
param: string $record

file_ok($relativepath)   X-Ref

return: bool false
param: string $relativepath

get_priority()   X-Ref
Returns the priority for being indexed by globalsearch

return: int

get_content_value($content)   X-Ref
Returns the presentable string value for a field content.

The returned string should be plain text.

return: string
param: stdClass $content

get_config_for_external()   X-Ref
Return the plugin configs for external functions,
in some cases the configs will need formatting or be returned only if the current user has some capabilities enabled.

return: array the list of config parameters

data_generate_default_template(&$data, $template, $recordid=0, $form=false, $update=true)   X-Ref
Given a template and a dataid, generate a default case template

return: bool|string
param: object $data
param: string template [addtemplate, singletemplate, listtempalte, rsstemplate]
param: int $recordid
param: bool $form
param: bool $update

data_generate_tag_form($recordid = false, $selected = [])   X-Ref
Build the form elements to manage tags for a record.

return: string
param: int|bool $recordid
param: string[] $selected raw tag names

data_replace_field_in_templates($data, $searchfieldname, $newfieldname)   X-Ref
Search for a field name and replaces it with another one in all the
form templates. Set $newfieldname as '' if you want to delete the
field from the form.

return: bool
param: object $data
param: string $searchfieldname
param: string $newfieldname

data_append_new_field_to_templates($data, $newfieldname)   X-Ref
Appends a new field at the end of the form template.

param: object $data
param: string $newfieldname

data_get_field_from_name($name, $data)   X-Ref
given a field name
this function creates an instance of the particular subfield class

return: object|bool
param: string $name
param: object $data

data_get_field_from_id($fieldid, $data)   X-Ref
given a field id
this function creates an instance of the particular subfield class

return: bool|object
param: int $fieldid
param: object $data

data_get_field_new($type, $data)   X-Ref
given a field id
this function creates an instance of the particular subfield class

return: object
param: string $type
param: object $data

data_get_field($field, $data, $cm=null)   X-Ref
returns a subclass field object given a record of the field, used to
invoke plugin methods
input: $param $field - record from db

return: data_field_base the field object instance or data_field_base if unkown type
param: stdClass $field the field record
param: stdClass $data the data instance
param: stdClass|null $cm optional course module data

data_isowner($record)   X-Ref
Given record object (or id), returns true if the record belongs to the current user

return: bool
param: mixed $record record object or id

data_atmaxentries($data)   X-Ref
has a user reached the max number of entries?

return: bool
param: object $data

data_numentries($data, $userid=null)   X-Ref
returns the number of entries already made by this user

return: int
param: object $data

data_add_record($data, $groupid = 0, $userid = null)   X-Ref
function that takes in a dataid and adds a record
this is used everytime an add template is submitted

return: bool
param: object $data
param: int $groupid
param: int $userid

data_tags_check($dataid, $template)   X-Ref
check the multple existence any tag in a template

check to see if there are 2 or more of the same tag being used.

return: bool
param: int $dataid,
param: string $template

data_add_instance($data, $mform = null)   X-Ref
Adds an instance of a data

return: int intance id
param: stdClass $data
param: mod_data_mod_form $mform

data_update_instance($data)   X-Ref
updates an instance of a data

return: bool
param: object $data

data_delete_instance($id)   X-Ref
deletes an instance of a data

return: bool
param: int $id

data_user_outline($course, $user, $mod, $data)   X-Ref
returns a summary of data activity of this user

return: object|null
param: object $course
param: object $user
param: object $mod
param: object $data

data_user_complete($course, $user, $mod, $data)   X-Ref
Prints all the records uploaded by this user

param: object $course
param: object $user
param: object $mod
param: object $data

data_get_user_grades($data, $userid=0)   X-Ref
Return grade for given user or all users.

return: array array of grades, false if none
param: object $data
param: int $userid optional user id, 0 means all users

data_update_grades($data, $userid=0, $nullifnone=true)   X-Ref
Update activity grades

param: object $data
param: int $userid specific user only, 0 means all
param: bool $nullifnone

data_grade_item_update($data, $grades=NULL)   X-Ref
Update/create grade item for given data

return: object grade_item
param: stdClass $data A database instance with extra cmidnumber property
param: mixed $grades Optional array/object of grade(s); 'reset' means reset grades in gradebook

data_grade_item_delete($data)   X-Ref
Delete grade item for given data

return: object grade_item
param: object $data object

data_print_template($template, $records, $data, $search='', $page=0, $return=false, moodle_url $jumpurl=null)   X-Ref
takes a list of records, the current data, a search string,
and mode to display prints the translated template

return: mixed
param: string $template
param: array $records
param: object $data
param: string $search
param: int $page
param: bool $return
param: object $jumpurl a moodle_url by which to jump back to the record list (can be null)

data_rating_permissions($contextid, $component, $ratingarea)   X-Ref
Return rating related permissions

return: array an associative array of the user's rating permissions
param: string $contextid the context id
param: string $component the component to get rating permissions for
param: string $ratingarea the rating area to get permissions for

data_rating_validate($params)   X-Ref
Validates a submitted rating

return: boolean true if the rating is valid. Will throw rating_exception if not
param: array $params submitted data

mod_data_rating_can_see_item_ratings($params)   X-Ref
Can the current user see ratings for a given itemid?

return: bool
param: array $params submitted data

data_print_preference_form($data, $perpage, $search, $sort='', $order='ASC', $search_array = '', $advanced = 0, $mode= '')   X-Ref
function that takes in the current data, number of items per page,
a search string and prints a preference box in view.php

This preference box prints a searchable advanced search template if
a) A template is defined
b) The advanced search checkbox is checked.

return: void
param: object $data
param: int $perpage
param: string $search
param: string $sort
param: string $order
param: array $search_array
param: int $advanced
param: string $mode

data_print_ratings($data, $record)   X-Ref

return: void Output echo'd
param: object $data
param: object $record

data_get_view_actions()   X-Ref
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: array

data_get_post_actions()   X-Ref
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: array

data_fieldname_exists($name, $dataid, $fieldid = 0)   X-Ref

return: bool
param: string $name
param: int $dataid
param: int $fieldid

data_convert_arrays_to_strings(&$fieldinput)   X-Ref

param: array $fieldinput

data_convert_to_roles($data, $teacherroles=array()   X-Ref
Converts a database (module instance) to use the Roles System

return: boolean data module was converted or not
param: object $data a data object with the same attributes as a record
param: int $datamodid the id of the data module, from the modules table
param: array $teacherroles array of roles that have archetype teacher
param: array $studentroles array of roles that have archetype student
param: array $guestroles array of roles that have archetype guest
param: int $cmid the course_module id for this data instance

data_preset_name($shortname, $path)   X-Ref
Returns the best name to show for a preset

return: string
param: string $shortname
param: string $path

data_get_available_presets($context)   X-Ref
Returns an array of all the available presets.

return: array

data_get_available_site_presets($context, array $presets=array()   X-Ref
Gets an array of all of the presets that users have saved to the site.

return: array An array of presets
param: stdClass $context The context that we are looking from.
param: array $presets

data_delete_site_preset($name)   X-Ref
Deletes a saved preset.

return: bool
param: string $name

data_print_header($course, $cm, $data, $currenttab='', string $actionbar = '')   X-Ref
Prints the heads for a page

param: stdClass $course
param: stdClass $cm
param: stdClass $data
param: string $currenttab
param: string $actionbar

data_user_can_add_entry($data, $currentgroup, $groupmode, $context = null)   X-Ref
Can user add more entries?

return: bool
param: object $data
param: mixed $currentgroup
param: int $groupmode
param: stdClass $context

data_user_can_manage_entry($record, $data, $context)   X-Ref
Check whether the current user is allowed to manage the given record considering manageentries capability,
data_in_readonly_period() result, ownership (determined by data_isowner()) and manageapproved setting.

return: bool returns true if the user is allowd to edit the entry, false otherwise
param: mixed $record record object or id
param: object $data data object
param: object $context context object

data_in_readonly_period($data)   X-Ref
Check whether the specified database activity is currently in a read-only period

return: bool returns true if the time fields in $data indicate a read-only period; false otherwise
param: object $data

is_directory_a_preset($directory)   X-Ref

return: bool

Class: data_preset_importer  - X-Ref

Abstract class used for data preset importers

__construct($course, $cm, $module, $directory)   X-Ref
Constructor

param: stdClass $course
param: stdClass $cm
param: stdClass $module
param: string $directory

get_directory()   X-Ref
Returns the name of the directory the preset is located in

return: string

data_preset_get_file_contents(&$filestorage, &$fileobj, $dir, $filename)   X-Ref
Retreive the contents of a file. That file may either be in a conventional directory of the Moodle file storage

return: string the contents of the file or null if the file doesn't exist.
param: file_storage $filestorage. should be null if using a conventional directory
param: stored_file $fileobj the directory to look in. null if using a conventional directory
param: string $dir the directory to look in. null if using the Moodle file storage
param: string $filename the name of the file we want

get_preset_settings()   X-Ref
Gets the preset settings

return: stdClass

import($overwritesettings)   X-Ref
Import the preset into the given database module

return: bool

cleanup()   X-Ref
Any clean up routines should go here

return: bool

Class: data_preset_upload_importer  - X-Ref

Data preset importer for uploaded presets

__construct($course, $cm, $module, $filepath)   X-Ref
No description

cleanup()   X-Ref
No description

Class: data_preset_existing_importer  - X-Ref

Data preset importer for existing presets

__construct($course, $cm, $module, $fullname)   X-Ref
No description

get_userid()   X-Ref
No description

data_preset_path($course, $userid, $shortname)   X-Ref

return: string
param: object $course
param: int $userid
param: string $shortname

data_reset_course_form_definition(&$mform)   X-Ref
Implementation of the function for printing the form elements that control
whether the course reset functionality affects the data.

param: $mform form passed by reference

data_reset_course_form_defaults($course)   X-Ref
Course reset form defaults.

return: array

data_reset_gradebook($courseid, $type='')   X-Ref
Removes all grades from gradebook

param: int $courseid
param: string $type optional type

data_reset_userdata($data)   X-Ref
Actual implementation of the reset course functionality, delete all the
data responses for course $data->courseid.

return: array status array
param: object $data the data submitted from the reset course.

data_get_extra_capabilities()   X-Ref
Returns all other caps used in module

return: array

data_supports($feature)   X-Ref

return: mixed True if module supports feature, false if not, null if doesn't know or string for the module purpose.
param: string $feature FEATURE_xx constant for requested feature

data_import_csv($cm, $data, &$csvdata, $encoding, $fielddelimiter)   X-Ref
Import records for a data instance from csv data.

return: int Number of records added.
param: object $cm Course module of the data instance.
param: object $data The data instance.
param: string $csvdata The csv data to be imported.
param: string $encoding The encoding of csv data.
param: string $fielddelimiter The delimiter of the csv data.

data_export_csv($export, $delimiter_name, $database, $count, $return=false)   X-Ref

return: string|void
param: array $export
param: string $delimiter_name
param: object $database
param: int $count
param: bool $return

data_export_xls($export, $dataname, $count)   X-Ref

return: string
param: array $export
param: string $dataname
param: int $count

data_export_ods($export, $dataname, $count)   X-Ref

param: array $export
param: string $dataname
param: int $count
param: string

data_get_exportdata($dataid, $fields, $selectedfields, $currentgroup=0, $context=null,$userdetails=false, $time=false, $approval=false, $tags = false)   X-Ref

return: array
param: int $dataid
param: array $fields
param: array $selectedfields
param: int $currentgroup group ID of the current group. This is used for
param: object $context the context in which the operation is performed (for capability checks)
param: bool $userdetails whether to include the details of the record author
param: bool $time whether to include time created/modified
param: bool $approval whether to include approval status
param: bool $tags whether to include tags

data_get_file_areas($course, $cm, $context)   X-Ref
Lists all browsable file areas

return: array
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $context context object

data_get_file_info($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)   X-Ref
File browsing support for data module.

return: file_info_stored file_info_stored instance or null if not found
param: file_browser $browser
param: array $areas
param: stdClass $course
param: cm_info $cm
param: context $context
param: string $filearea
param: int $itemid
param: string $filepath
param: string $filename

data_pluginfile($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()   X-Ref
Serves the data attachments. Implements needed access control ;-)

return: bool false if file not found, does not return if found - justsend the file
param: stdClass $course course object
param: stdClass $cm course module object
param: stdClass $context context object
param: string $filearea file area
param: array $args extra arguments
param: bool $forcedownload whether or not force download
param: array $options additional options affecting the file serving

data_extend_navigation($navigation, $course, $module, $cm)   X-Ref
No description

data_extend_settings_navigation(settings_navigation $settings, navigation_node $datanode)   X-Ref
Adds module specific settings to the settings block

param: settings_navigation $settings The settings navigation object
param: navigation_node $datanode The node to add module settings to

data_presets_save($course, $cm, $data, $path)   X-Ref
Save the database configuration as a preset.

return: bool
param: stdClass $course The course the database module belongs to.
param: stdClass $cm The course module record
param: stdClass $data The database record
param: string $path

data_presets_generate_xml($course, $cm, $data)   X-Ref
Generates the XML for the database module provided

return: string The XML for the preset
param: stdClass $course The course the database module belongs to.
param: stdClass $cm The course module record
param: stdClass $data The database record

data_presets_export($course, $cm, $data, $tostorage=false)   X-Ref
No description

data_comment_permissions($comment_param)   X-Ref
Running addtional permission check on plugin, for example, plugins
may have switch to turn on/off comments option, this callback will
affect UI display, not like pluginname_comment_validate only throw
exceptions.
Capability check has been done in comment->check_permissions(), we
don't need to do it again here.

return: array
param: stdClass $comment_param {

data_comment_validate($comment_param)   X-Ref
Validate comment parameter before perform other comments actions

return: boolean
param: stdClass $comment_param {

data_page_type_list($pagetype, $parentcontext, $currentcontext)   X-Ref
Return a list of page types

param: string $pagetype current page type
param: stdClass $parentcontext Block's parent context
param: stdClass $currentcontext Current context of block

data_get_all_recordids($dataid, $selectdata = '', $params = null)   X-Ref
Get all of the record ids from a database activity.

return: array $idarray     An array of record ids
param: int    $dataid      The dataid of the database module.
param: object $selectdata  Contains an additional sql statement for the
param: array  $params      Parameters that coincide with the sql statement.

data_get_advance_search_ids($recordids, $searcharray, $dataid)   X-Ref
Get the ids of all the records that match that advanced search criteria
This goes and loops through each criterion one at a time until it either
runs out of records or returns a subset of records.

return: array $recordids   An array of record ids.
param: array $recordids    An array of record ids.
param: array $searcharray  Contains information for the advanced search criteria
param: int $dataid         The data id of the database.

data_get_recordids($alias, $searcharray, $dataid, $recordids)   X-Ref
Gets the record IDs given the search criteria

return: array $nestarray   An arry of record IDs
param: string $alias       Record alias.
param: array $searcharray  Criteria for the search.
param: int $dataid         Data ID for the database
param: array $recordids    An array of record IDs.

data_get_advanced_search_sql($sort, $data, $recordids, $selectdata, $sortorder)   X-Ref
Returns an array with an sql string for advanced searches and the parameters that go with them.

return: array sqlselect     sqlselect['sql'] has the sql string, sqlselect['params'] contains an array of parameters.
param: int $sort            DATA_*
param: stdClass $data       Data module object
param: array $recordids     An array of record IDs.
param: string $selectdata   Information for the where and select part of the sql statement.
param: string $sortorder    Additional sort parameters

data_user_can_delete_preset($context, $preset)   X-Ref
Checks to see if the user has permission to delete the preset.

return: bool  Returns true if the user can delete, otherwise false.
param: stdClass $context  Context object.
param: stdClass $preset  The preset object that we are checking for deletion.

data_delete_record($recordid, $data, $courseid, $cmid)   X-Ref
Delete a record entry.

return: bool True if the record deleted, false if not.
param: int $recordid The ID for the record to be deleted.
param: object $data The data object for this activity.
param: int $courseid ID for the current course (for logging).
param: int $cmid The course module ID.

data_process_submission(stdClass $mod, $fields, stdClass $datarecord)   X-Ref
Check for required fields, and build a list of fields to be updated in a
submission.

return: stdClass containing:
param: $mod stdClass The current recordid - provided as an optimisation.
param: $fields array The field data
param: $datarecord stdClass The submitted data.

data_refresh_events($courseid = 0, $instance = null, $cm = null)   X-Ref
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 data event in the site is checked, else
only data events belonging to the course specified are checked.
This function is used, in its new format, by restore_refresh_events()

return: bool
param: int $courseid
param: int|stdClass $instance Data module instance or ID.
param: int|stdClass $cm Course module object or ID (not used in this module).

data_get_config($database, $key = null, $default = null)   X-Ref
Fetch the configuration for this database activity.

return: mixed                   The returned value
param: stdClass    $database   The object returned from the database for this instance
param: string      $key        The name of the key to retrieve. If none is supplied, then all configuration is returned
param: mixed       $default    The default value to use if no value was found for the specified key

data_set_config(&$database, $key, $value)   X-Ref
Update the configuration for this database activity.

param: stdClass    $database   The object returned from the database for this instance
param: string      $key        The name of the key to set
param: mixed       $value      The value to set for the key

data_update_completion_state($data, $course, $cm)   X-Ref
Sets the automatic completion state for this database item based on the
count of on its entries.

param: object $data The data object for this activity
param: object $course Course
param: object $cm course-module

data_view($data, $course, $cm, $context)   X-Ref
Mark the activity completed (if required) and trigger the course_module_viewed event.

param: stdClass $data       data object
param: stdClass $course     course object
param: stdClass $cm         course module object
param: stdClass $context    context object

mod_data_get_fontawesome_icon_map()   X-Ref
Get icon mapping for font-awesome.


data_check_updates_since(cm_info $cm, $from, $filter = array()   X-Ref
No description

mod_data_core_calendar_provide_event_action(calendar_event $event,\core_calendar\action_factory $factory,int $userid = 0)   X-Ref
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.

return: \core_calendar\local\event\entities\action_interface|null
param: calendar_event $event
param: \core_calendar\action_factory $factory
param: int $userid User id to use for all capability checks, etc. Set to 0 for current user (default).

data_get_coursemodule_info($coursemodule)   X-Ref
Add a get_coursemodule_info function in case any database 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.

return: cached_cm_info An object on information that the courses
param: stdClass $coursemodule The coursemodule object (record).

mod_data_get_completion_active_rule_descriptions($cm)   X-Ref
Callback which returns human-readable strings describing the active completion custom rules for the module instance.

return: array $descriptions the array of descriptions for the custom rules.
param: cm_info|stdClass $cm object with fields ->completion and ->customdata['customcompletionrules']

mod_data_core_calendar_get_valid_event_timestart_range(\calendar_event $event, \stdClass $instance)   X-Ref
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 sbumission start date'],
[1506741172, 'The due date must be before the cutoff date']
]

return: array
param: calendar_event $event The calendar event to get the time range for
param: stdClass $instance The module instance to get the range from

mod_data_core_calendar_event_timestart_updated(\calendar_event $event, \stdClass $data)   X-Ref
This function will update the data module according to the
event that has been modified.

It will set the timeopen or timeclose value of the data instance
according to the type of event provided.

param: \calendar_event $event
param: stdClass $data The module instance to get the range from

mod_data_core_calendar_get_event_action_string(string $eventtype)   X-Ref
Callback to fetch the activity event type lang string.

return: lang_string The event type lang string.
param: string $eventtype The event type.