index.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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(SYS_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. }