Minor - flint fixes

pull/2697/head
Julio Montoya 8 years ago
parent 7faddcb97a
commit 47d5370879
  1. 21
      plugin/card_game/card_game.php
  2. 10
      plugin/card_game/index.php
  3. 3
      plugin/card_game/lang/english.php
  4. 2
      plugin/card_game/lang/french.php
  5. 2
      plugin/card_game/lang/spanish.php
  6. 7
      plugin/card_game/plugin.php
  7. 10
      plugin/card_game/resources/ajax.card.php

@ -2,28 +2,31 @@
/* For licensing terms, see /license.txt */
/**
* Define the CardGame class as an extension of Plugin to
* install/uninstall the plugin
* install/uninstall the plugin.
*
* @author Damien Renou
*
* @package chamilo.plugin.card_game
*/
class CardGame extends Plugin
{
protected function __construct(){
protected function __construct()
{
parent::__construct(
'1.0',
'Damien Renou'
);
}
public static function create(){
public static function create()
{
static $result = null;
return $result ? $result : $result = new self();
}
public function install()
{
{
$sql = "CREATE TABLE IF NOT EXISTS plugin_card_game(
id INT NOT NULL AUTO_INCREMENT,
user_id INT NOT NULL,
@ -34,7 +37,7 @@ class CardGame extends Plugin
";
Database::query($sql);
}
public function uninstall()
{
$sql = "DROP TABLE IF EXISTS plugin_card_game";

@ -3,14 +3,15 @@
/**
* This is the main script of the Card Game plugin.
* It is loaded on every page through the inclusion of the plugin in the
* pre_footer region (a mandatory step of the installation)
* pre_footer region (a mandatory step of the installation).
*
* @author Damien Renou
*
* @package chamilo.plugin.card_game
*/
require_once __DIR__.'/../../main/inc/global.inc.php';
if (!api_is_anonymous()) {
require_once 'card_game.php';
$cardGame = CardGame::create();
@ -36,7 +37,6 @@ if (!api_is_anonymous()) {
$userId = (int) $user['id'];
if (!isset($_SESSION['cardgame'])) {
if (isset($userId)) {
$sqlCount = "SELECT access_date FROM plugin_card_game WHERE user_id = $userId";
$resultCount = Database::query($sqlCount)->rowCount();
@ -47,7 +47,6 @@ if (!api_is_anonymous()) {
VALUES ($userId, DATE_ADD(CURDATE(), INTERVAL -1 DAY), 1);";
$resultInsert = Database::query($sql);
$_SESSION['cardgame'] = 'havedeck';
} else {
// @todo change date call
$sqlDate = "SELECT access_date
@ -64,18 +63,15 @@ if (!api_is_anonymous()) {
}
}
}
} else {
if ($_SESSION['cardgame'] == 'havedeck') {
$fh .= '<div id="havedeckcardgame" ></div>';
}
}
$parts = '';
if (isset($userId)) {
try {
$sqlParts = "SELECT parts, pan FROM plugin_card_game WHERE user_id = $userId";
$resultParts = Database::query($sqlParts);

@ -1,6 +1,5 @@
<?php
$strings['openDeckCardGame'] = 'You have won a Chamilo card! Open it to see its contents.';
$strings['engageDeckCardGame'] = 'Come back everyday to win new cards.';
$strings['cardgameloose'] = 'You already have this piece. Come back tomorrow.';
$strings['cardgameloose'] = 'You already have this piece. Come back tomorrow.';

@ -2,4 +2,4 @@
$strings['openDeckCardGame'] = 'Tu as gagné une carte Chamilo ! Ouvre-la pour voir son contenu.';
$strings['engageDeckCardGame'] = 'Revenez tous les jours pour gagner de nouvelles cartes.';
$strings['cardgameloose'] = 'Vous avez déja cette pièce. Revenez demain.';
$strings['cardgameloose'] = 'Vous avez déja cette pièce. Revenez demain.';

@ -2,4 +2,4 @@
$strings['openDeckCardGame'] = 'Has ganado una tarjeta Chamilo ! Ábrela para ver su contenido.';
$strings['engageDeckCardGame'] = 'Regresa todos los días para ganar nuevas tarjetas.';
$strings['cardgameloose'] = 'Ya tienes esta pieza. Regresa mañana para más.';
$strings['cardgameloose'] = 'Ya tienes esta pieza. Regresa mañana para más.';

@ -3,10 +3,12 @@
/**
* This script is a configuration file for the add_this plugin.
* These settings will be used in the administration interface for plugins
* (Chamilo configuration settings->Plugins)
* (Chamilo configuration settings->Plugins).
*
* @package chamilo.plugin card_game
*
* @author Damien Renou <renou.damien@gmail.com>
*/
*/
/* Plugin config */
// The plugin title.
@ -17,4 +19,3 @@ $plugin_info['comment'] = "Show a card game";
$plugin_info['version'] = '1.2';
// The plugin author.
$plugin_info['author'] = 'Damien Renou';

@ -2,19 +2,19 @@
/* For license terms, see /license.txt */
/**
* This script answers to AJAX calls to store a new piece as revealed
* in the plugin_card_game table
* in the plugin_card_game table.
*
* @author Damien Renou
*
* @package chamilo.plugin.card_game
*/
require_once __DIR__.'/../../../main/inc/global.inc.php';
if (isset($_SESSION['cardgame'])) {
if ($_SESSION['cardgame'] = 'havedeck') {
$part = '1';
if (isset($_GET['part'])) {
$part = (int)$_GET['part'];
$part = (int) $_GET['part'];
$user = api_get_user_info();
if (isset($user['id'])) {
@ -34,4 +34,4 @@ if (isset($_SESSION['cardgame'])) {
}
}
}
}
}

Loading…
Cancel
Save