-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.php
More file actions
executable file
·154 lines (137 loc) · 4.11 KB
/
Copy pathlib.php
File metadata and controls
executable file
·154 lines (137 loc) · 4.11 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
<?php
// This file is part of Moodle - https://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 <https://www.gnu.org/licenses/>.
/**
* Library of interface functions and constants.
*
* @package mod_edflex
* @copyright 2025 Edflex <support@edflex.com>
* @license https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
use mod_edflex\output\edflex_scorm;
defined('MOODLE_INTERNAL') || die();
global $CFG;
/**
* Return if the plugin supports $feature.
*
* @param string $feature The feature.
*
* @return mixed True if module supports feature, null if doesn't know
*/
function edflex_supports($feature) {
switch ($feature) {
case FEATURE_MOD_INTRO:
case FEATURE_SHOW_DESCRIPTION:
case FEATURE_BACKUP_MOODLE2:
return true;
default:
return null;
}
}
/**
* Adds a new instance of the edflex module.
*
* @param object $moduleinstance The module instance.
* @param mod_page_mod_form $mform The form.
*
* @return bool
*/
function edflex_add_instance($moduleinstance, $mform = null) {
// The mod_edflex form is a launcher: it spawns SCORM modules via the
// Edflex browser, so no standalone edflex instance is ever persisted.
return false;
}
/**
* Updates an existing instance of the edflex module.
*
* @param object $moduleinstance The module instance.
* @param mod_page_mod_form $mform The form.
*
* @return bool
*/
function edflex_update_instance($moduleinstance, $mform = null) {
return false;
}
/**
* Removes an instance of the mod_edflex from the database.
*
* @param int $id The instance id.
*
* @return bool
*/
function edflex_delete_instance($id) {
global $DB;
if (!$DB->get_record('edflex', ['id' => $id])) {
return false;
}
$DB->delete_records('edflex', ['id' => $id]);
return true;
}
/**
* Extends the course navigation with additional functionality for the edflex module.
*
* @param object $navigation The navigation node.
* @param object $course The course.
* @param object $context The context.
*/
function mod_edflex_extend_navigation_course($navigation, $course, $context) {
mod_edflex_inject_browser_javascript();
}
/**
* Injects the necessary JavaScript and language strings for the Edflex browser modal functionality.
*
* This function initializes the browser modal using AMD JavaScript and provides a set
* of language strings required for the functionality.
*
* @return void
*/
function mod_edflex_inject_browser_javascript() {
global $PAGE;
$PAGE->requires->js_call_amd('mod_edflex/initbrowsermodal', 'init');
$PAGE->requires->strings_for_js([
'category',
'confirmsameactivitymultipletimesinthecourse',
'contenttype',
'contenttypeprogram',
'contenttypearticle',
'contenttypevideo',
'contenttypecourse',
'contenttypepodcast',
'contenttyperoleplay',
'contenttypeinteractive',
'contenttypetopvoice',
'contenttypeassessment',
'difficultyintroductive',
'difficultyintermediate',
'difficultyadvanced',
'duration',
'keywordssearch',
'level',
'language',
'edflexbrowsertitle',
'edflexbrowserloading',
], 'mod_edflex');
}
/**
* Legacy before_footer callback for Moodle < 4.4.
*
* On Moodle 4.4+ the {@see \core\hook\output\before_footer_html_generation} hook
* registered in db/hooks.php supersedes this and this function is not called.
*
* @return string|null
*/
function mod_edflex_before_footer() {
return \mod_edflex\hook_callbacks::scorm_footer_html();
}