steps.ajax.php 961 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. /**
  4. * Get the intro steps for the web page.
  5. *
  6. * @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
  7. *
  8. * @package chamilo.plugin.tour
  9. */
  10. require_once __DIR__.'/../../../main/inc/global.inc.php';
  11. if (!api_is_anonymous()) {
  12. $currentPageClass = isset($_GET['page_class']) ? $_GET['page_class'] : '';
  13. $tourPlugin = Tour::create();
  14. $json = $tourPlugin->getTourConfig();
  15. $currentPageSteps = [];
  16. foreach ($json as $pageContent) {
  17. if ($pageContent['pageClass'] == $currentPageClass) {
  18. foreach ($pageContent['steps'] as $step) {
  19. $currentPageSteps[] = [
  20. 'element' => $step['elementSelector'],
  21. 'intro' => $tourPlugin->get_lang($step['message']),
  22. ];
  23. }
  24. break;
  25. }
  26. }
  27. if (!empty($currentPageSteps)) {
  28. echo json_encode($currentPageSteps);
  29. }
  30. }