-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlib.php
More file actions
executable file
·144 lines (128 loc) · 3.9 KB
/
lib.php
File metadata and controls
executable file
·144 lines (128 loc) · 3.9 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
<?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) {
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) {
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) {
return false;
}
/**
* 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');
}
/**
* Render additional content before the footer in SCORM module pages.
*
* Checks if the current course module is a SCORM activity and retrieves
* associated edflex information from the database. If a record is found,
* it outputs the rendered content using the appropriate renderer.
*/
function mod_edflex_before_footer() {
global $PAGE, $DB, $OUTPUT;
if ($PAGE->cm && $PAGE->cm->modname === 'scorm') {
$scormid = $PAGE->cm->instance;
if ($edflex = $DB->get_record('edflex_scorm', ['scormid' => $scormid])) {
echo $OUTPUT->render(new edflex_scorm($edflex));
}
}
}