Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
moodle-theme_boost_campus
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elc
moodle-theme_boost_campus
Commits
de353049
Commit
de353049
authored
6 years ago
by
Kathrin Osswald
Committed by
Alexander Bias
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Improved the feature showhintcourseguestaccess to not be shown in some edge cases.
parent
dc8a1e0a
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGES.md
+1
-0
1 addition, 0 deletions
CHANGES.md
classes/output/core_renderer.php
+26
-25
26 additions, 25 deletions
classes/output/core_renderer.php
with
27 additions
and
25 deletions
CHANGES.md
+
1
−
0
View file @
de353049
...
@@ -6,6 +6,7 @@ Changes
...
@@ -6,6 +6,7 @@ Changes
### Unreleased
### Unreleased
*
2018-12-19 - Improved the feature showhintcourseguestaccess to not be shown in some edge cases.
*
2018-12-18 - Adding 'both' option for 'Switch to role…' menu fixes - Many thanks to Luca Bösch (lucaboesch) for his proposal and main work on this!
*
2018-12-18 - Adding 'both' option for 'Switch to role…' menu fixes - Many thanks to Luca Bösch (lucaboesch) for his proposal and main work on this!
*
2018-12-17 - Setting to change the breakpoint for smaller screens.
*
2018-12-17 - Setting to change the breakpoint for smaller screens.
...
...
This diff is collapsed.
Click to expand it.
classes/output/core_renderer.php
+
26
−
25
View file @
de353049
...
@@ -213,10 +213,14 @@ class core_renderer extends \theme_boost\output\core_renderer {
...
@@ -213,10 +213,14 @@ class core_renderer extends \theme_boost\output\core_renderer {
// MODIFICATION START:
// MODIFICATION START:
// If the setting showhintcourseguestaccess is set, a hint for users that view the course with guest access is shown.
// If the setting showhintcourseguestaccess is set, a hint for users that view the course with guest access is shown.
// We also check that the user did not switch the role. This is a special case for roles that can fully access the course
// without being enrolled. A role switch would show the guest access hint additionally in that case and this is not
// intended.
if
(
get_config
(
'theme_boost_campus'
,
'showhintcourseguestaccess'
)
==
'yes'
if
(
get_config
(
'theme_boost_campus'
,
'showhintcourseguestaccess'
)
==
'yes'
&&
is_guest
(
\context_course
::
instance
(
$COURSE
->
id
),
$USER
->
id
)
&&
is_guest
(
\context_course
::
instance
(
$COURSE
->
id
),
$USER
->
id
)
&&
$PAGE
->
has_set_url
()
&&
$PAGE
->
has_set_url
()
&&
$PAGE
->
url
->
compare
(
new
moodle_url
(
'/course/view.php'
),
URL_MATCH_BASE
))
{
&&
$PAGE
->
url
->
compare
(
new
moodle_url
(
'/course/view.php'
),
URL_MATCH_BASE
)
&&
!
is_role_switched
(
$COURSE
->
id
))
{
$html
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'course-guestaccess-infobox alert alert-warning'
));
$html
.
=
html_writer
::
start_tag
(
'div'
,
array
(
'class'
=>
'course-guestaccess-infobox alert alert-warning'
));
$html
.
=
html_writer
::
tag
(
'i'
,
null
,
array
(
'class'
=>
'fa fa-exclamation-circle fa-3x fa-pull-left'
));
$html
.
=
html_writer
::
tag
(
'i'
,
null
,
array
(
'class'
=>
'fa fa-exclamation-circle fa-3x fa-pull-left'
));
$html
.
=
get_string
(
'showhintcourseguestaccessgeneral'
,
'theme_boost_campus'
,
$html
.
=
get_string
(
'showhintcourseguestaccessgeneral'
,
'theme_boost_campus'
,
...
@@ -229,14 +233,12 @@ class core_renderer extends \theme_boost\output\core_renderer {
...
@@ -229,14 +233,12 @@ class core_renderer extends \theme_boost\output\core_renderer {
// MODIFICATION START.
// MODIFICATION START.
// Only use this if setting 'showswitchedroleincourse' is active.
// Only use this if setting 'showswitchedroleincourse' is active.
if
(
get_config
(
'theme_boost_campus'
,
'showswitchedroleincourse'
)
===
'yes'
)
{
if
(
get_config
(
'theme_boost_campus'
,
'showswitchedroleincourse'
)
===
'yes'
)
{
// Check if user
is logged in
.
// Check if
the
user
did a role switch
.
// If not, adding this section would make no sense and, even worse,
// If not, adding this section would make no sense and, even worse,
// user_get_user_navigation_info() will throw an exception due to the missing user object.
// user_get_user_navigation_info() will throw an exception due to the missing user object.
if
(
isloggedin
())
{
if
(
is_role_switched
(
$COURSE
->
id
))
{
$opts
=
\user_get_user_navigation_info
(
$USER
,
$this
->
page
);
// Role is switched.
if
(
!
empty
(
$opts
->
metadata
[
'asotherrole'
]))
{
// Get the role name switched to.
// Get the role name switched to.
$opts
=
\user_get_user_navigation_info
(
$USER
,
$this
->
page
);
$role
=
$opts
->
metadata
[
'rolename'
];
$role
=
$opts
->
metadata
[
'rolename'
];
// Get the URL to switch back (normal role).
// Get the URL to switch back (normal role).
$url
=
new
moodle_url
(
'/course/switchrole.php'
,
$url
=
new
moodle_url
(
'/course/switchrole.php'
,
...
@@ -257,7 +259,6 @@ class core_renderer extends \theme_boost\output\core_renderer {
...
@@ -257,7 +259,6 @@ class core_renderer extends \theme_boost\output\core_renderer {
$html
.
=
html_writer
::
end_tag
(
'div'
);
$html
.
=
html_writer
::
end_tag
(
'div'
);
}
}
}
}
}
// MODIFICATION END.
// MODIFICATION END.
return
$html
;
return
$html
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment