summaryrefslogtreecommitdiffstats
path: root/modules-available/locationinfo/hooks
diff options
context:
space:
mode:
authorSimon Rettberg2017-04-21 10:05:15 +0200
committerSimon Rettberg2017-04-21 10:05:15 +0200
commit2f7a19419a2ff356b6dec0952f9a4eefb4d850cc (patch)
tree64004f0dcb714877a9037313351ed99e1c1c6660 /modules-available/locationinfo/hooks
parent[locationinfo] Set default options properly when adding new server (diff)
downloadslx-admin-2f7a19419a2ff356b6dec0952f9a4eefb4d850cc.tar.gz
slx-admin-2f7a19419a2ff356b6dec0952f9a4eefb4d850cc.tar.xz
slx-admin-2f7a19419a2ff356b6dec0952f9a4eefb4d850cc.zip
[locatrioninfo] Add translation hook for coursebackends
Diffstat (limited to 'modules-available/locationinfo/hooks')
-rw-r--r--modules-available/locationinfo/hooks/translation.inc.php24
1 files changed, 24 insertions, 0 deletions
diff --git a/modules-available/locationinfo/hooks/translation.inc.php b/modules-available/locationinfo/hooks/translation.inc.php
new file mode 100644
index 00000000..a3f4edd2
--- /dev/null
+++ b/modules-available/locationinfo/hooks/translation.inc.php
@@ -0,0 +1,24 @@
+<?php
+
+$HANDLER = array();
+
+if (Module::isAvailable('locationinfo')) {
+ $HANDLER['subsections'] = array();
+ foreach (CourseBackend::getList() as $backend) {
+ // Define subsections
+ $HANDLER['subsections'][] = $backend;
+ // Grep handlers to detect tags
+ $HANDLER['grep_' . $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;
+ };
+ }
+}