diff --git a/blocks/site_main_menu/styles.css b/blocks/site_main_menu/styles.css index e1891e55e0c..4e1c6ecad1d 100644 --- a/blocks/site_main_menu/styles.css +++ b/blocks/site_main_menu/styles.css @@ -6,6 +6,7 @@ /* Made specific to win over .block.list_block .unlist > li > .column. */ width: 100%; display: table; + margin-bottom: 0.5rem; } .block_site_main_menu li .buttons a img { diff --git a/course/classes/local/entity/content_item.php b/course/classes/local/entity/content_item.php index cd7c264d4ee..25cc7e38a44 100644 --- a/course/classes/local/entity/content_item.php +++ b/course/classes/local/entity/content_item.php @@ -57,6 +57,9 @@ class content_item { /** @var string $componentname the name of the component from which this content item originates. */ private $componentname; + /** @var string $purpose the purpose type of this component. */ + private $purpose; + /** * The content_item constructor. * @@ -68,9 +71,10 @@ class content_item { * @param string $help The description of the item. * @param int $archetype the archetype for the content item (see MOD_ARCHETYPE_X definitions in lib/moodlelib.php). * @param string $componentname the name of the component/plugin with which this content item is associated. + * @param string $purpose the purpose type of this component. */ public function __construct(int $id, string $name, title $title, \moodle_url $link, string $icon, string $help, - int $archetype, string $componentname) { + int $archetype, string $componentname, string $purpose) { $this->id = $id; $this->name = $name; $this->title = $title; @@ -79,6 +83,7 @@ class content_item { $this->help = $help; $this->archetype = $archetype; $this->componentname = $componentname; + $this->purpose = $purpose; } /** @@ -151,4 +156,13 @@ class content_item { public function get_icon(): string { return $this->icon; } + + /** + * Get purpose for this item. + * + * @return string + */ + public function get_purpose(): string { + return $this->purpose; + } } diff --git a/course/classes/local/exporters/course_content_item_exporter.php b/course/classes/local/exporters/course_content_item_exporter.php index fb88964b0db..1d3ca9be795 100644 --- a/course/classes/local/exporters/course_content_item_exporter.php +++ b/course/classes/local/exporters/course_content_item_exporter.php @@ -68,6 +68,7 @@ class course_content_item_exporter extends exporter { 'help' => ['type' => PARAM_RAW, 'description' => 'Html description / help for the content item'], 'archetype' => ['type' => PARAM_RAW, 'description' => 'The archetype of the module exposing the content item'], 'componentname' => ['type' => PARAM_TEXT, 'description' => 'The name of the component exposing the content item'], + 'purpose' => ['type' => PARAM_TEXT, 'description' => 'The purpose of the component exposing the content item'], ]; } @@ -136,7 +137,8 @@ class course_content_item_exporter extends exporter { 'componentname' => $this->contentitem->get_component_name(), 'favourite' => $favourite, 'legacyitem' => ($this->contentitem->get_id() == -1), - 'recommended' => $recommended + 'recommended' => $recommended, + 'purpose' => $this->contentitem->get_purpose() ]; return $properties; diff --git a/course/classes/local/repository/content_item_readonly_repository.php b/course/classes/local/repository/content_item_readonly_repository.php index aa876f3a175..1b361658288 100644 --- a/course/classes/local/repository/content_item_readonly_repository.php +++ b/course/classes/local/repository/content_item_readonly_repository.php @@ -94,9 +94,9 @@ class content_item_readonly_repository implements content_item_readonly_reposito // modname:link, i.e. lti:http://etc... // We need to grab the module name out to create the componentname. $modname = (strpos($item->name, ':') !== false) ? explode(':', $item->name)[0] : $item->name; - + $purpose = plugin_supports('mod', $modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER); return new content_item($item->id, $item->name, $item->title, $item->link, $item->icon, $item->help ?? '', - $item->archetype, 'mod_' . $modname); + $item->archetype, 'mod_' . $modname, $purpose); } /** @@ -202,16 +202,18 @@ class content_item_readonly_repository implements content_item_readonly_reposito // If the module chooses to implement the hook, this may be thrown away. $help = $this->get_core_module_help_string($mod->name); $archetype = plugin_supports('mod', $mod->name, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); + $purpose = plugin_supports('mod', $mod->name, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER); $contentitem = new content_item( $mod->id, $mod->name, new lang_string_title("modulename", $mod->name), new \moodle_url(''), // No course scope, so just an empty link. - $OUTPUT->pix_icon('icon', '', $mod->name, ['class' => 'icon']), + $OUTPUT->pix_icon('icon', '', $mod->name, ['class' => 'icon activityicon']), $help, $archetype, - 'mod_' . $mod->name + 'mod_' . $mod->name, + $purpose, ); $modcontentitemreference = clone($contentitem); @@ -265,16 +267,18 @@ class content_item_readonly_repository implements content_item_readonly_reposito // If the module chooses to implement the hook, this may be thrown away. $help = $this->get_core_module_help_string($mod->name); $archetype = plugin_supports('mod', $mod->name, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER); + $purpose = plugin_supports('mod', $mod->name, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER); $contentitem = new content_item( $mod->id, $mod->name, new lang_string_title("modulename", $mod->name), new \moodle_url($urlbase, ['add' => $mod->name]), - $OUTPUT->pix_icon('icon', '', $mod->name, ['class' => 'icon']), + $OUTPUT->pix_icon('icon', '', $mod->name, ['class' => 'icon activityicon']), $help, $archetype, - 'mod_' . $mod->name + 'mod_' . $mod->name, + $purpose, ); // Legacy vs new hooks. diff --git a/course/format/classes/output/local/content/cm/title.php b/course/format/classes/output/local/content/cm/title.php index d6375345dfc..6abb90aefaf 100644 --- a/course/format/classes/output/local/content/cm/title.php +++ b/course/format/classes/output/local/content/cm/title.php @@ -110,6 +110,7 @@ class title implements renderable, templatable { 'pluginname' => get_string('pluginname', 'mod_' . $mod->modname), 'linkclasses' => $displayoptions['linkclasses'], 'textclasses' => $displayoptions['textclasses'], + 'purpose' => plugin_supports('mod', $mod->modname, FEATURE_MOD_PURPOSE, MOD_PURPOSE_OTHER), ]; // File type after name, for alphabetic lists (screen reader). diff --git a/course/format/templates/local/content/cm/title.mustache b/course/format/templates/local/content/cm/title.mustache index b82a30b2b31..ae5b1ef9562 100644 --- a/course/format/templates/local/content/cm/title.mustache +++ b/course/format/templates/local/content/cm/title.mustache @@ -29,13 +29,15 @@ "pluginname": "File", "altname": "PDF file", "linkclasses": "", - "textclasses": "" + "textclasses": "", + "purpose": "content", + "modname": "resource" } }} {{#url}}
-
+
{{{modname}}} icon
diff --git a/course/renderer.php b/course/renderer.php index 363001e91ee..f3beafd6372 100644 --- a/course/renderer.php +++ b/course/renderer.php @@ -710,9 +710,13 @@ class core_course_renderer extends plugin_renderer_base { $onclick = htmlspecialchars_decode($mod->onclick, ENT_QUOTES); // Display link itself. - $activitylink = html_writer::empty_tag('img', array('src' => $mod->get_icon_url(), - 'class' => 'iconlarge activityicon', 'alt' => '', 'role' => 'presentation', 'aria-hidden' => 'true')) . - html_writer::tag('span', $instancename . $altname, array('class' => 'instancename')); + $instancename = html_writer::tag('span', $instancename . $altname, ['class' => 'instancename ml-1']); + + $imageicon = html_writer::empty_tag('img', ['src' => $mod->get_icon_url(), + 'class' => 'activityicon', 'alt' => '', 'role' => 'presentation', 'aria-hidden' => 'true']); + $imageicon = html_writer::tag('span', $imageicon, ['class' => 'activityiconcontainer courseicon']); + $activitylink = $imageicon . $instancename; + if ($mod->uservisible) { $output .= html_writer::link($url, $activitylink, array('class' => 'aalink' . $linkclasses, 'onclick' => $onclick)); } else { diff --git a/course/templates/local/activitychooser/item.mustache b/course/templates/local/activitychooser/item.mustache index dd4e470d414..347949858df 100644 --- a/course/templates/local/activitychooser/item.mustache +++ b/course/templates/local/activitychooser/item.mustache @@ -26,13 +26,14 @@ "urls": { "addoption": "http://addoptionurl.com" }, - "icon": "" + "icon": "", + "purpose": "content" } }}