blob: 228e26b96aaec6e91322b5f2b9fe10bd0077877b (
plain) (
blame)
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
|
<?php
$HANDLER = array();
if (Module::isAvailable('locationinfo')) {
$HANDLER['subsections'] = array();
foreach (CourseBackend::getList() as $backend) {
// Define subsections
$HANDLER['subsections'][] = 'backend-' . $backend;
// Grep handlers to detect tags
$HANDLER['grep_backend-' . $backend] = function($module) use ($backend) {
$b = CourseBackend::getInstance($backend);
if ($b === false)
return array();
$props = $b->getCredentialDefinitions();
$return = array();
foreach ($props as $prop) {
$return[$prop->property] = true;
$return[$prop->property . '_helptext'] = true;
}
return $return;
};
}
$HANDLER['subsections'][] = 'panel-params';
$HANDLER['grep_panel-params'] = function($module) {
$return = [];
// DEFAULT is not using this mechanism as it's too specialized
foreach (['UPCOMING', 'URL', 'SUMMARY'] as $panelType) {
$return['intro-' . $panelType] = true;
$params = LocationInfo::getPanelParameters($panelType);
$params['string']['panelname'] = [];
foreach ($params as $types) {
foreach ($types as $key => $data) {
if (isset($data['section'])) {
if ($data['section'] === false)
continue; // Hidden entry; doesn't need translation
$return['section_' . $data['section']] = true;
}
$return[$key] = true;
$return[$key . '_helptext'] = true;
if (!empty($data['enum'])) {
foreach ($data['enum'] as $enum) {
$return[$key . '_enum_' . $enum] = true;
}
}
}
}
}
return $return;
};
}
|