Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
mod_forum\local\builders\exported_discussion Class Reference

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.
 

Detailed Description

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

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

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.

Parameters
renderer_base$rendererCore renderer
legacy_data_mapper_factory$legacydatamapperfactoryLegacy data mapper factory
exporter_factory$exporterfactoryExporter factory
vault_factory$vaultfactoryVault factory
rating_manager$ratingmanagerRating manager

Member Function Documentation

◆ build()

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.

Parameters
stdClass$userThe user to export the posts for.
forum_entity$forumThe forum that each of the $discussions belong to
discussion_entity$discussionA list of all discussions that each of the $posts belong to
Return values
stdClass[]List of exported posts in the same order as the $posts array.

◆ is_favourited()

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.

Parameters
discussion_entity$discussionThe discussion record
context_module$forumcontextForum context
stdClass$userThe user to check the favourite against
Return values
boolWhether or not the user has favourited the discussion

The documentation for this class was generated from the following file: