Support for filters and html in gradable names

This commit is contained in:
PMKuipers 2023-10-07 23:19:54 +02:00
parent e50fca0204
commit 405d76367c
7 changed files with 23 additions and 19 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1065,7 +1065,7 @@ export default {
<tr v-for="g in value.course.grades">
<td><span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span
><a
:href="(!guestmode)?(g.link):undefined" target="_blank" :title="g.name">{{g.name}}</a>
:href="(!guestmode)?(g.link):undefined" target="_blank"><span v-html="g.name"></span></a>
<abbr v-if="useRequiredGrades && g.required" :title="text.required_goal"
:class="'s-required ' + g.completion"
><i class='fa fa-asterisk' ></i
@ -1687,7 +1687,7 @@ export default {
<td><span class="r-activity-icon" :title="g.typename" v-html="g.icon"></span
><a
:href="g.gradinglink"
target="_blank" :title="g.name">{{g.name}}</a>
target="_blank" :title="g.name"><span v-html="g.name"></span></a>
<s-edit-mod
:title="value.fullname"
@saved="(fd) => g.name = fd.get('name')"

View File

@ -450,7 +450,7 @@ export default {
<span class='t-advanced-coursename'>{{c.course.fullname}}</span>
<ul v-if="c.grades.length > 0">
<li v-for='g in c.grades'>
<span class='t-advanced-gradename'>{{g.name}}</span>
<span class='t-advanced-gradename'><span v-html="g.name"></span></span>
<span v-if="g.changed == 'converted'" class='t-advanced-status changed'
>{{text.advanced_converted}}</span
><span v-else-if="g.changed == 'skipped'" class='t-advanced-status skipped'
@ -3341,7 +3341,7 @@ export default {
v-if="g.cmid > 0"
:cmid="g.cmid"
:coursectxid="value.course.ctxid"
genericonly>{{g.name}}</s-edit-mod>
genericonly><span v-html="g.name"></span></s-edit-mod>
</li>
</ul>
</b-form-group>

View File

@ -176,6 +176,13 @@ class gradeinfo {
$contentitem = static::get_contentitem($gi->itemmodule);
$this->icon = empty($contentitem) ? "" : $contentitem->get_icon();
$this->scale = $gi->load_scale();
$this->outcome = $gi->load_outcome();
$this->hidden = ($gi->hidden || (!empty($outcome) && $outcome->hidden)) ? true : false;
$this->name = empty($outcome) ? $gi->itemname : $outcome->name;
// Determine a link to the associated activity.
if ($gi->itemtype != "mod" || empty($gi->itemmodule) || empty($gi->iteminstance)) {
$this->link = "";
@ -191,6 +198,8 @@ class gradeinfo {
$ssequence = self::get_sectionsequence($cminfo->section);
$this->sectionorder = array_search($cminfo->id, $ssequence);
$this->name = $cminfo->get_formatted_name();
$this->link = "/mod/{$gi->itemmodule}/view.php?id={$cminfo->id}";
if ($gi->itemmodule == 'quiz') {
$this->gradinglink = "/mod/{$gi->itemmodule}/report.php?id={$cminfo->id}&mode=grading";
@ -201,12 +210,7 @@ class gradeinfo {
}
}
$this->scale = $gi->load_scale();
$this->outcome = $gi->load_outcome();
$this->hidden = ($gi->hidden || (!empty($outcome) && $outcome->hidden)) ? true : false;
$this->name = empty($outcome) ? $gi->itemname : $outcome->name;
$this->typename = empty($contentitem) ? $gi->itemmodule : $contentitem->get_title()->get_value();
$this->gradingscanner = new gradingscanner($gi);
@ -260,13 +264,13 @@ class gradeinfo {
return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'grade_item id'),
"cmid" => new \external_value(PARAM_INT, 'course module id'),
"name" => new \external_value(PARAM_TEXT, 'grade item name'),
"name" => new \external_value(PARAM_RAW, 'grade item name'),
"typename" => new \external_value(PARAM_TEXT, 'grade item type name'),
"outcome" => new \external_value(PARAM_BOOL, 'is outcome'),
"selected" => new \external_value(PARAM_BOOL, 'is selected for current studyitem'),
"icon" => new \external_value(PARAM_RAW, 'html for icon of related activity'),
"link" => new \external_value(PARAM_TEXT, 'link to related activity'),
"gradinglink" => new \external_value(PARAM_TEXT, 'link to related activity'),
"link" => new \external_value(PARAM_RAW, 'link to related activity'),
"gradinglink" => new \external_value(PARAM_RAW, 'link to related activity'),
"grading" => gradingscanner::structure(),
"required" => new \external_value(PARAM_BOOL, 'is required for current studyitem'),
], 'referenced course information', $value);
@ -312,14 +316,14 @@ class gradeinfo {
return new \external_single_structure([
"id" => new \external_value(PARAM_INT, 'grade_item id'),
"cmid" => new \external_value(PARAM_INT, 'course module id'),
"name" => new \external_value(PARAM_TEXT, 'grade item name'),
"name" => new \external_value(PARAM_RAW, 'grade item name'),
"typename" => new \external_value(PARAM_TEXT, 'grade item type name'),
"grade" => new \external_value(PARAM_TEXT, 'is outcome'),
"grade" => new \external_value(PARAM_TEXT, 'grade value'),
"gradetype" => new \external_value(PARAM_TEXT, 'grade type (completion|grade)'),
"feedback" => new \external_value(PARAM_RAW, 'html for feedback'),
"completion" => new \external_value(PARAM_TEXT, 'completion state (incomplete|progress|completed|excellent)'),
"icon" => new \external_value(PARAM_RAW, 'html for icon of related activity'),
"link" => new \external_value(PARAM_TEXT, 'link to related activity'),
"link" => new \external_value(PARAM_RAW, 'link to related activity'),
"pendingsubmission" => new \external_value(PARAM_BOOL, 'is selected for current studyitem', VALUE_OPTIONAL),
"required" => new \external_value(PARAM_BOOL, 'is required for current studyitem'),
"selected" => new \external_value(PARAM_BOOL, 'is selected for current studyitem'),