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]

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: 425 lines (17 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

discussion_list:: (7 methods):
  __construct()
  render()
  render_new_discussion()
  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,bool $enablediscussioncreation = true)   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
param: bool        $enablediscussioncreation To show the discussion button.
return: string      The rendered content for display

render_new_discussion(stdClass $user, ?int $groupid)   X-Ref
Add new discussion button to the action bar for tertiary nav.

param: stdClass $user The user object.
param: int|null $groupid The group id.
return: string rendered HTML string

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