Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)

Classes

class  data_file_info_container
 Class representing the virtual node with all itemids in the file browser. More...
 
class  data_portfolio_caller
 The class to handle entry exports of a database module. 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_approve_entry ($entryid, $approve)
 Approves or unapproves an entry.
 
 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_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.
 
 data_get_field_instances ($data)
 Return all the field instances for a given database.
 
 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.
 
 data_require_time_available ($data, $canmanageentries=null, $context=null)
 Requires a database to be available for the current user.
 
 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_events ($data)
 This creates new calendar events given as timeavailablefrom and timeclose by $data.
 
 data_update_record_fields_contents ($data, $record, $context, $datarecord, $processeddata)
 Updates the fields contents of an existing record.
 
 mod_data_get_tagged_records ($tag, $exclusivemode=false, $fromctx=0, $ctx=0, $rec=true, $page=0)
 Returns data records tagged with a specified tag.
 

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

data_set_events ( $data)

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

Parameters
stdClass$data
Return values
void

◆ 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

◆ 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