From b84f79ec8071700e24c4a831b3c1dcd92911b99d Mon Sep 17 00:00:00 2001 From: Mihail Geshoski Date: Thu, 16 May 2019 11:49:37 +0800 Subject: [PATCH] MDL-65607 forum: Add prefix to forum global functions --- .../classes/local/renderers/discussion_list.php | 6 +++--- mod/forum/externallib.php | 2 +- mod/forum/lib.php | 12 ++++++------ 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/mod/forum/classes/local/renderers/discussion_list.php b/mod/forum/classes/local/renderers/discussion_list.php index 0baad52722d..10b1d5ce41c 100644 --- a/mod/forum/classes/local/renderers/discussion_list.php +++ b/mod/forum/classes/local/renderers/discussion_list.php @@ -155,10 +155,10 @@ class discussion_list { $pageno = $this->get_page_number($pageno); // Count all forum discussion posts. - $alldiscussionscount = get_count_all_discussions($forum, $user, $groupid); + $alldiscussionscount = mod_forum_count_all_discussions($forum, $user, $groupid); - // Get all forum discussions posts. - $discussions = get_discussions($forum, $user, $groupid, $sortorder, $pageno, $pagesize); + // Get all forum discussion summaries. + $discussions = mod_forum_get_discussion_summaries($forum, $user, $groupid, $sortorder, $pageno, $pagesize); $forumview = [ 'forum' => (array) $forumexporter->export($this->renderer), diff --git a/mod/forum/externallib.php b/mod/forum/externallib.php index 200d05ae339..4f5ab14048b 100644 --- a/mod/forum/externallib.php +++ b/mod/forum/externallib.php @@ -852,7 +852,7 @@ class mod_forum_external extends external_api { throw new moodle_exception('noviewdiscussionspermission', 'forum'); } - $alldiscussions = get_discussions($forum, $USER, $groupid, $sortorder, $page, $perpage); + $alldiscussions = mod_forum_get_discussion_summaries($forum, $USER, $groupid, $sortorder, $page, $perpage); if ($alldiscussions) { $discussionids = array_keys($alldiscussions); diff --git a/mod/forum/lib.php b/mod/forum/lib.php index 43dc53e9014..77631482ac1 100644 --- a/mod/forum/lib.php +++ b/mod/forum/lib.php @@ -6756,9 +6756,9 @@ function mod_forum_core_calendar_event_timestart_updated(\calendar_event $event, * @param int|null $sortorder The sort order to use when selecting the discussions in the list * @param int|null $pageno The zero-indexed page number to use * @param int|null $pagesize The number of discussions to show on the page - * @return stdClass The data to use for display + * @return array The data to use for display */ -function get_discussions(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid, ?int $sortorder, +function mod_forum_get_discussion_summaries(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid, ?int $sortorder, ?int $pageno = 0, ?int $pagesize = 0) { $vaultfactory = mod_forum\local\container::get_vault_factory(); @@ -6766,7 +6766,7 @@ function get_discussions(\mod_forum\local\entities\forum $forum, stdClass $user, $managerfactory = mod_forum\local\container::get_manager_factory(); $capabilitymanager = $managerfactory->get_capability_manager($forum); - $groupids = get_groups_from_groupid($forum, $user, $groupid); + $groupids = mod_forum_get_groups_from_groupid($forum, $user, $groupid); if (null === $groupids) { return $discussions = $discussionvault->get_from_forum_id( @@ -6796,14 +6796,14 @@ function get_discussions(\mod_forum\local\entities\forum $forum, stdClass $user, * @param int $groupid The group to render * @return int The number of discussions in a forum */ -function get_count_all_discussions(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) { +function mod_forum_count_all_discussions(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) { $managerfactory = mod_forum\local\container::get_manager_factory(); $capabilitymanager = $managerfactory->get_capability_manager($forum); $vaultfactory = mod_forum\local\container::get_vault_factory(); $discussionvault = $vaultfactory->get_discussions_in_forum_vault(); - $groupids = get_groups_from_groupid($forum, $user, $groupid); + $groupids = mod_forum_get_groups_from_groupid($forum, $user, $groupid); if (null === $groupids) { return $discussionvault->get_total_discussion_count_from_forum_id( @@ -6827,7 +6827,7 @@ function get_count_all_discussions(\mod_forum\local\entities\forum $forum, stdCl * @param int $groupid The groupid requested * @return array The list of groups to show */ -function get_groups_from_groupid(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) : ?array { +function mod_forum_get_groups_from_groupid(\mod_forum\local\entities\forum $forum, stdClass $user, ?int $groupid) : ?array { $effectivegroupmode = $forum->get_effective_group_mode(); if (empty($effectivegroupmode)) {