index.php 1.4 KB

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