Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Exported discussion builder class. More...
Public Member Functions | |
__construct (renderer_base $renderer, legacy_data_mapper_factory $legacydatamapperfactory, exporter_factory $exporterfactory, vault_factory $vaultfactory, rating_manager $ratingmanager) | |
Constructor. | |
build (stdClass $user, forum_entity $forum, discussion_entity $discussion) | |
Build any additional variables for the exported discussion for a given set of discussions. | |
is_favourited (discussion_entity $discussion, context_module $forumcontext, stdClass $user) | |
Check whether the provided discussion has been favourited by the user. | |
Exported discussion 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 discussion.
It encapsulates the complexity involved with exporting discussions. 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_discussion::__construct | ( | renderer_base | $renderer, |
legacy_data_mapper_factory | $legacydatamapperfactory, | ||
exporter_factory | $exporterfactory, | ||
vault_factory | $vaultfactory, | ||
rating_manager | $ratingmanager ) |
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 |
rating_manager | $ratingmanager | Rating manager |
mod_forum\local\builders\exported_discussion::build | ( | stdClass | $user, |
forum_entity | $forum, | ||
discussion_entity | $discussion ) |
Build any additional variables for the exported discussion for a given set of discussions.
This will typically be used for a list of discussions in the same forum.
stdClass | $user | The user to export the posts for. |
forum_entity | $forum | The forum that each of the $discussions belong to |
discussion_entity | $discussion | A list of all discussions that each of the $posts belong to |
stdClass[] | List of exported posts in the same order as the $posts array. |
mod_forum\local\builders\exported_discussion::is_favourited | ( | discussion_entity | $discussion, |
context_module | $forumcontext, | ||
stdClass | $user ) |
Check whether the provided discussion has been favourited by the user.
discussion_entity | $discussion | The discussion record |
context_module | $forumcontext | Forum context |
stdClass | $user | The user to check the favourite against |
bool | Whether or not the user has favourited the discussion |