Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_data

Namespaces

namespace  mod_data
  
 
namespace  mod_data\analytics\indicator
  
 
namespace  mod_data\completion
  
 
namespace  mod_data\event
  
 
namespace  mod_data\external
  
 
namespace  mod_data\form
  
 
namespace  mod_data\local\exporter
  
 
namespace  mod_data\local\importer
  
 
namespace  mod_data\output
  
 
namespace  mod_data\plugininfo
  
 
namespace  mod_data\privacy
  
 
namespace  mod_data\search
  
 

Classes

class  backup_data_activity_structure_step
 Define all the backup steps that will be used by the backup_data_activity_task. More...
 
class  backup_data_activity_task
 Provides the steps to perform one complete backup of the Database instance. More...
 
class  behat_mod_data
 Database-related steps definitions. More...
 
class  behat_mod_data_deprecated
 
class  behat_mod_data_generator
 
class  data_existing_preset_form
 
class  data_export_form
 
class  data_field_base
 
class  data_file_info_container
 Class representing the virtual node with all itemids in the file browser. More...
 
class  data_import_preset_zip_form
 Import preset class. More...
 
class  data_portfolio_caller
 The class to handle entry exports of a database module. More...
 
class  data_preset_existing_importer
 Data preset importer for existing presets. More...
 
class  data_preset_importer
 Abstract class used for data preset importers. More...
 
class  data_preset_upload_importer
 Data preset importer for uploaded presets. More...
 
class  data_save_preset_form
 
class  mod_data\analytics\indicator\activity_base
 Activity base class. More...
 
class  mod_data\analytics\indicator\cognitive_depth
 Cognitive depth indicator - data. More...
 
class  mod_data\analytics\indicator\social_breadth
 Social breadth indicator - data. More...
 
class  mod_data\completion\custom_completion
 
class  mod_data\dates
 Class for fetching the important dates in mod_data for a given module instance and a user. More...
 
class  mod_data\event\comment_created
 The mod_data comment created event class. More...
 
class  mod_data\event\comment_deleted
 The mod_data comment deleted event class. More...
 
class  mod_data\event\course_module_instance_list_viewed
 The mod_data instance list viewed event class. More...
 
class  mod_data\event\course_module_viewed
 The mod_data course module viewed event class. More...
 
class  mod_data\event\field_created
 
class  mod_data\event\field_deleted
 
class  mod_data\event\field_updated
 
class  mod_data\external\content_exporter
 Class for exporting content associated to a record. More...
 
class  mod_data\external\database_summary_exporter
 Class for exporting partial database data (some fields are only viewable by admins). More...
 
class  mod_data\external\delete_saved_preset
 
class  mod_data\external\field_exporter
 Class for exporting field data. More...
 
class  mod_data\external\get_mapping_information
 
class  mod_data\external\record_exporter
 Class for exporting record data. More...
 
class  mod_data\form\import_presets
 
class  mod_data\form\save_as_preset
 
class  mod_data\local\exporter\csv_entries_exporter
 
class  mod_data\local\exporter\entries_exporter
 
class  mod_data\local\exporter\ods_entries_exporter
 
class  mod_data\local\exporter\utils
 
class  mod_data\local\importer\csv_entries_importer
 
class  mod_data\local\importer\entries_importer
 
class  mod_data\local\importer\preset_existing_importer
 
class  mod_data\local\importer\preset_importer
 
class  mod_data\local\importer\preset_upload_importer
 
class  mod_data\manager
 
class  mod_data\output\action_bar
 
class  mod_data\output\add_entries_action
 
class  mod_data\output\defaulttemplate
 
class  mod_data\output\empty_database_action_bar
 
class  mod_data\output\fields_action_bar
 
class  mod_data\output\fields_mappings_action_bar
 
class  mod_data\output\preset_preview
 
class  mod_data\output\presets
 
class  mod_data\output\presets_action_bar
 
class  mod_data\output\template_editor
 
class  mod_data\output\template_editor_tools
 
class  mod_data\output\templates_action_bar
 
class  mod_data\output\view_action_bar
 
class  mod_data\output\view_footer
 
class  mod_data\output\zero_state_action_bar
 
class  mod_data\plugininfo\datafield
 
class  mod_data\plugininfo\datapreset
 
class  mod_data\preset
 
interface  mod_data\privacy\datafield_provider
 Interface datafield_provider, all datafield plugins need to implement it. More...
 
class  mod_data\privacy\provider
 Implementation of the privacy subsystem plugin provider for the database activity module. More...
 
class  mod_data\search\activity
 Search area for mod_data activities. More...
 
class  mod_data\search\entry
 Search area for mod_data activity entries. More...
 
class  mod_data\search\sortedcontentqueue
 Priority Queue class to sort out db entry contents. More...
 
class  mod_data\template
 
class  mod_data_external
 Database module external functions. More...
 
class  mod_data_generator
 Data generator class for mod_data. More...
 
class  mod_data_renderer
 
class  moodle1_mod_data_handler
 Database conversion handler. More...
 
class  restore_data_activity_structure_step
 Define all the restore steps that will be used by the restore_data_activity_task. More...
 
class  restore_data_activity_task
 data restore task that provides all the settings and steps to perform one complete restore of the activity More...
 

Functions

 data_add_fields_contents_to_new_record ($data, $context, $recordid, $fields, $datarecord, $processeddata)
 Populate the field contents of a new record with the submitted data.
 
 data_add_instance ($data, $mform=null)
 Adds an instance of a data.
 
object data_add_record ($data, $groupid=0, $userid=null, bool $approved=true)
 function that takes in a dataid and adds a record this is used everytime an add template is submitted
 
object data_append_new_field_to_templates ($data, $newfieldname)
 Appends a new field at the end of the form template.
 
 data_approve_entry ($entryid, $approve)
 Approves or unapproves an entry.
 
 data_atmaxentries ($data)
 has a user reached the max number of entries?
 
 data_build_search_array ($data, $paging, $searcharray, $defaults=null, $fn='', $ln='')
 Build the search array.
 
 data_can_view_record ($data, $record, $currentgroup, $canmanageentries)
 Check if the current user can view the given record.
 
 data_check_updates_since (cm_info $cm, $from, $filter=array())
 
 data_comment_permissions ($comment_param)
 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.
 
 data_comment_validate ($comment_param)
 Validate comment parameter before perform other comments actions.
 
 data_convert_arrays_to_strings (&$fieldinput)
 
object data_convert_to_roles ($data, $teacherroles=array(), $studentroles=array(), $cmid=NULL)
 Converts a database (module instance) to use the Roles System.
 
object data_delete_instance ($id)
 deletes an instance of a data
 
 data_delete_record ($recordid, $data, $courseid, $cmid)
 Delete a record entry.
 
 data_delete_site_preset ($name)
 Deletes a saved preset.
 
object data_export_csv ($export, $delimiter_name, $database, $count, $return=false)
 
object data_export_ods ($export, $dataname, $count)
 
object data_export_xls ($export, $dataname, $count)
 
 data_extend_navigation ($navigation, $course, $module, $cm)
 
 data_extend_settings_navigation (settings_navigation $settings, navigation_node $datanode)
 Adds module specific settings to the settings block.
 
 data_fieldname_exists ($name, $dataid, $fieldid=0)
 
 data_generate_default_template (&$data, $template, $recordid=0, $form=false, $update=true)
 Given a template and a dataid, generate a default case template.
 
 data_generate_tag_form ($recordid=false, $selected=[])
 Build the form elements to manage tags for a record.
 
 data_get_advance_search_ids ($recordids, $searcharray, $dataid)
 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.
 
 data_get_advanced_search_sql ($sort, $data, $recordids, $selectdata, $sortorder)
 Returns an array with an sql string for advanced searches and the parameters that go with them.
 
 data_get_all_recordids ($dataid, $selectdata='', $params=null)
 Get all of the record ids from a database activity.
 
 data_get_available_presets ($context)
 Returns an array of all the available presets.
 
 data_get_available_site_presets ($context, array $presets=array())
 Gets an array of all of the presets that users have saved to the site.
 
 data_get_completion_state ()
 
 data_get_config ($database, $key=null, $default=null)
 Fetch the configuration for this database activity.
 
 data_get_coursemodule_info ($coursemodule)
 Add a get_coursemodule_info function in case any database type wants to add 'extra' information for the course (see resource).
 
 data_get_entries_left_to_add ($data, $numentries, $canmanageentries)
 Return the number of entries left to add to complete the activity.
 
 data_get_entries_left_to_view ($data, $numentries, $canmanageentries)
 Return the number of entires left to add to view other users entries.
 
object data_get_exportdata ($dataid, $fields, $selectedfields, $currentgroup=0, $context=null, $userdetails=false, $time=false, $approval=false, $tags=false)
 
 data_get_extra_capabilities ()
 Returns all other caps used in module.
 
object data_get_field (stdClass $field, stdClass $data, ?stdClass $cm=null)
 returns a subclass field object given a record of the field, used to invoke plugin methods input: $param $field - record from db
 
object data_get_field_from_id ($fieldid, $data)
 given a field id this function creates an instance of the particular subfield class
 
object data_get_field_from_name ($name, $data)
 given a field name this function creates an instance of the particular subfield class
 
 data_get_field_instances ($data)
 Return all the field instances for a given database.
 
object data_get_field_new ($type, $data)
 given a field id this function creates an instance of the particular subfield class
 
 data_get_file_areas ($course, $cm, $context)
 Lists all browsable file areas.
 
 data_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename)
 File browsing support for data module.
 
 data_get_post_actions ()
 List the actions that correspond to a post of this module.
 
 data_get_recordids ($alias, $searcharray, $dataid, $recordids)
 Gets the record IDs given the search criteria.
 
 data_get_tag_title_field ($dataid)
 Get the title of a field to show when displaying tag results.
 
 data_get_tag_title_for_entry ($field, $entry)
 Get the title of an entry to show when displaying tag results.
 
 data_get_time_availability_status ($data, $canmanageentries=null, $context=null)
 Check if a database is available for the current user.
 
object data_get_user_grades ($data, $userid=0)
 Return grade for given user or all users.
 
 data_get_view_actions ()
 List the actions that correspond to a view of this module.
 
 data_grade_item_delete ($data)
 Delete grade item for given data.
 
 data_grade_item_update ($data, $grades=NULL)
 Update/create grade item for given data.
 
 data_import_csv ($cm, $data, &$csvdata, $encoding, $fielddelimiter)
 
 data_in_readonly_period ($data)
 Check whether the specified database activity is currently in a read-only period.
 
object data_isowner ($record)
 Given record object (or id), returns true if the record belongs to the current user.
 
object data_numentries ($data, $userid=null)
 returns the number of entries already made by this user
 
 data_page_type_list ($pagetype, $parentcontext, $currentcontext)
 Return a list of page types.
 
 data_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array())
 Serves the data attachments.
 
 data_preset_name ($shortname, $path)
 Returns the best name to show for a preset.
 
object data_preset_path ($course, $userid, $shortname)
 @global object
 
 data_presets_export ($course, $cm, $data, $tostorage=false)
 Export current fields and presets.
 
moodle_database data_presets_generate_xml ($course, $cm, $data)
 Generates the XML for the database module provided.
 
 data_presets_save ($course, $cm, $data, $path)
 Save the database configuration as a preset.
 
 data_print_header ($course, $cm, $data, $currenttab='', string $actionbar='')
 Prints the heads for a page.
 
object data_print_preference_form ($data, $perpage, $search, $sort='', $order='ASC', $search_array='', $advanced=0, $mode='')
 function that takes in the current data, number of items per page, a search string and prints a preference box in view.php
 
object data_print_ratings ($data, $record, bool $print=true)
 @global object
 
 data_print_template ($templatename, $records, $data, $search='', $page=0, $return=false, moodle_url $jumpurl=null)
 takes a list of records, the current data, a search string, and mode to display prints the translated template
 
 data_process_submission (stdClass $mod, $fields, stdClass $datarecord)
 Check for required fields, and build a list of fields to be updated in a submission.
 
 data_rating_permissions ($contextid, $component, $ratingarea)
 Return rating related permissions.
 
 data_rating_validate ($params)
 Validates a submitted rating.
 
 data_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.
 
object data_replace_field_in_templates ($data, $searchfieldname, $newfieldname)
 Search for a field name and replaces it with another one in all the form templates.
 
 data_require_time_available ($data, $canmanageentries=null, $context=null)
 Requires a database to be available for the current user.
 
 data_reset_course_form_defaults ($course)
 Course reset form defaults.
 
 data_reset_course_form_definition (&$mform)
 Implementation of the function for printing the form elements that control whether the course reset functionality affects the data.
 
object data_reset_gradebook ($courseid, $type='')
 Removes all grades from gradebook.
 
object data_reset_userdata ($data)
 Actual implementation of the reset course functionality, delete all the data responses for course $data->courseid.
 
 data_rss_delete_file ($data)
 Given a database object, deletes all cached RSS files associated with it.
 
 data_rss_get_feed ($context, $args)
 Generates the Database modules RSS Feed.
 
 data_rss_get_sql ($data, $time=0)
 Creates and returns a SQL query for the items that would be included in the RSS Feed.
 
 data_rss_newstuff ($data, $time)
 If there is new stuff in since $time this returns true Otherwise it returns false.
 
 data_search_entries ($data, $cm, $context, $mode, $currentgroup, $search='', $sort=null, $order=null, $page=0, $perpage=0, $advanced=null, $searcharray=null, $record=null)
 Search entries in a database.
 
 data_set_config (&$database, $key, $value)
 Update the configuration for this database activity.
 
 data_set_events ($data)
 This creates new calendar events given as timeavailablefrom and timeclose by $data.
 
 data_supports ($feature)
 
object data_tags_check ($dataid, $template)
 check the multple existence any tag in a template
 
 data_update_completion_state ($data, $course, $cm)
 Sets the automatic completion state for this database item based on the count of on its entries.
 
 data_update_grades ($data, $userid=0, $nullifnone=true)
 Update activity grades.
 
object data_update_instance ($data)
 updates an instance of a data
 
 data_update_record_fields_contents ($data, $record, $context, $datarecord, $processeddata)
 Updates the fields contents of an existing record.
 
 data_user_can_add_entry ($data, $currentgroup, $groupmode, $context=null)
 Can user add more entries?
 
 data_user_can_delete_preset ($context, $preset)
 Checks to see if the user has permission to delete the preset.
 
 data_user_can_manage_entry ($record, $data, $context)
 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.
 
object data_user_complete ($course, $user, $mod, $data)
 Prints all the records uploaded by this user.
 
object data_user_outline ($course, $user, $mod, $data)
 returns a summary of data activity of this user
 
 data_view ($data, $course, $cm, $context)
 Mark the activity completed (if required) and trigger the course_module_viewed event.
 
 is_directory_a_preset ($directory)
 Check if the files in a directory are the expected for a preset.
 
 mod_data_core_calendar_event_timestart_updated (\calendar_event $event, stdClass $data)
 This function will update the data module according to the event that has been modified.
 
 mod_data_core_calendar_get_event_action_string (string $eventtype)
 Callback to fetch the activity event type lang string.
 
 mod_data_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_data_core_calendar_provide_event_action (calendar_event $event, core_calendar\action_factory $factory, int $userid=0)
 This function receives a calendar event and returns the action associated with it, or null if there is none.
 
 mod_data_get_completion_active_rule_descriptions ($cm)
 Callback which returns human-readable strings describing the active completion custom rules for the module instance.
 
 mod_data_get_fontawesome_icon_map ()
 Get icon mapping for font-awesome.
 
 mod_data_get_tagged_records ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=true, $page=0)
 Returns data records tagged with a specified tag.
 
 mod_data_rating_can_see_item_ratings ($params)
 Can the current user see ratings for a given itemid?
 
 xmldb_data_upgrade ($oldversion)
 

Variables

 $capabilities
 
 $functions
 
 $logs
 
 $plugin = 2024041600
 
 $tagareas
 
$plugin component = 'mod_data'
 
$plugin cron = 0
 
const DATA_APPROVED -3
 
const DATA_CAP_EXPORT 'mod/data:viewalluserpresets'
 
const DATA_EVENT_TYPE_CLOSE 'close'
 
const DATA_EVENT_TYPE_OPEN 'open'
 
const DATA_FIRSTNAME -1
 
const DATA_LASTNAME -2
 
const DATA_MAX_ENTRIES 50
 
const DATA_PERPAGE_SINGLE 1
 
const DATA_PRESET_COMPONENT 'mod_data'
 
const DATA_PRESET_CONTEXT SYSCONTEXTID
 
const DATA_PRESET_FILEAREA 'site_presets'
 
const DATA_TAGS -5
 
const DATA_TIMEADDED 0
 
const DATA_TIMEMODIFIED -4
 
 if (!defined( 'MOODLE_INTERNAL'))
 
$plugin version = 2024053100
 

Detailed Description

Function Documentation

◆ data_add_fields_contents_to_new_record()

data_add_fields_contents_to_new_record ( $data,
$context,
$recordid,
$fields,
$datarecord,
$processeddata )

Populate the field contents of a new record with the submitted data.

An event has been previously triggered upon the creation of the new record in data_add_record().

Parameters
stdClass$datadatabase object
stdClass$contextcontext object
int$recordidthe new record id
array$fieldslist of fields of the database
stdClass$datarecordthe submitted data
stdClass$processeddatapre-processed submitted fields
Since
Moodle 3.3

◆ data_add_instance()

data_add_instance ( $data,
$mform = null )

Adds an instance of a data.

Parameters
stdClass$data
mod_data_mod_form$mform
Return values
intintance id

◆ data_add_record()

object data_add_record ( $data,
$groupid = 0,
$userid = null,
bool $approved = true )

function that takes in a dataid and adds a record this is used everytime an add template is submitted

@global object

Parameters
object$data
int$groupid
int$userid
bool$approvedIf specified, and the user has the capability to approve entries, then this value will be used as the approved status of the new record
Return values
bool

◆ data_append_new_field_to_templates()

object data_append_new_field_to_templates ( $data,
$newfieldname )

Appends a new field at the end of the form template.

Parameters
object$data
string$newfieldname
Return values
boolif the field has been added or not

◆ data_approve_entry()

data_approve_entry ( $entryid,
$approve )

Approves or unapproves an entry.

Parameters
int$entryidthe entry to approve or unapprove.
bool$approveWhether to approve or unapprove (true for approve false otherwise).
Since
Moodle 3.3

◆ data_atmaxentries()

data_atmaxentries ( $data)

has a user reached the max number of entries?

Parameters
object$data
Return values
bool

◆ data_build_search_array()

data_build_search_array ( $data,
$paging,
$searcharray,
$defaults = null,
$fn = '',
$ln = '' )

Build the search array.

Parameters
stdClass$datathe database object
bool$pagingif paging is being used
array$searcharraythe current search array (saved by session)
array$defaultsdefault values for the searchable fields
str$fnthe first name to search (optional)
str$lnthe last name to search (optional)
Return values
arraythe search array and plain search build based on the different elements
Since
Moodle 3.3

◆ data_can_view_record()

data_can_view_record ( $data,
$record,
$currentgroup,
$canmanageentries )

Check if the current user can view the given record.

Parameters
stdClass$datadatabase record
stdClass$recordthe record (entry) to check
int$currentgroupcurrent group
bool$canmanageentriesif the user can manage entries
Return values
booltrue if the user can view the entry
Since
Moodle 3.3

◆ data_comment_permissions()

data_comment_permissions ( $comment_param)

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.

Parameters
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Return values
array

◆ data_comment_validate()

data_comment_validate ( $comment_param)

Validate comment parameter before perform other comments actions.

Parameters
stdClass$comment_param{ context => context the context object courseid => int course id cm => stdClass course module object commentarea => string comment area itemid => int itemid }
Return values
boolean

◆ data_convert_arrays_to_strings()

data_convert_arrays_to_strings ( & $fieldinput)
Parameters
array$fieldinput

◆ data_convert_to_roles()

object data_convert_to_roles ( $data,
$teacherroles = array(),
$studentroles = array(),
$cmid = NULL )

Converts a database (module instance) to use the Roles System.

@global object @uses CONTEXT_MODULE @uses CAP_PREVENT @uses CAP_ALLOW

Parameters
object$dataa data object with the same attributes as a record from the data database table
int$datamodidthe id of the data module, from the modules table
array$teacherrolesarray of roles that have archetype teacher
array$studentrolesarray of roles that have archetype student
array$guestrolesarray of roles that have archetype guest
int$cmidthe course_module id for this data instance
Return values
booleandata module was converted or not

◆ data_delete_instance()

object data_delete_instance ( $id)

deletes an instance of a data

Parameters
int$id
Return values
bool

◆ data_delete_record()

data_delete_record ( $recordid,
$data,
$courseid,
$cmid )

Delete a record entry.

Parameters
int$recordidThe ID for the record to be deleted.
object$dataThe data object for this activity.
int$courseidID for the current course (for logging).
int$cmidThe course module ID.
Return values
boolTrue if the record deleted, false if not.

◆ data_delete_site_preset()

data_delete_site_preset ( $name)

Deletes a saved preset.

Parameters
string$name
Return values
bool
Deprecated
since Moodle 4.1 MDL-75187 - please, use the preset\delete() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\delete()

◆ data_export_csv()

object data_export_csv ( $export,
$delimiter_name,
$database,
$count,
$return = false )
Deprecated
since Moodle 4.3, exporting is now being done by mod_data\local\exporter\csv_entries_exporter
Parameters
array$export
string$delimiter_name
object$database
int$count
bool$return
Return values
string|void

◆ data_export_ods()

object data_export_ods ( $export,
$dataname,
$count )
Deprecated
since Moodle 4.3, exporting is now being done by mod_data\local\exporter\ods_entries_exporter
Parameters
array$export
string$dataname
int$count
string

◆ data_export_xls()

object data_export_xls ( $export,
$dataname,
$count )
Deprecated
since Moodle 4.3.
Parameters
array$export
string$dataname
int$count
Return values
string

◆ data_extend_settings_navigation()

data_extend_settings_navigation ( settings_navigation $settings,
navigation_node $datanode )

Adds module specific settings to the settings block.

Parameters
settings_navigation$settingsThe settings navigation object
navigation_node$datanodeThe node to add module settings to

◆ data_fieldname_exists()

data_fieldname_exists ( $name,
$dataid,
$fieldid = 0 )
Parameters
string$name
int$dataid
int$fieldid
Return values
bool

◆ data_generate_default_template()

data_generate_default_template ( & $data,
$template,
$recordid = 0,
$form = false,
$update = true )

Given a template and a dataid, generate a default case template.

Parameters
stdClass$datathe mod_data record.
string$templatethe template name
int$recordidthe entry record
bool$formprint a form instead of data
bool$updateif the function update the $data object or not
Return values
stringthe template content or an empty string if no content is available (for instance, when database has no fields).

◆ data_generate_tag_form()

data_generate_tag_form ( $recordid = false,
$selected = [] )

Build the form elements to manage tags for a record.

Parameters
int | bool$recordid
string[]$selectedraw tag names
Return values
string

◆ data_get_advance_search_ids()

data_get_advance_search_ids ( $recordids,
$searcharray,
$dataid )

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.

Parameters
array$recordidsAn array of record ids.
array$searcharrayContains information for the advanced search criteria
int$dataidThe data id of the database.
Return values
array\$recordidsAn array of record ids.

◆ data_get_advanced_search_sql()

data_get_advanced_search_sql ( $sort,
$data,
$recordids,
$selectdata,
$sortorder )

Returns an array with an sql string for advanced searches and the parameters that go with them.

Parameters
int$sortDATA_*
stdClass$dataData module object
array$recordidsAn array of record IDs.
string$selectdataInformation for the where and select part of the sql statement.
string$sortorderAdditional sort parameters
Return values
arraysqlselect sqlselect['sql'] has the sql string, sqlselect['params'] contains an array of parameters.

◆ data_get_all_recordids()

data_get_all_recordids ( $dataid,
$selectdata = '',
$params = null )

Get all of the record ids from a database activity.

Parameters
int$dataidThe dataid of the database module.
object$selectdataContains an additional sql statement for the where clause for group and approval fields.
array$paramsParameters that coincide with the sql statement.
Return values
array\$idarrayAn array of record ids

◆ data_get_available_presets()

data_get_available_presets ( $context)

Returns an array of all the available presets.

Return values
array
Deprecated
since Moodle 4.1 MDL-75148 - please, use the manager\get_available_presets() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
manager\get_available_presets()

◆ data_get_available_site_presets()

data_get_available_site_presets ( $context,
array $presets = array() )

Gets an array of all of the presets that users have saved to the site.

Parameters
stdClass$contextThe context that we are looking from.
array$presets
Return values
arrayAn array of presets
Deprecated
since Moodle 4.1 MDL-75148 - please, use the manager\get_available_saved_presets() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
manager\get_available_saved_presets()

◆ data_get_completion_state()

data_get_completion_state ( )
Deprecated
since Moodle 3.11

◆ data_get_config()

data_get_config ( $database,
$key = null,
$default = null )

Fetch the configuration for this database activity.

Parameters
stdClass$databaseThe object returned from the database for this instance
string$keyThe name of the key to retrieve. If none is supplied, then all configuration is returned
mixed$defaultThe default value to use if no value was found for the specified key
Return values
mixedThe returned value

◆ data_get_coursemodule_info()

data_get_coursemodule_info ( $coursemodule)

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.

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

◆ data_get_entries_left_to_add()

data_get_entries_left_to_add ( $data,
$numentries,
$canmanageentries )

Return the number of entries left to add to complete the activity.

Parameters
stdClass$datadatabase object
int$numentriesthe number of entries the current user has created
bool$canmanageentrieswhether the user can manage entries (teachers, managers)
Return values
intthe number of entries left, 0 if no entries left or if is not required
Since
Moodle 3.3

◆ data_get_entries_left_to_view()

data_get_entries_left_to_view ( $data,
$numentries,
$canmanageentries )

Return the number of entires left to add to view other users entries.

Parameters
stdClass$datadatabase object
int$numentriesthe number of entries the current user has created
bool$canmanageentrieswhether the user can manage entries (teachers, managers)
Return values
intthe number of entries left, 0 if no entries left or if is not required
Since
Moodle 3.3

◆ data_get_exportdata()

object data_get_exportdata ( $dataid,
$fields,
$selectedfields,
$currentgroup = 0,
$context = null,
$userdetails = false,
$time = false,
$approval = false,
$tags = false )
Deprecated
since Moodle 4.3, use mod_data\local\exporter\utils\data_exportdata with a mod_data\local\exporter\entries_exporter object
Parameters
int$dataid
array$fields
array$selectedfields
int$currentgroupgroup ID of the current group. This is used for exporting data while maintaining group divisions.
object$contextthe context in which the operation is performed (for capability checks)
bool$userdetailswhether to include the details of the record author
bool$timewhether to include time created/modified
bool$approvalwhether to include approval status
bool$tagswhether to include tags
Return values
array

◆ data_get_extra_capabilities()

data_get_extra_capabilities ( )

Returns all other caps used in module.

Return values
array

◆ data_get_field()

object data_get_field ( stdClass $field,
stdClass $data,
?stdClass $cm = null )

returns a subclass field object given a record of the field, used to invoke plugin methods input: $param $field - record from db

Parameters
stdClass$fieldthe field record
stdClass$datathe data instance
stdClass | null$cmoptional course module data
Return values
data_field_basethe field object instance or data_field_base if unkown type

◆ data_get_field_from_id()

object data_get_field_from_id ( $fieldid,
$data )

given a field id this function creates an instance of the particular subfield class

Parameters
int$fieldid
object$data
Return values
bool|object

◆ data_get_field_from_name()

object data_get_field_from_name ( $name,
$data )

given a field name this function creates an instance of the particular subfield class

Parameters
string$name
object$data
Return values
object|bool

◆ data_get_field_instances()

data_get_field_instances ( $data)

Return all the field instances for a given database.

Parameters
stdClass$datadatabase object
Return values
arrayfield instances
Since
Moodle 3.3

◆ data_get_field_new()

object data_get_field_new ( $type,
$data )

given a field id this function creates an instance of the particular subfield class

Parameters
string$type
object$data
Return values
object

◆ data_get_file_areas()

data_get_file_areas ( $course,
$cm,
$context )

Lists all browsable file areas.

Parameters
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Return values
array

◆ data_get_file_info()

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

File browsing support for data module.

Parameters
file_browser$browser
array$areas
stdClass$course
cm_info$cm
context$context
string$filearea
int$itemid
string$filepath
string$filename
Return values
file_info_storedfile_info_stored instance or null if not found

◆ data_get_post_actions()

data_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

◆ data_get_recordids()

data_get_recordids ( $alias,
$searcharray,
$dataid,
$recordids )

Gets the record IDs given the search criteria.

Parameters
string$aliasRecord alias.
array$searcharrayCriteria for the search.
int$dataidData ID for the database
array$recordidsAn array of record IDs.
Return values
array\$nestarrayAn arry of record IDs

◆ data_get_tag_title_field()

data_get_tag_title_field ( $dataid)

Get the title of a field to show when displaying tag results.

Parameters
int$dataidThe id of the data field
Return values
stdClassThe field data from the 'data_fields' table as well as it's priority

◆ data_get_tag_title_for_entry()

data_get_tag_title_for_entry ( $field,
$entry )

Get the title of an entry to show when displaying tag results.

Parameters
stdClass$fieldThe field from the 'data_fields' table
stdClass$entryThe entry from the 'data_records' table
Return values
string|nullIt will return the title of the entry or null if the field type is not available.

◆ data_get_time_availability_status()

data_get_time_availability_status ( $data,
$canmanageentries = null,
$context = null )

Check if a database is available for the current user.

Parameters
stdClass$datadatabase record
boolean$canmanageentriesoptional, if the user can manage entries
stdClass$contextModule context, required if $canmanageentries is not set
Return values
arraystatus (available or not and possible warnings)
Since
Moodle 3.3

◆ data_get_user_grades()

object data_get_user_grades ( $data,
$userid = 0 )

Return grade for given user or all users.

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

◆ data_get_view_actions()

data_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

◆ data_grade_item_delete()

data_grade_item_delete ( $data)

Delete grade item for given data.

Parameters
object$dataobject
Return values
objectgrade_item

◆ data_grade_item_update()

data_grade_item_update ( $data,
$grades = NULL )

Update/create grade item for given data.

Parameters
stdClass$dataA database instance with extra cmidnumber property
mixed$gradesOptional array/object of grade(s); 'reset' means reset grades in gradebook
Return values
objectgrade_item

◆ data_import_csv()

data_import_csv ( $cm,
$data,
& $csvdata,
$encoding,
$fielddelimiter )
Deprecated
since Moodle 4.3, importing is now being done by mod_data\local\importer\csv_importer\import_csv Import records for a data instance from csv data.
Parameters
object$cmCourse module of the data instance.
object$dataThe data instance.
string$csvdataThe csv data to be imported.
string$encodingThe encoding of csv data.
string$fielddelimiterThe delimiter of the csv data.
Return values
intNumber of records added.

◆ data_in_readonly_period()

data_in_readonly_period ( $data)

Check whether the specified database activity is currently in a read-only period.

Parameters
object$data
Return values
boolreturns true if the time fields in $data indicate a read-only period; false otherwise

◆ data_isowner()

object data_isowner ( $record)

Given record object (or id), returns true if the record belongs to the current user.

@global object

Parameters
mixed$recordrecord object or id
Return values
bool

◆ data_numentries()

object data_numentries ( $data,
$userid = null )

returns the number of entries already made by this user

@global object

Parameters
object$data
Return values
int

◆ data_page_type_list()

data_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

◆ data_pluginfile()

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

Serves the data attachments.

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 - justsend the file

◆ data_preset_name()

data_preset_name ( $shortname,
$path )

Returns the best name to show for a preset.

Parameters
string$shortname
string$path
Return values
string
Deprecated
since Moodle 4.1 MDL-75148 - please, use the preset\get_name_from_plugin() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\get_name_from_plugin()

◆ data_preset_path()

object data_preset_path ( $course,
$userid,
$shortname )

@global object

Parameters
object$course
int$userid
string$shortname
Return values
string

◆ data_presets_export()

data_presets_export ( $course,
$cm,
$data,
$tostorage = false )

Export current fields and presets.

Parameters
stdClass$courseThe course the database module belongs to.
stdClass$cmThe course module record
stdClass$dataThe database record
bool$tostorage
Return values
stringthe full path to the exported preset file.
Deprecated
since Moodle 4.1 MDL-75142 - please, use the preset\export() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\export()

◆ data_presets_generate_xml()

moodle_database data_presets_generate_xml ( $course,
$cm,
$data )

Generates the XML for the database module provided.

$DB

Parameters
stdClass$courseThe course the database module belongs to.
stdClass$cmThe course module record
stdClass$dataThe database record
Return values
stringThe XML for the preset
Deprecated
since Moodle 4.1 MDL-75142 - please, use the protected preset\generate_preset_xml() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\generate_preset_xml()

◆ data_presets_save()

data_presets_save ( $course,
$cm,
$data,
$path )

Save the database configuration as a preset.

Parameters
stdClass$courseThe course the database module belongs to.
stdClass$cmThe course module record
stdClass$dataThe database record
string$path
Return values
bool
Deprecated
since Moodle 4.1 MDL-75142 - please, use the preset\save() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\save()

◆ data_print_header()

data_print_header ( $course,
$cm,
$data,
$currenttab = '',
string $actionbar = '' )

Prints the heads for a page.

Parameters
stdClass$course
stdClass$cm
stdClass$data
string$currenttab
string$actionbar

◆ data_print_preference_form()

object data_print_preference_form ( $data,
$perpage,
$search,
$sort = '',
$order = 'ASC',
$search_array = '',
$advanced = 0,
$mode = '' )

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.

@global object

Parameters
object$data
int$perpage
string$search
string$sort
string$order
array$search_array
int$advanced
string$mode
Return values
void

◆ data_print_ratings()

object data_print_ratings ( $data,
$record,
bool $print = true )

@global object

Parameters
object$data
object$record
bool$printif the result must be printed or returner.
Return values
voidOutput echo'd

◆ data_print_template()

data_print_template ( $templatename,
$records,
$data,
$search = '',
$page = 0,
$return = false,
moodle_url $jumpurl = null )

takes a list of records, the current data, a search string, and mode to display prints the translated template

Deprecated
since Moodle 4.1 MDL-75146 - please do not use this function any more.
Todo
MDL-75189 Final deprecation in Moodle 4.5.
Parameters
string$templatenamethe template name
array$recordsthe entries records
stdClass$datathe database instance object
string$searchthe current search term
int$pagepage number for pagination
bool$returnif the result should be returned (true) or printed (false)
moodle_url | null$jumpurla moodle_url by which to jump back to the record list (can be null)
Return values
mixedstring with all parsed entries or nothing if $return is false

◆ data_process_submission()

data_process_submission ( stdClass $mod,
$fields,
stdClass $datarecord )

Check for required fields, and build a list of fields to be updated in a submission.

Parameters
$modstdClass The current recordid - provided as an optimisation.
$fieldsarray The field data
$datarecordstdClass The submitted data.
Return values
stdClasscontaining:
  • string[] generalnotifications Notifications for the form as a whole.
  • string[] fieldnotifications Notifications for a specific field.
  • bool validated Whether the field was validated successfully.
  • data_field_base[] fields The field objects to be update.

◆ data_rating_permissions()

data_rating_permissions ( $contextid,
$component,
$ratingarea )

Return rating related permissions.

Parameters
string$contextidthe context id
string$componentthe component to get rating permissions for
string$ratingareathe rating area to get permissions for
Return values
arrayan associative array of the user's rating permissions

◆ data_rating_validate()

data_rating_validate ( $params)

Validates a submitted rating.

Parameters
array$paramssubmitted data context => object the context in which the rated items exists [required] itemid => int the ID of the object being rated scaleid => int the scale from which the user can select a rating. Used for bounds checking. [required] rating => int the submitted rating rateduserid => int the id of the user whose items have been rated. NOT the user who submitted the ratings. 0 to update all. [required] aggregation => int the aggregation method to apply when calculating grades ie RATING_AGGREGATE_AVERAGE [required]
Return values
booleantrue if the rating is valid. Will throw rating_exception if not

◆ data_refresh_events()

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

Parameters
int$courseid
int | stdClass$instanceData module instance or ID.
int | stdClass$cmCourse module object or ID (not used in this module).
Return values
bool

◆ data_replace_field_in_templates()

object data_replace_field_in_templates ( $data,
$searchfieldname,
$newfieldname )

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.

Parameters
object$data
string$searchfieldname
string$newfieldname
Return values
bool

◆ data_require_time_available()

data_require_time_available ( $data,
$canmanageentries = null,
$context = null )

Requires a database to be available for the current user.

Parameters
stdClass$datadatabase record
boolean$canmanageentriesoptional, if the user can manage entries
stdClass$contextModule context, required if $canmanageentries is not set
Exceptions
moodle_exception
Since
Moodle 3.3

◆ data_reset_course_form_defaults()

data_reset_course_form_defaults ( $course)

Course reset form defaults.

Return values
array

◆ data_reset_course_form_definition()

data_reset_course_form_definition ( & $mform)

Implementation of the function for printing the form elements that control whether the course reset functionality affects the data.

Parameters
MoodleQuickForm$mformform passed by reference

◆ data_reset_gradebook()

object data_reset_gradebook ( $courseid,
$type = '' )

Removes all grades from gradebook.

@global object

Parameters
int$courseid
string$typeoptional type

◆ data_reset_userdata()

object data_reset_userdata ( $data)

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

@global object

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

◆ data_rss_delete_file()

data_rss_delete_file ( $data)

Given a database object, deletes all cached RSS files associated with it.

Parameters
stdClass$data

◆ data_rss_get_feed()

data_rss_get_feed ( $context,
$args )

Generates the Database modules RSS Feed.

Parameters
strClass$contextthe context the feed should be created under
array$argsarray of arguments to be used in the creation of the RSS Feed
Return values
NULL|stringNULL if there is nothing to return, or the file path of the cached file if there is

◆ data_rss_get_sql()

data_rss_get_sql ( $data,
$time = 0 )

Creates and returns a SQL query for the items that would be included in the RSS Feed.

Parameters
stdClass$datadatabase instance object
int$timeepoch timestamp to compare time-modified to, 0 for all or a proper value
Return values
stringSQL query string to get the items for the databse RSS Feed

◆ data_rss_newstuff()

data_rss_newstuff ( $data,
$time )

If there is new stuff in since $time this returns true Otherwise it returns false.

Parameters
stdClass$datathe data activity object
int$timetimestamp
Return values
booltrue if there is new stuff for the RSS Feed

◆ data_search_entries()

data_search_entries ( $data,
$cm,
$context,
$mode,
$currentgroup,
$search = '',
$sort = null,
$order = null,
$page = 0,
$perpage = 0,
$advanced = null,
$searcharray = null,
$record = null )

Search entries in a database.

Parameters
stdClass$datadatabase object
stdClass$cmcourse module object
stdClass$contextcontext object
stdClass$modein which mode we are viewing the database (list, single)
int$currentgroupthe current group being used
str$searchsearch for this text in the entry data
str$sortthe field to sort by
str$orderthe order to use when sorting
int$pagefor pagination, the current page
int$perpageentries per page
bool$advancedwhether we are using or not advanced search
array$searcharraywhen using advanced search, the advanced data to use
stdClass$recordif we jsut want this record after doing all the access checks
Return values
arraythe entries found among other data related to the search
Since
Moodle 3.3

◆ data_set_config()

data_set_config ( & $database,
$key,
$value )

Update the configuration for this database activity.

Parameters
stdClass$databaseThe object returned from the database for this instance
string$keyThe name of the key to set
mixed$valueThe value to set for the key

◆ data_set_events()

data_set_events ( $data)

This creates new calendar events given as timeavailablefrom and timeclose by $data.

Parameters
stdClass$data
Return values
void

◆ data_supports()

data_supports ( $feature)
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.

◆ data_tags_check()

object data_tags_check ( $dataid,
$template )

check the multple existence any tag in a template

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

Parameters
int$dataid

param string $template

Return values
bool

◆ data_update_completion_state()

data_update_completion_state ( $data,
$course,
$cm )

Sets the automatic completion state for this database item based on the count of on its entries.

Since
Moodle 3.3
Parameters
object$dataThe data object for this activity
object$courseCourse
object$cmcourse-module

◆ data_update_grades()

data_update_grades ( $data,
$userid = 0,
$nullifnone = true )

Update activity grades.

Parameters
object$data
int$useridspecific user only, 0 means all
bool$nullifnone

◆ data_update_instance()

object data_update_instance ( $data)

updates an instance of a data

Parameters
object$data
Return values
bool

◆ data_update_record_fields_contents()

data_update_record_fields_contents ( $data,
$record,
$context,
$datarecord,
$processeddata )

Updates the fields contents of an existing record.

Parameters
stdClass$datadatabase object
stdClass$recordrecord to update object
stdClass$contextcontext object
stdClass$datarecordthe submitted data
stdClass$processeddatapre-processed submitted fields
Since
Moodle 3.3

◆ data_user_can_add_entry()

data_user_can_add_entry ( $data,
$currentgroup,
$groupmode,
$context = null )

Can user add more entries?

Parameters
object$data
mixed$currentgroup
int$groupmode
stdClass$context
Return values
bool

◆ data_user_can_delete_preset()

data_user_can_delete_preset ( $context,
$preset )

Checks to see if the user has permission to delete the preset.

Parameters
stdClass$contextContext object.
stdClass$presetThe preset object that we are checking for deletion.
Return values
boolReturns true if the user can delete, otherwise false.
Deprecated
since Moodle 4.1 MDL-75187 - please, use the preset\can_manage() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
preset\can_manage()

◆ data_user_can_manage_entry()

data_user_can_manage_entry ( $record,
$data,
$context )

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.

Parameters
mixed$recordrecord object or id
object$datadata object
object$contextcontext object
Return values
boolreturns true if the user is allowd to edit the entry, false otherwise

◆ data_user_complete()

object data_user_complete ( $course,
$user,
$mod,
$data )

Prints all the records uploaded by this user.

Parameters
object$course
object$user
object$mod
object$data

◆ data_user_outline()

object data_user_outline ( $course,
$user,
$mod,
$data )

returns a summary of data activity of this user

Parameters
object$course
object$user
object$mod
object$data
Return values
object|null

◆ data_view()

data_view ( $data,
$course,
$cm,
$context )

Mark the activity completed (if required) and trigger the course_module_viewed event.

Deprecated
since Moodle 4.1 MDL-75146 - please do not use this function any more.
Todo
MDL-75189 Final deprecation in Moodle 4.5.
Parameters
stdClass$datadata object
stdClass$coursecourse object
stdClass$cmcourse module object
stdClass$contextcontext object
Since
Moodle 3.3

◆ is_directory_a_preset()

is_directory_a_preset ( $directory)

Check if the files in a directory are the expected for a preset.

Return values
boolWheter the defined $directory has or not all the expected preset files.
Deprecated
since Moodle 4.1 MDL-75148 - please, use the preset\is_directory_a_preset() function instead.
Todo
MDL-75189 This will be deleted in Moodle 4.5.
See also
manager\is_directory_a_preset()

◆ mod_data_core_calendar_event_timestart_updated()

mod_data_core_calendar_event_timestart_updated ( \calendar_event $event,
stdClass $data )

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.

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

◆ mod_data_core_calendar_get_event_action_string()

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

mod_data_core_calendar_get_valid_event_timestart_range ( \calendar_event $event,
stdClass $instance )

This function calculates the minimum and maximum cutoff values for the timestart of the given event.

It will return an array with two values, the first being the minimum cutoff value and the second being the maximum cutoff value. Either or both values can be null, which indicates there is no minimum or maximum, respectively.

If a cutoff is required then the function must return an array containing the cutoff timestamp and error string to display to the user if the cutoff value is violated.

A minimum and maximum cutoff return value will look like: [ [1505704373, 'The due date must be after the sbumission start date'], [1506741172, 'The due date must be before the cutoff date'] ]

Parameters
calendar_event$eventThe calendar event to get the time range for
stdClass$instanceThe module instance to get the range from
Return values
array

◆ mod_data_core_calendar_provide_event_action()

mod_data_core_calendar_provide_event_action ( calendar_event $event,
core_calendar\action_factory $factory,
int $userid = 0 )

This function receives a calendar event and returns the action associated with it, or null if there is none.

This is used by block_myoverview in order to display the event appropriately. If null is returned then the event is not displayed on the block.

Parameters
calendar_event$event
core_calendar\action_factory$factory
int$useridUser id to use for all capability checks, etc. Set to 0 for current user (default).
Return values
core_calendar\local\event\entities\action_interface|null

◆ mod_data_get_completion_active_rule_descriptions()

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

mod_data_get_tagged_records ( $tag,
$exclusivemode = false,
$fromctx = 0,
$ctx = 0,
$rec = true,
$page = 0 )

Returns data records tagged with a specified tag.

This is a callback used by the tag area mod_data/data_records to search for data records tagged with a specific tag.

Parameters
core_tag_tag$tag
bool$exclusivemodeif set to true it means that no other entities tagged with this tag are displayed on the page and the per-page limit may be bigger
int$fromctxcontext id where the link was displayed, may be used by callbacks to display items in the same context first
int$ctxcontext id where to search for records
bool$recsearch in subcontexts as well
int$page0-based number of page being displayed
Return values
core_tag\output\tagindex

◆ mod_data_rating_can_see_item_ratings()

mod_data_rating_can_see_item_ratings ( $params)

Can the current user see ratings for a given itemid?

Parameters
array$paramssubmitted data contextid => int contextid [required] component => The component for this module - should always be mod_data [required] ratingarea => object the context in which the rated items exists [required] itemid => int the ID of the object being rated [required] scaleid => int scale id [optional]
Return values
bool
Exceptions
coding_exception
rating_exception

Variable Documentation

◆ $functions

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

◆ $logs

$logs
Initial value:
= array(
array('module'=>'data', 'action'=>'view', 'mtable'=>'data', 'field'=>'name'),
array('module'=>'data', 'action'=>'add', 'mtable'=>'data', 'field'=>'name'),
array('module'=>'data', 'action'=>'update', 'mtable'=>'data', 'field'=>'name'),
array('module'=>'data', 'action'=>'record delete', 'mtable'=>'data', 'field'=>'name'),
array('module'=>'data', 'action'=>'fields add', 'mtable'=>'data_fields', 'field'=>'name'),
array('module'=>'data', 'action'=>'fields update', 'mtable'=>'data_fields', 'field'=>'name'),
array('module'=>'data', 'action'=>'templates saved', 'mtable'=>'data', 'field'=>'name'),
array('module'=>'data', 'action'=>'templates def', 'mtable'=>'data', 'field'=>'name'),
)

◆ $tagareas

$tagareas
Initial value:
= array(
array(
'itemtype' => 'data_records',
'component' => 'mod_data',
'callback' => 'mod_data_get_tagged_records',
'callbackfile' => '/mod/data/locallib.php',
),
)