index.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Config the plugin.
  5. *
  6. * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
  7. *
  8. * @package chamilo.plugin.tour
  9. */
  10. require_once __DIR__.'/config.php';
  11. $pluginPath = api_get_path(SYS_PLUGIN_PATH).'tour/';
  12. $pluginWebPath = api_get_path(WEB_PLUGIN_PATH).'tour/';
  13. $userId = api_get_user_id();
  14. $tourPlugin = Tour::create();
  15. $config = $tourPlugin->getTourConfig();
  16. $showTour = $tourPlugin->get('show_tour') === 'true';
  17. if ($showTour) {
  18. $pages = [];
  19. foreach ($config as $pageContent) {
  20. $pages[] = [
  21. 'pageClass' => $pageContent['pageClass'],
  22. 'show' => $tourPlugin->checkTourForUser($pageContent['pageClass'], $userId),
  23. ];
  24. }
  25. $theme = $tourPlugin->get('theme');
  26. $_template['show_tour'] = $showTour;
  27. $_template['pages'] = json_encode($pages);
  28. $_template['web_path'] = [
  29. 'intro_css' => "{$pluginWebPath}intro.js/introjs.min.css",
  30. 'intro_theme_css' => null,
  31. 'intro_js' => "{$pluginWebPath}intro.js/intro.min.js",
  32. 'steps_ajax' => "{$pluginWebPath}ajax/steps.ajax.php",
  33. 'save_ajax' => "{$pluginWebPath}ajax/save.ajax.php",
  34. ];
  35. if (file_exists("{$pluginPath}intro.js/introjs-$theme.css")) {
  36. $_template['web_path']['intro_theme_css'] = "{$pluginWebPath}intro.js/introjs-$theme.css";
  37. }
  38. }