Actualización
This commit is contained in:
25
plugin/tour/ajax/save.ajax.php
Normal file
25
plugin/tour/ajax/save.ajax.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
/**
|
||||
* Get the intro steps for the web page.
|
||||
*
|
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
|
||||
*
|
||||
* @package chamilo.plugin.tour
|
||||
*/
|
||||
/**
|
||||
* Init.
|
||||
*/
|
||||
require_once __DIR__.'/../../../main/inc/global.inc.php';
|
||||
require_once __DIR__.'/../config.php';
|
||||
|
||||
if (!api_is_anonymous()) {
|
||||
$currentPageClass = isset($_POST['page_class']) ? $_POST['page_class'] : '';
|
||||
|
||||
if (!empty($currentPageClass)) {
|
||||
$userId = api_get_user_id();
|
||||
|
||||
$tourPlugin = Tour::create();
|
||||
$tourPlugin->saveCompletedTour($currentPageClass, $userId);
|
||||
}
|
||||
}
|
||||
34
plugin/tour/ajax/steps.ajax.php
Normal file
34
plugin/tour/ajax/steps.ajax.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
/* For licensing terms, see /license.txt */
|
||||
|
||||
/**
|
||||
* Get the intro steps for the web page.
|
||||
*
|
||||
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
|
||||
*
|
||||
* @package chamilo.plugin.tour
|
||||
*/
|
||||
require_once __DIR__.'/../../../main/inc/global.inc.php';
|
||||
|
||||
if (!api_is_anonymous()) {
|
||||
$currentPageClass = isset($_GET['page_class']) ? $_GET['page_class'] : '';
|
||||
$tourPlugin = Tour::create();
|
||||
$json = $tourPlugin->getTourConfig();
|
||||
$currentPageSteps = [];
|
||||
foreach ($json as $pageContent) {
|
||||
if ($pageContent['pageClass'] == $currentPageClass) {
|
||||
foreach ($pageContent['steps'] as $step) {
|
||||
$currentPageSteps[] = [
|
||||
'element' => $step['elementSelector'],
|
||||
'intro' => $tourPlugin->get_lang($step['message']),
|
||||
];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($currentPageSteps)) {
|
||||
echo json_encode($currentPageSteps);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user