Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Base class for callers. More...
Public Member Functions | |
__construct ($callbackargs) | |
Create portfolio_caller object. | |
check_permissions () | |
Callback to do whatever capability checks required in the caller (called during the export process. | |
expected_time () | |
How long does this reasonably expect to take. | |
expected_time_file () | |
Helper method to calculate expected time for multi or single file exports. | |
export_config_form (&$mform, $instance) | |
If this caller wants any additional config items, they should be defined here. | |
export_config_validation ($data) | |
Just like the moodle form validation function, this is passed in the data array from the form and if a non empty array is returned, form processing will stop. | |
get ($field) | |
Generic getter for properties belonging to this instance outside the subclasses like name, visible etc. | |
get_allowed_export_config () | |
Similar to the other allowed_config functions if you need export config, you must provide a list of what the fields are. | |
get_export_config ($key) | |
Returns a particular export config value. | |
get_export_summary () | |
After the user submits their config, they're given a confirm screen summarising what they've chosen. | |
get_mimetype () | |
Gets mimetype. | |
get_navigation () | |
Function to build navigation. | |
get_return_url () | |
This is the "return to where you were" url. | |
get_sha1 () | |
Helper function to get sha1. | |
get_sha1_file () | |
Helper function to calculate the sha1 for multi or single file exports. | |
has_export_config () | |
Whether this caller wants any additional config during export (eg options or metadata) | |
heading_summary () | |
Return a string to put at the header summarising this export. | |
load_data () | |
Load data. | |
prepare_package () | |
Called before the portfolio plugin gets control. | |
prepare_package_file () | |
Helper function to copy files into the temp area for single or multi file exports. | |
set ($field, &$value) | |
Generic setter for properties belonging to this instance outside the subclass like name, visible, etc. | |
set_context ($PAGE) | |
Return the context for this export. | |
set_export_config ($config) | |
Stores the config generated at export time. | |
set_file_and_format_data ($ids=null) | |
Set up the required files for this export. | |
set_formats_from_button ($formats) | |
The button-location always knows best what the formats are... so it should be trusted. | |
supported_formats () | |
Array of formats this caller supports. | |
Static Public Member Functions | |
static | base_supported_formats () |
Base supported formats. | |
static | display_name () |
Clean name to display to the user about this caller location. | |
static | expected_callbackargs () |
Array of arguments the caller expects to be passed through to it. | |
Protected Member Functions | |
add_format ($format) | |
Adds a new format to the list of supported formats. | |
Protected Attributes | |
stdClass | $course |
course active during the call | |
array | $exportconfig = array() |
configuration used for export. | |
stdClass | $exporter |
a reference to the exporter object | |
string | $intendedmimetype |
set this for generated-file exports | |
stored_file object | $multifiles |
set this for multi file exports | |
stored_file | $singlefile |
single file exports configuration | |
array | $supportedformats |
can be optionally overridden by subclass constructors | |
stdclass | $user |
user currently exporting content | |
Base class for callers.
portfolio_caller_base::__construct | ( | $callbackargs | ) |
Create portfolio_caller object.
array | $callbackargs | argument properties |
Reimplemented in assign_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, and mod_workshop_portfolio_caller.
|
protected |
Adds a new format to the list of supported formats.
This functions also handles removing conflicting and less specific formats at the same time.
string | $format | one of PORTFOLIO_FORMAT_XX |
void |
|
static |
Base supported formats.
coding_exception |
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
|
abstract |
Callback to do whatever capability checks required in the caller (called during the export process.
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
|
static |
Clean name to display to the user about this caller location.
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
|
static |
Array of arguments the caller expects to be passed through to it.
This must be keyed on the argument name, and the array value is a boolean, whether it is required, or just optional eg array( id => true, somethingelse => false )
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
|
abstract |
How long does this reasonably expect to take.
Should we offer the user the option to wait..? This is deliberately nonstatic so it can take filesize into account the portfolio plugin can override this. (so for example even if a huge file is being sent, the download portfolio plugin doesn't care )
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
portfolio_caller_base::expected_time_file | ( | ) |
Helper method to calculate expected time for multi or single file exports.
string | file time expectation |
portfolio_caller_base::export_config_form | ( | & | $mform, |
$instance ) |
If this caller wants any additional config items, they should be defined here.
moodleform | $mform | passed by reference, add elements to it. |
portfolio_plugin_base | $instance | subclass of portfolio_plugin_base |
Reimplemented in data_portfolio_caller.
portfolio_caller_base::export_config_validation | ( | $data | ) |
Just like the moodle form validation function, this is passed in the data array from the form and if a non empty array is returned, form processing will stop.
array | $data | data from form. |
portfolio_caller_base::get | ( | $field | ) |
Generic getter for properties belonging to this instance outside the subclasses like name, visible etc.
string | $field | property's name |
mixed |
portfolio_export_exception |
Reimplemented in portfolio_module_caller_base.
portfolio_caller_base::get_allowed_export_config | ( | ) |
Similar to the other allowed_config functions if you need export config, you must provide a list of what the fields are.
Even if you want to store stuff during export without displaying a form to the user, you can use this.
array | array of allowed keys |
Reimplemented in data_portfolio_caller.
|
final |
Returns a particular export config value.
Subclasses shouldn't need to override this
string | $key | the config item to fetch |
null|mixed | of export configuration |
portfolio_caller_base::get_export_summary | ( | ) |
After the user submits their config, they're given a confirm screen summarising what they've chosen.
This function should return a table of nice strings => values of what they've chosen to be displayed in a table.
bool |
portfolio_caller_base::get_mimetype | ( | ) |
Gets mimetype.
string |
|
abstract |
Function to build navigation.
Reimplemented in forum_portfolio_caller, mod_workshop_portfolio_caller, and portfolio_module_caller_base.
|
abstract |
This is the "return to where you were" url.
Reimplemented in chat_portfolio_caller, forum_portfolio_caller, mod_workshop_portfolio_caller, and portfolio_module_caller_base.
|
abstract |
Helper function to get sha1.
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
portfolio_caller_base::get_sha1_file | ( | ) |
Helper function to calculate the sha1 for multi or single file exports.
string | sha1 file exports |
portfolio_caller_base::has_export_config | ( | ) |
Whether this caller wants any additional config during export (eg options or metadata)
bool |
Reimplemented in data_portfolio_caller.
portfolio_caller_base::heading_summary | ( | ) |
Return a string to put at the header summarising this export.
By default, it just display the name (usually just 'assignment' or something unhelpful
string |
Reimplemented in portfolio_module_caller_base.
|
abstract |
Load data.
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
|
abstract |
Called before the portfolio plugin gets control.
This function should copy all the files it wants to the temporary directory, using copy_existing_file or write_new_file
Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_entry_portfolio_caller, glossary_full_portfolio_caller, and mod_workshop_portfolio_caller.
portfolio_caller_base::prepare_package_file | ( | ) |
Helper function to copy files into the temp area for single or multi file exports.
stored_file|bool |
|
final |
Generic setter for properties belonging to this instance outside the subclass like name, visible, etc.
string | $field | property's name |
mixed | $value | property's value |
bool |
moodle_exception |
|
abstract |
Return the context for this export.
used for $PAGE->set_context
moodle_page | $PAGE | global page object |
Reimplemented in portfolio_module_caller_base.
|
final |
Stores the config generated at export time.
Subclasses can retrieve values using
array | $config | formdata |
portfolio_caller_base::set_file_and_format_data | ( | $ids = null | ) |
Set up the required files for this export.
This supports either passing files directly or passing area arguments directly through to the files api using file_storage\get_area_files
mixed | $ids | one of:
|
void |
portfolio_caller_base::set_formats_from_button | ( | $formats | ) |
|
final |
Array of formats this caller supports.
array | list of formats |
|
protected |
configuration used for export.
Use set_export_config and get_export_config to access