Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 3.9.x will end* 10 May 2021 (12 months).
  • Bug fixes for security issues in 3.9.x will end* 8 May 2023 (36 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.
/mod/data/ -> lib.php (source)

Differences Between: [Versions 39 and 311] [Versions 39 and 400] [Versions 39 and 401] [Versions 39 and 402] [Versions 39 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: 4828 lines (173 kb)
Included or required: 6 times
Referenced: 1 time
Includes or requires: 1 file
 mod/data/tabs.php

Defines 4 classes

data_field_base:: (66 methods):
  __construct()
  define_default_field()
  define_field()
  insert_field()
  update_field()
  delete_field()
  display_add_field()
  display_edit_field()
  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_get_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()


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

param: int $recordid
return: string

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

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

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

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

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

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

param: int $recordid
return: bool

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

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

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.

param: string $fieldname
return: 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.

param: string $record
return: string

file_ok($relativepath)   X-Ref

param: string $relativepath
return: bool false

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.

param: stdClass $content
return: string

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

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

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

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

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.

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

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

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

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

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

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

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

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

param: object $field
param: object $data
param: object $cm
return: object

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

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

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

param: object $data
return: bool

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

param: object $data
return: int

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

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

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.

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

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

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

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

param: object $data
return: bool

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

param: int $id
return: bool

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

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

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.

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

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

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
return: object grade_item

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

param: object $data object
return: object grade_item

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

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)
return: mixed

data_rating_permissions($contextid, $component, $ratingarea)   X-Ref
Return rating related 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
return: array an associative array of the user's rating permissions

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

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

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

param: array $params submitted data
return: bool

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.

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
return: void

data_print_ratings($data, $record)   X-Ref

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

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

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

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

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
return: boolean data module was converted or not

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

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

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.

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

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

param: string $name
return: bool

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

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

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

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

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.

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

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

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

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

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
return: string the contents of the file or null if the file doesn't exist.

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

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

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.

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

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

return: array

data_supports($feature)   X-Ref

param: string $feature FEATURE_xx constant for requested feature
return: mixed True if module supports feature, null if doesn't know

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

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.
return: int Number of records added.

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

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

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

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

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

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
return: array

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

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

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

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
return: file_info_stored file_info_stored instance or null if not found

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

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
return: bool false if file not found, does not return if found - justsend the file

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.

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
return: bool

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

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

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.

param: stdClass $comment_param {
return: array

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

param: stdClass $comment_param {
return: boolean

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.

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.
return: array $idarray     An array of record ids

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.

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.
return: array $recordids   An array of record ids.

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

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.
return: array $nestarray   An arry 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.

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
return: array sqlselect     sqlselect['sql'] has the sql string, sqlselect['params'] contains an array of parameters.

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

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

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

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.
return: bool True if the record deleted, false if not.

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.

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

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()

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).
return: bool

data_get_config($database, $key = null, $default = null)   X-Ref
Fetch 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 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
return: mixed                   The returned value

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_get_completion_state($course, $cm, $userid, $type)   X-Ref
Obtains the automatic completion state for this database item based on any conditions
on its settings. The call for this is in completion lib where the modulename is appended
to the function name. This is why there are unused parameters.

param: stdClass $course Course
param: cm_info|stdClass $cm course-module
param: int $userid User ID
param: bool $type Type of comparison (or/and; can be used as return value if no conditions)
return: bool True if completed, false if not, $type if conditions not set.

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.

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).
return: \core_calendar\local\event\entities\action_interface|null

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.

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

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.

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

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

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

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