Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Files | |
file | access.php |
Plugin capabilities. | |
file | activity.php |
Search area for mod_data activities. | |
file | activity_base.php |
Activity base class. | |
file | backup_data_activity_task.class.php |
Defines backup_data_activity_task. | |
file | backup_data_stepslib.php |
@subpackage backup-moodle2 | |
file | behat_mod_data.php |
Steps definitions related with the database activity. | |
file | cognitive_depth.php |
Cognitive depth indicator - data. | |
file | comment_created.php |
The mod_data comment created event. | |
file | comment_deleted.php |
The mod_data comment deleted event. | |
file | content_exporter.php |
Class for exporting content associated to a record. | |
file | course_module_instance_list_viewed.php |
The mod_data instance list viewed event. | |
file | course_module_viewed.php |
The mod_data course module viewed event. | |
file | database_summary_exporter.php |
Class for exporting partial database data. | |
file | datafield.php |
Subplugin info class. | |
file | datafield_provider.php |
Contains interface datafield_provider. | |
file | datapreset.php |
Subplugin info class. | |
file | entry.php |
Search area for mod_data activity entries. | |
file | external.php |
Database module external API. | |
file | field_created.php |
The mod_data field created event. | |
file | field_deleted.php |
The mod_data field deleted event. | |
file | field_exporter.php |
Class for exporting field data. | |
file | field_updated.php |
The mod_data field updated event. | |
file | lib.php |
Data generator class for mod_data. | |
file | lib.php |
file | lib.php |
Provides support for the conversion of moodle1 backup to the moodle2 format Based off of a template @ http://docs.moodle.org/dev/Backup_1.9_conversion_for_developers. | |
file | locallib.php |
file | log.php |
Definition of log events. | |
file | provider.php |
Privacy Subsystem implementation for mod_data. | |
file | record_created.php |
The mod_data record created event. | |
file | record_deleted.php |
The mod_data record deleted event. | |
file | record_exporter.php |
Class for exporting record data. | |
file | record_updated.php |
The mod_data record updated event. | |
file | restore_data_activity_task.class.php |
@subpackage backup-moodle2 | |
file | restore_data_stepslib.php |
@subpackage backup-moodle2 | |
file | rsslib.php |
This file contains all the common stuff to be used for RSS in the Database Module. | |
file | services.php |
Database external functions and service definitions. | |
file | social_breadth.php |
Social breadth indicator - data. | |
file | sortedcontentqueue.php |
Priority Queue class to sort out db entry contents. | |
file | tag.php |
Tag areas in component mod_data. | |
file | template_updated.php |
The mod_data template updated event. | |
file | template_viewed.php |
The mod_data template viewed event. | |
file | version.php |
Data module version information. | |
Namespaces | |
mod_data\analytics\indicator | |
| |
mod_data\event | |
| |
mod_data\external | |
| |
mod_data\plugininfo | |
| |
mod_data\privacy | |
| |
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 |
class | data_field_base |
class | data_file_info_container |
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 | 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\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\event\record_created |
class | mod_data\event\record_deleted |
class | mod_data\event\record_updated |
class | mod_data\event\template_updated |
class | mod_data\event\template_viewed |
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\field_exporter |
Class for exporting field data. More... | |
class | mod_data\external\record_exporter |
Class for exporting record data. More... | |
class | mod_data\plugininfo\datafield |
class | mod_data\plugininfo\datapreset |
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_external |
class | mod_data_generator |
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. More... | |
data_add_instance ($data, $mform=null) | |
Adds an instance of a data. More... | |
object | data_add_record ($data, $groupid=0, $userid=null) |
function that takes in a dataid and adds a record this is used everytime an add template is submitted More... | |
object | data_append_new_field_to_templates ($data, $newfieldname) |
Appends a new field at the end of the form template. More... | |
data_approve_entry ($entryid, $approve) | |
Approves or unapproves an entry. More... | |
data_atmaxentries ($data) | |
has a user reached the max number of entries? More... | |
data_build_search_array ($data, $paging, $searcharray, $defaults=null, $fn='', $ln='') | |
Build the search array. More... | |
data_can_view_record ($data, $record, $currentgroup, $canmanageentries) | |
Check if the current user can view the given record. More... | |
data_check_updates_since (cm_info $cm, $from, $filter=array()) | |
data_comment_permissions ($comment_param) | |
data_comment_validate ($comment_param) | |
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. More... | |
object | data_delete_instance ($id) |
deletes an instance of a data More... | |
data_delete_record ($recordid, $data, $courseid, $cmid) | |
Delete a record entry. More... | |
data_delete_site_preset ($name) | |
Deletes a saved preset. More... | |
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. More... | |
data_fieldname_exists ($name, $dataid, $fieldid=0) | |
object | data_generate_default_template (&$data, $template, $recordid=0, $form=false, $update=true) |
Given a template and a dataid, generate a default case template. More... | |
data_generate_tag_form ($recordid=false, $selected=[]) | |
Build the form elements to manage tags for a record. More... | |
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. More... | |
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. More... | |
data_get_all_recordids ($dataid, $selectdata='', $params=null) | |
Get all of the record ids from a database activity. More... | |
data_get_available_presets ($context) | |
Returns an array of all the available presets. More... | |
data_get_available_site_presets ($context, array $presets=array()) | |
Gets an array of all of the presets that users have saved to the site. More... | |
data_get_completion_state ($course, $cm, $userid, $type) | |
Obtains the automatic completion state for this database item based on any conditions on its settings. More... | |
data_get_config ($database, $key=null, $default=null) | |
Fetch the configuration for this database activity. More... | |
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). More... | |
data_get_entries_left_to_add ($data, $numentries, $canmanageentries) | |
Return the number of entries left to add to complete the activity. More... | |
data_get_entries_left_to_view ($data, $numentries, $canmanageentries) | |
Return the number of entires left to add to view other users entries. More... | |
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. More... | |
object | data_get_field ($field, $data, $cm=null) |
returns a subclass field object given a record of the field, used to invoke plugin methods input: $param $field - record from db More... | |
object | data_get_field_from_id ($fieldid, $data) |
given a field id this function creates an instance of the particular subfield class More... | |
object | data_get_field_from_name ($name, $data) |
given a field name this function creates an instance of the particular subfield class More... | |
data_get_field_instances ($data) | |
Return all the field instances for a given database. More... | |
object | data_get_field_new ($type, $data) |
given a field id this function creates an instance of the particular subfield class More... | |
data_get_file_areas ($course, $cm, $context) | |
data_get_file_info ($browser, $areas, $course, $cm, $context, $filearea, $itemid, $filepath, $filename) | |
File browsing support for data module. More... | |
data_get_post_actions () | |
List the actions that correspond to a post of this module. More... | |
data_get_recordids ($alias, $searcharray, $dataid, $recordids) | |
Gets the record IDs given the search criteria. More... | |
data_get_tag_title_field ($dataid) | |
Get the title of a field to show when displaying tag results. More... | |
data_get_tag_title_for_entry ($field, $entry) | |
Get the title of an entry to show when displaying tag results. More... | |
data_get_time_availability_status ($data, $canmanageentries=null, $context=null) | |
Check if a database is available for the current user. More... | |
object | data_get_user_grades ($data, $userid=0) |
Return grade for given user or all users. More... | |
data_get_view_actions () | |
List the actions that correspond to a view of this module. More... | |
data_grade_item_delete ($data) | |
data_grade_item_update ($data, $grades=NULL) | |
data_import_csv ($cm, $data, &$csvdata, $encoding, $fielddelimiter) | |
Import records for a data instance from csv data. More... | |
data_in_readonly_period ($data) | |
Check whether the specified database activity is currently in a read-only period. More... | |
object | data_isowner ($record) |
Given record object (or id), returns true if the record belongs to the current user. More... | |
object | data_numentries ($data, $userid=null) |
returns the number of entries already made by this user More... | |
data_page_type_list ($pagetype, $parentcontext, $currentcontext) | |
Return a list of page types. More... | |
data_pluginfile ($course, $cm, $context, $filearea, $args, $forcedownload, array $options=array()) | |
data_preset_name ($shortname, $path) | |
Returns the best name to show for a preset. More... | |
object | data_preset_path ($course, $userid, $shortname) |
@global object More... | |
data_presets_export ($course, $cm, $data, $tostorage=false) | |
moodle_database | data_presets_generate_xml ($course, $cm, $data) |
Generates the XML for the database module provided. More... | |
data_presets_save ($course, $cm, $data, $path) | |
Save the database configuration as a preset. More... | |
data_print_header ($course, $cm, $data, $currenttab='') | |
Prints the heads for a page. More... | |
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 More... | |
object | data_print_ratings ($data, $record) |
@global object More... | |
object | data_print_template ($template, $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 More... | |
data_process_submission (stdClass $mod, $fields, stdClass $datarecord) | |
Check for required fields, and build a list of fields to be updated in a submission. More... | |
data_rating_permissions ($contextid, $component, $ratingarea) | |
Return rating related permissions. More... | |
data_rating_validate ($params) | |
Validates a submitted rating. More... | |
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. More... | |
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. More... | |
data_require_time_available ($data, $canmanageentries=null, $context=null) | |
Requires a database to be available for the current user. More... | |
data_reset_course_form_defaults ($course) | |
Course reset form defaults. More... | |
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. More... | |
object | data_reset_gradebook ($courseid, $type='') |
Removes all grades from gradebook. More... | |
object | data_reset_userdata ($data) |
Actual implementation of the reset course functionality, delete all the data responses for course $data->courseid. More... | |
data_rss_delete_file ($data) | |
Given a database object, deletes all cached RSS files associated with it. More... | |
data_rss_get_feed ($context, $args) | |
Generates the Database modules RSS Feed. More... | |
data_rss_get_sql ($data, $time=0) | |
Creates and returns a SQL query for the items that would be included in the RSS Feed. More... | |
data_rss_newstuff ($data, $time) | |
If there is new stuff in since $time this returns true Otherwise it returns false. More... | |
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. More... | |
data_set_config (&$database, $key, $value) | |
Update the configuration for this database activity. More... | |
data_set_events ($data) | |
This creates new calendar events given as timeavailablefrom and timeclose by $data. More... | |
data_supports ($feature) | |
object | data_tags_check ($dataid, $template) |
check the multple existence any tag in a template More... | |
data_update_completion_state ($data, $course, $cm) | |
Sets the automatic completion state for this database item based on the count of on its entries. More... | |
data_update_grades ($data, $userid=0, $nullifnone=true) | |
object | data_update_instance ($data) |
updates an instance of a data More... | |
data_update_record_fields_contents ($data, $record, $context, $datarecord, $processeddata) | |
Updates the fields contents of an existing record. More... | |
data_user_can_add_entry ($data, $currentgroup, $groupmode, $context=null) | |
Can user add more entries? More... | |
data_user_can_delete_preset ($context, $preset) | |
Checks to see if the user has permission to delete the preset. More... | |
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. More... | |
object | data_user_complete ($course, $user, $mod, $data) |
Prints all the records uploaded by this user. More... | |
object | data_user_outline ($course, $user, $mod, $data) |
returns a summary of data activity of this user More... | |
data_view ($data, $course, $cm, $context) | |
Mark the activity completed (if required) and trigger the course_module_viewed event. More... | |
is_directory_a_preset ($directory) | |
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. More... | |
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. More... | |
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. More... | |
mod_data_get_completion_active_rule_descriptions ($cm) | |
Callback which returns human-readable strings describing the active completion custom rules for the module instance. More... | |
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. More... | |
mod_data_rating_can_see_item_ratings ($params) | |
Can the current user see ratings for a given itemid? More... | |
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().
stdClass | $data | database object |
stdClass | $context | context object |
int | $recordid | the new record id |
array | $fields | list of fields of the database |
stdClass | $datarecord | the submitted data |
stdClass | $processeddata | pre-processed submitted fields |
data_add_instance | ( | $data, | |
$mform = null |
|||
) |
Adds an instance of a data.
stdClass | $data | |
mod_data_mod_form | $mform |
int | intance id |
object data_add_record | ( | $data, | |
$groupid = 0 , |
|||
$userid = null |
|||
) |
function that takes in a dataid and adds a record this is used everytime an add template is submitted
@global object
object | $data | |
int | $groupid | |
int | $userid |
bool |
object data_append_new_field_to_templates | ( | $data, | |
$newfieldname | |||
) |
Appends a new field at the end of the form template.
object | $data | |
string | $newfieldname |
data_approve_entry | ( | $entryid, | |
$approve | |||
) |
Approves or unapproves an entry.
int | $entryid | the entry to approve or unapprove. |
bool | $approve | Whether to approve or unapprove (true for approve false otherwise). |
data_atmaxentries | ( | $data | ) |
has a user reached the max number of entries?
object | $data |
bool |
data_build_search_array | ( | $data, | |
$paging, | |||
$searcharray, | |||
$defaults = null , |
|||
$fn = '' , |
|||
$ln = '' |
|||
) |
Build the search array.
stdClass | $data | the database object |
bool | $paging | if paging is being used |
array | $searcharray | the current search array (saved by session) |
array | $defaults | default values for the searchable fields |
str | $fn | the first name to search (optional) |
str | $ln | the last name to search (optional) |
array | the search array and plain search build based on the different elements |
data_can_view_record | ( | $data, | |
$record, | |||
$currentgroup, | |||
$canmanageentries | |||
) |
Check if the current user can view the given record.
stdClass | $data | database record |
stdClass | $record | the record (entry) to check |
int | $currentgroup | current group |
bool | $canmanageentries | if the user can manage entries |
bool | true if the user can view the entry |
data_convert_arrays_to_strings | ( | & | $fieldinput | ) |
array | $fieldinput |
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
object | $data | a data object with the same attributes as a record from the data database table |
int | $datamodid | the id of the data module, from the modules table |
array | $teacherroles | array of roles that have archetype teacher |
array | $studentroles | array of roles that have archetype student |
array | $guestroles | array of roles that have archetype guest |
int | $cmid | the course_module id for this data instance |
boolean | data module was converted or not |
object data_delete_instance | ( | $id | ) |
deletes an instance of a data
int | $id |
bool |
data_delete_record | ( | $recordid, | |
$data, | |||
$courseid, | |||
$cmid | |||
) |
Delete a record entry.
int | $recordid | The ID for the record to be deleted. |
object | $data | The data object for this activity. |
int | $courseid | ID for the current course (for logging). |
int | $cmid | The course module ID. |
bool | True if the record deleted, false if not. |
data_delete_site_preset | ( | $name | ) |
Deletes a saved preset.
string | $name |
bool |
object data_export_csv | ( | $export, | |
$delimiter_name, | |||
$database, | |||
$count, | |||
$return = false |
|||
) |
array | $export | |
string | $delimiter_name | |
object | $database | |
int | $count | |
bool | $return |
string|void |
object data_export_ods | ( | $export, | |
$dataname, | |||
$count | |||
) |
array | $export | |
string | $dataname | |
int | $count | |
string |
object data_export_xls | ( | $export, | |
$dataname, | |||
$count | |||
) |
array | $export | |
string | $dataname | |
int | $count |
string |
data_extend_settings_navigation | ( | settings_navigation | $settings, |
navigation_node | $datanode | ||
) |
Adds module specific settings to the settings block.
settings_navigation | $settings | The settings navigation object |
navigation_node | $datanode | The node to add module settings to |
data_fieldname_exists | ( | $name, | |
$dataid, | |||
$fieldid = 0 |
|||
) |
string | $name | |
int | $dataid | |
int | $fieldid |
bool |
object data_generate_default_template | ( | & | $data, |
$template, | |||
$recordid = 0 , |
|||
$form = false , |
|||
$update = true |
|||
) |
Given a template and a dataid, generate a default case template.
object | $data | |
string | template [addtemplate, singletemplate, listtempalte, rsstemplate] | |
int | $recordid | |
bool | $form | |
bool | $update |
bool|string |
data_generate_tag_form | ( | $recordid = false , |
|
$selected = [] |
|||
) |
Build the form elements to manage tags for a record.
int | bool | $recordid | |
string[] | $selected | raw tag names |
string |
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.
array | $recordids | An array of record ids. |
array | $searcharray | Contains information for the advanced search criteria |
int | $dataid | The data id of the database. |
array::$recordids | An array of record ids. |
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.
int | $sort | DATA_* |
stdClass | $data | Data module object |
array | $recordids | An array of record IDs. |
string | $selectdata | Information for the where and select part of the sql statement. |
string | $sortorder | Additional sort parameters |
array | sqlselect sqlselect['sql'] has the sql string, sqlselect['params'] contains an array of parameters. |
data_get_all_recordids | ( | $dataid, | |
$selectdata = '' , |
|||
$params = null |
|||
) |
Get all of the record ids from a database activity.
int | $dataid | The dataid of the database module. |
object | $selectdata | Contains an additional sql statement for the where clause for group and approval fields. |
array | $params | Parameters that coincide with the sql statement. |
array::$idarray | An array of record ids |
data_get_available_presets | ( | $context | ) |
Returns an array of all the available presets.
array |
data_get_available_site_presets | ( | $context, | |
array | $presets = array() |
||
) |
Gets an array of all of the presets that users have saved to the site.
stdClass | $context | The context that we are looking from. |
array | $presets |
array | An array of presets |
data_get_completion_state | ( | $course, | |
$cm, | |||
$userid, | |||
$type | |||
) |
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.
stdClass | $course | Course |
cm_info | stdClass | $cm | course-module |
int | $userid | User ID |
bool | $type | Type of comparison (or/and; can be used as return value if no conditions) |
bool | True if completed, false if not, $type if conditions not set. |
data_get_config | ( | $database, | |
$key = null , |
|||
$default = null |
|||
) |
Fetch the configuration for this database activity.
stdClass | $database | The object returned from the database for this instance |
string | $key | The name of the key to retrieve. If none is supplied, then all configuration is returned |
mixed | $default | The default value to use if no value was found for the specified key |
mixed | The returned value |
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.
stdClass | $coursemodule | The coursemodule object (record). |
cached_cm_info | An object on information that the courses will know about (most noticeably, an icon). |
data_get_entries_left_to_add | ( | $data, | |
$numentries, | |||
$canmanageentries | |||
) |
Return the number of entries left to add to complete the activity.
stdClass | $data | database object |
int | $numentries | the number of entries the current user has created |
bool | $canmanageentries | whether the user can manage entries (teachers, managers) |
int | the number of entries left, 0 if no entries left or if is not required |
data_get_entries_left_to_view | ( | $data, | |
$numentries, | |||
$canmanageentries | |||
) |
Return the number of entires left to add to view other users entries.
stdClass | $data | database object |
int | $numentries | the number of entries the current user has created |
bool | $canmanageentries | whether the user can manage entries (teachers, managers) |
int | the number of entries left, 0 if no entries left or if is not required |
object data_get_exportdata | ( | $dataid, | |
$fields, | |||
$selectedfields, | |||
$currentgroup = 0 , |
|||
$context = null , |
|||
$userdetails = false , |
|||
$time = false , |
|||
$approval = false , |
|||
$tags = false |
|||
) |
int | $dataid | |
array | $fields | |
array | $selectedfields | |
int | $currentgroup | group ID of the current group. This is used for exporting data while maintaining group divisions. |
object | $context | the context in which the operation is performed (for capability checks) |
bool | $userdetails | whether to include the details of the record author |
bool | $time | whether to include time created/modified |
bool | $approval | whether to include approval status |
bool | $tags | whether to include tags |
array |
data_get_extra_capabilities | ( | ) |
Returns all other caps used in module.
array |
object data_get_field | ( | $field, | |
$data, | |||
$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 | $field | |
object | $data | |
object | $cm |
object |
object data_get_field_from_id | ( | $fieldid, | |
$data | |||
) |
given a field id this function creates an instance of the particular subfield class
int | $fieldid | |
object | $data |
bool|object |
object data_get_field_from_name | ( | $name, | |
$data | |||
) |
given a field name this function creates an instance of the particular subfield class
string | $name | |
object | $data |
object|bool |
data_get_field_instances | ( | $data | ) |
Return all the field instances for a given database.
stdClass | $data | database object |
array | field instances |
object data_get_field_new | ( | $type, | |
$data | |||
) |
given a field id this function creates an instance of the particular subfield class
string | $type | |
object | $data |
object |
data_get_file_info | ( | $browser, | |
$areas, | |||
$course, | |||
$cm, | |||
$context, | |||
$filearea, | |||
$itemid, | |||
$filepath, | |||
$filename | |||
) |
File browsing support for data module.
file_browser | $browser | |
array | $areas | |
stdClass | $course | |
cm_info | $cm | |
context | $context | |
string | $filearea | |
int | $itemid | |
string | $filepath | |
string | $filename |
file_info_stored | file_info_stored instance or null if not found |
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.
array |
data_get_recordids | ( | $alias, | |
$searcharray, | |||
$dataid, | |||
$recordids | |||
) |
Gets the record IDs given the search criteria.
string | $alias | Record alias. |
array | $searcharray | Criteria for the search. |
int | $dataid | Data ID for the database |
array | $recordids | An array of record IDs. |
array::$nestarray | An arry of record IDs |
data_get_tag_title_field | ( | $dataid | ) |
Get the title of a field to show when displaying tag results.
int | $dataid | The id of the data field |
stdClass | The field data from the 'data_fields' table as well as it's priority |
data_get_tag_title_for_entry | ( | $field, | |
$entry | |||
) |
Get the title of an entry to show when displaying tag results.
stdClass | $field | The field from the 'data_fields' table |
stdClass | $entry | The entry from the 'data_records' table |
string | The title of the entry |
data_get_time_availability_status | ( | $data, | |
$canmanageentries = null , |
|||
$context = null |
|||
) |
Check if a database is available for the current user.
stdClass | $data | database record |
boolean | $canmanageentries | optional, if the user can manage entries |
stdClass | $context | Module context, required if $canmanageentries is not set |
array | status (available or not and possible warnings) |
object data_get_user_grades | ( | $data, | |
$userid = 0 |
|||
) |
Return grade for given user or all users.
object | $data | |
int | $userid | optional user id, 0 means all users |
array | array of grades, false if none |
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.
array |
data_import_csv | ( | $cm, | |
$data, | |||
& | $csvdata, | ||
$encoding, | |||
$fielddelimiter | |||
) |
Import records for a data instance from csv data.
object | $cm | Course module of the data instance. |
object | $data | The data instance. |
string | $csvdata | The csv data to be imported. |
string | $encoding | The encoding of csv data. |
string | $fielddelimiter | The delimiter of the csv data. |
int | Number of records added. |
data_in_readonly_period | ( | $data | ) |
Check whether the specified database activity is currently in a read-only period.
object | $data |
bool | returns true if the time fields in $data indicate a read-only period; false otherwise |
object data_isowner | ( | $record | ) |
Given record object (or id), returns true if the record belongs to the current user.
@global object
mixed | $record | record object or id |
bool |
object data_numentries | ( | $data, | |
$userid = null |
|||
) |
returns the number of entries already made by this user
@global object
object | $data |
int |
data_page_type_list | ( | $pagetype, | |
$parentcontext, | |||
$currentcontext | |||
) |
Return a list of page types.
string | $pagetype | current page type |
stdClass | $parentcontext | Block's parent context |
stdClass | $currentcontext | Current context of block |
data_preset_name | ( | $shortname, | |
$path | |||
) |
Returns the best name to show for a preset.
string | $shortname | |
string | $path |
string |
object data_preset_path | ( | $course, | |
$userid, | |||
$shortname | |||
) |
@global object
object | $course | |
int | $userid | |
string | $shortname |
string |
moodle_database data_presets_generate_xml | ( | $course, | |
$cm, | |||
$data | |||
) |
Generates the XML for the database module provided.
$DB
stdClass | $course | The course the database module belongs to. |
stdClass | $cm | The course module record |
stdClass | $data | The database record |
string | The XML for the preset |
data_presets_save | ( | $course, | |
$cm, | |||
$data, | |||
$path | |||
) |
Save the database configuration as a preset.
stdClass | $course | The course the database module belongs to. |
stdClass | $cm | The course module record |
stdClass | $data | The database record |
string | $path |
bool |
data_print_header | ( | $course, | |
$cm, | |||
$data, | |||
$currenttab = '' |
|||
) |
Prints the heads for a page.
stdClass | $course | |
stdClass | $cm | |
stdClass | $data | |
string | $currenttab |
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
object | $data | |
int | $perpage | |
string | $search | |
string | $sort | |
string | $order | |
array | $search_array | |
int | $advanced | |
string | $mode |
void |
object data_print_ratings | ( | $data, | |
$record | |||
) |
@global object
object | $data | |
object | $record |
void | Output echo'd |
object data_print_template | ( | $template, | |
$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
@global object
string | $template | |
array | $records | |
object | $data | |
string | $search | |
int | $page | |
bool | $return | |
object | $jumpurl | a moodle_url by which to jump back to the record list (can be null) |
mixed |
data_process_submission | ( | stdClass | $mod, |
$fields, | |||
stdClass | $datarecord | ||
) |
Check for required fields, and build a list of fields to be updated in a submission.
$mod | stdClass The current recordid - provided as an optimisation. |
$fields | array The field data |
$datarecord | stdClass The submitted data. |
stdClass | containing:
|
data_rating_permissions | ( | $contextid, | |
$component, | |||
$ratingarea | |||
) |
Return rating related permissions.
string | $contextid | the context id |
string | $component | the component to get rating permissions for |
string | $ratingarea | the rating area to get permissions for |
array | an associative array of the user's rating permissions |
data_rating_validate | ( | $params | ) |
Validates a submitted rating.
array | $params | submitted 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] |
boolean | true if the rating is valid. Will throw rating_exception if not |
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()
int | $courseid | |
int | stdClass | $instance | Data module instance or ID. |
int | stdClass | $cm | Course module object or ID (not used in this module). |
bool |
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.
object | $data | |
string | $searchfieldname | |
string | $newfieldname |
bool |
data_require_time_available | ( | $data, | |
$canmanageentries = null , |
|||
$context = null |
|||
) |
Requires a database to be available for the current user.
stdClass | $data | database record |
boolean | $canmanageentries | optional, if the user can manage entries |
stdClass | $context | Module context, required if $canmanageentries is not set |
moodle_exception |
data_reset_course_form_defaults | ( | $course | ) |
Course reset form defaults.
array |
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.
$mform | form passed by reference |
object data_reset_gradebook | ( | $courseid, | |
$type = '' |
|||
) |
Removes all grades from gradebook.
@global object
int | $courseid | |
string | $type | optional type |
object data_reset_userdata | ( | $data | ) |
Actual implementation of the reset course functionality, delete all the data responses for course $data->courseid.
@global object
object | $data | the data submitted from the reset course. |
array | status array |
data_rss_delete_file | ( | $data | ) |
Given a database object, deletes all cached RSS files associated with it.
stdClass | $data |
data_rss_get_feed | ( | $context, | |
$args | |||
) |
Generates the Database modules RSS Feed.
strClass | $context | the context the feed should be created under |
array | $args | array of arguments to be used in the creation of the RSS Feed |
NULL|string | NULL if there is nothing to return, or the file path of the cached file if there is |
data_rss_get_sql | ( | $data, | |
$time = 0 |
|||
) |
Creates and returns a SQL query for the items that would be included in the RSS Feed.
stdClass | $data | database instance object |
int | $time | epoch timestamp to compare time-modified to, 0 for all or a proper value |
string | SQL query string to get the items for the databse RSS Feed |
data_rss_newstuff | ( | $data, | |
$time | |||
) |
If there is new stuff in since $time this returns true Otherwise it returns false.
stdClass | $data | the data activity object |
int | $time | timestamp |
bool | true if there is new stuff for the RSS Feed |
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.
stdClass | $data | database object |
stdClass | $cm | course module object |
stdClass | $context | context object |
stdClass | $mode | in which mode we are viewing the database (list, single) |
int | $currentgroup | the current group being used |
str | $search | search for this text in the entry data |
str | $sort | the field to sort by |
str | $order | the order to use when sorting |
int | $page | for pagination, the current page |
int | $perpage | entries per page |
bool | $advanced | whether we are using or not advanced search |
array | $searcharray | when using advanced search, the advanced data to use |
stdClass | $record | if we jsut want this record after doing all the access checks |
array | the entries found among other data related to the search |
data_set_config | ( | & | $database, |
$key, | |||
$value | |||
) |
Update the configuration for this database activity.
stdClass | $database | The object returned from the database for this instance |
string | $key | The name of the key to set |
mixed | $value | The value to set for the key |
data_set_events | ( | $data | ) |
This creates new calendar events given as timeavailablefrom and timeclose by $data.
stdClass | $data |
void |
data_supports | ( | $feature | ) |
string | $feature | FEATURE_xx constant for requested feature |
mixed | True if module supports feature, null if doesn't know |
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.
int | $dataid |
data_update_completion_state | ( | $data, | |
$course, | |||
$cm | |||
) |
Sets the automatic completion state for this database item based on the count of on its entries.
object | $data | The data object for this activity |
object | $course | Course |
object | $cm | course-module |
object data_update_instance | ( | $data | ) |
updates an instance of a data
object | $data |
bool |
data_update_record_fields_contents | ( | $data, | |
$record, | |||
$context, | |||
$datarecord, | |||
$processeddata | |||
) |
Updates the fields contents of an existing record.
stdClass | $data | database object |
stdClass | $record | record to update object |
stdClass | $context | context object |
stdClass | $datarecord | the submitted data |
stdClass | $processeddata | pre-processed submitted fields |
data_user_can_add_entry | ( | $data, | |
$currentgroup, | |||
$groupmode, | |||
$context = null |
|||
) |
Can user add more entries?
object | $data | |
mixed | $currentgroup | |
int | $groupmode | |
stdClass | $context |
bool |
data_user_can_delete_preset | ( | $context, | |
$preset | |||
) |
Checks to see if the user has permission to delete the preset.
stdClass | $context | Context object. |
stdClass | $preset | The preset object that we are checking for deletion. |
bool | Returns true if the user can delete, otherwise false. |
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.
mixed | $record | record object or id |
object | $data | data object |
object | $context | context object |
bool | returns true if the user is allowd to edit the entry, false otherwise |
object data_user_complete | ( | $course, | |
$user, | |||
$mod, | |||
$data | |||
) |
Prints all the records uploaded by this user.
object | $course | |
object | $user | |
object | $mod | |
object | $data |
object data_user_outline | ( | $course, | |
$user, | |||
$mod, | |||
$data | |||
) |
returns a summary of data activity of this user
object | $course | |
object | $user | |
object | $mod | |
object | $data |
object|null |
data_view | ( | $data, | |
$course, | |||
$cm, | |||
$context | |||
) |
Mark the activity completed (if required) and trigger the course_module_viewed event.
stdClass | $data | data object |
stdClass | $course | course object |
stdClass | $cm | course module object |
stdClass | $context | context object |
is_directory_a_preset | ( | $directory | ) |
bool |
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.
moodle_exception |
calendar_event | $event | |
stdClass | $data | The module instance to get the range from |
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'] ]
calendar_event | $event | The calendar event to get the time range for |
stdClass | $instance | The module instance to get the range from |
array |
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.
calendar_event | $event | |
core_calendar\action_factory | $factory | |
int | $userid | User id to use for all capability checks, etc. Set to 0 for current user (default). |
core_calendar |
mod_data_get_completion_active_rule_descriptions | ( | $cm | ) |
Callback which returns human-readable strings describing the active completion custom rules for the module instance.
cm_info | stdClass | $cm | object with fields ->completion and ->customdata['customcompletionrules'] |
array::$descriptions | the array of descriptions for the custom rules. |
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.
core_tag_tag | $tag | |
bool | $exclusivemode | if 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 | $fromctx | context id where the link was displayed, may be used by callbacks to display items in the same context first |
int | $ctx | context id where to search for records |
bool | $rec | search in subcontexts as well |
int | $page | 0-based number of page being displayed |
core_tag |
mod_data_rating_can_see_item_ratings | ( | $params | ) |
Can the current user see ratings for a given itemid?
array | $params | submitted 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] |
bool |
coding_exception | |
rating_exception |
$logs |
$tagareas |