See Release Notes
Long Term Support Release
Differences Between: [Versions 401 and 402] [Versions 401 and 403]
This file contains the class definition for the exporter object.
Copyright: | 2008 Penny Leach <penny@catalyst.net.nz> |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 927 lines (37 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
portfolio_exporter:: (30 methods):
__construct()
get()
set()
set_forcequeue()
process_stage()
instance()
caller()
process_stage_config()
process_stage_confirm()
process_stage_queueorwait()
process_stage_package()
process_stage_cleanup()
process_stage_send()
log_transfer()
update_log_url()
process_stage_finished()
print_header()
cancel_request()
save()
rewaken_object()
new_file_record_base()
verify_rewaken()
copy_existing_file()
write_new_file()
zip_tempfiles()
get_tempfiles()
get_base_filearea()
print_expired_export()
print_cleaned_export()
print_finish_info()
Class: portfolio_exporter - X-Ref
The class that handles the various stages of the actual export__construct($instance, portfolio_caller_base $caller, $callercomponent) X-Ref |
Construct a new exporter for use param: portfolio_plugin_base $instance portfolio instance (passed by reference) param: portfolio_caller_base $caller portfolio caller (passed by reference) param: string $callercomponent the name of the callercomponent |
get($field) X-Ref |
Generic getter for properties belonging to this instance <b>outside</b> the subclasses like name, visible etc. param: string $field property's name return: portfolio_format|mixed |
set($field, &$value) X-Ref |
Generic setter for properties belonging to this instance <b>outside</b> the subclass like name, visible, etc. param: string $field property's name param: mixed $value property's value return: bool |
set_forcequeue() X-Ref |
Sets this export to force queued. Sometimes plugins need to set this randomly if an external system changes its mind about what's supported |
process_stage($stage, $alreadystolen=false) X-Ref |
Process the given stage calling whatever functions are necessary param: int $stage (see PORTFOLIO_STAGE_* constants) param: bool $alreadystolen used to avoid letting plugins steal control twice. return: bool whether or not to process the next stage. this is important as the function is called recursively. |
instance() X-Ref |
Helper function to return the portfolio instance return: portfolio_plugin_base subclass |
caller() X-Ref |
Helper function to return the caller object return: portfolio_caller_base subclass |
process_stage_config() X-Ref |
Processes the 'config' stage of the export return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
process_stage_confirm() X-Ref |
Processes the 'confirm' stage of the export return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
process_stage_queueorwait() X-Ref |
Processes the 'queueornext' stage of the export return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
process_stage_package() X-Ref |
Processes the 'package' stage of the export return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
process_stage_cleanup($pullok=false) X-Ref |
Processes the 'cleanup' stage of the export param: bool $pullok normally cleanup is deferred for pull plugins until after the file is requested from portfolio/file.php return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
process_stage_send() X-Ref |
Processes the 'send' stage of the export return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
log_transfer() X-Ref |
Log the transfer this should only be called after the file has been sent either via push, or sent from a pull request. |
update_log_url($url) X-Ref |
In some cases (mahara) we need to update this after the log has been done because of MDL-20872 param: string $url link to be recorded to portfolio log |
process_stage_finished($queued=false) X-Ref |
Processes the 'finish' stage of the export param: bool $queued let the process to be queued return: bool whether or not to process the next stage. this is important as the control function is called recursively. |
print_header($headingstr, $summary=true) X-Ref |
Local print header function to be reused across the export param: string $headingstr full language string param: bool $summary (optional) to print summary, default is set to true return: void |
cancel_request($logreturn=false) X-Ref |
Cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started param: bool $logreturn options to return to porfolio log or caller return page return: void |
save() X-Ref |
Writes out the contents of this object and all its data to the portfolio_tempdata table and sets the 'id' field. return: void |
rewaken_object($id) X-Ref |
Rewakens the data from the database given the id. Makes sure to load the required files with the class definitions param: int $id id of data return: portfolio_exporter |
new_file_record_base($name) X-Ref |
Helper function to create the beginnings of a file_record object to create a new file in the portfolio_temporary working directory. Use write_new_file or copy_existing_file externally param: string $name filename of new record return: object |
verify_rewaken($readonly=false) X-Ref |
Verifies a rewoken object. Checks to make sure it belongs to the same user and session as is currently in use. param: bool $readonly if we're reawakening this for a user to just display in the log view, don't verify the sessionkey |
copy_existing_file($oldfile) X-Ref |
Copies a file from somewhere else in moodle to the portfolio temporary working directory associated with this export param: stored_file $oldfile existing stored file object return: stored_file|bool new file object |
write_new_file($content, $name, $manifest=true) X-Ref |
Writes out some content to a file in the portfolio temporary working directory associated with this export. param: string $content content to write param: string $name filename to use param: bool $manifest whether this is the main file or an secondary file (eg attachment) return: stored_file |
zip_tempfiles($filename='portfolio-export.zip', $filepath='/final/') X-Ref |
Zips all files in the temporary directory param: string $filename name of resulting zipfile (optional, defaults to portfolio-export.zip) param: string $filepath subpath in the filearea (optional, defaults to final) return: stored_file|bool resulting stored_file object, or false |
get_tempfiles($skipfile='portfolio-export.zip') X-Ref |
Returns an arary of files in the temporary working directory for this export. Always use this instead of the files api directly param: string $skipfile name of the file to be skipped return: array of stored_file objects keyed by name |
get_base_filearea() X-Ref |
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 return: array contextid, filearea, itemid are the keys. |
print_expired_export() X-Ref |
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 |
print_cleaned_export($log, $instance=null) X-Ref |
Wrapper function to print a friendly error to users param: stdClass $log portfolio_log object param: portfolio_plugin_base $instance portfolio instance |
print_finish_info($returnurl, $continueurl, $extras=null) X-Ref |
Wrapper function to print continue and/or return link param: string $returnurl link to previos page param: string $continueurl continue to next page param: array $extras (optional) other links to be display. |