From 74d9dbf6969c4e6877cb7a23a544c9bb5d706b5c Mon Sep 17 00:00:00 2001 From: Simey Lameze Date: Mon, 2 Sep 2019 06:59:03 +0800 Subject: [PATCH] MDL-66455 calendar: show site level subscriptions --- calendar/managesubscriptions.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/calendar/managesubscriptions.php b/calendar/managesubscriptions.php index 2bc85428dde..9c6af0adacc 100644 --- a/calendar/managesubscriptions.php +++ b/calendar/managesubscriptions.php @@ -127,7 +127,8 @@ $searches = []; $params = []; $usedefaultfilters = true; -if (!empty($courseid) && $courseid == SITEID && !empty($types['site'])) { + +if (!empty($types['site'])) { $searches[] = "(eventtype = 'site')"; $usedefaultfilters = false; } @@ -144,9 +145,14 @@ if (!empty($courseid) && !empty($types['course'])) { $usedefaultfilters = false; } -if (!empty($categoryid) && !empty($types['category'])) { - $searches[] = "(eventtype = 'category' AND categoryid = :categoryid)"; - $params += ['categoryid' => $categoryid]; +if (!empty($types['category'])) { + if (!empty($categoryid)) { + $searches[] = "(eventtype = 'category' AND categoryid = :categoryid)"; + $params += ['categoryid' => $categoryid]; + } else { + $searches[] = "(eventtype = 'category')"; + } + $usedefaultfilters = false; }