mirror of
https://github.com/moodle/moodle.git
synced 2025-04-21 16:32:18 +02:00
MDL-84555 core_course: add activity_icons to completion bulk editors
This commit is contained in:
parent
e445b12ac9
commit
ec9915b278
@ -26,13 +26,12 @@
|
||||
namespace core_completion;
|
||||
|
||||
use core\context;
|
||||
use core\output\local\properties\iconsize;
|
||||
use core_course\output\activity_icon;
|
||||
use stdClass;
|
||||
use context_course;
|
||||
use cm_info;
|
||||
use tabobject;
|
||||
use lang_string;
|
||||
use moodle_url;
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
/**
|
||||
* Bulk activity completion manager class
|
||||
@ -105,6 +104,7 @@ class manager {
|
||||
* @return array
|
||||
*/
|
||||
public function get_activities($cmids, $withcompletiondetails = false) {
|
||||
$output = \core\di::get(\core\output\renderer_helper::class)->get_core_renderer();
|
||||
$moduleinfo = get_fast_modinfo($this->courseid);
|
||||
$activities = [];
|
||||
foreach ($cmids as $cmid) {
|
||||
@ -112,11 +112,16 @@ class manager {
|
||||
if (!$mod->uservisible) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$icon = activity_icon::from_cm_info($mod)
|
||||
->set_icon_size(iconsize::SIZE5);
|
||||
|
||||
$moduleobject = new stdClass();
|
||||
$moduleobject->cmid = $cmid;
|
||||
$moduleobject->modname = $mod->get_formatted_name();
|
||||
$moduleobject->icon = $mod->get_icon_url()->out();
|
||||
$moduleobject->url = $mod->url;
|
||||
$moduleobject->activityicon = $icon->export_for_template($output);
|
||||
$moduleobject->canmanage = $withcompletiondetails && self::can_edit_bulk_completion($this->courseid, $mod);
|
||||
|
||||
// Get activity completion information.
|
||||
|
@ -15,6 +15,7 @@
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
use core_completion\manager;
|
||||
use core_course\output\activity_icon;
|
||||
|
||||
defined('MOODLE_INTERNAL') || die;
|
||||
|
||||
@ -39,7 +40,7 @@ class core_course_bulk_activity_completion_renderer extends plugin_renderer_base
|
||||
/**
|
||||
* Render the bulk completion tab.
|
||||
*
|
||||
* @param Array|stdClass $data the context data to pass to the template.
|
||||
* @param array|stdClass $data the context data to pass to the template.
|
||||
* @return bool|string
|
||||
*/
|
||||
public function bulkcompletion($data) {
|
||||
@ -78,6 +79,8 @@ class core_course_bulk_activity_completion_renderer extends plugin_renderer_base
|
||||
$module->open = false;
|
||||
}
|
||||
|
||||
$module->activityicon = activity_icon::from_modname($module->name)->export_for_template($this);
|
||||
|
||||
$moduleform = manager::get_module_form($module->name, $course);
|
||||
if ($moduleform) {
|
||||
$module->formhtml = $modform->render();
|
||||
|
@ -36,27 +36,32 @@
|
||||
<div class="row mb-1">
|
||||
<div class="activityinstance col-6">
|
||||
<div class="mod-indent-outer"></div>
|
||||
<div>
|
||||
<div class="d-flex align-items-center align-self-start gap-3 mb-2">
|
||||
{{#canmanage}}
|
||||
<label class="accesshide" for="selectactivity_{{cmid}}">{{#str}}select, completion{{/str}} {{modname}}</label>
|
||||
<input type="checkbox" id="selectactivity_{{cmid}}" class="me-1" name="cmid[]" data-section="{{sectionnumber}}" value="{{cmid}}" aria-label="{{#str}}checkactivity, completion, {{{modname}}}{{/str}}">
|
||||
<input type="checkbox" id="selectactivity_{{cmid}}" name="cmid[]" data-section="{{sectionnumber}}" value="{{cmid}}" aria-label="{{#str}}checkactivity, completion, {{{modname}}}{{/str}}">
|
||||
{{/canmanage}}
|
||||
<a href="{{url}}">
|
||||
<img src="{{icon}}" class="activityicon" alt="">
|
||||
<span class="instancename">{{{modname}}}</span>
|
||||
<a href="{{url}}" class="activityiconcontainer">
|
||||
{{#activityicon}}
|
||||
{{> core_course/activity_icon}}
|
||||
{{/activityicon}}
|
||||
{{^activityicon}}
|
||||
<img src="{{icon}}" class="activityicon" alt="">
|
||||
{{/activityicon}}
|
||||
<span class="instancename">{{{modname}}}</span>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activity-completionstatus col-6" id="completionstatus_{{cmid}}">
|
||||
<div class="col-sm-1 ps-0">
|
||||
<div class="activity-completionstatus col-6 d-flex align-items-start gap-1" id="completionstatus_{{cmid}}">
|
||||
<div>
|
||||
{{#completionstatus.icon}}
|
||||
{{{completionstatus.icon}}}
|
||||
{{/completionstatus.icon}}
|
||||
{{^completionstatus.icon}}
|
||||
<span class="me-3"></span>
|
||||
<span class="me-4"> </span>
|
||||
{{/completionstatus.icon}}
|
||||
</div>
|
||||
<div class="col-sm-11 ps-0">
|
||||
<div>
|
||||
<span class="text-muted muted">{{{completionstatus.string}}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -50,7 +50,7 @@
|
||||
</div>
|
||||
<div class="row mb-1">
|
||||
<div class="col-6">
|
||||
<input type="checkbox" class="mastercheck me-1" aria-label="{{#str}}checkall, completion{{/str}}">
|
||||
<input type="checkbox" class="mastercheck me-3" aria-label="{{#str}}checkall, completion{{/str}}">
|
||||
<label class="fw-bold">{{#str}}activitieslabel, core_completion{{/str}}</label>
|
||||
</div>
|
||||
<div class="col-6">
|
||||
@ -64,7 +64,7 @@
|
||||
<div class="mb-1">
|
||||
<div class="row mb-1">
|
||||
<div class="col-sm-12">
|
||||
<input type="checkbox" data-section-master="{{sectionnumber}}" class="me-1" aria-label="{{#str}}checkallsection, completion, {{{name}}}{{/str}}">
|
||||
<input type="checkbox" data-section-master="{{sectionnumber}}" class="me-3" aria-label="{{#str}}checkallsection, completion, {{{name}}}{{/str}}">
|
||||
<h3 class="d-inline-block">{{{name}}}</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -48,7 +48,9 @@
|
||||
{{#canmanage}}
|
||||
{{<core/local/collapsable_section}}
|
||||
{{$titlecontent}}
|
||||
<img class="activityicon ms-2" src="{{icon}}" alt="" aria-hidden="true">
|
||||
{{#activityicon}}
|
||||
{{>core_course/activity_icon}}
|
||||
{{/activityicon}}
|
||||
<span class="activityname ms-3 mb-0">{{{formattedname}}}</span>
|
||||
{{/titlecontent}}
|
||||
{{$elementid}}activitycompletioncollapse-{{id}}{{/elementid}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user