Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.2.x will end 22 April 2024 (12 months).
  • Bug fixes for security issues in 4.2.x will end 7 October 2024 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.1.x is supported too.

Differences Between: [Versions 310 and 402] [Versions 311 and 402] [Versions 39 and 402] [Versions 400 and 402]

Provides the {@link mod_workshop_portfolio_caller} class.

Copyright: Loc Nguyen <ndloc1905@gmail.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 533 lines (20 kb)
Included or required:0 times
Referenced: 1 time
Includes or requires: 0 files

Defines 1 class


Class: mod_workshop_portfolio_caller  - X-Ref

Workshop portfolio caller class to integrate with portfolio API.

__construct($callbackargs)   X-Ref
Explicit constructor to set the properties declared by the parent class.

Firstly we call the parent's constructor to set the $this->id property
from the passed argument. Then we populate the $this->cm so that the
default parent class methods work well.

param: array $callbackargs

expected_callbackargs()   X-Ref
Return array of expected callback arguments and whether they are required or not.

The 'id' argument is supposed to be our course module id (cmid) - see
the parent class' properties.

return: array of (string)callbackname => (bool)required

load_data()   X-Ref
Load data required for the export.


prepare_package()   X-Ref
Prepare the package ready to be passed off to the portfolio plugin.


add_area_files($filearea, $itemid)   X-Ref
Helper method to add all files from the given location to $this->multifiles

param: string $filearea
param: int $itemid

export_header(workshop_submission $workshopsubmission)   X-Ref
Render the header of the exported content.

This is mainly used for the HTML output format. In case of LEAP2A
export, this is not used as the information is stored in metadata and
displayed as a part of the journal and entry title in Mahara.

param: workshop_submission $workshopsubmission
return: string HTML

export_content(workshop_submission $workshopsubmission)   X-Ref
Render the content of the submission.

param: workshop_submission $workshopsubmission
return: string

export_assessment(workshop_assessment $assessment)   X-Ref
Render the content of an assessment.

param: workshop_assessment $assessment
return: string HTML

export_files_list($filearea)   X-Ref
Export the files in the given file area in a list.

param: string $filearea
return: string HTML

format_exported_text($text, $format)   X-Ref
Helper function to call {@link format_text()} on exported text.

We need to call {@link format_text()} to convert the text into HTML, but
we have to keep the original @@PLUGINFILE@@ placeholder there without a
warning so that {@link portfolio_rewrite_pluginfile_urls()} can do its work.

param: string $text
param: int $format
return: string HTML

export_content_leap2a(portfolio_format_leap2a_writer $leapwriter,workshop_submission $workshopsubmission, $html)   X-Ref
Add a LEAP2A entry element that corresponds to a submission including attachments.

param: portfolio_format_leap2a_writer $leapwriter Writer object to add entries to.
param: workshop_submission $workshopsubmission
param: string $html The exported HTML content of the submission
return: int id of new entry

get_return_url()   X-Ref
Return URL for redirecting the user back to where the export started.

return: string

get_navigation()   X-Ref
Get navigation that logically follows from the place the user was before.

return: array

expected_time()   X-Ref
How long might we expect this export to take.

return: string such as PORTFOLIO_TIME_LOW

check_permissions()   X-Ref
Make sure that the current user is allowed to do the export.

return: boolean

get_sha1()   X-Ref
Return the SHA1 hash of the exported content.

return: string

display_name()   X-Ref
Return a nice name to be displayed about this export location.

return: string

base_supported_formats()   X-Ref
What export formats the workshop generally supports.

If there are no files embedded/attached, the plain HTML format is added
in {@link self::load_data()}.

return: array