Moodle APIs
3.8
Moodle 3.8.6 (Build: 20201109)
|
Public Member Functions | |
__construct ($instance, portfolio_caller_base $caller, $callercomponent) | |
Construct a new exporter for use. More... | |
caller () | |
Helper function to return the caller object. More... | |
cancel_request ($logreturn=false) | |
Cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started. More... | |
copy_existing_file ($oldfile) | |
Copies a file from somewhere else in moodle to the portfolio temporary working directory associated with this export. More... | |
get ($field) | |
Generic getter for properties belonging to this instance outside the subclasses like name, visible etc. More... | |
get_base_filearea () | |
Returns the context, filearea, and itemid. More... | |
get_tempfiles ($skipfile='portfolio-export.zip') | |
Returns an arary of files in the temporary working directory for this export. More... | |
instance () | |
Helper function to return the portfolio instance. More... | |
log_transfer () | |
Log the transfer. More... | |
print_header ($headingstr, $summary=true) | |
Local print header function to be reused across the export. More... | |
process_stage ($stage, $alreadystolen=false) | |
Process the given stage calling whatever functions are necessary. More... | |
process_stage_cleanup ($pullok=false) | |
Processes the 'cleanup' stage of the export. More... | |
process_stage_config () | |
Processes the 'config' stage of the export. More... | |
process_stage_confirm () | |
Processes the 'confirm' stage of the export. More... | |
process_stage_finished ($queued=false) | |
Processes the 'finish' stage of the export. More... | |
process_stage_package () | |
Processes the 'package' stage of the export. More... | |
process_stage_queueorwait () | |
Processes the 'queueornext' stage of the export. More... | |
process_stage_send () | |
Processes the 'send' stage of the export. More... | |
save () | |
Writes out the contents of this object and all its data to the portfolio_tempdata table and sets the 'id' field. More... | |
set ($field, &$value) | |
Generic setter for properties belonging to this instance outside the subclass like name, visible, etc. More... | |
set_forcequeue () | |
Sets this export to force queued. More... | |
update_log_url ($url) | |
In some cases (mahara) we need to update this after the log has been done because of MDL-20872 More... | |
verify_rewaken ($readonly=false) | |
Verifies a rewoken object. More... | |
write_new_file ($content, $name, $manifest=true) | |
Writes out some content to a file in the portfolio temporary working directory associated with this export. More... | |
zip_tempfiles ($filename='portfolio-export.zip', $filepath='/final/') | |
Zips all files in the temporary directory. More... | |
Static Public Member Functions | |
static | print_cleaned_export ($log, $instance=null) |
Wrapper function to print a friendly error to users. More... | |
static | print_expired_export () |
Wrapper function to print a friendly error to users This is generally caused by them hitting an expired transfer through the usage of the backbutton. More... | |
static | print_finish_info ($returnurl, $continueurl, $extras=null) |
Wrapper function to print continue and/or return link. More... | |
static | rewaken_object ($id) |
Rewakens the data from the database given the id. More... | |
Public Attributes | |
string | $callercomponent |
the component that contains the class definition of the caller object used to re-waken the object after sleep | |
string | $instancefile |
the file to include that contains the class defintion of the portfolio instance plugin used to re-waken the object after sleep | |
portfolio_exporter::__construct | ( | $instance, | |
portfolio_caller_base | $caller, | ||
$callercomponent | |||
) |
Construct a new exporter for use.
portfolio_plugin_base | $instance | portfolio instance (passed by reference) |
portfolio_caller_base | $caller | portfolio caller (passed by reference) |
string | $callercomponent | the name of the callercomponent |
portfolio_exporter::caller | ( | ) |
Helper function to return the caller object.
portfolio_caller_base | subclass |
portfolio_exporter::cancel_request | ( | $logreturn = false | ) |
Cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started.
bool | $logreturn | options to return to porfolio log or caller return page |
void | @uses exit |
portfolio_exporter::copy_existing_file | ( | $oldfile | ) |
Copies a file from somewhere else in moodle to the portfolio temporary working directory associated with this export.
stored_file | $oldfile | existing stored file object |
stored_file|bool | new file object |
portfolio_exporter::get | ( | $field | ) |
Generic getter for properties belonging to this instance outside the subclasses like name, visible etc.
string | $field | property's name |
portfolio_format|mixed |
portfolio_exporter::get_base_filearea | ( | ) |
Returns the context, filearea, and itemid.
Parts of a filearea (not filepath) to be used by plugins if they want to do things like zip up the contents of the temp area to here, or something that can't be done just using write_new_file, copy_existing_file or get_tempfiles
array | contextid, filearea, itemid are the keys. |
portfolio_exporter::get_tempfiles | ( | $skipfile = 'portfolio-export.zip' | ) |
Returns an arary of files in the temporary working directory for this export.
Always use this instead of the files api directly
string | $skipfile | name of the file to be skipped |
array | of stored_file objects keyed by name |
portfolio_exporter::instance | ( | ) |
Helper function to return the portfolio instance.
portfolio_plugin_base | subclass |
portfolio_exporter::log_transfer | ( | ) |
Log the transfer.
this should only be called after the file has been sent either via push, or sent from a pull request.
|
static |
Wrapper function to print a friendly error to users.
stdClass | $log | portfolio_log object |
portfolio_plugin_base | $instance | portfolio instance @uses exit |
|
static |
Wrapper function to print a friendly error to users This is generally caused by them hitting an expired transfer through the usage of the backbutton.
@uses exit
|
static |
Wrapper function to print continue and/or return link.
string | $returnurl | link to previos page |
string | $continueurl | continue to next page |
array | $extras | (optional) other links to be display. |
portfolio_exporter::print_header | ( | $headingstr, | |
$summary = true |
|||
) |
Local print header function to be reused across the export.
string | $headingstr | full language string |
bool | $summary | (optional) to print summary, default is set to true |
void |
portfolio_exporter::process_stage | ( | $stage, | |
$alreadystolen = false |
|||
) |
Process the given stage calling whatever functions are necessary.
int | $stage | (see PORTFOLIO_STAGE_* constants) |
bool | $alreadystolen | used to avoid letting plugins steal control twice. |
bool | whether or not to process the next stage. this is important as the function is called recursively. |
portfolio_exporter::process_stage_cleanup | ( | $pullok = false | ) |
Processes the 'cleanup' stage of the export.
bool | $pullok | normally cleanup is deferred for pull plugins until after the file is requested from portfolio/file.php if you want to clean up earlier, pass true here (defaults to false) |
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_exporter::process_stage_config | ( | ) |
Processes the 'config' stage of the export.
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_exporter::process_stage_confirm | ( | ) |
Processes the 'confirm' stage of the export.
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_exporter::process_stage_finished | ( | $queued = false | ) |
Processes the 'finish' stage of the export.
bool | $queued | let the process to be queued |
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_exporter::process_stage_package | ( | ) |
Processes the 'package' stage of the export.
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_export_exception |
portfolio_exporter::process_stage_queueorwait | ( | ) |
Processes the 'queueornext' stage of the export.
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
portfolio_exporter::process_stage_send | ( | ) |
Processes the 'send' stage of the export.
bool | whether or not to process the next stage. this is important as the control function is called recursively. |
|
static |
Rewakens the data from the database given the id.
Makes sure to load the required files with the class definitions
int | $id | id of data |
portfolio_exporter |
portfolio_exporter::save | ( | ) |
Writes out the contents of this object and all its data to the portfolio_tempdata table and sets the 'id' field.
void |
portfolio_exporter::set | ( | $field, | |
& | $value | ||
) |
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 |
portfolio_export_exception |
portfolio_exporter::set_forcequeue | ( | ) |
Sets this export to force queued.
Sometimes plugins need to set this randomly if an external system changes its mind about what's supported
portfolio_exporter::update_log_url | ( | $url | ) |
In some cases (mahara) we need to update this after the log has been done because of MDL-20872
string | $url | link to be recorded to portfolio log |
portfolio_exporter::verify_rewaken | ( | $readonly = false | ) |
Verifies a rewoken object.
Checks to make sure it belongs to the same user and session as is currently in use.
bool | $readonly | if we're reawakening this for a user to just display in the log view, don't verify the sessionkey |
portfolio_exception |
portfolio_exporter::write_new_file | ( | $content, | |
$name, | |||
$manifest = true |
|||
) |
Writes out some content to a file in the portfolio temporary working directory associated with this export.
string | $content | content to write |
string | $name | filename to use |
bool | $manifest | whether this is the main file or an secondary file (eg attachment) |
stored_file |
portfolio_exporter::zip_tempfiles | ( | $filename = 'portfolio-export.zip' , |
|
$filepath = '/final/' |
|||
) |
Zips all files in the temporary directory.
string | $filename | name of resulting zipfile (optional, defaults to portfolio-export.zip) |
string | $filepath | subpath in the filearea (optional, defaults to final) |
stored_file|bool | resulting stored_file object, or false |