modified: SRC/app/Http/Controllers/ReferentController.php

modified:   SRC/app/Http/routes.php
	modified:   SRC/public/js/ListeOeuvre.js
	modified:   SRC/resources/views/referent.blade.php
This commit is contained in:
Malibu
2015-02-26 15:07:34 +01:00
parent 439888f0db
commit 9edc7af7d3
4 changed files with 34 additions and 2 deletions

View File

@ -13,6 +13,7 @@ use App\Models\Technique;
use App\Models\Oeuvre;
use App\Models\Jeu;
use Response;
use Session;
class ReferentController extends Controller {
@ -95,6 +96,10 @@ class ReferentController extends Controller {
public function showListeOeuvres($id)
{
if (Session::has('listeoeuvre_current'))
Session::forget('listeoeuvre_current');
Session::put('listeoeuvre_current', $id);
return Response::json(ListeOeuvre::find($id)->oeuvres->toArray());
}
@ -146,4 +151,18 @@ class ReferentController extends Controller {
;
}
public function updateAssoGames() {
$idListeOeuvre = Session::get('listeoeuvre_current', 'default');
$res = Input::get('data', array());
$ListeOeuvre = ListeOeuvre::find($idListeOeuvre);
$table = [];
foreach ($res as $key => $value){
if($value == 'true')
array_push($table, $key);
}
$ListeOeuvre->jeux()->sync($table);
}
}