Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.10.x will end 8 November 2021 (12 months).
  • Bug fixes for security issues in 3.10.x will end 9 May 2022 (18 months).
  • PHP version: minimum PHP 7.2.0 Note: minimum PHP version has increased since Moodle 3.8. PHP 7.3.x and 7.4.x are supported too.

Exported discussion builder class.

Copyright: 2019 Peter Dias<peter@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 155 lines (6 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

exported_discussion:: (4 methods):
  __construct()
  build()
  get_groups_available_in_forum()
  is_favourited()


Class: exported_discussion  - X-Ref

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

__construct(renderer_base $renderer,legacy_data_mapper_factory $legacydatamapperfactory,exporter_factory $exporterfactory,vault_factory $vaultfactory,rating_manager $ratingmanager)   X-Ref
Constructor.

param: renderer_base $renderer Core renderer
param: legacy_data_mapper_factory $legacydatamapperfactory Legacy data mapper factory
param: exporter_factory $exporterfactory Exporter factory
param: vault_factory $vaultfactory Vault factory
param: rating_manager $ratingmanager Rating manager

build(stdClass $user,forum_entity $forum,discussion_entity $discussion)   X-Ref
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.

param: stdClass $user The user to export the posts for.
param: forum_entity $forum The forum that each of the $discussions belong to
param: discussion_entity $discussion A list of all discussions that each of the $posts belong to
return: stdClass[] List of exported posts in the same order as the $posts array.

get_groups_available_in_forum($forum)   X-Ref
Get the groups details for all groups available to the forum.

param: forum_entity $forum The forum entity
return: stdClass[]

is_favourited(discussion_entity $discussion, \context_module $forumcontext, \stdClass $user)   X-Ref
Check whether the provided discussion has been favourited by the user.

param: discussion_entity $discussion The discussion record
param: \context_module $forumcontext Forum context
param: \stdClass $user The user to check the favourite against
return: bool Whether or not the user has favourited the discussion