-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathlib.php
More file actions
77 lines (72 loc) · 2.79 KB
/
Copy pathlib.php
File metadata and controls
77 lines (72 loc) · 2.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
// This file is part of Moodle - https://questionpy.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/>.
/**
* Contains the {@see inplace_editable} callback for the `block_coursefeedback` plugin.
*
* @package block_coursefeedback
* @copyright 2026 innoCampus, Technische Universität Berlin
* @copyright 2026 Moodle.NRW, Ruhr-Universität Bochum
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use block_coursefeedback\local\course_organization_mapping\course_organization_mapping;
use block_coursefeedback\local\persistent\survey_execution;
use block_coursefeedback\output\slot_users_editable;
use core\output\inplace_editable;
/**
* Callback for inplace editable API.
*
* @param string $itemtype
* @param string $itemid
* @param string $newvalue
* @return inplace_editable|null
*/
function block_coursefeedback_inplace_editable(string $itemtype, string $itemid, string $newvalue): ?inplace_editable {
if ($itemtype === 'slot_users') {
return slot_users_editable::update($itemid, $newvalue);
}
debugging("Unrecognised itemtype for block_coursefeedback_inplace_editable: '$itemtype'");
return null;
}
/**
* Called when building a course's navbar. We add a link to the course's survey settings if the course has a survey execution.
*
* @param navigation_node $parentnode
* @param stdClass $course
* @param context $context
* @return void
*/
function block_coursefeedback_extend_navigation_course(
navigation_node $parentnode,
stdClass $course,
context $context,
): void {
global $DB;
try {
if (
has_capability('block/coursefeedback:viewcoursesettings', $context)
&& ($organization = course_organization_mapping::get_instance()->get_organization_for_course($course))
&& $DB->record_exists(
survey_execution::TABLE,
['courseid' => $course->id, 'organizationid' => $organization->get('id')]
)
) {
$url = new moodle_url('/blocks/coursefeedback/course.php', ['id' => $course->id]);
$parentnode->add(get_string("course_settings", "block_coursefeedback"), $url, key: "coursefeedback");
}
} catch (\Exception $e) {
debugging($e);
}
}