Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
portfolio_caller_base Class Reference
Inheritance diagram for portfolio_caller_base:
portfolio_module_caller_base assign_portfolio_caller chat_portfolio_caller data_portfolio_caller forum_portfolio_caller glossary_entry_portfolio_caller glossary_full_portfolio_caller mod_workshop_portfolio_caller

Public Member Functions

 __construct ($callbackargs)
 Create portfolio_caller object. More...
 
 check_permissions ()
 Callback to do whatever capability checks required in the caller (called during the export process. More...
 
 expected_time ()
 How long does this reasonably expect 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 ($field)
 Generic getter for properties belonging to this instance outside the subclasses like name, visible etc. 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 ()
 Function to build navigation. More...
 
 get_return_url ()
 This is the "return to where you were" url. More...
 
 get_sha1 ()
 Helper function to get sha1. 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. More...
 
 prepare_package ()
 Called before the portfolio plugin gets control. More...
 
 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)
 Return the context for this export. 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... so it should be trusted. More...
 
 supported_formats ()
 Array of formats this caller supports. More...
 

Static Public Member Functions

static base_supported_formats ()
 Base supported formats. More...
 
static display_name ()
 Clean name to display to the user about this caller location. More...
 
static expected_callbackargs ()
 Array of arguments the caller expects to be passed through to it. More...
 

Protected Member Functions

 add_format ($format)
 Adds a new format to the list of supported formats. More...
 

Protected Attributes

stdClass $course
 course active during the call
 
array $exportconfig = array()
 configuration used for export. More...
 
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
 

Constructor & Destructor Documentation

◆ __construct()

portfolio_caller_base::__construct (   $callbackargs)

Create portfolio_caller object.

Parameters
array$callbackargsargument properties

Reimplemented in assign_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, and mod_workshop_portfolio_caller.

Member Function Documentation

◆ add_format()

portfolio_caller_base::add_format (   $format)
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.

Parameters
string$formatone of PORTFOLIO_FORMAT_XX
Return values
void

◆ base_supported_formats()

static portfolio_caller_base::base_supported_formats ( )
static

◆ check_permissions()

portfolio_caller_base::check_permissions ( )
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_full_portfolio_caller, glossary_entry_portfolio_caller, and mod_workshop_portfolio_caller.

◆ display_name()

static portfolio_caller_base::display_name ( )
static

◆ expected_callbackargs()

static portfolio_caller_base::expected_callbackargs ( )
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_full_portfolio_caller, glossary_entry_portfolio_caller, and mod_workshop_portfolio_caller.

◆ expected_time()

portfolio_caller_base::expected_time ( )
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_full_portfolio_caller, glossary_entry_portfolio_caller, and mod_workshop_portfolio_caller.

◆ expected_time_file()

portfolio_caller_base::expected_time_file ( )

Helper method to calculate expected time for multi or single file exports.

Return values
stringfile time expectation

◆ export_config_form()

portfolio_caller_base::export_config_form ( $mform,
  $instance 
)

If this caller wants any additional config items, they should be defined here.

Parameters
moodleform$mformpassed by reference, add elements to it.
portfolio_plugin_base$instancesubclass of portfolio_plugin_base

Reimplemented in data_portfolio_caller.

◆ export_config_validation()

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.

Parameters
array$datadata from form.

◆ get()

portfolio_caller_base::get (   $field)

Generic getter for properties belonging to this instance outside the subclasses like name, visible etc.

Parameters
string$fieldproperty's name
Return values
mixed
Exceptions
portfolio_export_exception

Reimplemented in portfolio_module_caller_base.

◆ get_allowed_export_config()

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.

Return values
arrayarray of allowed keys

Reimplemented in data_portfolio_caller.

◆ get_export_config()

portfolio_caller_base::get_export_config (   $key)
final

Returns a particular export config value.

Subclasses shouldn't need to override this

Parameters
string$keythe config item to fetch
Return values
null|mixedof export configuration

◆ get_export_summary()

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.

Return values
bool

◆ get_mimetype()

portfolio_caller_base::get_mimetype ( )

Gets mimetype.

Return values
string

◆ get_navigation()

portfolio_caller_base::get_navigation ( )
abstract

Function to build navigation.

Reimplemented in portfolio_module_caller_base, forum_portfolio_caller, and mod_workshop_portfolio_caller.

◆ get_return_url()

portfolio_caller_base::get_return_url ( )
abstract

This is the "return to where you were" url.

Reimplemented in portfolio_module_caller_base, chat_portfolio_caller, forum_portfolio_caller, and mod_workshop_portfolio_caller.

◆ get_sha1()

portfolio_caller_base::get_sha1 ( )
abstract

◆ get_sha1_file()

portfolio_caller_base::get_sha1_file ( )

Helper function to calculate the sha1 for multi or single file exports.

Return values
stringsha1 file exports

◆ has_export_config()

portfolio_caller_base::has_export_config ( )

Whether this caller wants any additional config during export (eg options or metadata)

Return values
bool

Reimplemented in data_portfolio_caller.

◆ heading_summary()

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

Return values
string

Reimplemented in portfolio_module_caller_base.

◆ load_data()

portfolio_caller_base::load_data ( )
abstract

◆ prepare_package()

portfolio_caller_base::prepare_package ( )
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

See also
copy_existing_file()
write_new_file()

Reimplemented in assign_portfolio_caller, chat_portfolio_caller, data_portfolio_caller, forum_portfolio_caller, glossary_full_portfolio_caller, glossary_entry_portfolio_caller, and mod_workshop_portfolio_caller.

◆ prepare_package_file()

portfolio_caller_base::prepare_package_file ( )

Helper function to copy files into the temp area for single or multi file exports.

Return values
stored_file|bool

◆ set()

portfolio_caller_base::set (   $field,
$value 
)
final

Generic setter for properties belonging to this instance outside the subclass like name, visible, etc.

Parameters
string$fieldproperty's name
mixed$valueproperty's value
Return values
bool
Exceptions
moodle_exception

◆ set_context()

portfolio_caller_base::set_context (   $PAGE)
abstract

Return the context for this export.

used for $PAGE->set_context

Parameters
moodle_page$PAGEglobal page object

Reimplemented in portfolio_module_caller_base.

◆ set_export_config()

portfolio_caller_base::set_export_config (   $config)
final

Stores the config generated at export time.

Subclasses can retrieve values using

See also
get_export_config
Parameters
array$configformdata

◆ set_file_and_format_data()

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

Parameters
mixed$idsone of:
Return values
void

◆ set_formats_from_button()

portfolio_caller_base::set_formats_from_button (   $formats)

The button-location always knows best what the formats are... so it should be trusted.

Todo:
MDL-31298 - re-analyze set_formats_from_button comment
Parameters
array$formatsarray of PORTFOLIO_FORMAT_XX
Return values
void

◆ supported_formats()

portfolio_caller_base::supported_formats ( )
final

Array of formats this caller supports.

Return values
arraylist of formats

Member Data Documentation

◆ $exportconfig

array portfolio_caller_base::$exportconfig = array()
protected

configuration used for export.

Use set_export_config and get_export_config to access


The documentation for this class was generated from the following file: