glossary.js.php 932 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../inc/global.inc.php';
  4. header('Content-type: application/x-javascript');
  5. $origin = api_get_origin();
  6. $tpl = new Template('', false, false, false, true, false, false);
  7. $glossaryExtraTools = api_get_setting('show_glossary_in_extra_tools');
  8. if ($origin == 'learnpath') {
  9. $showGlossary = in_array($glossaryExtraTools, ['lp', 'exercise_and_lp']);
  10. } else {
  11. $showGlossary = in_array($glossaryExtraTools, ['true', 'lp', 'exercise_and_lp']);
  12. }
  13. if ($showGlossary) {
  14. $templateName = 'glossary/glossary_auto.js.tpl';
  15. if (api_get_setting('show_glossary_in_documents') == 'ismanual') {
  16. $templateName = 'glossary/glossary_manual.js.tpl';
  17. }
  18. $addReady = isset($_GET['add_ready']) ? true : false;
  19. $tpl->assign('add_ready', $addReady);
  20. $contentTemplate = $tpl->get_template($templateName);
  21. $tpl->display($contentTemplate);
  22. }