Presque terminé
This commit is contained in:
parent
6ea2de6e26
commit
0cfce7d1f9
81952
INITBASE/inventaire.xml
Normal file
81952
INITBASE/inventaire.xml
Normal file
File diff suppressed because it is too large
Load Diff
203
INITBASE/loader.py
Normal file
203
INITBASE/loader.py
Normal file
@ -0,0 +1,203 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
import xml.etree.ElementTree as ET
|
||||||
|
import MySQLdb as mdb
|
||||||
|
import sys
|
||||||
|
import re
|
||||||
|
|
||||||
|
|
||||||
|
def insert (cur, table, dict) :
|
||||||
|
keys = ""
|
||||||
|
datas = ""
|
||||||
|
for key , data in dict.items() :
|
||||||
|
keys += key + ","
|
||||||
|
datas += "\"" + str(data) + "\","
|
||||||
|
|
||||||
|
req = "INSERT INTO " + table + "(" + keys[:-1] + ")" + " VALUES (" + datas[:-1] + ")"
|
||||||
|
#print(req)
|
||||||
|
cur.execute(req)
|
||||||
|
return cur.lastrowid
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
try :
|
||||||
|
listeTechnique = {}
|
||||||
|
listeMatiere= {}
|
||||||
|
listeDomaine = {}
|
||||||
|
listeDesignation = {}
|
||||||
|
listeAuteur = {}
|
||||||
|
listeDatation = {}
|
||||||
|
|
||||||
|
con = mdb.connect('127.0.0.1', 'root', '', 'moduleweb',charset='utf8')
|
||||||
|
cur = con.cursor()
|
||||||
|
# Suppresion des données existantes dan la bd
|
||||||
|
cur.execute("TRUNCATE table auteurs")
|
||||||
|
cur.execute("TRUNCATE table matieres")
|
||||||
|
cur.execute("TRUNCATE table techniques")
|
||||||
|
cur.execute("TRUNCATE table domaines")
|
||||||
|
cur.execute("TRUNCATE table datations")
|
||||||
|
cur.execute("TRUNCATE table oeuvres")
|
||||||
|
|
||||||
|
# On parcourt le fichier xml
|
||||||
|
tree = ET.parse('inventaire.xml')
|
||||||
|
root = tree.getroot()
|
||||||
|
|
||||||
|
# Pour chaque oeuvre
|
||||||
|
for o in root.iter('oeuvre'):
|
||||||
|
idtechnique = "NULL"
|
||||||
|
idmatiere = "NULL"
|
||||||
|
iddomaine= "NULL"
|
||||||
|
iddesignation = "NULL"
|
||||||
|
iddesignation2 = "NULL"
|
||||||
|
iddesignation3 = "NULL"
|
||||||
|
idauteur = "NULL"
|
||||||
|
idauteur2 = "NULL"
|
||||||
|
image = "NULL"
|
||||||
|
iddatation = "NULL"
|
||||||
|
|
||||||
|
technique = None
|
||||||
|
matiere = None
|
||||||
|
domaine = None
|
||||||
|
designation = None
|
||||||
|
designation2 = None
|
||||||
|
designation3 = None
|
||||||
|
auteur = None
|
||||||
|
auteur2 = None
|
||||||
|
datation = None
|
||||||
|
datation2 = None
|
||||||
|
|
||||||
|
# On parcourt tout les tags
|
||||||
|
for child in o :
|
||||||
|
if child.tag == 'auteur1' :
|
||||||
|
auteur = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'auteur2' :
|
||||||
|
auteur2 = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'datation1':
|
||||||
|
datation = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'datation2':
|
||||||
|
datation2 = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'designation':
|
||||||
|
designation1 = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'designation2':
|
||||||
|
designation2 = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'designation3':
|
||||||
|
designation3 = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'domaine':
|
||||||
|
domaine = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'matiere':
|
||||||
|
matiere = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'technique':
|
||||||
|
technique = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
elif child.tag == 'image' :
|
||||||
|
image = child.text.encode('utf-8')
|
||||||
|
|
||||||
|
# On s'interesee qu'aux oeuvres ayant une image
|
||||||
|
if image != "NULL" :
|
||||||
|
if str(datation)+str(datation2) in listeDatation :
|
||||||
|
iddatation = listeDatation[str(datation)+str(datation2)]
|
||||||
|
else :
|
||||||
|
if datation is not None and datation2 is not None :
|
||||||
|
if re.compile("vers").search(datation.lower()) or re.compile("avant").search(datation.lower()):
|
||||||
|
try:
|
||||||
|
datas = {"dateDebut" : datation2.split("-")[0] + "-01-01", "dateFin" : datation2.split("-")[1] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
except Exception, e:
|
||||||
|
if re.compile("^[0-9]{4}[ ]").match(datation.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split(" ")[0] + "-01-01", "dateFin" : datation.split(" ")[0] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
elif re.compile("^[0-9]{4}-[0-9]{4}$").search(datation.lower()) and re.compile("^[0-9]{4}-[0-9]{4}$").search(datation2.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split("-")[0] + "-01-01", "dateFin" : datation2.split("-")[1] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
elif re.compile("^[0-9]{4}[ ]").match(datation.lower()) and re.compile("^[0-9]{4}[ ]").match(datation2.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split(" ")[0] + "-01-01", "dateFin" : datation2.split(" ")[0] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
elif re.compile("^[0-9]{4}-[0-9]{4}[ ]").match(datation.lower()) and re.compile("^[0-9]{4}-[0-9]{4}[ ]").match(datation2.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split("-")[0] + "-01-01", "dateFin" : datation2.split("-")[1].split(" ")[0] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
elif re.compile("^[0-9]{4}-[0-9]{4}[ ]").match(datation.lower()) and re.compile("^[0-9]{4}-[0-9]{4}").match(datation2.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split("-")[0] + "-01-01", "dateFin" : datation2.split("-")[1].split(" ")[0] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
if datation is not None and datation2 is None :
|
||||||
|
if re.compile("^[0-9]{4}[ ]").match(datation.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split(" ")[0] + "-01-01", "dateFin" : datation.split(" ")[0] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
elif re.compile("^[0-9]{4}$").match(datation.lower()) :
|
||||||
|
datas = {"dateDebut" : datation + "-01-01", "dateFin" : datation + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
elif re.compile("^[0-9]{4}-[0-9]{4}$").match(datation.lower()) :
|
||||||
|
datas = {"dateDebut" : datation.split("-")[0] + "-01-01", "dateFin" : datation.split("-")[1] + "-12-31"}
|
||||||
|
iddatation = insert(cur,"datations",datas)
|
||||||
|
|
||||||
|
if iddatation != "NULL" :
|
||||||
|
listeDatation[str(datation)+str(datation2) ] = iddatation
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if technique is not None :
|
||||||
|
if not technique in listeTechnique :
|
||||||
|
datas = { "nom" : technique}
|
||||||
|
idtechnique = insert(cur,"techniques",datas)
|
||||||
|
listeTechnique[technique] = idtechnique
|
||||||
|
else :
|
||||||
|
idtechnique = listeTechnique[technique]
|
||||||
|
|
||||||
|
if matiere is not None :
|
||||||
|
if not matiere in listeMatiere :
|
||||||
|
datas = { "nom" : matiere}
|
||||||
|
idmatiere = insert(cur,"matieres",datas)
|
||||||
|
listeMatiere[matiere] = idmatiere
|
||||||
|
else :
|
||||||
|
idmatiere = listeMatiere[matiere]
|
||||||
|
|
||||||
|
if domaine is not None :
|
||||||
|
if not domaine in listeDomaine :
|
||||||
|
datas = { "nom" : domaine}
|
||||||
|
iddomaine = insert(cur,"domaines",datas)
|
||||||
|
listeDomaine[domaine] = iddomaine
|
||||||
|
else :
|
||||||
|
iddomaine = listeDomaine[domaine]
|
||||||
|
|
||||||
|
if auteur is not None :
|
||||||
|
if not auteur in listeAuteur :
|
||||||
|
datas = { "nom" : auteur}
|
||||||
|
idauteur = insert(cur,"auteurs", datas)
|
||||||
|
listeAuteur[auteur] = idauteur
|
||||||
|
else :
|
||||||
|
idauteur = listeAuteur[auteur]
|
||||||
|
|
||||||
|
|
||||||
|
datas = {"technique_id" : idtechnique, "domaine_id" : iddomaine, "matiere_id" : idmatiere,
|
||||||
|
"image" : image, "designation" : con.escape_string(designation1), "auteur_id" : idauteur}
|
||||||
|
for key , data in datas.items() :
|
||||||
|
if data == "NULL" :
|
||||||
|
del datas[key]
|
||||||
|
|
||||||
|
idoeuvre = insert(cur,"oeuvres",datas)
|
||||||
|
con.commit()
|
||||||
|
|
||||||
|
except mdb.Error, e:
|
||||||
|
if con:
|
||||||
|
con.rollback()
|
||||||
|
|
||||||
|
print("Error %d: %s" % (e.args[0],e.args[1]))
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
finally:
|
||||||
|
if con:
|
||||||
|
con.close()
|
@ -54,12 +54,12 @@ class APIController extends Controller {
|
|||||||
//$listeoeuvres = Oeuvre::where('auteur_id', '=', Input::get('auteur'))->simplePaginate(1);
|
//$listeoeuvres = Oeuvre::where('auteur_id', '=', Input::get('auteur'))->simplePaginate(1);
|
||||||
|
|
||||||
$auteurs = (Input::get('auteur', array()))?Input::get('auteur', array()): [];
|
$auteurs = (Input::get('auteur', array()))?Input::get('auteur', array()): [];
|
||||||
$designations = (Input::get('designation', array()))? Input::get('designation', array()): [];
|
$designations = (Input::get('designation')) ? Input::get('designation') : "";
|
||||||
$domaines = (Input::get('domaine', array()))? Input::get('domaine', array()): [];
|
$domaines = (Input::get('domaine', array()))? Input::get('domaine', array()): [];
|
||||||
$matieres = (Input::get('matiere', array()))? Input::get('matiere', array()): [];
|
$matieres = (Input::get('matiere', array()))? Input::get('matiere', array()): [];
|
||||||
$techniques = (Input::get('technique', array()))?Input::get('technique', array()): [];
|
$techniques = (Input::get('technique', array()))?Input::get('technique', array()): [];
|
||||||
|
|
||||||
$listeoeuvres = Oeuvre::authorFilter($auteurs)
|
$listeoeuvres = Oeuvre::auteurFilter($auteurs)
|
||||||
->techniqueFilter($techniques)
|
->techniqueFilter($techniques)
|
||||||
->designationFilter($designations)
|
->designationFilter($designations)
|
||||||
->domaineFilter($domaines)
|
->domaineFilter($domaines)
|
||||||
|
@ -2,7 +2,11 @@
|
|||||||
|
|
||||||
use App\Referent;
|
use App\Referent;
|
||||||
use App\ConfigJeu;
|
use App\ConfigJeu;
|
||||||
|
use App\Auteur;
|
||||||
|
use App\Domaine;
|
||||||
use App\Oeuvre;
|
use App\Oeuvre;
|
||||||
|
use App\Matiere;
|
||||||
|
use App\Technique;
|
||||||
use Input;
|
use Input;
|
||||||
use Request;
|
use Request;
|
||||||
use Response;
|
use Response;
|
||||||
@ -103,7 +107,9 @@ class ReferentController extends Controller {
|
|||||||
$meslistes = $me->configjeu;
|
$meslistes = $me->configjeu;
|
||||||
$mesoeuvres = $me->configjeu->find($idListe);
|
$mesoeuvres = $me->configjeu->find($idListe);
|
||||||
|
|
||||||
return view('backend/ref_home',['meslistes' => $meslistes, 'mesoeuvres' => $mesoeuvres, 'me' => $me, 'listeoeuvres' => $listeoeuvres]);
|
return view('backend/ref_home',['meslistes' => $meslistes, 'mesoeuvres' => $mesoeuvres, 'me' => $me, 'listeoeuvres' => $listeoeuvres,
|
||||||
|
'auteurs' => Auteur::all(), 'domaines' => Domaine::all(), 'matieres' => Matiere::all(), 'techniques' => Technique::all()
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function changerParamListe() {
|
public function changerParamListe() {
|
||||||
|
@ -28,48 +28,34 @@ class Oeuvre extends Model {
|
|||||||
return $this->hasMany('App\Datation');
|
return $this->hasMany('App\Datation');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeAuthorFilter($query, $array)
|
public function scopeAuteurFilter($query, $array)
|
||||||
{
|
{
|
||||||
if ($array == []) return $query;
|
if ($array == []) return $query;
|
||||||
$query->whereHas('auteur', function($q) use ($array)
|
return $query->whereIn('auteur_id', $array);
|
||||||
{
|
|
||||||
$q->whereIn('id', $array);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeDesignationFilter($query, $array)
|
public function scopeDesignationFilter($query, $designation)
|
||||||
{
|
{
|
||||||
if ($array == []) return $query;
|
if ($designation == "") return $query;
|
||||||
$query->whereHas('designation', function($q) use ($array)
|
return $query->where('designation', 'like', '%'.$designation.'%');
|
||||||
{
|
|
||||||
$q->whereIn('id', $array);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeDomaineFilter($query, $array)
|
public function scopeDomaineFilter($query, $array)
|
||||||
{
|
{
|
||||||
if ($array == []) return $query;
|
if ($array == []) return $query;
|
||||||
$query->whereHas('domaine', function($q) use ($array)
|
return $query->whereIn('domaine_id', $array);
|
||||||
{
|
|
||||||
$q->whereIn('id', $array);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function scopeMatiereFilter($query, $array)
|
public function scopeMatiereFilter($query, $array)
|
||||||
{
|
{
|
||||||
if ($array == []) return $query;
|
if ($array == []) return $query;
|
||||||
$query->whereHas('matiere', function($q) use ($array)
|
return $query->whereIn('matiere_id', $array);
|
||||||
{
|
|
||||||
$q->whereIn('id', $array);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
}
|
||||||
public function scopeTechniqueFilter($query, $array)
|
public function scopeTechniqueFilter($query, $array)
|
||||||
{
|
{
|
||||||
if ($array == []) return $query;
|
if ($array == []) return $query;
|
||||||
$query->whereHas('technique', function($q) use ($array)
|
return $query->whereIn('technique_id', $array);
|
||||||
{
|
|
||||||
$q->whereIn('id', $array);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
BIN
SRC/public/imgs/avatar/1.png
Normal file
BIN
SRC/public/imgs/avatar/1.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.6 KiB |
4
SRC/public/js/bootstrap-multiselect.js
vendored
4
SRC/public/js/bootstrap-multiselect.js
vendored
@ -321,9 +321,9 @@
|
|||||||
includeFilterClearBtn: true,
|
includeFilterClearBtn: true,
|
||||||
preventInputChangeEvent: false,
|
preventInputChangeEvent: false,
|
||||||
nonSelectedText: 'Tous',
|
nonSelectedText: 'Tous',
|
||||||
nSelectedText: 'selected',
|
nSelectedText: 'sélectionnés',
|
||||||
allSelectedText: 'Tous',
|
allSelectedText: 'Tous',
|
||||||
numberDisplayed: 3,
|
numberDisplayed: 4,
|
||||||
disableIfEmpty: false,
|
disableIfEmpty: false,
|
||||||
templates: {
|
templates: {
|
||||||
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
|
button: '<button type="button" class="multiselect dropdown-toggle" data-toggle="dropdown"><span class="multiselect-selected-text"></span> <b class="caret"></b></button>',
|
||||||
|
@ -37,89 +37,6 @@
|
|||||||
this._init();
|
this._init();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Memory options
|
|
||||||
*
|
|
||||||
* Memory default options. Available options are:
|
|
||||||
*
|
|
||||||
* wrapperID: the element in which Memory gets built
|
|
||||||
* cards: the array of cards
|
|
||||||
* onGameStart: callback for when game starts
|
|
||||||
* onGameEnd: callback for when game ends
|
|
||||||
*/
|
|
||||||
/*
|
|
||||||
Memory.prototype.options = {
|
|
||||||
wrapperID : "container",
|
|
||||||
cards : [
|
|
||||||
{
|
|
||||||
id : 1,
|
|
||||||
img: "/pictures/default/monsters-01.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 2,
|
|
||||||
img: "/pictures/default/monsters-02.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 3,
|
|
||||||
img: "/pictures/default/monsters-03.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 4,
|
|
||||||
img: "/pictures/default/monsters-04.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 5,
|
|
||||||
img: "/pictures/default/monsters-05.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 6,
|
|
||||||
img: "/pictures/default/monsters-06.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 7,
|
|
||||||
img: "/pictures/default/monsters-07.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 8,
|
|
||||||
img: "/pictures/default/monsters-08.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 9,
|
|
||||||
img: "/pictures/default/monsters-09.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 10,
|
|
||||||
img: "/pictures/default/monsters-10.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 11,
|
|
||||||
img: "/pictures/default/monsters-11.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 12,
|
|
||||||
img: "/pictures/default/monsters-12.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 13,
|
|
||||||
img: "/pictures/default/monsters-13.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 14,
|
|
||||||
img: "/pictures/default/monsters-14.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 15,
|
|
||||||
img: "/pictures/default/monsters-15.png"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id : 16,
|
|
||||||
img: "/pictures/default/monsters-16.png"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
onGameStart : function() { return false; },
|
|
||||||
onGameEnd : function() { return false; }
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
/**
|
/**
|
||||||
* Memory _init - initialise Memory
|
* Memory _init - initialise Memory
|
||||||
*
|
*
|
||||||
@ -133,12 +50,7 @@
|
|||||||
this.game.className = "mg";
|
this.game.className = "mg";
|
||||||
document.getElementById(this.options.wrapperID).appendChild(this.game);
|
document.getElementById(this.options.wrapperID).appendChild(this.game);
|
||||||
|
|
||||||
this.gameMeta = document.createElement("div");
|
|
||||||
this.gameMeta.className = "mg__meta clearfix";
|
|
||||||
|
|
||||||
this.gameStartScreen = document.createElement("div");
|
|
||||||
this.gameStartScreen.id = "mg__start-screen";
|
|
||||||
this.gameStartScreen.className = "mg__start-screen";
|
|
||||||
|
|
||||||
this.gameWrapper = document.createElement("div");
|
this.gameWrapper = document.createElement("div");
|
||||||
this.gameWrapper.id = "mg__wrapper";
|
this.gameWrapper.id = "mg__wrapper";
|
||||||
@ -186,76 +98,7 @@
|
|||||||
this.flippedTiles = 0;
|
this.flippedTiles = 0;
|
||||||
this.chosenLevel = "";
|
this.chosenLevel = "";
|
||||||
this.numMoves = 0;
|
this.numMoves = 0;
|
||||||
// var niveauChoisi = 0;
|
this._setupGameWrapper(1);
|
||||||
// if (this.chosenLevel) == "1" {niveauChoisi = '<i class="fa fa-star-o"></i>';} if(this.chosenLevel) == "2" {niveauChoisi = '<i class="fa fa-star-half-o"></i>';} else {niveauChoisi = '<i class="fa fa-star"></i>';}
|
|
||||||
|
|
||||||
this.gameMetaHTML = '<div class="mg__meta--left">\
|
|
||||||
<span class="mg__meta--level">Niveau: \
|
|
||||||
<span id="mg__meta--level">' + this.chosenLevel + '</span>\
|
|
||||||
</span>\
|
|
||||||
<span class="mg__meta--moves">Coups: \
|
|
||||||
<span id="mg__meta--moves">' + this.numMoves + '</span>\
|
|
||||||
</span>\
|
|
||||||
</div>\
|
|
||||||
<div class="mg__meta--right">\
|
|
||||||
<button id="mg__button--restart" class="mg__button btn-lg"><i class="fa fa-repeat fa-1x fa-spin"></i></button>\
|
|
||||||
</div>';
|
|
||||||
this.gameMeta.innerHTML = this.gameMetaHTML;
|
|
||||||
this.game.appendChild(this.gameMeta);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// <button type="button" class="btn btn-default"> <span class="glyphicon glyphicon-star-empty"></span> </button>
|
|
||||||
|
|
||||||
this.gameStartScreenHTML = '<h2 class="mg__start-screen--heading">JEU MEMORY</h2>\
|
|
||||||
<h3 class="mg__start-screen--sub-heading">Choisir un niveau : </h3>\
|
|
||||||
<ul class="mg__start-screen--level-select">\
|
|
||||||
<span data-level="1"><button class="btn btn-success btn-lg"><i class="fa fa-2x fa-star-o"></i></button></span>\
|
|
||||||
<span data-level="2"><button class="btn btn-warning btn-lg "><i class="fa fa-2x fa-star-half-o"></i><i class="fa fa-2x fa-star-half-o"></i></button></span>\
|
|
||||||
<span data-level="3"><button class="btn btn-danger btn-lg"><i class="fa fa-2x fa-star"></i> <i class="fa fa-2x fa-star"></i> <i class="fa fa-2x fa-star"></i></button></span>\
|
|
||||||
</ul>';
|
|
||||||
//Memory.prototype._setupGameWrapper(1);
|
|
||||||
//this._gamePlay();
|
|
||||||
//this._setupGame();
|
|
||||||
this.gameStartScreen.innerHTML = this.gameStartScreenHTML;
|
|
||||||
this.game.appendChild(this.gameStartScreen);
|
|
||||||
|
|
||||||
document.getElementById("mg__button--restart").addEventListener( "click", function(e) {
|
|
||||||
self.resetGame();
|
|
||||||
});
|
|
||||||
|
|
||||||
this._startScreenEvents();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memory _startScreenEvents
|
|
||||||
*
|
|
||||||
* We're now listening for events on the start screen. That is, we're waiting
|
|
||||||
* for when a user chooses a level.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Memory.prototype._startScreenEvents = function() {
|
|
||||||
var levelsNodes = this.gameStartScreen.querySelectorAll("ul.mg__start-screen--level-select span");
|
|
||||||
for ( var i = 0, len = levelsNodes.length; i < len; i++ ) {
|
|
||||||
var levelNode = levelsNodes[i];
|
|
||||||
this._startScreenEventsHandler(levelNode);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Memoery _startScreenEventsHandler
|
|
||||||
*
|
|
||||||
* A helper function to handle the click of the level inside the events
|
|
||||||
* function.
|
|
||||||
*/
|
|
||||||
|
|
||||||
Memory.prototype._startScreenEventsHandler = function(levelNode) {
|
|
||||||
var self = this;
|
|
||||||
levelNode.addEventListener( "click", function(e) {
|
|
||||||
if (self.gameState === 1) {
|
|
||||||
self._setupGameWrapper(this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -266,13 +109,11 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Memory.prototype._setupGameWrapper = function(levelNode) {
|
Memory.prototype._setupGameWrapper = function(levelNode) {
|
||||||
this.level = levelNode.getAttribute("data-level");
|
this.level = levelNode;
|
||||||
this.gameStartScreen.parentNode.removeChild(this.gameStartScreen);
|
|
||||||
this.gameContents.className = "mg__contents mg__level-"+this.level;
|
this.gameContents.className = "mg__contents mg__level-"+this.level;
|
||||||
this.game.appendChild(this.gameWrapper);
|
this.game.appendChild(this.gameWrapper);
|
||||||
|
|
||||||
this.chosenLevel = this.level;
|
this.chosenLevel = this.level;
|
||||||
document.getElementById("mg__meta--level").innerHTML = this.chosenLevel;
|
|
||||||
|
|
||||||
this._renderTiles();
|
this._renderTiles();
|
||||||
};
|
};
|
||||||
@ -481,8 +322,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
Memory.prototype._clearGame = function() {
|
Memory.prototype._clearGame = function() {
|
||||||
if (this.gameMeta.parentNode !== null) this.game.removeChild(this.gameMeta);
|
|
||||||
if (this.gameStartScreen.parentNode !== null) this.game.removeChild(this.gameStartScreen);
|
|
||||||
if (this.gameWrapper.parentNode !== null) this.game.removeChild(this.gameWrapper);
|
if (this.gameWrapper.parentNode !== null) this.game.removeChild(this.gameWrapper);
|
||||||
if (this.gameMessages.parentNode !== null) this.game.removeChild(this.gameMessages);
|
if (this.gameMessages.parentNode !== null) this.game.removeChild(this.gameMessages);
|
||||||
}
|
}
|
||||||
|
@ -167,15 +167,49 @@
|
|||||||
<div class="col-md-10">
|
<div class="col-md-10">
|
||||||
<form class="form-horizontal" id="recherche">
|
<form class="form-horizontal" id="recherche">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputAuteur" class="col-sm-2 control-label">Auteur</label>
|
<label for="designation" class="col-sm-2 control-label">Désignation</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<select name="auteur[]" class="form-control" multiple><option>1</option><option>2</option></select>
|
<input id="designation" name="designation" class="form-control" placeholder="Désignation">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="inputDomaine" class="col-sm-2 control-label">Domaine</label>
|
<label for="auteur" class="col-sm-2 control-label">Auteur</label>
|
||||||
<div class="col-sm-10">
|
<div class="col-sm-10">
|
||||||
<input type="text" name="domaine" class="form-control" id="inputDomaine" placeholder="Domaine">
|
<select id="auteur" name="auteur[]" class="form-control" multiple>
|
||||||
|
@foreach($auteurs as $e)
|
||||||
|
<option value="{{ $e->id }}">{{ $e->nom }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="domaine" class="col-sm-2 control-label">Domaine</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select id="domaine" name="domaine[]" class="form-control" multiple>
|
||||||
|
@foreach($domaines as $e)
|
||||||
|
<option value="{{ $e->id }}">{{ $e->nom }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="matiere" class="col-sm-2 control-label">Matière</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select id="matiere" name="matiere[]" class="form-control" multiple>
|
||||||
|
@foreach($matieres as $e)
|
||||||
|
<option value="{{ $e->id }}">{{ $e->nom }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="domaine" class="col-sm-2 control-label">Technique</label>
|
||||||
|
<div class="col-sm-10">
|
||||||
|
<select id="technique" name="technique[]" class="form-control" multiple>
|
||||||
|
@foreach($techniques as $e)
|
||||||
|
<option value="{{ $e->id }}">{{ $e->nom }}</option>
|
||||||
|
@endforeach
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
@ -231,7 +265,8 @@ $('#imagesSearched').on('click', '.pager a', function (event) {
|
|||||||
|
|
||||||
$('#recherche select').multiselect({
|
$('#recherche select').multiselect({
|
||||||
enableFiltering: true,
|
enableFiltering: true,
|
||||||
buttonWidth: '100%'
|
buttonWidth: '100%',
|
||||||
|
maxHeight: 200
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#recherche").on('submit', function(event){
|
$("#recherche").on('submit', function(event){
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
<div class="container">
|
<div class="container">
|
||||||
<!-- Brand and toggle get grouped for better mobile display -->
|
<!-- Brand and toggle get grouped for better mobile display -->
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
|
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target=".nav-collapse">
|
||||||
<span class="sr-only">Toggle navigation</span>
|
<span class="sr-only">Toggle navigation</span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
<span class="icon-bar"></span>
|
<span class="icon-bar"></span>
|
||||||
|
@ -6,21 +6,8 @@
|
|||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
|
|
||||||
<div class="container">
|
<div style="margin:auto;width:90%">
|
||||||
|
<div id="my-memory-game"></div>
|
||||||
<!-- <center><img src="http://i.ytimg.com/vi/xiIO1zUXNVI/maxresdefault.jpg" width="60%"></center> -->
|
|
||||||
|
|
||||||
|
|
||||||
<div class="wrapper">
|
|
||||||
<div class="content">
|
|
||||||
<div class="row">
|
|
||||||
<div class="col-xs-12 col-sm-10 col-md-12">
|
|
||||||
<div id="my-memory-game"></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
</div>
|
|
||||||
</div><!-- /.content -->
|
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user