Moodle PHP Documentation 4.4
Moodle 4.4.1 (Build: 20240610) (db07c09afc5)
|
Exported post builder class. More...
Public Member Functions | |
__construct (renderer_base $renderer, legacy_data_mapper_factory $legacydatamapperfactory, exporter_factory $exporterfactory, vault_factory $vaultfactory, manager_factory $managerfactory) | |
Constructor. | |
build (stdClass $user, array $forums, array $discussions, array $posts, bool $includeinlineattachments=false) | |
Build the exported posts for a given set of forums, discussions, and posts. | |
Exported post builder class.
This class is an implementation of the builder pattern (loosely). It is responsible for taking a set of related forums, discussions, and posts and generate the exported version of the posts.
It encapsulates the complexity involved with exporting posts. All of the relevant additional resources will be loaded by this class in order to ensure the exporting process can happen.
See this doc for more information on the builder pattern: https://designpatternsphp.readthedocs.io/en/latest/Creational/Builder/README.html
mod_forum\local\builders\exported_posts::__construct | ( | renderer_base | $renderer, |
legacy_data_mapper_factory | $legacydatamapperfactory, | ||
exporter_factory | $exporterfactory, | ||
vault_factory | $vaultfactory, | ||
manager_factory | $managerfactory ) |
Constructor.
renderer_base | $renderer | Core renderer |
legacy_data_mapper_factory | $legacydatamapperfactory | Legacy data mapper factory |
exporter_factory | $exporterfactory | Exporter factory |
vault_factory | $vaultfactory | Vault factory |
manager_factory | $managerfactory | Manager factory |
mod_forum\local\builders\exported_posts::build | ( | stdClass | $user, |
array | $forums, | ||
array | $discussions, | ||
array | $posts, | ||
bool | $includeinlineattachments = false ) |
Build the exported posts for a given set of forums, discussions, and posts.
This will typically be used for a list of posts in the same discussion/forum however it does support exporting any arbitrary list of posts as long as the caller also provides a unique list of all discussions for the list of posts and all forums for the list of discussions.
Increasing the number of different forums being processed will increase the processing time due to processing multiple contexts (for things like capabilities, files, etc). The code attempts to load the additional resources as efficiently as possible but there is no way around some of the additional overhead.
Note: Some posts will be removed as part of the build process according to capabilities. A one-to-one mapping should not be expected.
stdClass | $user | The user to export the posts for. |
forum_entity[] | $forums | A list of all forums that each of the $discussions belong to |
discussion_entity[] | $discussions | A list of all discussions that each of the $posts belong to |
post_entity[] | $posts | The list of posts to export. |
bool | $includeinlineattachments | Whether inline attachments should be included or not. |
stdClass[] | List of exported posts in the same order as the $posts array. |