This commit is contained in:
Malibu 2015-03-24 12:25:08 +01:00
commit 55b1ba1028
8 changed files with 223 additions and 223 deletions

View File

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

View File

@ -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;

View File

@ -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

View File

@ -1,7 +1,6 @@
;(function( window ) {
//'use strict';
// code inspiré de https://github.com/callmenick/Memory
/**
* Extend object function
*
@ -18,8 +17,7 @@
}
/**
* Shuffle array function
*
* fonction qui va permettre de mélanger les cartes dans une array
*/
function shuffle(o) {
@ -28,8 +26,7 @@
};
/**
* Memory constructor
*
* Constructeur du Memory
*/
function Memory( options, level, nbcase, nbPartie ) {
@ -41,8 +38,7 @@
/**
* Memory _init - initialise Memory
*
* Creates all the game content areas, adds the id's and classes, and gets
* ready for game setup.
*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,20 +67,13 @@
};
/**
* Memory _setupGame - Sets up the game
* Memory _setupGame - on définit les paramètres du jeu
*
* We're caching all game related variables, and by default, displaying the
* meta info bar and start screen HTML.
* Etats de la variable gameStates:
*
* 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
* 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) {
@ -106,8 +95,7 @@
/**
* 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.
*Cette fonction définit l'espace du jeu.
*/
Memory.prototype._setupGameWrapper = function(levelNode,nbcase,nbPartie) {
@ -125,28 +113,21 @@
/**
* 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.
* 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 ;
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="<img height='80px' src='/imgs/sad.png'><h1>Pas assez de cartes enregistrées par le référent </h1>";}
else {
//this.halfNumTiles = this.gridX;
this.newCards = [];
for ( var i = 0; i < this.halfNumTiles; i++ ) {
this.newCards.push(this.cards[i], this.cards[i]);
@ -163,13 +144,7 @@
<div class="mg__tile--inner" data-id="' + this.newCards[i]["id"] + '">\
<span class="mg__tile--outside"></span>\
<span class="mg__tile--inside" style="background-image:url(' + this.newCards[i]["img"] + ');"></span>';
this.tilesHTML +='</div>';
/* if(this.level == 1 && n == 2){
this.tilesHTML +="</tr><tr>";
}*/
this.tilesHTML +="</div>";
this.tilesHTML +='</div></div>';
}
this.gameContents.innerHTML = this.tilesHTML;
@ -181,10 +156,8 @@
/**
* 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.
*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) {
@ -197,13 +170,8 @@
/**
* 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.
*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) {
@ -248,13 +216,13 @@
// cache this
var self = this;
// add correct class
// on ajoute la classe correct
window.setTimeout( function(){
self.card1.classList.add("correct");
self.card2.classList.add("correct");
}, 300 );
// remove correct class and reset vars
// On supprime la classe correct et on réinitialiser les vars
window.setTimeout( function(){
self.card1.classList.remove("correct");
self.card2.classList.remove("correct");
@ -265,7 +233,7 @@
}
}, 500 );
// plus one on the move counter
// on incrémente les compteurs
this._gameCounterPlusOne();
};
@ -339,42 +307,26 @@
/**
* Memoray _winGame
*
* You won the game! This function runs the "onGameEnd" callback, which by
* default clears the game div entirely and shows a "play again" button.
* fonction lorsque l'utilisateur à gagné.
*/
/*
Memory.prototype._winGame = function() {
var self = this;
if (this.options.onGameEnd() === false) {
this._clearGame();
alert("zoro 2");
document.location.href="/memo";
self.resetGame();
} else {
// run callback
this.options.onGameEnd();
//alert("coucou");
}
}
*/
Memory.prototype._winGame = function(levelNode, nbPartie, nbcase) {
Memory.prototype._winGame = function(levelNode, nbPartie, nbcase) {
var self = this;
this.level = levelNode;
partieRealise = partieRealise + 1 ;
if (partieRealise != nbPartie){
// Pour gagner une coupe il y a un certain nombre de partie à faire
this._clearGame();
this._init(this.level, nbcase, nbPartie);
}
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 = '<img style="height: 270px;" src="/imgs/trophees/bronze.png"><br>\
<button id="mg__onend--restart" class="mg__button"><span class="icon-spinner11"></span></button>';}
@ -384,17 +336,17 @@ Memory.prototype._winGame = function(levelNode, nbPartie, nbcase) {
else if(levelNode == 3){this.gameMessages.innerHTML = '<img style="height: 270px;" src="/imgs/trophees/or.png"><br>\
<button id="mg__onend--restart" class="mg__button"><span class="icon-spinner11"></span></button>';}
else
else
{ this.gameMessages.innerHTML = '<h2 class="mg__onend--heading"><span class="icon-trophy"></span></h2>\
<button id="mg__onend--restart" class="mg__button"><span class="icon-spinner11"></span></button>';}
// 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;
@ -407,7 +359,7 @@ else
// run callback
this.options.onGameEnd();
}
}
}
/**
* Memory resetGame

View File

@ -31,8 +31,8 @@
</div>
</div>
</form>
<div class="alert alert-grey">Ci-dessous, vous pouvez associer les listes d'oeuvres à un jeu. Cliquez sur le bouton "<span class="glyphicon glyphicon-ok"> </span> Associer" quand c'est terminé.</div>
<form method="post" action="{{ URL::to('referent/changerparamliste') }}">
<div class="alert alert-grey">Ci-dessous, vous pouvez associer les listes d'oeuvres à un jeu. </div>
<form id ="assoListeJeu" method="post" action="{{ URL::to('referent/changerparamliste') }}">
<table class="table">
<thead class="tablethead">
<tr>
@ -45,15 +45,15 @@
<tbody>
<tr>
<td>Liste aléatoire</td>
<td><input type="radio" name="memo" value="0" checked type="checkbox"></td>
<td><input type="radio" name="puzzle" value="0" checked type="checkbox"></td>
<td><input class="radioAsso" type="radio" name="memo" value="0" checked type="checkbox"></td>
<td><input class="radioAsso" type="radio" name="puzzle" value="0" checked type="checkbox"></td>
<td></td>
</tr>
@foreach ($meslistes as $index => $listeoeuvre)
<tr>
<td>{{$listeoeuvre->nom}}</td>
<td><input type="radio" name="memo" value="{{$listeoeuvre->id}}" {{ ($listeoeuvre->actifMemo == 1) ? 'checked' : '' }} type="checkbox"></td>
<td><input type="radio" name="puzzle" value="{{$listeoeuvre->id}}" {{ ($listeoeuvre->actifPuzzle == 1) ? 'checked' : '' }} type="checkbox"></td>
<td><input class="radioAsso" type="radio" name="memo" value="{{$listeoeuvre->id}}" {{ ($listeoeuvre->actifMemo == 1) ? 'checked' : '' }} type="checkbox"></td>
<td><input class="radioAsso" type="radio" name="puzzle" value="{{$listeoeuvre->id}}" {{ ($listeoeuvre->actifPuzzle == 1) ? 'checked' : '' }} type="checkbox"></td>
<td>
<div class="btn-group" role="group" aria-label="...">
<a href="{{ URL::to('referent/modifierliste', $listeoeuvre->id) }}" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-pencil"></span></a>
@ -66,7 +66,6 @@
</form>
</tbody>
</table>
<div class="text-center"><button type="submit" class="btn btn-xs btn-primary"><span class="glyphicon glyphicon-ok-circle"> </span> Associer</button></div>
</div>
</div>
@ -315,6 +314,10 @@ $("#recherche").on('submit', function(event){
});
$(".radioAsso").change(function() {
$.get('{{ URL::to('referent/changerparamliste') }}' + $('#assoListeJeu').serialize());
});
/*

View File

@ -13,6 +13,7 @@
<ul class="nav navbar-nav">
<li class="active"><a href="#">Mes Listes</a></li>
<li><a data-toggle="modal" data-target="#myModal1" href="#">Mon Compte</a></li>
<li><a href="{{ URL::to('changerref', $me->id) }}" >Voir mes jeux</a></li>
</ul>
<ul class="nav navbar-nav navbar-right">
<li><a href="{{ URL::to('logout') }}">Déconnexion</a></li>
@ -38,32 +39,38 @@
<input type="hidden" name="idUser" value="{{ $me->id }}" />
<div class="modal-body">
<div class="form-group">
<label for="firstname" class="col-sm-3 control-label">Prénom :</label>
<div class="col-sm-9">
<label for="firstname" class="col-sm-4 control-label">Prénom :</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="firstname" name="prenom" required placeholder="Prénom" value="{{$me->prenom}}">
</div>
</div>
<div class="form-group">
<label for="lastname" class="col-sm-3 control-label">Nom :</label>
<div class="col-sm-9">
<label for="lastname" class="col-sm-4 control-label">Nom :</label>
<div class="col-sm-8">
<input type="text" class="form-control" id="lastname" name="nom" required placeholder="Nom" value="{{$me->nom}}">
</div>
</div>
<div class="form-group">
<label for="email" class="col-sm-3 control-label">Email :</label>
<div class="col-sm-9">
<label for="email" class="col-sm-4 control-label">Email :</label>
<div class="col-sm-8">
<input type="email" class="form-control" id="email" name="email" required placeholder="Email" value="{{$me->email}}">
</div>
</div>
<div class="form-group">
<label for="city" class="col-sm-3 control-label">Etablissement :</label>
<div class="col-sm-9">
<input type="text" class="form-control" id="city" name="etablissement" required placeholder="Ecole" value="{{$me->etablissement}}">
<label for="password_confirm" class="col-sm-4 control-label">Nouveau mot de passe (min. 6 caractères):</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="password" name="password" required placeholder="Mot de passe">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label" for="exampleInputFile">Image :</label>
<div class="col-sm-9">
<label for="password_confirm" class="col-sm-4 control-label">Confirmer le mot de passe :</label>
<div class="col-sm-8">
<input type="password" class="form-control" id="password_confirm" name="password_confirm" required placeholder="Mot de passe">
</div>
</div>
<div class="form-group">
<label class="col-sm-4 control-label" for="exampleInputFile">Image :</label>
<div class="col-sm-8">
<input type="file" class="form-control" name="file" id="file">
</div>
</div>

View File

@ -35,7 +35,7 @@
<script>
var redirectTimer;
var chiffre;
imgRef.innerHTML = '&nbsp;';
@ -51,13 +51,19 @@
function startCounter(event) {
absorbEvent_(event);
imgRef.innerHTML = 3;
chiffre = 3;
imgRef.innerHTML = "Redirection <br>"+chiffre;
redirectTimer = setInterval(counter, 1000);
}
function counter() {
imgRef.innerHTML--;
if(imgRef.innerHTML == 0) location.href="{{URL::to('choisirref')}}";
chiffre--;
imgRef.innerHTML = "Redirection <br>"+chiffre;
if(chiffre == 0)
{
endCounter(null);
location.href="{{URL::to('choisirref')}}";
}
}
function endCounter(event) {

View File

@ -8,11 +8,16 @@
L'objectif de ce site est de permettre aux enfants de jouer à des jeux tout en leur apportant de l'intérêt pour les différentes oeuvres d'art exposées dans le fameux musée toulousain.<br>
<span style="color:red;">Lorsque vous aurez choisit un référent, il faudra appuyer pendant 3 secondes sur l'icone de votre référent afin de revenir sur cette page.</span><br>
<<<<<<< HEAD
Si vous n'avez pas de référent, vous pouvez toujours <span style="color:#37378e;"><a href="/">cliquer ici pour jouer aux jeux</a></span>, sinon cliquez sur leur image.
</div>
<div id="txt_show" style="@if($cookie == 'close')display: none; @endif text-align:center;background-color: #fcfc6b; padding:10px; margin:auto;font-size:18px;">
<a href="#" style="text-align:center;background-color: #fcfc6b; padding:10px; margin:auto;font-size:18px;" onClick="cache();">À Propos</a>
=======
Si vous n'avez pas de référent, vous pouvez toujours <span style="color:#37378e;"><a href="/changerref/1">cliquer ici pour jouer aux jeux</a></span>, sinon cliquez sur leur image.
>>>>>>> e809566ed4eb28978676ffc730cad62dcf828fdc
</div>
<nav>
<input name="searchterm" class="icon-search" id="searchterm" placeholder="&#xe986; Rechercher un référent" type="text">