diff --git a/SRC/app/Http/Controllers/ReferentController.php b/SRC/app/Http/Controllers/ReferentController.php
index d96fd10..cea79dc 100755
--- a/SRC/app/Http/Controllers/ReferentController.php
+++ b/SRC/app/Http/Controllers/ReferentController.php
@@ -14,6 +14,7 @@ use Session;
use Config;
use File;
use Auth;
+use Hash;
class ReferentController extends Controller {
@@ -52,10 +53,26 @@ class ReferentController extends Controller {
$user = Referent::find($idUser);
$user->prenom = Input::get('prenom');
$user->email = Input::get('email');
- $user->etablissement = Input::get('etablissement');
$user->nom = Input::get('nom');
+ $passwd = Input::get('password');
+ $passwd_conf = Input::get('password_confirm');
-
+
+ if($passwd == $passwd_conf) //verifie les donnees pareils
+ {
+ if (strlen($passwd) >= 6) //verifie la longueur de chaine
+ {
+ $user->motdepasse = Hash::make('secret'); // encrypt le mot de passe
+ $user->save(); //sauvegarde le mot de passe
+ }
+ else
+ return redirect('/referent')->with('erreur', 'Mot de passe inferieur à 6 caractères.');
+ }
+ else
+ {
+ return redirect('/referent')->with('erreur', 'Mot de passe incorrect.');
+ }
+
if (Request::hasFile('file'))
{
$extension = Input::file('file')->getClientOriginalExtension();
@@ -122,8 +139,7 @@ class ReferentController extends Controller {
if(Input::get('puzzle') != 0)
ConfigJeu::where('referent_id', '=', Auth::user()->id)->find(Input::get('puzzle'))->update(array('actifPuzzle' => 1));
- Session::flash('message', 'Vous avez modifié les listes associées aux jeux avec succès.');
- return redirect()->back();
+ return ;
}
public function ajouterOeuvresDansListe($id) {
diff --git a/SRC/public/css/frontend.css b/SRC/public/css/frontend.css
index e4c49d9..cd60e4d 100755
--- a/SRC/public/css/frontend.css
+++ b/SRC/public/css/frontend.css
@@ -172,17 +172,28 @@ button.level:active {
height:100px;
width:100px;
margin:40px;
+ padding-top : 30px;
cursor:pointer;
background-position: center center;
background-size:cover;
- line-height:100px;
+ line-height:20px;
font-weight:bold;
- font-size:40px;
+ font-size:18px;
+
}
#imgRef:active {
cursor:wait;
}
+.referent:hover
+{
+ -moz-box-shadow: 0px 0px 10px 2px white;
+-webkit-box-shadow: 0px 0px 10px 2px white;
+-o-box-shadow: 0px 0px 10px 2px white;
+box-shadow: 0px 0px 10px 2px white;
+filter:progid:DXImageTransform.Microsoft.Shadow(color=#656565, Direction=NaN, Strength=10);
+}
+
.trophy-text {
font-weight: bold;
line-height: 40px;
diff --git a/SRC/public/js/firework.js b/SRC/public/js/firework.js
index 782c455..92cc62c 100755
--- a/SRC/public/js/firework.js
+++ b/SRC/public/js/firework.js
@@ -1,6 +1,6 @@
-var bits=60; // how many bits
-var speed=33; // how fast - smaller is faster
-var bangs=5; // how many can be launched simultaneously (note that using too many can slow the script down)
+var bits=50; // how many bits
+var speed=20; // how fast - smaller is faster
+var bangs=4; // how many can be launched simultaneously (note that using too many can slow the script down)
var colours=new Array("#03f", "#f03", "#0e0", "#93f", "#0cf", "#f93", "#f0c");
// blue red green purple cyan orange pink
diff --git a/SRC/public/js/memory.js b/SRC/public/js/memory.js
index 09ea1e9..6b31f45 100755
--- a/SRC/public/js/memory.js
+++ b/SRC/public/js/memory.js
@@ -1,13 +1,12 @@
;(function( window ) {
- //'use strict';
-
+ // code inspiré de https://github.com/callmenick/Memory
/**
- * Extend object function
- *
- */
+ * Extend object function
+ *
+ */
- var partieRealise = 0;
+ var partieRealise = 0;
function extend( a, b ) {
for( var key in b ) {
if( b.hasOwnProperty( key ) ) {
@@ -18,9 +17,8 @@
}
/**
- * Shuffle array function
- *
- */
+ * fonction qui va permettre de mélanger les cartes dans une array
+ */
function shuffle(o) {
for(var j, x, i = o.length; i; j = parseInt(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
@@ -28,9 +26,8 @@
};
/**
- * Memory constructor
- *
- */
+ * Constructeur du Memory
+ */
function Memory( options, level, nbcase, nbPartie ) {
this.options = extend( {}, this.options );
@@ -39,11 +36,10 @@
}
/**
- * Memory _init - initialise Memory
- *
- * Creates all the game content areas, adds the id's and classes, and gets
- * ready for game setup.
- */
+ * Memory _init - initialise Memory
+ *
+ *Crée toutes les zones de contenu de jeu, ajoute les id et les classes, et se prépare pour la configuration de jeu.
+ */
Memory.prototype._init = function(level,nbcase, nbPartie) {
@@ -71,21 +67,14 @@
};
/**
- * Memory _setupGame - Sets up the game
- *
- * We're caching all game related variables, and by default, displaying the
- * meta info bar and start screen HTML.
- *
- * A NOTE ABOUT GAME STATES:
- *
- * There are 4 game states in total, governed by the variable this.gameState.
- * Each game state allows for a certain series of functions to be performed.
- * The gameStates are as follows:
- *
- * 1 : default, allows user to choose level
- * 2 : set when user chooses level, and game is in play
- * 3 : game is finished
- */
+ * Memory _setupGame - on définit les paramètres du jeu
+ *
+ * Etats de la variable gameStates:
+ *
+ * 1 : par défaut,ça permet à l'utilisateur de choisir un niveau
+ * 2 : changer le niveau pendant que le joueur joue
+ * 3 : le jeu est fini
+ */
Memory.prototype._setupGame = function(level, nbcase, nbPartie) {
var self = this;
@@ -104,11 +93,10 @@
}
/**
- * Memory _setupGameWrapper
- *
- * This function sets up the game wrapper, which is where the actual memory
- * tiles will reside and where all the game play happens.
- */
+ * Memory _setupGameWrapper
+ *
+ *Cette fonction définit l'espace du jeu.
+ */
Memory.prototype._setupGameWrapper = function(levelNode,nbcase,nbPartie) {
this.nbcase = nbcase;
@@ -123,69 +111,54 @@
/**
- * Memory _renderTiles
- *
- * This renders the actual tiles with content. A few thing happen here:
- *
- * 1. Calculate grid X and Y based on user level selection
- * 2. Calculate num tiles
- * 3. Create new cards array based on level, and draw cards from original array
- * 4. Shuffle the new cards array
- * 5. Cards get distributed into tiles
- * 6. gamePlay function gets triggered, taking care of all the game play action.
- */
+ * Memory _renderTiles
+ *
+ * Dans cette fonction nous définissons le niveau et le nombre de carte enregistré dans la base.
+ * On y créer une array ou on y met les carte. Puis on utilise la fonction shuffle pour mélaner et donc ne pas avoir toutes les cartes à la suite.
+ * Ensuite on affiche les cartes
+ * Puis on déclenche le jeu.
+ */
Memory.prototype._renderTiles = function(nbPartie,nbcase) {
- if(this.level == 1) {this.gridX = 2; this.gridY= 2; }
- else if(this.level == 2) {this.gridX = 3; this.gridY= 2; }
- else { this.gridX = 2; this.gridY=4 ; }
- // this.gridY = this.gridX ;
+ if(this.level == 1) {this.gridX = 2; this.gridY= 2; }
+ else if(this.level == 2) {this.gridX = 3; this.gridY= 2; }
+ else { this.gridX = 2; this.gridY=4 ; }
this.numTiles = this.nbcase*2;
this.halfNumTiles = this.numTiles/2;
if (this.cards.length < this.halfNumTiles) { console.log("pas assez de carte"); document.getElementById("mg__contents").innerHTML="
Pas assez de cartes enregistrées par le référent
";}
else {
- //this.halfNumTiles = this.gridX;
+ this.newCards = [];
+ for ( var i = 0; i < this.halfNumTiles; i++ ) {
+ this.newCards.push(this.cards[i], this.cards[i]);
+ }
+ this.newCards = shuffle(this.newCards);
- this.newCards = [];
- for ( var i = 0; i < this.halfNumTiles; i++ ) {
- this.newCards.push(this.cards[i], this.cards[i]);
- }
- this.newCards = shuffle(this.newCards);
-
- this.tilesHTML = '';
- var n = 0;
- for ( var i = 0; i < this.numTiles; i++ ) {
- n = n + 1;
- if(this.level == 3 && n == 5 ){n = 9}
- if(this.level == 2 && n == 4 ){n = 7}
- this.tilesHTML += '
\
+ this.tilesHTML = '';
+ var n = 0;
+ for ( var i = 0; i < this.numTiles; i++ ) {
+ n = n + 1;
+ if(this.level == 3 && n == 5 ){n = 9}
+ if(this.level == 2 && n == 4 ){n = 7}
+ this.tilesHTML += '
";
- }*/
- this.tilesHTML +="";
+ this.gameContents.innerHTML = this.tilesHTML;
+ this.gameState = 2;
+ this.options.onGameStart();
+ this._gamePlay(this.level, nbPartie, nbcase);
}
-
- this.gameContents.innerHTML = this.tilesHTML;
- this.gameState = 2;
- this.options.onGameStart();
- this._gamePlay(this.level, nbPartie, nbcase);
- }
}
/**
- * Memory _gamePlay
- *
- * Now that all the HTML is set up, the game is ready to be played. In this
- * function, we loop through all the tiles (goverend by the .mg__tile--inner)
- * class, and for each tile, we run the _gamePlayEvents function.
- */
+ * Memory _gamePlay
+ *Maintenant que tout le HTML est mis en place, le jeu est prêt à être joué.
+ *Dans cette fonction, avec une boucle on ajoute les "tiles" avec la fonction gamePlayEvents.
+ */
Memory.prototype._gamePlay = function(levelNode,nbPartie,nbcase) {
var tiles = document.querySelectorAll(".mg__tile--inner");
@@ -196,15 +169,10 @@
};
/**
- * Memory _gamePlayEvents
- *
- * This function takes care of the "events", which is basically the clicking
- * of tiles. Tiles need to be checked if flipped or not, flipped if possible,
- * and if zero, one, or two cards are flipped. When two cards are flipped, we
- * have to check for matches and mismatches. The _gameCardsMatch and
- * _gameCardsMismatch functions perform two separate sets of functions, and are
- * thus separated below.
- */
+ * Memory _gamePlayEvents
+ *Cette fonction prend en charge les «événements», qui est essentiellement le clic sur les "tiles".
+ *Les "titles" sont verifié, savoir si ils sont retourné ou non et vérifier si les deux cartes retourné sont identiques.
+ */
Memory.prototype._gamePlayEvents = function(tile,levelNode,nbPartie,nbcase) {
var self = this;
@@ -231,30 +199,30 @@
}
/**
- * Memory _gameCardsMatch
- *
- * This function runs if the cards match. The "correct" class is added briefly
- * which fades in a background green colour. The times set on the two timeout
- * functions are chosen based on transition values in the CSS. The "flip" has
- * a 0.3s transition, so the "correct" class is added 0.3s later, shown for
- * 1.2s, then removed. The cards remain flipped due to the activated "flip"
- * class from the gamePlayEvents function.
- */
+ * Memory _gameCardsMatch
+ *
+ * This function runs if the cards match. The "correct" class is added briefly
+ * which fades in a background green colour. The times set on the two timeout
+ * functions are chosen based on transition values in the CSS. The "flip" has
+ * a 0.3s transition, so the "correct" class is added 0.3s later, shown for
+ * 1.2s, then removed. The cards remain flipped due to the activated "flip"
+ * class from the gamePlayEvents function.
+ */
"document"in self&&("classList"in document.createElement("_")?!function(){"use strict";var a=document.createElement("_");if(a.classList.add("c1","c2"),!a.classList.contains("c2")){var b=function(a){var b=DOMTokenList.prototype[a];DOMTokenList.prototype[a]=function(a){var c,d=arguments.length;for(c=0;d>c;c++)a=arguments[c],b.call(this,a)}};b("add"),b("remove")}if(a.classList.toggle("c3",!1),a.classList.contains("c3")){var c=DOMTokenList.prototype.toggle;DOMTokenList.prototype.toggle=function(a,b){return 1 in arguments&&!this.contains(a)==!b?b:c.call(this,a)}}a=null}():!function(a){"use strict";if("Element"in a){var b="classList",c="prototype",d=a.Element[c],e=Object,f=String[c].trim||function(){return this.replace(/^\s+|\s+$/g,"")},g=Array[c].indexOf||function(a){for(var b=0,c=this.length;c>b;b++)if(b in this&&this[b]===a)return b;return-1},h=function(a,b){this.name=a,this.code=DOMException[a],this.message=b},i=function(a,b){if(""===b)throw new h("SYNTAX_ERR","An invalid or illegal string was specified");if(/\s/.test(b))throw new h("INVALID_CHARACTER_ERR","String contains an invalid character");return g.call(a,b)},j=function(a){for(var b=f.call(a.getAttribute("class")||""),c=b?b.split(/\s+/):[],d=0,e=c.length;e>d;d++)this.push(c[d]);this._updateClassName=function(){a.setAttribute("class",this.toString())}},k=j[c]=[],l=function(){return new j(this)};if(h[c]=Error[c],k.item=function(a){return this[a]||null},k.contains=function(a){return a+="",-1!==i(this,a)},k.add=function(){var a,b=arguments,c=0,d=b.length,e=!1;do a=b[c]+"",-1===i(this,a)&&(this.push(a),e=!0);while(++c \
+ else if (this.options.onGameEnd() === false) {
+ // si il a fini le jeu on le félicite et on lui rajoute aussi des feu d'artifice.
+ this._clearGame();
+ firework();
+ //firework2();
+ // on affiche la bonne coupe en fonction du niveau choisi
+ if(levelNode == 1){this.gameMessages.innerHTML = ' \
';}
else if(levelNode == 2){this.gameMessages.innerHTML = ' \
- ';}
-
- else if(levelNode == 3){this.gameMessages.innerHTML = ' \
- ';}
-
-else
- { this.gameMessages.innerHTML = '
\
+ ';}
+ // en ajax on incrémente les coupes de l'utilisateur
var r = new XMLHttpRequest();
r.open("GET", "/setRecords" + "/" + levelNode, true);
r.send();
//http://translate.google.com/translate_tts?ie=UTF-8&q=bravo%2C%20tu%20as%20gagn%C3%A9&tl=fr
//http://translate.google.com/translate_tts?ie=UTF-8&q=bravo%2C%20tu%20as%20gagn%C3%A9&tl=fr&total=1&idx=0&textlen=18&client=t&prev=input
-
+ //une petite voix dit à l'utilisateur qu'il a gagné
var audio = new Audio();
var texte = 'http://translate.google.com/translate_tts?ie=UTF-8&q=bravo%2C%20tu%20as%20gagn%C3%A9&tl=fr';
audio.src =texte;
audio.play();
- this.game.appendChild(this.gameMessages);
- document.getElementById("mg__onend--restart").addEventListener( "click", function(e) {
- document.location.href="/memo";
- });
- } else {
- // run callback
- this.options.onGameEnd();
+ this.game.appendChild(this.gameMessages);
+ document.getElementById("mg__onend--restart").addEventListener( "click", function(e) {
+ document.location.href="/memo";
+ });
+ } else {
+ // run callback
+ this.options.onGameEnd();
+ }
}
-}
/**
- * Memory resetGame
- *
- * This function resets the game. It can run at the end of the game when the
- * user is presented the option to play again, or at any time like a reset
- * button. It is a public function, and can be used in whatever custom calls
- * in your markup.
- */
+ * Memory resetGame
+ *
+ * This function resets the game. It can run at the end of the game when the
+ * user is presented the option to play again, or at any time like a reset
+ * button. It is a public function, and can be used in whatever custom calls
+ * in your markup.
+ */
Memory.prototype.resetGame = function() {
this._clearGame();
@@ -424,8 +376,8 @@ else
};
/**
- * Add Memory to global namespace
- */
+ * Add Memory to global namespace
+ */
window.Memory = Memory;
diff --git a/SRC/resources/views/backend/ref_home.blade.php b/SRC/resources/views/backend/ref_home.blade.php
index 58434bd..f354717 100755
--- a/SRC/resources/views/backend/ref_home.blade.php
+++ b/SRC/resources/views/backend/ref_home.blade.php
@@ -31,8 +31,8 @@
-
Ci-dessous, vous pouvez associer les listes d'oeuvres à un jeu. Cliquez sur le bouton " Associer" quand c'est terminé.