MDL-78117 comment: use new context entity in system report.

This commit is contained in:
Paul Holden 2023-07-20 15:37:01 +01:00
parent d8df4ad675
commit ca6731dff7
No known key found for this signature in database
GPG Key ID: A81A96D6045F6164

View File

@ -23,6 +23,7 @@ use lang_string;
use moodle_url;
use pix_icon;
use stdClass;
use core\reportbuilder\local\entities\context;
use core_reportbuilder\system_report;
use core_reportbuilder\local\entities\user;
use core_reportbuilder\local\report\action;
@ -53,6 +54,13 @@ class comments extends system_report {
return [$row->id, get_string('select')];
});
// Join the context entity.
$contextentity = (new context())
->set_table_alias('context', $commententity->get_table_alias('context'));
$this->add_entity($contextentity
->add_join($commententity->get_context_join())
);
// Join the user entity to the comment userid (author).
$userentity = new user();
$useralias = $userentity->get_table_alias('user');
@ -82,7 +90,7 @@ class comments extends system_report {
$this->add_columns_from_entities([
'user:fullnamewithlink',
'comment:content',
'comment:contexturl',
'context:link',
'comment:timecreated',
]);