diff --git a/CHANGES.md b/CHANGES.md index adc242a87db9c08aee8773e6438d950d2a660ffd..123607668446b8f7fe96b77e4b9f8c22fafda926 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -6,6 +6,7 @@ Changes ### Unreleased +* 2020-08-19 - Added capability theme/boost_campus:viewhintinhiddencourse for setting showhintcoursehidden. * 2020-08-14 - Reduced inflationary call to reset theme caches for the settings. * 2020-08-12 - Fixed undefined variables notices. * 2020-08-11 - Added setting to be able to show a hint for a unrestricted self enrolment in a visible course. diff --git a/classes/output/core_renderer.php b/classes/output/core_renderer.php index 477e6bfda9763c1e2ce9166e93956aba663854a9..63a3575b070a366168bad125f040348890cdf072 100644 --- a/classes/output/core_renderer.php +++ b/classes/output/core_renderer.php @@ -218,8 +218,11 @@ class core_renderer extends \core_renderer { // MODIFICATION START: // If the setting showhintcoursehidden is set, the visibility of the course is hidden and // a hint for the visibility will be shown. - if (get_config('theme_boost_campus', 'showhintcoursehidden') == 'yes' && $COURSE->visible == false && - $this->page->has_set_url() && $this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE)) { + if (get_config('theme_boost_campus', 'showhintcoursehidden') == 'yes' + && has_capability('theme/boost_campus:viewhintinhiddencourse', \context_course::instance($COURSE->id)) + && $this->page->has_set_url() + && $this->page->url->compare(new moodle_url('/course/view.php'), URL_MATCH_BASE) + && $COURSE->visible == false) { $html .= html_writer::start_tag('div', array('class' => 'course-hidden-infobox alert alert-warning')); $html .= html_writer::tag('i', null, array('class' => 'fa fa-exclamation-circle fa-3x fa-pull-left')); $html .= get_string('showhintcoursehiddengeneral', 'theme_boost_campus', $COURSE->id); diff --git a/db/access.php b/db/access.php index e78d994b2a631dfbc36ea8036a273ab5f09870e1..2a01a6ea06d6b4ccfc2d06941b7d13cefa6db65a 100644 --- a/db/access.php +++ b/db/access.php @@ -28,6 +28,15 @@ $capabilities = array( // Ability to see a hint for unrestricted self enrolment in a visible course. 'theme/boost_campus:viewhintcourseselfenrol' => array( + 'captype' => 'read', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'teacher' => CAP_ALLOW, + 'editingteacher' => CAP_ALLOW, + 'manager' => CAP_ALLOW ) + ), + // Ability to see a hint in a hidden course. + 'theme/boost_campus:viewhintinhiddencourse' => array( 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, 'archetypes' => array( diff --git a/lang/en/theme_boost_campus.php b/lang/en/theme_boost_campus.php index a7c161fcfa1aa30687faa8d093448b279a2b88a4..bec69e9ef431f56b10dda19d6eec26a53fd32e83 100644 --- a/lang/en/theme_boost_campus.php +++ b/lang/en/theme_boost_campus.php @@ -312,3 +312,4 @@ $string['privacy:metadata:request:infobanner_dismissed_no'] = 'Perpetual info ba // CAPABILITIES. $string['boost_campus:viewhintcourseselfenrol'] = 'To be able to see a hint for unrestricted self enrolment in a visible course.'; +$string['boost_campus:viewhintinhiddencourse'] = 'To be able to see a hint in a hidden course.'; diff --git a/version.php b/version.php index 52745403b7613bf225ff78193985610c43ad74b1..eceb765daba8df2753add07c88079b7b25630b35 100644 --- a/version.php +++ b/version.php @@ -25,7 +25,7 @@ defined('MOODLE_INTERNAL') || die(); $plugin->component = 'theme_boost_campus'; -$plugin->version = 2020081200; +$plugin->version = 2020081201; $plugin->release = 'v3.8-r2'; $plugin->requires = 2019111804; $plugin->maturity = MATURITY_STABLE;