Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
__construct (cm_info $cm, stdClass $instance) | |
Class constructor. | |
can_export_entries (?int $userid=null) | |
Check if the user can export entries on the current context. | |
can_manage_templates (?int $userid=null) | |
Check if the user can manage templates on the current context. | |
can_view_preset (preset $preset, ?int $userid=null) | |
Check if the user can view a specific preset. | |
get_available_presets () | |
Returns an array of all the available presets. | |
get_available_saved_presets () | |
Returns an array of all the presets that users have saved to the site. | |
get_context () | |
Return the current context. | |
get_coursemodule () | |
Return the current cm_info. | |
get_field (stdClass $fieldrecord) | |
Return a specific field instance from a field record. | |
get_field_records () | |
Return the field records (the current data_fields records). | |
get_fields () | |
Return the database fields. | |
get_instance () | |
Return the current instance. | |
get_renderer (?moodle_page $page=null) | |
Return the current module renderer. | |
get_template (string $templatename, array $options=[]) | |
Return a specific template. | |
has_fields () | |
Return if the database has fields. | |
has_records () | |
Return if the database has records. | |
reset_all_templates () | |
Reset all templates. | |
reset_template (string $templatename) | |
Reset all templates related to a specific template. | |
set_module_viewed (stdClass $course) | |
Trigger module viewed event and set the module viewed for completion. | |
set_template_viewed () | |
Trigger module template viewed event. | |
update_templates (stdClass $newtemplates) | |
Update the database templates. | |
Static Public Member Functions | |
static | create_from_coursemodule ($cm) |
Create a manager instance from a course_modules record. | |
static | create_from_data_record ($record) |
Create a manager instance from a data_record entry. | |
static | create_from_instance (stdClass $instance) |
Create a manager instance from an instance record. | |
static | get_available_plugin_presets () |
Returns an array of all the available plugin presets. | |
Public Attributes | |
string | $path |
plugin path. | |
const | MODULE = 'data' |
Module name. | |
const | PLUGINNAME = 'mod_data' |
The plugin name. | |
const | TEMPLATES_LIST |
Template list with their files required to save the information of a preset. | |
mod_data\manager::__construct | ( | cm_info | $cm, |
stdClass | $instance ) |
Class constructor.
cm_info | $cm | course module info object |
stdClass | $instance | activity instance object. |
mod_data\manager::can_export_entries | ( | ?int | $userid = null | ) |
Check if the user can export entries on the current context.
int | $userid | the user id to check ($USER->id if null). |
bool | if the user can export entries on current context. |
mod_data\manager::can_manage_templates | ( | ?int | $userid = null | ) |
Check if the user can manage templates on the current context.
int | $userid | the user id to check ($USER->id if null). |
bool | if the user can manage templates on current context. |
mod_data\manager::can_view_preset | ( | preset | $preset, |
?int | $userid = null ) |
Check if the user can view a specific preset.
preset | $preset | the preset instance. |
int | $userid | the user id to check ($USER->id if null). |
bool | if the user can view the preset. |
|
static |
Create a manager instance from a course_modules record.
stdClass | cm_info | $cm | an activity record |
manager |
|
static |
Create a manager instance from a data_record entry.
stdClass | $record | the data_record record |
manager |
|
static |
Create a manager instance from an instance record.
stdClass | $instance | an activity record |
manager |
|
static |
Returns an array of all the available plugin presets.
array | A list with the datapreset plugins. |
mod_data\manager::get_available_presets | ( | ) |
Returns an array of all the available presets.
array | A list with the datapreset plugins and the presets saved by users. |
mod_data\manager::get_available_saved_presets | ( | ) |
Returns an array of all the presets that users have saved to the site.
array | A list with the preset saved by the users. |
mod_data\manager::get_context | ( | ) |
Return the current context.
context_module |
mod_data\manager::get_coursemodule | ( | ) |
mod_data\manager::get_field | ( | stdClass | $fieldrecord | ) |
Return a specific field instance from a field record.
stdClass | $fieldrecord | the fieldrecord to convert |
data_field_base | the data field class instance |
mod_data\manager::get_field_records | ( | ) |
Return the field records (the current data_fields records).
stdClass[] | an array of records |
mod_data\manager::get_fields | ( | ) |
Return the database fields.
data_field_base[] | the field instances. |
mod_data\manager::get_instance | ( | ) |
Return the current instance.
stdClass | the instance record |
mod_data\manager::get_renderer | ( | ?moodle_page | $page = null | ) |
Return the current module renderer.
moodle_page | null | $page | the current page |
mod_data_renderer | the module renderer |
mod_data\manager::get_template | ( | string | $templatename, |
array | $options = [] ) |
Return a specific template.
NOTE: this method returns a default template if the module template is empty. However, it won't update the template database field.
Some possible options:
string | $templatename | |
array | $options | extra display options array |
template | the template instance |
mod_data\manager::has_fields | ( | ) |
Return if the database has fields.
bool | true if the database has fields |
mod_data\manager::has_records | ( | ) |
Return if the database has records.
bool | true if the database has records |
mod_data\manager::reset_all_templates | ( | ) |
Reset all templates.
bool | if the reset is done or not |
mod_data\manager::reset_template | ( | string | $templatename | ) |
Reset all templates related to a specific template.
string | $templatename | the template name |
bool | if the reset is done or not |
mod_data\manager::set_module_viewed | ( | stdClass | $course | ) |
Trigger module viewed event and set the module viewed for completion.
stdClass | $course | course object |
mod_data\manager::update_templates | ( | stdClass | $newtemplates | ) |
Update the database templates.
stdClass | $newtemplates | an object with all the new templates |
bool | if updated successfully. |
const mod_data\manager::TEMPLATES_LIST |
Template list with their files required to save the information of a preset.