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]

Forum Exporter factory.

Copyright: 2019 Ryan Wyllie <ryan@moodle.com>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 275 lines (11 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: exporter  - X-Ref

The exporter factory class used to fetch an instance of the different exporter types.

See:
https://designpatternsphp.readthedocs.io/en/latest/Creational/SimpleFactory/README.html

__construct(legacy_data_mapper_factory $legacydatamapperfactory, manager_factory $managerfactory,url_factory $urlfactory, vault_factory $vaultfactory)   X-Ref
Constructor for the exporter factory.

param: legacy_data_mapper_factory $legacydatamapperfactory The factory to fetch a legacy data mapper instance
param: manager_factory $managerfactory The factory fo fetch a manager instance
param: url_factory $urlfactory The factory to create urls
param: vault_factory $vaultfactory The vault factory

get_forum_exporter(stdClass $user,forum_entity $forum,?int $currentgroup)   X-Ref
Construct a new forum exporter for the specified user and forum.

param: stdClass        $user The user viewing the forum
param: forum_entity    $forum The forum being viewed
param: int             $currentgroup The group currently being viewed
return: forum_exporter

get_forum_export_structure()   X-Ref
Fetch the structure of the forum exporter.

return: array

get_discussion_exporter(stdClass $user,forum_entity $forum,discussion_entity $discussion,array $groupsbyid = [],array $favouriteids = [])   X-Ref
Construct a new discussion exporter for the specified user and forum discussion.

param: stdClass          $user The user viewing the forum
param: forum_entity      $forum The forum being viewed
param: discussion_entity $discussion The discussion being viewed
param: stdClass[]        $groupsbyid The list of groups in the forum
return: discussion_exporter

get_discussion_export_structure()   X-Ref
Fetch the structure of the discussion exporter.

return: array

get_discussion_summaries_exporter(stdClass $user,forum_entity $forum,array $discussions,array $groupsbyid = [],array $groupsbyauthorid = [],array $discussionreplycount = [],array $discussionunreadcount = [],array $latestpostids = [],array $postauthorcontextids = [],array $favourites = [],array $latestauthors = [])   X-Ref
Construct a new discussion summaries exporter for the specified user and set of discussions.

param: stdClass        $user The user viewing the forum
param: forum_entity    $forum The forum being viewed
param: discussion_summary_entity[] $discussions The set of discussion summaries to export
param: stdClass[]      $groupsbyauthorid The set of groups in an associative array for each author
param: stdClass[]      $groupsbyid The set of groups in the forum in an associative array for each group
param: int[]           $discussionreplycount The number of replies for each discussion
param: int[]           $discussionunreadcount The number of unread posts for each discussion
param: int[]           $latestpostids The latest post id for each discussion
param: int[]           $postauthorcontextids The context ids for the first and last post authors (indexed by author id)
param: int[]           $favourites The list of discussion ids that have been favourited
return: discussion_summaries_exporter

get_discussion_summaries_export_structure()   X-Ref
Fetch the structure of the discussion summaries exporter.

return: array

get_posts_exporter(stdClass $user,forum_entity $forum,discussion_entity $discussion,array $posts,array $authorsbyid = [],array $authorcontextids = [],array $attachmentsbypostid = [],array $groupsbyauthorid = [],post_read_receipt_collection_entity $readreceiptcollection = null,array $tagsbypostid = [],array $ratingbypostid = [],bool $includehtml = false,array $inlineattachmentsbypostid = [])   X-Ref
Construct a new post exporter for the specified user and set of post.

param: stdClass        $user The user viewing the forum
param: forum_entity    $forum The forum being viewed
param: discussion_entity $discussion The discussion that the post is in
param: post_entity[]   $posts The set of posts to be exported
param: author_entity[] $authorsbyid List of authors indexed by author id
param: int[]           $authorcontextids List of authors context ids indexed by author id
param: array           $attachmentsbypostid List of attachments for each post indexed by post id
param: array           $groupsbyauthorid List of groups for the post authors indexed by author id
param: post_read_receipt_collection_entity|null $readreceiptcollection Details of read receipts for each post
param: array           $tagsbypostid List of tags for each post indexed by post id
param: rating[]        $ratingbypostid List of ratings for each post indexed by post id
param: bool            $includehtml Include some pre-constructed HTML in the export
param: array           $inlineattachmentsbypostid List of attachments for each post indexed by post id
return: posts_exporter

get_posts_export_structure()   X-Ref
Fetch the structure of the posts exporter.

return: array