diff --git a/course/format/classes/output/local/content/cm/cmicon.php b/course/format/classes/output/local/content/cm/cmicon.php index a9a86eb2062..f9363040ddc 100644 --- a/course/format/classes/output/local/content/cm/cmicon.php +++ b/course/format/classes/output/local/content/cm/cmicon.php @@ -79,6 +79,7 @@ class cmicon implements named_templatable, renderable { $iconurl = $mod->get_icon_url(); $iconclass = $iconurl->get_param('filtericon') ? '' : 'nofilter'; $data = [ + 'uservisible' => $mod->uservisible, 'url' => $mod->url, 'icon' => $iconurl, 'iconclass' => $iconclass, diff --git a/course/format/templates/local/content/cm/cmicon.mustache b/course/format/templates/local/content/cm/cmicon.mustache index 324b81ac879..4a77d7a84a3 100644 --- a/course/format/templates/local/content/cm/cmicon.mustache +++ b/course/format/templates/local/content/cm/cmicon.mustache @@ -21,6 +21,7 @@ Example context (json): { + "uservisible": true, "url": "#", "icon": "../../../pix/help.svg", "iconclass": "", @@ -30,10 +31,17 @@ } }} {{#url}} - - {{{modname}}} icon - + {{#uservisible}} + + {{{modname}}} icon + + {{/uservisible}} + {{^uservisible}} +
+ {{{modname}}} icon +
+ {{/uservisible}} {{/url}} diff --git a/course/format/tests/behat/activity_icon_tooltip.feature b/course/format/tests/behat/activity_icon_tooltip.feature index 79d58e37018..383446a7cf7 100644 --- a/course/format/tests/behat/activity_icon_tooltip.feature +++ b/course/format/tests/behat/activity_icon_tooltip.feature @@ -39,3 +39,16 @@ Feature: Activity type tooltip. Given I am on the "C1" "Course" page logged in as "student1" When I hover over the "assign icon" "link" in the "Activity sample 1" "activity" Then "body>.tooltip" "css_element" should not exist + + Scenario: Student cannot see the activity icon link if does not have access. + Given I am on the "Activity sample 2" "page activity editing" page logged in as "admin" + When I expand all fieldsets + And I press "Add restriction..." + And I click on "Date" "button" in the "Add restriction..." "dialogue" + And I set the field "direction" to "until" + And I set the field "x[year]" to "2013" + And I set the field "x[month]" to "March" + And I press "Save and return to course" + And I log out + And I am on the "C1" "Course" page logged in as "student1" + Then "page icon" "link" should not exist in the "Activity sample 2" "activity"