Merge branch 'master' of https://github.com/matthieupenchenat81/ModuleWeb
This commit is contained in:
commit
7a2f91ffb5
@ -39,7 +39,6 @@ class AdminController extends Controller {
|
|||||||
public function addUser()
|
public function addUser()
|
||||||
{
|
{
|
||||||
$user = new Referent;
|
$user = new Referent;
|
||||||
|
|
||||||
$user->nom = Input::get('nom');
|
$user->nom = Input::get('nom');
|
||||||
$user->email = Input::get('email');
|
$user->email = Input::get('email');
|
||||||
$user->etablissement = Input::get('etablissement');
|
$user->etablissement = Input::get('etablissement');
|
||||||
|
@ -5,6 +5,7 @@ use App\Referent;
|
|||||||
use App\ConfigJeu;
|
use App\ConfigJeu;
|
||||||
use App\Oeuvre;
|
use App\Oeuvre;
|
||||||
use Cookie;
|
use Cookie;
|
||||||
|
|
||||||
class GameController extends Controller {
|
class GameController extends Controller {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -23,8 +24,10 @@ class GameController extends Controller {
|
|||||||
* @return Response
|
* @return Response
|
||||||
*/
|
*/
|
||||||
public function chooseDifMemo() {
|
public function chooseDifMemo() {
|
||||||
$nbOr = Cookie::get('referent');
|
return view('frontend/memo_level');
|
||||||
return view('frontend/memo_level', ['nbOr' => $nbOr]);
|
}
|
||||||
|
public function chooseDifPuzzle() {
|
||||||
|
return view('frontend/puzzle_level');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function playMemo($niveau) {
|
public function playMemo($niveau) {
|
||||||
@ -43,71 +46,30 @@ class GameController extends Controller {
|
|||||||
return view('frontend/memo', ['oeuvres' => $oes, 'niveau' => $niveau, 'nbBloc'=>$bloc]);
|
return view('frontend/memo', ['oeuvres' => $oes, 'niveau' => $niveau, 'nbBloc'=>$bloc]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function chooseDifPuzzle() {
|
|
||||||
return view('frontend/puzzle_level');
|
|
||||||
}
|
|
||||||
|
|
||||||
public function playPuzzle($niveau) {
|
public function playPuzzle($niveau) {
|
||||||
|
try {
|
||||||
|
$idRef = Cookie::get('referent');
|
||||||
|
$ref = Referent::findOrFail($idRef);
|
||||||
|
$configjeu = $ref->configjeu()->where('actifPuzzle', '=', '1')->firstOrFail();
|
||||||
|
|
||||||
$idRef = Cookie::get('referent');
|
if(count($configjeu->oeuvres->count()) >= 1) {
|
||||||
$ref = Referent::find($idRef);
|
$oes = $configjeu->oeuvres()->select('image')->get();
|
||||||
|
$params = json_decode($configjeu->parametres);
|
||||||
$configjeu = $ref->configjeu()->where('actifPuzzle', '=', '1')->first();
|
$nbTab = $params->pt;
|
||||||
|
$dimension = $params->{"p" . $niveau};
|
||||||
if($configjeu && count($configjeu->oeuvres) >= 1) {
|
if(!(isset($dimension) && is_numeric($dimension))) throw new ModelNotFoundException();
|
||||||
$oes = $configjeu->oeuvres;
|
} else throw new ModelNotFoundException();
|
||||||
$params = json_decode($configjeu->parametres);
|
} catch(ModelNotFoundException $e) {
|
||||||
$nbTab = $params->pt;
|
$oes = Oeuvre::orderByRaw("RAND()")->take(5)->select('image')->get();
|
||||||
$dimension = $params->{ "p".$niveau};
|
|
||||||
|
|
||||||
} else {
|
|
||||||
$oes = Oeuvre::orderByRaw("RAND()")->take(5)->get();
|
|
||||||
$nbTab = 3;
|
$nbTab = 3;
|
||||||
$dimension = 2;
|
$dimension = 2;
|
||||||
}
|
}
|
||||||
|
return view('frontend/puzzle', ['oeuvres' => $oes, 'dimension' => $dimension, 'nbTab' => $nbTab, 'niveau' => $niveau]);
|
||||||
return view('frontend/puzzle', ['oeuvres' => $oes, 'dimension' => $dimension, 'nbTab' => $nbTab]);
|
|
||||||
|
|
||||||
}
|
|
||||||
public function index()
|
|
||||||
{
|
|
||||||
$res = User::referents()->get();
|
|
||||||
return view('home',['referent' => $res]);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function findReferents($reg) {
|
|
||||||
|
|
||||||
$res = User::referents()->name($reg)->get();
|
|
||||||
return Response::json($res->toArray());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show referent games
|
|
||||||
*
|
|
||||||
* @param String $id
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function showReferentGames($id)
|
|
||||||
{
|
|
||||||
$listeOeuvre = $ListeOeuvre = ListeOeuvre::ofUser($id)->activeListOeuvre()->first();
|
|
||||||
if($listeOeuvre == '')
|
|
||||||
$games = [];
|
|
||||||
else
|
|
||||||
$games = $listeOeuvre->jeux()->get();
|
|
||||||
|
|
||||||
return view('referent_games', ['games' => $games]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function index() {
|
||||||
* Show one referent game
|
$res = User::referents()->get();
|
||||||
*
|
return view('home', ['referent' => $res]);
|
||||||
* @param String $id
|
|
||||||
* @param String $idGame
|
|
||||||
* @return Response
|
|
||||||
*/
|
|
||||||
public function showOneReferentGame($id, $idGame)
|
|
||||||
{
|
|
||||||
return view('one_referent_game', ['referent' => $id, 'game' => $idGame]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,9 @@
|
|||||||
}
|
}
|
||||||
function preload () {
|
function preload () {
|
||||||
game.load.spritesheet('balls', '{{ URL::to('imgs/puzzle/balls.png') }}', 17, 17);
|
game.load.spritesheet('balls', '{{ URL::to('imgs/puzzle/balls.png') }}', 17, 17);
|
||||||
game.load.image('trophee', '{{ URL::to('imgs/trophees/or.png') }}');
|
game.load.image('trophee3', '{{ URL::to('imgs/trophees/or.png') }}');
|
||||||
|
game.load.image('trophee2', '{{ URL::to('imgs/trophees/argent.png') }}');
|
||||||
|
game.load.image('trophee1', '{{ URL::to('imgs/trophees/bronze.png') }}');
|
||||||
|
|
||||||
for(i=1; i<=selection.length; i++) {
|
for(i=1; i<=selection.length; i++) {
|
||||||
game.load.spritesheet("tableau"+i, selection[i-1].src, selection[i-1].width/dimensions[0], selection[i-1].height/dimensions[1]);
|
game.load.spritesheet("tableau"+i, selection[i-1].src, selection[i-1].width/dimensions[0], selection[i-1].height/dimensions[1]);
|
||||||
@ -213,7 +215,7 @@
|
|||||||
var ratioImage = 0.8;
|
var ratioImage = 0.8;
|
||||||
var dimensions = [{{$dimension}}, {{$dimension}}];
|
var dimensions = [{{$dimension}}, {{$dimension}}];
|
||||||
var nbToPlay = {{$nbTab}};
|
var nbToPlay = {{$nbTab}};
|
||||||
|
var trophy = {{ $niveau }};
|
||||||
var images = [];
|
var images = [];
|
||||||
@foreach ($oeuvres as $i => $oeuvre)
|
@foreach ($oeuvres as $i => $oeuvre)
|
||||||
images.push("http://www.augustins.org/documents/10180/156407/{{ $oeuvre -> image}}");
|
images.push("http://www.augustins.org/documents/10180/156407/{{ $oeuvre -> image}}");
|
||||||
|
Reference in New Issue
Block a user