Improve code style in Tour plugin - refs #7279

1.9.x
Yannick Warnier 11 years ago
parent 13716b604b
commit 0c02ca4c12
  1. 11
      plugin/tour/ajax/save.ajax.php
  2. 8
      plugin/tour/ajax/steps.ajax.php
  3. 2
      plugin/tour/config.php
  4. 6
      plugin/tour/index.php
  5. 4
      plugin/tour/install.php
  6. 2
      plugin/tour/lang/english.php
  7. 2
      plugin/tour/lang/spanish.php
  8. 2
      plugin/tour/plugin.php
  9. 2
      plugin/tour/readme.txt
  10. 14
      plugin/tour/src/tour_plugin.class.php
  11. 4
      plugin/tour/uninstall.php

@ -1,14 +1,15 @@
<?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 dirname(dirname(dirname(dirname(__FILE__)))) . '/main/inc/global.inc.php';
require_once dirname((__DIR__)) . '/config.php';
/**
* 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'] : '';
@ -19,4 +20,4 @@ if (!api_is_anonymous()) {
$tourPlugin = Tour::create();
$tourPlugin->saveCompletedTour($currentPageClass, $userId);
}
}
}

@ -1,13 +1,11 @@
<?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 dirname(dirname(dirname(dirname(__FILE__)))) . '/main/inc/global.inc.php';
require_once __DIR__.'/../../../main/inc/global.inc.php';
require_once api_get_path(LIBRARY_PATH) . 'plugin.class.php';
require_once api_get_path(PLUGIN_PATH) . 'tour/src/tour_plugin.class.php';
@ -16,7 +14,7 @@ if (!api_is_anonymous()) {
$tourPlugin = Tour::create();
$json = $tourPlugin->getTourCofig();
$json = $tourPlugin->getTourConfig();
$currentPageSteps = array();
@ -36,4 +34,4 @@ if (!api_is_anonymous()) {
if (!empty($currentPageSteps)) {
echo json_encode($currentPageSteps);
}
}
}

@ -1,7 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>

@ -1,13 +1,11 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Config the plugin
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.tour
*/
require_once dirname(__FILE__) . '/config.php';
require_once __DIR__ . '/config.php';
$pluginPath = api_get_path(PLUGIN_PATH) . 'tour/';
$pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/';
@ -15,7 +13,7 @@ $pluginWebPath = api_get_path(WEB_PLUGIN_PATH) . 'tour/';
$userId = api_get_user_id();
$tourPlugin = Tour::create();
$config = $tourPlugin->getTourCofig();
$config = $tourPlugin->getTourConfig();
$showTour = $tourPlugin->get('show_tour') === 'true';
if ($showTour) {

@ -1,12 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Initialization install
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.tour
*/
require_once dirname(__FILE__) . '/config.php';
require_once __DIR__ . '/config.php';
Tour::create()->install();

@ -1,7 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Strings to english L10n
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>

@ -1,7 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Strings to spanish L10n
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>

@ -1,7 +1,5 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Show the JavaScript template in the web pages
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>

@ -2,7 +2,7 @@
<p>Shows people how to use your Chamilo LMS</p>
<h2>Set the blocks for the tour</h2>
<p>Edit the plugin/tour/config/tour.json file adding the page classes and steps</p>
<p>To set the steps in a page, add a object like this:</p>
<p>To set the steps in a page, add an object like this:</p>
<pre>
{
"pageClass": "page unique class selector",

@ -1,16 +1,12 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Description of Tour
*
* The Tour class allows a guided tour in HTML5 of the Chamilo interface
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.tour
*/
class Tour extends Plugin
{
/**
* Class constructor
*/
@ -98,10 +94,10 @@ class Tour extends Plugin
$checkResult = Database::select('count(1) as qty', $pluginTourLogTable, array(
'where' => array(
"page_class = '?' AND " => $currentPageClass,
"user_id = ?" => $userId
"user_id = ?" => intval($userId)
)), 'first');
if ($checkResult != false) {
if ($checkResult !== false) {
if ($checkResult['qty'] > 0) {
return false;
}
@ -122,7 +118,7 @@ class Tour extends Plugin
Database::insert($pluginTourLogTable, array(
'page_class' => $currentPageClass,
'user_id' => $userId,
'user_id' => intval($userId),
'visualization_datetime' => api_get_utc_datetime()
));
}
@ -131,7 +127,7 @@ class Tour extends Plugin
* Get the configuration to show the tour in pages
* @return array The config data
*/
public function getTourCofig()
public function getTourConfig()
{
$pluginPath = api_get_path(PLUGIN_PATH) . 'tour/';

@ -1,12 +1,10 @@
<?php
/* For licensing terms, see /license.txt */
/**
* Initialization uninstall
* @author Angel Fernando Quiroz Campos <angel.quiroz@beeznest.com>
* @package chamilo.plugin.tour
*/
require_once dirname(__FILE__) . '/config.php';
require_once __DIR__ . '/config.php';
Tour::create()->uninstall();

Loading…
Cancel
Save