mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
MDL-83892 course: fix section name in single activity format
The course activities overview shows the section name under each activity. However, this information should not be present when the course format does not support sections.
This commit is contained in:
parent
a26db489d0
commit
fd905bcacc
3 changed files with 17 additions and 5 deletions
|
@ -53,13 +53,17 @@ class activityname implements renderable, named_templatable {
|
||||||
$section = $this->cm->get_section_info();
|
$section = $this->cm->get_section_info();
|
||||||
$course = $this->cm->get_course();
|
$course = $this->cm->get_course();
|
||||||
$format = course_format::instance($course);
|
$format = course_format::instance($course);
|
||||||
return (object) [
|
|
||||||
|
$result = (object) [
|
||||||
'activityname' => \core_external\util::format_string($cm->name, $cm->context, true),
|
'activityname' => \core_external\util::format_string($cm->name, $cm->context, true),
|
||||||
'activityurl' => $cm->url,
|
'activityurl' => $cm->url,
|
||||||
'sectiontitle' => $format->get_section_name($section),
|
|
||||||
'hidden' => empty($cm->visible),
|
'hidden' => empty($cm->visible),
|
||||||
'stealth' => $cm->is_stealth(),
|
'stealth' => $cm->is_stealth(),
|
||||||
];
|
];
|
||||||
|
if ($format->uses_sections()) {
|
||||||
|
$result->sectiontitle = $format->get_section_name($section);
|
||||||
|
}
|
||||||
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -32,15 +32,23 @@
|
||||||
<div class="fw-bold">
|
<div class="fw-bold">
|
||||||
<a href="{{activityurl}}" class="activityname">{{activityname}}</a>
|
<a href="{{activityurl}}" class="activityname">{{activityname}}</a>
|
||||||
</div>
|
</div>
|
||||||
|
{{#sectiontitle}}
|
||||||
<div>
|
<div>
|
||||||
{{sectiontitle}}
|
{{sectiontitle}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/sectiontitle}}
|
||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
{{#hidden}}
|
{{#hidden}}
|
||||||
<span class="badge badge-success">{{#str}}hiddenfromstudents{{/str}}</span>
|
<span class="badge rounded-pill text-bg-secondary fw-normal">
|
||||||
|
{{#pix}}i/show, core{{/pix}}
|
||||||
|
{{#str}}hiddenfromstudents{{/str}}
|
||||||
|
</span>
|
||||||
{{/hidden}}
|
{{/hidden}}
|
||||||
{{#stealth}}
|
{{#stealth}}
|
||||||
<span class="badge badge-warning">{{#str}}hiddenoncoursepage{{/str}}</span>
|
<span class="badge rounded-pill text-bg-secondary fw-normal">
|
||||||
|
{{#pix}}t/stealth, core{{/pix}}
|
||||||
|
{{#str}}hiddenoncoursepage{{/str}}
|
||||||
|
</span>
|
||||||
{{/stealth}}
|
{{/stealth}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -72,7 +72,7 @@
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
<div class="course-overview border border-secondary border-1 rounded">
|
<div class="course-overview border border-secondary border-1 rounded pt-2">
|
||||||
<table
|
<table
|
||||||
class="course-overview-table boxaligncenter {{!
|
class="course-overview-table boxaligncenter {{!
|
||||||
}} table table-responsive w-100 d-block d-md-table"
|
}} table table-responsive w-100 d-block d-md-table"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue