Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Moodle Local Dashboard Example
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Polaris
moodle
Moodle Local Dashboard Example
Commits
03e87633
Commit
03e87633
authored
8 months ago
by
Sebastian Schilling
Browse files
Options
Downloads
Patches
Plain Diff
fix: added hook to display menu in Moodle 4.5
parent
f1eb9992
Branches
main
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
classes/hook_callbacks.php
+47
-0
47 additions, 0 deletions
classes/hook_callbacks.php
db/hooks.php
+31
-0
31 additions, 0 deletions
db/hooks.php
lib.php
+4
-18
4 additions, 18 deletions
lib.php
version.php
+1
-1
1 addition, 1 deletion
version.php
with
83 additions
and
19 deletions
classes/hook_callbacks.php
0 → 100644
+
47
−
0
View file @
03e87633
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
*
* @package local_polaris_dashboard
* @copyright 2023, Center für Lehr- und Lernservice (CLS), RWTH Aachen University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
namespace
local_polaris_dashboard
;
defined
(
'MOODLE_INTERNAL'
)
||
die
();
class
hook_callbacks
{
/**
* Workaround to bypass the course navigation override by Moodle version 4+.
* Is called after the override.
* An "_extend_course_navigation" function would not allow to add the navigation node in front of the grade-entry.
* As the local_ladashboard_extend_navigation function works on earlier versions,
* the branch is checked and the function is aborted if an earlier version than 4 is used.
*/
static
function
local_polaris_dashboard_before_html_attributes
(
$attributes
)
{
global
$PAGE
,
$CFG
;
if
(
$PAGE
->
context
->
contextlevel
!=
CONTEXT_COURSE
||
((
int
)
$CFG
->
branch
)
<
400
)
{
return
$attributes
;
}
local_polaris_dashboard_extend_arbitrary_navigation
(
$PAGE
->
secondarynav
);
return
$attributes
;
}
}
This diff is collapsed.
Click to expand it.
db/hooks.php
0 → 100644
+
31
−
0
View file @
03e87633
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Hook callbacks for Polaris Dashboard
*
* @package local_polaris_dashboard
* @copyright 2024 Sebastian Schilling <schilling@cls.rwth-aachen.de>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
$callbacks
=
[
[
'hook'
=>
\core\hook\output\before_html_attributes
::
class
,
'callback'
=>
[
\local_polaris_dashboard\hook_callbacks
::
class
,
'local_polaris_dashboard_before_html_attributes'
],
],
];
This diff is collapsed.
Click to expand it.
lib.php
+
4
−
18
View file @
03e87633
...
@@ -24,6 +24,9 @@
...
@@ -24,6 +24,9 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
use
core\hook\output\before_html_attributes
;
require_once
(
$CFG
->
dirroot
.
"/local/polaris_dashboard/locallib.php"
);
require_once
(
$CFG
->
dirroot
.
"/local/polaris_dashboard/locallib.php"
);
/**
/**
...
@@ -40,22 +43,5 @@ function local_polaris_dashboard_extend_navigation(global_navigation $navigation
...
@@ -40,22 +43,5 @@ function local_polaris_dashboard_extend_navigation(global_navigation $navigation
$course_nav
=
$navigation
->
find
(
$COURSE
->
id
,
navigation_node
::
TYPE_COURSE
);
$course_nav
=
$navigation
->
find
(
$COURSE
->
id
,
navigation_node
::
TYPE_COURSE
);
local_polaris_dashboard_extend_arbitrary_navigation
(
$course_nav
);
local_polaris_dashboard_extend_arbitrary_navigation
(
$course_nav
);
}
/**
* Workaround to bypass the course navigation override by Moodle version 4+.
* Is called after the override.
* An "_extend_course_navigation" function would not allow to add the navigation node in front of the grade-entry.
* As the local_ladashboard_extend_navigation function works on earlier versions,
* the branch is checked and the function is aborted if an earlier version than 4 is used.
*/
function
local_polaris_dashboard_add_htmlattributes
()
{
global
$PAGE
,
$CFG
;
if
(
$PAGE
->
context
->
contextlevel
!=
CONTEXT_COURSE
||
((
int
)
$CFG
->
branch
)
<
400
)
{
return
[];
}
local_polaris_dashboard_extend_arbitrary_navigation
(
$PAGE
->
secondarynav
);
return
[];
}
}
This diff is collapsed.
Click to expand it.
version.php
+
1
−
1
View file @
03e87633
...
@@ -24,7 +24,7 @@
...
@@ -24,7 +24,7 @@
defined
(
'MOODLE_INTERNAL'
)
||
die
();
defined
(
'MOODLE_INTERNAL'
)
||
die
();
$plugin
->
version
=
2023081401
2
;
$plugin
->
version
=
2023081401
4
;
$plugin
->
requires
=
2014051200
;
$plugin
->
requires
=
2014051200
;
$plugin
->
component
=
'local_polaris_dashboard'
;
$plugin
->
component
=
'local_polaris_dashboard'
;
$plugin
->
maturity
=
MATURITY_ALPHA
;
$plugin
->
maturity
=
MATURITY_ALPHA
;
...
...
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