|
@@ -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 {
|
|
|
|
|
|
$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);
|