Moodle  2.2.1
http://www.collinsharper.com
portfolio_exporter Class Reference
Inheritance diagram for portfolio_exporter:

Public Member Functions

 __construct (&$instance, &$caller, $callerfile)
 get ($field)
 set ($field, &$value)
 set_forcequeue ()
 process_stage ($stage, $alreadystolen=false)
 instance ()
 caller ()
 process_stage_config ()
 process_stage_confirm ()
 process_stage_queueorwait ()
 process_stage_package ()
 process_stage_cleanup ($pullok=false)
 process_stage_send ()
 log_transfer ()
 update_log_url ($url)
 process_stage_finished ($queued=false)
 print_header ($headingstr, $summary=true)
 cancel_request ($logreturn=false)
 save ()
 verify_rewaken ($readonly=false)
 copy_existing_file ($oldfile)
 write_new_file ($content, $name, $manifest=true)
 zip_tempfiles ($filename='portfolio-export.zip', $filepath='/final/')
 get_tempfiles ($skipfile='portfolio-export.zip')
 get_base_filearea ()

Static Public Member Functions

static rewaken_object ($id)
static print_expired_export ()
static print_cleaned_export ($log, $instance=null)
static print_finish_info ($returnurl, $continueurl, $extras=null)

Data Fields

 $instancefile
 $callerfile

Detailed Description

The class that handles the various stages of the actual export and the communication between the caller and the portfolio plugin. this is stored in the database between page requests in serialized base64 encoded form also contains helper methods for the plugin and caller to use (at the end of the file) {

See also:
get_base_filearea} - where to write files to {
write_new_file} - write some content to a file in the export filearea {
copy_existing_file} - copy an existing file into the export filearea {
get_tempfiles} - return list of all files in the export filearea

Definition at line 41 of file exporter.php.


Constructor & Destructor Documentation

__construct ( &$  instance,
&$  caller,
callerfile 
)

construct a new exporter for use

Parameters:
portfolio_plugin_basesubclass $instance portfolio instance (passed by reference)
portfolio_caller_basesubclass $caller portfolio caller (passed by reference)
string$callerfilepath to callerfile (relative to dataroot)

Definition at line 135 of file exporter.php.

Here is the call graph for this function:


Member Function Documentation

caller ( )

helper function to return the caller object

Returns:
portfolio_caller_base subclass

Definition at line 275 of file exporter.php.

Here is the caller graph for this function:

cancel_request ( logreturn = false)

cancels a potfolio request and cleans up the tempdata and redirects the user back to where they started

Definition at line 615 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

copy_existing_file ( oldfile)

copies a file from somewhere else in moodle to the portfolio temporary working directory associated with this export

Parameters:
$oldfilestored_file object
Returns:
stored_file new file object

Reimplemented in portfolio_exporter_test.

Definition at line 745 of file exporter.php.

Here is the call graph for this function:

get ( field)

Definition at line 154 of file exporter.php.

Here is the call graph for this function:

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

Returns:
array contextid, filearea, itemid are the keys.

Definition at line 833 of file exporter.php.

Here is the caller graph for this function:

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

Returns:
array of stored_file objects keyed by name

Definition at line 808 of file exporter.php.

Here is the call graph for this function:

instance ( )

helper function to return the portfolio instance

Returns:
portfolio_plugin_base subclass

Definition at line 266 of file exporter.php.

Here is the caller graph for this function:

log the transfer this should only be called after the file has been sent either via push, or sent from a pull request.

Definition at line 530 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static print_cleaned_export ( log,
instance = null 
) [static]

Definition at line 860 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

static print_expired_export ( ) [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

Definition at line 847 of file exporter.php.

static print_finish_info ( returnurl,
continueurl,
extras = null 
) [static]

Definition at line 877 of file exporter.php.

Here is the caller graph for this function:

print_header ( headingstr,
summary = true 
)

local print header function to be reused across the export

Parameters:
string$headerstringfull language string

Definition at line 585 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

process_stage ( stage,
alreadystolen = false 
)

process the given stage calling whatever functions are necessary

Parameters:
int$stage(see PORTFOLIO_STAGE_* constants)
boolean$alreadystolenused to avoid letting plugins steal control twice.
Returns:
boolean whether or not to process the next stage. this is important as the function is called recursively.

Definition at line 205 of file exporter.php.

Here is the call graph for this function:

process_stage_cleanup ( pullok = false)

processes the 'cleanup' stage of the export

Parameters:
boolean$pulloknormally 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)
Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 486 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

processes the 'config' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 284 of file exporter.php.

Here is the call graph for this function:

processes the 'confirm' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 375 of file exporter.php.

Here is the call graph for this function:

process_stage_finished ( queued = false)

processes the 'finish' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 560 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

processes the 'package' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 455 of file exporter.php.

Here is the call graph for this function:

processes the 'queueornext' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 440 of file exporter.php.

Here is the call graph for this function:

processes the 'send' stage of the export

Returns:
boolean whether or not to process the next stage. this is important as the control function is called recursively.

Definition at line 508 of file exporter.php.

Here is the call graph for this function:

static rewaken_object ( id) [static]

rewakens the data from the database given the id makes sure to load the required files with the class definitions

Parameters:
int$idid of data
Returns:
portfolio_exporter

Definition at line 664 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

save ( )

writes out the contents of this object and all its data to the portfolio_tempdata table and sets the 'id' field.

Definition at line 631 of file exporter.php.

Here is the call graph for this function:

Here is the caller graph for this function:

set ( field,
&$  value 
)

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

Definition at line 172 of file exporter.php.

Here is the call graph for this function:

sets this export to force queued sometimes plugins need to set this randomly if an external system changes its mind about what's supported

Definition at line 193 of file exporter.php.

update_log_url ( url)

in some cases (mahara) we need to update this after the log has been done because of MDL-20872

Definition at line 550 of file exporter.php.

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.

Parameters:
boolean$readonlyif we're reawakening this for a user to just display in the log view, don't verify the sessionkey when continuing transfers, you must pass false here.
Exceptions:
portfolio_exception

Definition at line 718 of file exporter.php.

Here is the call graph for this function:

write_new_file ( content,
name,
manifest = true 
)

writes out some content to a file in the portfolio temporary working directory associated with this export

Parameters:
string$contentcontent to write
string$namefilename to use
bool$maifestwhether this is the main file or an secondary file (eg attachment)
Returns:
stored_file new file object

Definition at line 773 of file exporter.php.

Here is the call graph for this function:

zip_tempfiles ( filename = 'portfolio-export.zip',
filepath = '/final/' 
)

zips all files in the temporary directory

Parameters:
string$filenamename of resulting zipfile (optional, defaults to portfolio-export.zip
string$filepathsubpath in the filearea (optional, defaults to final)
Returns:
stored_file resulting stored_file object

Definition at line 790 of file exporter.php.

Here is the call graph for this function:


Field Documentation

$callerfile

the file to include that contains the class definition of the caller object used to re-waken the object after sleep

Definition at line 74 of file exporter.php.

$instancefile

the file to include that contains the class defintion of the portfolio instance plugin used to re-waken the object after sleep

Definition at line 67 of file exporter.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations