MDL-66076 forumreport_summary: Always show viewcount column
authorMichael Hawkins <michaelh@moodle.com>
Tue, 8 Oct 2019 08:33:21 +0000 (16:33 +0800)
committerJun Pataleta <jun@moodle.com>
Fri, 11 Oct 2019 03:09:50 +0000 (11:09 +0800)
Previously this was hidden if filtering by groups, but will now be
visible, along with a disclaimer that the data is not filtered
(since the groups cannot be determined from the logs used).

mod/forum/report/summary/classes/summary_table.php
mod/forum/report/summary/index.php
mod/forum/report/summary/lang/en/forumreport_summary.php

index 91e7e3c..1db6814 100644 (file)
@@ -115,12 +115,9 @@ class summary_table extends table_sql {
             'attachmentcount' => get_string('attachmentcount', 'forumreport_summary'),
         ];
 
-        // Only include viewcount column when no groups filter is applied.
-        if (!$this->is_filtered_by_groups($filters['groups'])) {
-            $this->logreader = $this->get_internal_log_reader();
-            if ($this->logreader) {
-                $columnheaders['viewcount'] = get_string('viewcount', 'forumreport_summary');
-            }
+        $this->logreader = $this->get_internal_log_reader();
+        if ($this->logreader) {
+            $columnheaders['viewcount'] = get_string('viewcount', 'forumreport_summary');
         }
 
         $columnheaders['earliestpost'] = get_string('earliestpost', 'forumreport_summary');
index 14c87dc..78ac735 100644 (file)
@@ -76,6 +76,10 @@ $PAGE->navbar->add(get_string('nodetitle', "forumreport_summary"));
 echo $OUTPUT->header();
 echo $OUTPUT->heading(get_string('summarytitle', 'forumreport_summary', $forumname), 2, 'p-b-2');
 
+if (!empty($filters['groups'])) {
+    \core\notification::info(get_string('viewsdisclaimer', 'forumreport_summary'));
+}
+
 // Render the report filters form.
 $renderer = $PAGE->get_renderer('forumreport_summary');
 echo $renderer->render_filters_form($cm, $url, $filters);
index d3bb447..4d5ac13 100644 (file)
@@ -38,3 +38,4 @@ $string['replycount'] = 'Number of replies posted';
 $string['summary:viewall'] = 'Access summary report data for each user within a given forum or forums';
 $string['summary:view'] = 'Access summary report within a given forum or forums';
 $string['summarytitle'] = 'Summary report - {$a}';
+$string['viewsdisclaimer'] = 'Number of views column is not filtered by group';
\ No newline at end of file