@@ -47,39 +47,35 @@ function theme_boost_union_get_course_related_hints() {
47
47
&& $ PAGE ->has_set_url ()
48
48
&& $ COURSE ->visible == false ) {
49
49
50
- // The hint will only be shown when the course is viewed.
50
+ // Initialize hint text.
51
+ $ hintcoursehiddentext = '' ;
52
+
53
+ // The general hint will only be shown when the course is viewed.
51
54
if ($ PAGE ->url ->compare (new moodle_url ('/course/view.php ' ), URL_MATCH_BASE )) {
52
55
// Prepare template context.
53
- $ templatecontext = ['courseid ' => $ COURSE ->id ];
54
-
55
- // If the user has the capability to change the course settings, an additional link to the course settings is shown.
56
- if (has_capability ('moodle/course:update ' , context_course::instance ($ COURSE ->id ))) {
57
- $ templatecontext ['showcoursesettingslink ' ] = true ;
58
- } else {
59
- $ templatecontext ['showcoursesettingslink ' ] = false ;
60
- }
61
-
62
- // Render template and add it to HTML code.
63
- $ html .= $ OUTPUT ->render_from_template ('theme_boost_union/course-hint-hidden ' , $ templatecontext );
56
+ $ hintcoursehiddentext = get_string ('showhintcoursehiddengeneral ' , 'theme_boost_union ' );
64
57
}
65
58
66
59
// If the setting showhintcoursehiddennotifications is set too and we view a forum (e.g. announcement) within a hidden
67
60
// course a hint will be shown that no notifications via forums will be sent out to students.
68
61
if (get_config ('theme_boost_union ' , 'showhintforumnotifications ' ) == THEME_BOOST_UNION_SETTING_SELECT_YES
69
62
&& $ PAGE ->url ->compare (new moodle_url ('/mod/forum/view.php ' ), URL_MATCH_BASE )) {
70
63
71
- // Prepare template context.
72
- $ templatecontext = [ ' courseid ' => $ COURSE -> id ];
64
+ $ hintcoursehiddentext = get_string ( ' showhintforumnotifications ' , ' theme_boost_union ' );
65
+ }
73
66
74
- // If the user has the capability to change the course settings, an additional link to the course settings is shown.
75
- if (has_capability ('moodle/course:update ' , context_course::instance ($ COURSE ->id ))) {
76
- $ templatecontext ['showcoursesettingslink ' ] = true ;
77
- } else {
78
- $ templatecontext ['showcoursesettingslink ' ] = false ;
79
- }
67
+ // If we show any kind of hint for the hidden course, construct the hint html item via mustache.
68
+ if ($ hintcoursehiddentext ) {
69
+ // Prepare the templates context.
70
+ $ templatecontext = [
71
+ 'courseid ' => $ COURSE ->id ,
72
+ 'hintcoursehiddentext ' => $ hintcoursehiddentext ,
73
+ // If the user has the capability to change the course settings, an additional link to the course settings is shown.
74
+ 'showcoursesettingslink ' => has_capability ('moodle/course:update ' , context_course::instance ($ COURSE ->id )),
75
+ ];
80
76
81
77
// Render template and add it to HTML code.
82
- $ html .= $ OUTPUT ->render_from_template ('theme_boost_union/course-hint-hidden-forum-notifications ' , $ templatecontext );
78
+ $ html .= $ OUTPUT ->render_from_template ('theme_boost_union/course-hint-hidden ' , $ templatecontext );
83
79
}
84
80
}
85
81
0 commit comments