Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Workshop portfolio caller class to integrate with portfolio API. More...
Public Member Functions | |
__construct ($callbackargs) | |
Explicit constructor to set the properties declared by the parent class. More... | |
check_permissions () | |
Make sure that the current user is allowed to do the export. More... | |
expected_time () | |
How long might we expect this export to take. More... | |
expected_time_file () | |
Helper method to calculate expected time for multi or single file exports. More... | |
export_config_form (&$mform, $instance) | |
If this caller wants any additional config items, they should be defined here. More... | |
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. More... | |
get ($key) | |
Override the parent get function to make sure when we're asked for a course, We retrieve the object from the database as needed. More... | |
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. More... | |
get_export_config ($key) | |
Returns a particular export config value. More... | |
get_export_summary () | |
After the user submits their config, they're given a confirm screen summarising what they've chosen. More... | |
get_mimetype () | |
Gets mimetype. More... | |
get_navigation () | |
Get navigation that logically follows from the place the user was before. More... | |
get_return_url () | |
Return URL for redirecting the user back to where the export started. More... | |
get_sha1 () | |
Return the SHA1 hash of the exported content. More... | |
get_sha1_file () | |
Helper function to calculate the sha1 for multi or single file exports. More... | |
has_export_config () | |
Whether this caller wants any additional config during export (eg options or metadata) More... | |
heading_summary () | |
Return a string to put at the header summarising this export. More... | |
load_data () | |
Load data required for the export. | |
prepare_package () | |
Prepare the package ready to be passed off to the portfolio plugin. | |
prepare_package_file () | |
Helper function to copy files into the temp area for single or multi file exports. More... | |
set ($field, &$value) | |
Generic setter for properties belonging to this instance outside the subclass like name, visible, etc. More... | |
set_context ($PAGE) | |
Overridden to return the course module context. More... | |
set_export_config ($config) | |
Stores the config generated at export time. More... | |
set_file_and_format_data ($ids=null) | |
Set up the required files for this export. More... | |
set_formats_from_button ($formats) | |
The button-location always knows best what the formats are... More... | |
supported_formats () | |
Array of formats this caller supports. More... | |
Static Public Member Functions | |
static | base_supported_formats () |
What export formats the workshop generally supports. More... | |
static | display_name () |
Return a nice name to be displayed about this export location. More... | |
static | expected_callbackargs () |
Return array of expected callback arguments and whether they are required or not. More... | |
Protected Member Functions | |
add_area_files ($filearea, $itemid) | |
Helper method to add all files from the given location to $this->multifiles. More... | |
add_format ($format) | |
Adds a new format to the list of supported formats. More... | |
export_assessment (workshop_assessment $assessment) | |
Render the content of an assessment. More... | |
export_content (workshop_submission $workshopsubmission) | |
Render the content of the submission. More... | |
export_content_leap2a (portfolio_format_leap2a_writer $leapwriter, workshop_submission $workshopsubmission, $html) | |
Add a LEAP2A entry element that corresponds to a submission including attachments. More... | |
export_files_list ($filearea) | |
Export the files in the given file area in a list. More... | |
export_header (workshop_submission $workshopsubmission) | |
Render the header of the exported content. More... | |
format_exported_text ($text, $format) | |
Helper function to call format_text() on exported text. More... | |
Protected Attributes | |
array | $assessments = [] |
of objects List of assessments of the exported submission. | |
object | $cm |
coursemodule object. More... | |
stdclass | $course |
course object | |
array | $exportconfig = array() |
configuration used for export. More... | |
stdClass | $exporter |
a reference to the exporter object | |
int | $id |
cmid | |
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 | |
object | $submission |
The submission being exported. | |
int | $submissionid |
ID if the exported submission, set via the constructor. | |
array | $supportedformats |
can be optionally overridden by subclass constructors | |
stdclass | $user |
user currently exporting content | |
workshop | $workshop |
The workshop instance where the export is happening. | |
Workshop portfolio caller class to integrate with portfolio API.
mod_workshop_portfolio_caller::__construct | ( | $callbackargs | ) |
Explicit constructor to set the properties declared by the parent class.
Firstly we call the parent's constructor to set the $this->id property from the passed argument. Then we populate the $this->cm so that the default parent class methods work well.
array | $callbackargs |
Reimplemented from portfolio_caller_base.
|
protected |
Helper method to add all files from the given location to $this->multifiles.
string | $filearea | |
int | $itemid |
|
protectedinherited |
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 |
What export formats the workshop generally supports.
If there are no files embedded/attached, the plain HTML format is added in self::load_data().
array |
Reimplemented from portfolio_caller_base.
mod_workshop_portfolio_caller::check_permissions | ( | ) |
Make sure that the current user is allowed to do the export.
boolean |
Reimplemented from portfolio_caller_base.
|
static |
Return a nice name to be displayed about this export location.
string |
Reimplemented from portfolio_caller_base.
|
static |
Return array of expected callback arguments and whether they are required or not.
The 'id' argument is supposed to be our course module id (cmid) - see the parent class' properties.
array | of (string)callbackname => (bool)required |
Reimplemented from portfolio_caller_base.
mod_workshop_portfolio_caller::expected_time | ( | ) |
How long might we expect this export to take.
string | such as PORTFOLIO_TIME_LOW |
Reimplemented from portfolio_caller_base.
|
inherited |
Helper method to calculate expected time for multi or single file exports.
string | file time expectation |
|
protected |
Render the content of an assessment.
workshop_assessment | $assessment |
string | HTML |
|
inherited |
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.
|
inherited |
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. |
|
protected |
Render the content of the submission.
workshop_submission | $workshopsubmission |
string |
|
protected |
Add a LEAP2A entry element that corresponds to a submission including attachments.
portfolio_format_leap2a_writer | $leapwriter | Writer object to add entries to. |
workshop_submission | $workshopsubmission | |
string | $html | The exported HTML content of the submission |
int | id of new entry |
|
protected |
Export the files in the given file area in a list.
string | $filearea |
string | HTML |
|
protected |
Render the header of the exported content.
This is mainly used for the HTML output format. In case of LEAP2A export, this is not used as the information is stored in metadata and displayed as a part of the journal and entry title in Mahara.
workshop_submission | $workshopsubmission |
string | HTML |
|
protected |
Helper function to call format_text() on exported text.
We need to call format_text() to convert the text into HTML, but we have to keep the original @PLUGINFILE@ placeholder there without a warning so that portfolio_rewrite_pluginfile_urls() can do its work.
string | $text | |
int | $format |
string | HTML |
|
inherited |
Override the parent get function to make sure when we're asked for a course, We retrieve the object from the database as needed.
string | $key | the name of get function |
stdClass |
Reimplemented from portfolio_caller_base.
|
inherited |
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.
|
finalinherited |
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 |
|
inherited |
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 |
|
inherited |
Gets mimetype.
string |
mod_workshop_portfolio_caller::get_navigation | ( | ) |
Get navigation that logically follows from the place the user was before.
array |
Reimplemented from portfolio_module_caller_base.
mod_workshop_portfolio_caller::get_return_url | ( | ) |
Return URL for redirecting the user back to where the export started.
string |
Reimplemented from portfolio_module_caller_base.
mod_workshop_portfolio_caller::get_sha1 | ( | ) |
Return the SHA1 hash of the exported content.
string |
Reimplemented from portfolio_caller_base.
|
inherited |
Helper function to calculate the sha1 for multi or single file exports.
string | sha1 file exports |
|
inherited |
Whether this caller wants any additional config during export (eg options or metadata)
bool |
Reimplemented in data_portfolio_caller.
|
inherited |
Return a string to put at the header summarising this export.
by default, this function just display the name and module instance name. Override this to do something more specific
string |
Reimplemented from portfolio_caller_base.
|
inherited |
Helper function to copy files into the temp area for single or multi file exports.
stored_file|bool |
|
finalinherited |
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 |
|
inherited |
Overridden to return the course module context.
moodle_page | $PAGE | global PAGE |
Reimplemented from portfolio_caller_base.
|
finalinherited |
Stores the config generated at export time.
Subclasses can retrieve values using
array | $config | formdata |
|
inherited |
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 |
|
inherited |
|
finalinherited |
Array of formats this caller supports.
array | list of formats |
|
protectedinherited |
coursemodule object.
set this in the constructor like $this->cm = get_coursemodule_from_instance('forum', $this->forum->id);
|
protectedinherited |
configuration used for export.
Use set_export_config and get_export_config to access