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
585bbbbd
Commit
585bbbbd
authored
8 years ago
by
Kathrin Osswald
Browse files
Options
Downloads
Patches
Plain Diff
Improvements to the default homepage on top feature.
parent
4902c95b
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
locallib.php
+14
-9
14 additions, 9 deletions
locallib.php
with
14 additions
and
9 deletions
locallib.php
+
14
−
9
View file @
585bbbbd
...
...
@@ -175,26 +175,26 @@ function theme_boost_campus_process_flatnav(flat_navigation $flatnav) {
// If the setting defaulthomepageontop is enabled.
if
(
get_config
(
'theme_boost_campus'
,
'defaulthomepageontop'
)
==
'yes'
)
{
// Only proceed processing if we are in a course context.
if
(
$flatnav
->
find
(
'coursehome'
,
global_navigation
::
TYPE_CUSTOM
)
!=
false
)
{
if
(
(
$coursehomenode
=
$flatnav
->
find
(
'coursehome'
,
global_navigation
::
TYPE_CUSTOM
)
)
!=
false
)
{
// If the site home is set as the deafult homepage by the admin.
if
(
get_config
(
'core'
,
'defaulthomepage'
)
==
HOMEPAGE_SITE
)
{
// Return the modified flat_navigtation.
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'home'
);
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'home'
,
$coursehomenode
);
}
else
if
(
get_config
(
'core'
,
'defaulthomepage'
)
==
HOMEPAGE_MY
)
{
// If the dashboard is set as the default homepage
// by the admin.
// Return the modified flat_navigtation.
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'myhome'
);
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'myhome'
,
$coursehomenode
);
}
else
if
(
get_config
(
'core'
,
'defaulthomepage'
)
==
HOMEPAGE_USER
)
{
// If the admin defined that the user can set
// the default homepage for himself.
// Site home.
if
(
get_user_preferences
(
'user_home_page_preference'
,
$USER
)
==
0
)
{
// Return the modified flat_navigtation.
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'home'
);
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'home'
,
$coursehomenode
);
}
else
if
(
get_user_preferences
(
'user_home_page_preference'
,
$USER
)
==
1
||
// Dashboard.
get_user_preferences
(
'user_home_page_preference'
,
$USER
)
==
false
)
{
// If no user preference is set,
// use the default value of core setting default homepage (Dashboard).
// Return the modified flat_navigtation.
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'myhome'
);
$flatnavreturn
=
theme_boost_campus_set_node_on_top
(
$flatnav
,
'myhome'
,
$coursehomenode
);
}
else
{
// Should not happen.
// Return the passed flat navigation without changes.
$flatnavreturn
=
$flatnav
;
...
...
@@ -219,16 +219,21 @@ function theme_boost_campus_process_flatnav(flat_navigation $flatnav) {
*
* @param flat_navigation $flatnav The flat navigation object.
* @param string $nodename The name of the node that is to modify.
* @param navigation_node $beforenode The node before which the to be modified node shall be added.
* @return flat_navigation.
*/
function
theme_boost_campus_set_node_on_top
(
flat_navigation
$flatnav
,
$nodename
)
{
function
theme_boost_campus_set_node_on_top
(
flat_navigation
$flatnav
,
$nodename
,
$beforenode
)
{
// Get the node for which the sorting shall be changed.
$pageflatnav
=
$flatnav
->
find
(
$nodename
,
global_navigation
::
TYPE_SYSTEM
);
// Set the showdivider of the new top node to false that no empty nav-element will be created.
$pageflatnav
->
set_showdivider
(
false
);
// Add the showdivider to the coursehome node as this is the next one and this will add a margin top to it.
$
flatnav
->
find
(
'coursehome'
,
global_navigation
::
TYPE_CUSTOM
)
->
set_showdivider
(
true
);
$
beforenode
->
set_showdivider
(
true
);
// Remove the site home navigation node that it does not appear twice in the menu.
$flatnav
->
remove
(
$nodename
);
// Add the saved site home node as the before node of the course home node.
$flatnav
->
add
(
$pageflatnav
,
'coursehome'
);
// Add the saved site home node before the $beforenode.
$flatnav
->
add
(
$pageflatnav
,
$beforenode
->
key
);
// Return the modified changes.
return
$flatnav
;
}
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