Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

Differences Between: [Versions 310 and 311] [Versions 311 and 400] [Versions 311 and 401] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]

Discussion list renderer.

Copyright: 2019 Andrew Nicols <andrew@nicols.co.uk>
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 400 lines (16 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

discussion_list:: (6 methods):
  __construct()
  render()
  get_discussion_form()
  get_page_size()
  get_page_number()
  get_notifications()


Class: discussion_list  - X-Ref

The discussion list renderer.

__construct(forum_entity $forum,renderer_base $renderer,legacy_data_mapper_factory $legacydatamapperfactory,exporter_factory $exporterfactory,vault_factory $vaultfactory,builder_factory $builderfactory,capability_manager $capabilitymanager,url_factory $urlfactory,forum_gradeitem $forumgradeitem,string $template,array $notifications = [],callable $postprocessfortemplate = null)   X-Ref
Constructor for a new discussion list renderer.

param: forum_entity        $forum The forum entity to be rendered
param: renderer_base       $renderer The renderer used to render the view
param: legacy_data_mapper_factory $legacydatamapperfactory The factory used to fetch a legacy record
param: exporter_factory    $exporterfactory The factory used to fetch exporter instances
param: vault_factory       $vaultfactory The factory used to fetch the vault instances
param: builder_factory     $builderfactory The factory used to fetch the builder instances
param: capability_manager  $capabilitymanager The managed used to check capabilities on the forum
param: url_factory         $urlfactory The factory used to create URLs in the forum
param: string              $template
param: notification[]      $notifications A list of any notifications to be displayed within the page
param: callable|null       $postprocessfortemplate Callback function to process discussion lists for templates

render(stdClass $user,\cm_info $cm,?int $groupid,?int $sortorder,?int $pageno,?int $pagesize,int $displaymode = null)   X-Ref
Render for the specified user.

param: stdClass    $user The user to render for
param: cm_info     $cm The course module info for this discussion list
param: int         $groupid The group to render
param: int         $sortorder The sort order to use when selecting the discussions in the list
param: int         $pageno The zero-indexed page number to use
param: int         $pagesize The number of discussions to show on the page
param: int         $displaymode The discussion display mode
return: string      The rendered content for display

get_discussion_form(stdClass $user, \cm_info $cm, ?int $groupid)   X-Ref
Get the mod_forum_post_form. This is the default boiler plate from mod_forum/post_form.php with the inpage flag caveat

param: stdClass $user The user the form is being generated for
param: \cm_info $cm
param: int $groupid The groupid if any
return: string The rendered html

get_page_size(?int $pagesize)   X-Ref
Fetch the page size to use when displaying the page.

param: int         $pagesize The number of discussions to show on the page
return: int         The normalised page size

get_page_number(?int $pageno)   X-Ref
Fetch the current page number (zero-indexed).

param: int         $pageno The zero-indexed page number to use
return: int         The normalised page number

get_notifications(stdClass $user, ?int $groupid)   X-Ref
Get the list of notification for display.

param: stdClass $user The viewing user
param: int|null $groupid The forum's group id
return: array