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.

A URL factory for the forum.

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

Defines 1 class


Class: url  - X-Ref

A URL factory for the forum.

__construct(legacy_data_mapper_factory $legacydatamapperfactory)   X-Ref
Constructor.

param: legacy_data_mapper_factory $legacydatamapperfactory Legacy data mapper factory

get_course_url_from_courseid(int $courseid)   X-Ref
Get the course url from the given course id.

param: int $courseid The course id
return: moodle_url

get_course_url_from_forum(forum_entity $forum)   X-Ref
Get the course url from the given forum entity.

param: forum_entity $forum The forum entity
return: moodle_url

get_discussion_create_url(forum_entity $forum)   X-Ref
Get the create discussion url for the given forum.

param: forum_entity $forum The forum entity
return: moodle_url

get_forum_view_url_from_forum(forum_entity $forum, ?int $pageno = null,?int $sortorder = null)   X-Ref
Get the view forum url for the given forum and optionally a page number.

param: forum_entity $forum The forum entity
param: int|null $pageno The page number
param: int|null $sortorder The sorting order
return: moodle_url

get_forum_view_url_from_course_module_id(int $coursemoduleid, ?int $pageno = null,?int $sortorder = null)   X-Ref
Get the view forum url for the given course module id and optionally a page number.

param: int $coursemoduleid The course module id
param: int|null $pageno The page number
param: int|null $sortorder The sorting order
return: moodle_url

get_discussion_view_url_from_discussion_id(int $discussionid)   X-Ref
Get the view discussion url from the given discussion id.

param: int $discussionid The discussion id
return: moodle_url

get_discussion_view_url_from_discussion(discussion_entity $discussion)   X-Ref
Get the view discussion url from the given discussion.

param: discussion_entity $discussion The discussion
return: moodle_url

get_discussion_view_first_unread_post_url_from_discussion(discussion_entity $discussion)   X-Ref
Get the url to view the first unread post in a discussion.

param: discussion_entity $discussion The discussion
return: moodle_url

get_discussion_view_latest_post_url_from_discussion(discussion_entity $discussion, ?int $latestpost)   X-Ref
Get the url to view the latest post in a discussion.

param: discussion_entity $discussion The discussion
param: int|null $latestpost The id of the latest post
return: moodle_url

get_discussion_view_url_from_post(post_entity $post)   X-Ref
Get the url to view a discussion from a post.

param: post_entity $post The post
return: moodle_url

get_view_post_url_from_post_id(int $discussionid, int $postid)   X-Ref
Get the url to view a discussion from a discussion id and post id.

param: int $discussionid The discussion id
param: int $postid The post id
return: moodle_url

get_view_post_url_from_post(post_entity $post)   X-Ref
Get the url to view a post in the context of the rest of the discussion.

param: post_entity $post The post
return: moodle_url

get_view_isolated_post_url_from_post_id(int $discussionid, int $postid)   X-Ref
Get the url to view a post and it's replies in isolation without the rest of the
discussion.

param: int $discussionid The discussion id
param: int $postid The post id
return: moodle_url

get_view_isolated_post_url_from_post(post_entity $post)   X-Ref
Get the url to view a post and it's replies in isolation without the rest of the
discussion.

param: post_entity $post The post
return: moodle_url

get_edit_post_url_from_post(forum_entity $forum, post_entity $post)   X-Ref
Get the url to edit a post.

param: forum_entity $forum The forum the post belongs to
param: post_entity $post The post
return: moodle_url

get_split_discussion_at_post_url_from_post(post_entity $post)   X-Ref
Get the url to split a discussion at a post.

param: post_entity $post The post
return: moodle_url

get_delete_post_url_from_post(post_entity $post)   X-Ref
Get the url to delete a post.

param: post_entity $post The post
return: moodle_url

get_reply_to_post_url_from_post(post_entity $post)   X-Ref
Get the url to reply to a post.

param: post_entity $post The post
return: moodle_url

get_export_post_url_from_post(post_entity $post)   X-Ref
Get the url to export (see portfolios) a post.

param: post_entity $post The post
return: moodle_url

get_mark_post_as_read_url_from_post(post_entity $post, int $displaymode = FORUM_MODE_THREADED)   X-Ref
Get the url to mark a post as read.

param: post_entity $post The post
param: int $displaymode The display mode to show the forum in after marking as read
return: moodle_url

get_mark_post_as_unread_url_from_post(post_entity $post, int $displaymode = FORUM_MODE_THREADED)   X-Ref
Get the url to mark a post as unread.

param: post_entity $post The post
param: int $displaymode The display mode to show the forum in after marking as unread
return: moodle_url

get_export_attachment_url_from_post_and_attachment(post_entity $post, stored_file $attachment)   X-Ref
Get the url to export attachments for a post.

param: post_entity $post The post
param: stored_file $attachment
return: moodle_url|null

get_author_profile_url(author_entity $author, int $courseid)   X-Ref
Get the url to view an author's profile.

param: author_entity $author The author
param: int $courseid The course id
return: moodle_url

get_author_profile_image_url(author_entity $author,int $authorcontextid = null,int $size = 100)   X-Ref
Get the url to view the author's profile image. The author's context id should be
provided to prevent the code from needing to load it.

param: author_entity $author The author
param: int|null $authorcontextid The author context id
param: int $size The size of the image to return
return: moodle_url

get_author_group_url(\stdClass $group)   X-Ref
Get the url to view an author's group.

param: \stdClass $group The group
return: moodle_url

get_mark_discussion_as_read_url_from_discussion(forum_entity $forum,discussion_entity $discussion)   X-Ref
Get the url to mark a discussion as read.

param: forum_entity $forum The forum that the discussion belongs to
param: discussion_entity $discussion The discussion
return: moodle_url

get_mark_all_discussions_as_read_url(forum_entity $forum)   X-Ref
Get the url to mark all discussions as read.

param: forum_entity $forum The forum that the discussions belong to
return: moodle_url

get_discussion_subscribe_url(discussion_entity $discussion)   X-Ref
Get the url to subscribe to a discussion.

param: discussion_entity $discussion The discussion
return: moodle_url

get_pin_discussion_url_from_discussion(discussion_entity $discussion)   X-Ref
Generate the pinned discussion link

param: discussion_entity $discussion
return: moodle_url