Differences Between: [Versions 400 and 402] [Versions 400 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. return: portfolio_format|mixed param: string $field property's name |
set($field, &$value) X-Ref |
Generic setter for properties belonging to this instance <b>outside</b> the subclass like name, visible, etc. return: bool param: string $field property's name param: mixed $value property's value |
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 return: bool whether or not to process the next stage. this is important as the function is called recursively. param: int $stage (see PORTFOLIO_STAGE_* constants) param: bool $alreadystolen used to avoid letting plugins steal control twice. |
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 return: bool whether or not to process the next stage. this is important as the control function is called recursively. param: bool $pullok normally cleanup is deferred for pull plugins until after the file is requested from portfolio/file.php |
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 return: bool whether or not to process the next stage. this is important as the control function is called recursively. param: bool $queued let the process to be queued |
print_header($headingstr, $summary=true) X-Ref |
Local print header function to be reused across the export return: void param: string $headingstr full language string param: bool $summary (optional) to print summary, default is set to true |
cancel_request($logreturn=false) X-Ref |
Cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started return: void param: bool $logreturn options to return to porfolio log or caller return page |
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 return: portfolio_exporter param: int $id id of data |
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 return: object param: string $name filename of new record |
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 return: stored_file|bool new file object param: stored_file $oldfile existing stored 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. return: stored_file 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) |
zip_tempfiles($filename='portfolio-export.zip', $filepath='/final/') X-Ref |
Zips all files in the temporary directory return: stored_file|bool resulting stored_file object, or false param: string $filename name of resulting zipfile (optional, defaults to portfolio-export.zip) param: string $filepath subpath in the filearea (optional, defaults to final) |
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 return: array of stored_file objects keyed by name param: string $skipfile name of the file to be skipped |
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. |