MDL-66722 forum: Add the grading component information

Part of MDL-66074
This commit is contained in:
Andrew Nicols
2019-10-30 10:23:40 +08:00
committed by Mathew May
parent 9adedccd2b
commit 09f92d6644
3 changed files with 15 additions and 0 deletions
@@ -26,6 +26,7 @@ namespace mod_forum\local\factories;
defined('MOODLE_INTERNAL') || die();
use mod_forum\grades\forum_gradeitem;
use mod_forum\local\entities\discussion as discussion_entity;
use mod_forum\local\entities\forum as forum_entity;
use mod_forum\local\factories\vault as vault_factory;
@@ -455,6 +456,7 @@ class renderer {
$this->builderfactory,
$capabilitymanager,
$this->urlfactory,
forum_gradeitem::load_from_forum_entity($forum),
$template,
$notifications,
function($discussions, $user, $forum) {
@@ -494,6 +496,7 @@ class renderer {
$this->builderfactory,
$capabilitymanager,
$this->urlfactory,
forum_gradeitem::load_from_forum_entity($forum),
$template,
$notifications,
function($discussions, $user, $forum) use ($capabilitymanager) {
@@ -26,6 +26,7 @@ namespace mod_forum\local\renderers;
defined('MOODLE_INTERNAL') || die();
use mod_forum\grades\forum_gradeitem;
use mod_forum\local\entities\forum as forum_entity;
use mod_forum\local\factories\legacy_data_mapper as legacy_data_mapper_factory;
use mod_forum\local\factories\exporter as exporter_factory;
@@ -84,6 +85,9 @@ class discussion_list {
/** @var string $template The template to use when displaying */
private $template;
/** @var gradeitem The gradeitem instance associated with this forum */
private $forumgradeitem;
/**
* Constructor for a new discussion list renderer.
*
@@ -108,6 +112,7 @@ class discussion_list {
builder_factory $builderfactory,
capability_manager $capabilitymanager,
url_factory $urlfactory,
forum_gradeitem $forumgradeitem,
string $template,
array $notifications = [],
callable $postprocessfortemplate = null
@@ -124,6 +129,7 @@ class discussion_list {
$this->notifications = $notifications;
$this->postprocessfortemplate = $postprocessfortemplate;
$this->template = $template;
$this->forumgradeitem = $forumgradeitem;
$forumdatamapper = $this->legacydatamapperfactory->get_forum_data_mapper();
$this->forumrecord = $forumdatamapper->to_legacy_object($forum);
@@ -168,7 +174,10 @@ class discussion_list {
$forumview = [
'forum' => (array) $forumexporter->export($this->renderer),
'contextid' => $forum->get_context()->id,
'cmid' => $cm->id,
'gradingcomponent' => $this->forumgradeitem->get_grading_component_name(),
'gradingcomponentsubtype' => $this->forumgradeitem->get_grading_component_subtype(),
'hasanyactions' => $hasanyactions,
'groupchangemenu' => groups_print_activity_menu(
$cm,
@@ -33,8 +33,11 @@
}
}}
<div id="discussion-list-{{uniqid}}" {{!
}}data-contextid="{{contextid}}" {{!
}}data-cmid="{{cmid}}" {{!
}}data-group="{{forum.groupid}}" {{!
}}data-grading-component="{{gradingcomponent}}" {{!
}}data-grading-component-subtype="{{gradingcomponentsubtype}}" {{!
}}data-gradable-itemtype="forum" {{!
}}{{#firstgradeduserid}}data-initialuserid="{{firstgradeduserid}}" {{/firstgradeduserid}}{{!
}}>