Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
CRAP
n/a
0 / 0
local_atrisk_extend_navigation_category_settings
0.00% covered (danger)
0.00%
0 / 9
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2// This file is part of Moodle - https://moodle.org/
3//
4// Moodle is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// Moodle is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with Moodle.  If not, see <https://www.gnu.org/licenses/>.
16
17/**
18 * Navigation for local_atrisk.
19 *
20 * @package    local_atrisk
21 * @copyright  2026 DevLMS <contact@devlms.com>
22 * @license    https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
23 */
24
25/**
26 * Add "At-risk students" to a category's settings menu for staff who can see it.
27 *
28 * @param navigation_node $navigation
29 * @param context_coursecat $context
30 */
31function local_atrisk_extend_navigation_category_settings(navigation_node $navigation, context_coursecat $context) {
32    if (has_capability('local/atrisk:view', $context)) {
33        $navigation->add(
34            get_string('pluginname', 'local_atrisk'),
35            new moodle_url('/local/atrisk/category.php', ['id' => $context->instanceid]),
36            navigation_node::TYPE_SETTING,
37            null,
38            'local_atrisk',
39            new pix_icon('i/warning', '')
40        );
41    }
42}