Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
|
Public Member Functions | |
define_default_field () | |
This field just sets up a default field object. | |
define_field ($data) | |
Set up the field object according to data in an object. | |
object | delete_content ($recordid=0) |
Delete all content associated with the field. | |
object | delete_field () |
Delete a field completely. | |
display_add_field ($recordid=0, $formdata=null) | |
Print the relevant form element in the ADD template for this field. | |
display_browse_field ($recordid, $template) | |
Display the content of the field in browse mode. | |
object | display_edit_field () |
Print the relevant form element to define the attributes for this field viewable by teachers only. | |
display_search_field ($value='') | |
export_file_value (stdClass $record) | |
Exports the file content for file export. | |
export_text_value (stdClass $record) | |
Here we export the text value of a picture field which is the filename of the exported picture. | |
file_export_supported () | |
Specifies that this field type supports the export of files. | |
file_import_supported () | |
Specifies that this field type supports the import of files. | |
file_ok ($path) | |
generate_sql ($tablealias, $value) | |
get_config_for_external () | |
Return the plugin configs for external functions. | |
get_data_content_preview (int $recordid) | |
Generate a fake data_content for this field to be used in preset previews. | |
get_field_params () | |
Function to let field define their parameters. | |
get_file ($recordid, $content=null) | |
get_name () | |
Return the field type name. | |
get_preview () | |
Get the field preview value. | |
get_sort_field () | |
Returns the sortable field for the content. | |
get_sort_sql ($fieldname) | |
Returns the SQL needed to refer to the column. | |
object | image () |
Prints the respective type icon. | |
import_file_value (int $contentid, string $filecontent, string $filename) | |
Provides the necessary code for importing a file when importing the content of a mod_data instance. | |
object | insert_field () |
Insert a new field in the database We assume the field object is already defined as $this->field. | |
name () | |
Returns the name/type of the field. | |
notemptyfield ($value, $name) | |
Custom notempty function. | |
parse_search_field ($defaults=null) | |
print_after_form () | |
Just in case a field needs to print something after the whole form. | |
print_before_form () | |
Just in case a field needs to print something before the whole form. | |
set_preview (bool $preview) | |
Set the field to preview mode. | |
supports_preview () | |
Return if the field type supports preview. | |
text_export_supported () | |
Per default, it is assumed that fields support text exporting. | |
update_content ($recordid, $value, $name='') | |
Update the content of one data field in the data_content table. | |
update_field () | |
Update a field in the database. | |
update_thumbnail ($content, $file) | |
validate (stdClass $fieldinput) | |
Validate the image field type parameters. | |
Static Public Member Functions | |
static | get_content_value ($content) |
Returns the presentable string value for a field content. | |
static | get_priority () |
Returns the priority for being indexed by globalsearch. | |
Protected Member Functions | |
get_data_content (int $recordid) | |
Return the data_content of the field, or generate it if it is in preview mode. | |
Protected Attributes | |
bool | $preview = false |
whether the field is used in preview mode. | |
Static Protected Attributes | |
static priority | $priority = self::NO_PRIORITY |
for globalsearch indexing | |
|
inherited |
This field just sets up a default field object.
bool |
|
inherited |
Set up the field object according to data in an object.
Now is the time to clean it!
bool |
|
inherited |
Delete all content associated with the field.
int | $recordid |
bool |
|
inherited |
Delete a field completely.
bool |
data_field_picture::display_add_field | ( | $recordid = 0, | |
$formdata = null ) |
Print the relevant form element in the ADD template for this field.
int | $recordid |
string |
Reimplemented from data_field_base.
data_field_picture::display_browse_field | ( | $recordid, | |
$template ) |
Display the content of the field in browse mode.
int | $recordid | |
object | $template |
bool|string |
Reimplemented from data_field_base.
|
inherited |
Print the relevant form element to define the attributes for this field viewable by teachers only.
@global object
void | Output is echo'd |
data_field_picture::export_file_value | ( | stdClass | $record | ) |
Exports the file content for file export.
stdClass | $record | the data content record the file belongs to |
null|string | The file content of the stored file or null if no file should be exported for this record |
Reimplemented from data_field_base.
data_field_picture::export_text_value | ( | stdClass | $record | ) |
Here we export the text value of a picture field which is the filename of the exported picture.
stdClass | $record | the record which is being exported |
string | the value which will be stored in the exported file for this field |
Reimplemented from data_field_base.
data_field_picture::file_export_supported | ( | ) |
Specifies that this field type supports the export of files.
bool | true which means that file export is being supported by this field type |
Reimplemented from data_field_base.
data_field_picture::file_import_supported | ( | ) |
Specifies that this field type supports the import of files.
bool | true which means that file import is being supported by this field type |
Reimplemented from data_field_base.
data_field_picture::file_ok | ( | $relativepath | ) |
data_field_picture::get_config_for_external | ( | ) |
Return the plugin configs for external functions.
array | the list of config parameters |
Reimplemented from data_field_base.
|
staticinherited |
Returns the presentable string value for a field content.
The returned string should be plain text.
stdClass | $content |
string |
Reimplemented in data_field_checkbox, data_field_multimenu, and data_field_textarea.
|
protectedinherited |
Return the data_content of the field, or generate it if it is in preview mode.
int | $recordid | the record id |
stdClass|bool | the record data or false if none |
data_field_picture::get_data_content_preview | ( | int | $recordid | ) |
Generate a fake data_content for this field to be used in preset previews.
Data plugins must override this method and support_preview in order to enable preset preview for this field.
int | $recordid | the fake record id |
stdClass | the fake record |
Reimplemented from data_field_base.
data_field_picture::get_field_params | ( | ) |
Function to let field define their parameters.
This method that should be overridden by the datafield plugins when they need to define their data.
array |
Reimplemented from data_field_base.
|
inherited |
Return the field type name.
string | the filed type. |
|
inherited |
Get the field preview value.
bool |
|
staticinherited |
Returns the priority for being indexed by globalsearch.
int |
|
inherited |
Returns the sortable field for the content.
By default, it's just content but for some plugins, it could be content 1 - content4
string |
|
inherited |
Returns the SQL needed to refer to the column.
Some fields may need to CAST() etc.
string | $fieldname |
string\$fieldname |
Reimplemented in data_field_date, data_field_latlong, and data_field_number.
|
inherited |
Prints the respective type icon.
string |
data_field_picture::import_file_value | ( | int | $contentid, |
string | $filecontent, | ||
string | $filename ) |
Provides the necessary code for importing a file when importing the content of a mod_data instance.
int | $contentid | the id of the mod_data content record |
string | $filecontent | the content of the file to import as string |
string | $filename | the filename the imported file should get |
void |
Reimplemented from data_field_base.
|
inherited |
Insert a new field in the database We assume the field object is already defined as $this->field.
bool |
|
inherited |
Returns the name/type of the field.
string |
data_field_picture::notemptyfield | ( | $value, | |
$name ) |
Custom notempty function.
string | $value | |
string | $name |
bool |
Reimplemented from data_field_base.
|
inherited |
Just in case a field needs to print something after the whole form.
Reimplemented in data_field_textarea.
|
inherited |
Set the field to preview mode.
bool | $preview | the new preview value |
data_field_picture::supports_preview | ( | ) |
Return if the field type supports preview.
Fields without a preview cannot be displayed in the preset preview.
bool | if the plugin supports preview. |
Reimplemented from data_field_base.
|
inherited |
Per default, it is assumed that fields support text exporting.
Override this (return false) on fields not supporting text exporting.
bool | true |
data_field_picture::update_content | ( | $recordid, | |
$value, | |||
$name = '' ) |
Update the content of one data field in the data_content table.
int | $recordid | |
mixed | $value | |
string | $name |
bool |
Reimplemented from data_field_base.
data_field_picture::update_field | ( | ) |
data_field_picture::validate | ( | stdClass | $fieldinput | ) |
Validate the image field type parameters.
This will check for valid numeric values in the width and height fields.
stdClass | $fieldinput | the field input data |
array | array of error messages if width or height parameters are not numeric |
coding_exception |
Reimplemented from data_field_base.