diff --git a/SRC/app/Http/Controllers/ReferentController.php b/SRC/app/Http/Controllers/ReferentController.php index 9029bac..2bc4c33 100755 --- a/SRC/app/Http/Controllers/ReferentController.php +++ b/SRC/app/Http/Controllers/ReferentController.php @@ -10,7 +10,12 @@ use App\Models\Designation; use App\Models\Domaine; use App\Models\Matiere; use App\Models\Technique; +<<<<<<< HEAD +======= +use App\Models\Oeuvre; +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c use Response; +use Illuminate\Pagination\Paginator as Paginator; class ReferentController extends Controller { @@ -42,9 +47,12 @@ class ReferentController extends Controller { $dataSearch['domaine'] = Domaine::orderBy('nom')->get(); $dataSearch['matiere'] = Matiere::orderBy('nom')->get(); $dataSearch['technique'] = Technique::orderBy('nom')->get(); +<<<<<<< HEAD //$ListeOeuvre = ListeOeuvre::find(2); //$ListeOeuvre->oeuvres()->attach([22, 23, 24, 25, 26]); +======= +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c $listeoeuvres = ListeOeuvre::currentUser()->get(); return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'listeoeuvres' => $listeoeuvres, 'data' => $dataSearch]); @@ -120,4 +128,25 @@ class ReferentController extends Controller { return Response::json(array()); } + public function search() + { + $auteurs = (Input::get('auteur', array()))?Input::get('auteur', array()): []; + $designations = (Input::get('designation', array()))? Input::get('designation', array()): []; + $domaines = (Input::get('domaine', array()))? Input::get('domaine', array()): []; + $matieres = (Input::get('matiere', array()))? Input::get('matiere', array()): []; + $techniques = (Input::get('technique', array()))?Input::get('technique', array()): []; + $debut = (Input::get('debut'))? Input::get('debut'): ''; + $fin = (Input::get('fin'))?Input::get('fin'): ''; + + $res = Oeuvre::authorFilter($auteurs) + ->designationFilter($designations) + ->domaineFilter($domaines) + ->matiereFilter($matieres) + ->debutFilter($debut) + ->finFilter($fin) + ->paginate(15); + + return Response::json($res->toArray()); + } + } diff --git a/SRC/app/Http/routes.php b/SRC/app/Http/routes.php index c363a82..0a5d503 100644 --- a/SRC/app/Http/routes.php +++ b/SRC/app/Http/routes.php @@ -40,6 +40,7 @@ Route::group(['middleware' => 'auth'], function () Route::post('addListeOeuvre', 'ReferentController@addListeOeuvre'); Route::get('showListOeuvres/{id}', 'ReferentController@showListeOeuvres'); Route::post('setListOeuvres', 'ReferentController@setListOeuvres'); + Route::post('search', 'ReferentController@search'); }); Route::group(['middleware' => 'admin'], function () diff --git a/SRC/app/Models/Oeuvre.php b/SRC/app/Models/Oeuvre.php index 22b26f8..56a07e1 100644 --- a/SRC/app/Models/Oeuvre.php +++ b/SRC/app/Models/Oeuvre.php @@ -7,4 +7,97 @@ class Oeuvre extends Model { protected $table = 'oeuvre'; public $timestamps = false; + + public function designations() + { + return $this->belongsToMany('App\Models\Designation', 'assodesignationaoeuvre'); + } + + public function auteurs() + { + return $this->belongsToMany('App\Models\Auteur', 'assoauteuraoeuvre'); + } + + public function technique() + { + return $this->belongsTo('App\Models\Technique', 'idtechnique', 'id'); + } + + public function domaine() + { + return $this->belongsTo('App\Models\Domaine', 'iddomaine', 'id'); + } + + public function matiere() + { + return $this->belongsTo('App\Models\Matiere', 'idmatiere', 'id'); + } + + public function datation() + { + return $this->belongsTo('App\Models\Datation', 'iddate', 'id'); + } + + public function scopeAuthorFilter($query, $array) + { + if ($array == []) return $query; + $query->whereHas('auteurs', function($q) use ($array) + { + $q->whereIn('id', $array); + }); + } + + public function scopeDesignationFilter($query, $array) + { + if ($array == []) return $query; + $query->whereHas('designations', function($q) use ($array) + { + $q->whereIn('id', $array); + }); + } + + public function scopeDomaineFilter($query, $array) + { + if ($array == []) return $query; + $query->whereHas('domaine', function($q) use ($array) + { + $q->whereIn('id', $array); + }); + } + + public function scopeMatiereFilter($query, $array) + { + if ($array == []) return $query; + $query->whereHas('matiere', function($q) use ($array) + { + $q->whereIn('id', $array); + }); + } + + public function scopeTechniqueFilter($query, $array) + { + if ($array == []) return $query; + $query->whereHas('technique', function($q) use ($array) + { + $q->whereIn('id', $array); + }); + } + + public function scopeDebutFilter($query, $date) + { + if ($date == '') return $query; + $query->whereHas('datation', function($q) use ($date) + { + $q->where('debut', '>=', $date); + }); + } + + public function scopeFinFilter($query, $date) + { + if ($date == '') return $query; + $query->whereHas('datation', function($q) use ($date) + { + $q->where('debut', '<=', $date); + }); + } } diff --git a/SRC/public/css/game.css b/SRC/public/css/game.css index 65e158d..2b128e3 100644 --- a/SRC/public/css/game.css +++ b/SRC/public/css/game.css @@ -5,4 +5,14 @@ body background-repeat:no-repeat; background-position:100% 100%; background-size:cover; -} \ No newline at end of file +<<<<<<< HEAD +} +======= +} + +.iconGame +{ + width: 13%; + height: 23%; +} +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c diff --git a/SRC/public/css/home.css b/SRC/public/css/home.css index 4083860..7af419d 100644 --- a/SRC/public/css/home.css +++ b/SRC/public/css/home.css @@ -46,6 +46,10 @@ body { width : 40%; box-shadow: 0 0 6px black inset; border: 1px solid dimgrey; +<<<<<<< HEAD +======= + font-size: 1.5em; +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c } .carousel-indicators diff --git a/SRC/public/js/ListeOeuvre.js b/SRC/public/js/ListeOeuvre.js index 60d533d..5288376 100644 --- a/SRC/public/js/ListeOeuvre.js +++ b/SRC/public/js/ListeOeuvre.js @@ -56,3 +56,72 @@ $('#enregistrer').click(function() { }); +// Afficher résultat de recherche d'oeuvre +$('#search_button, #previous, #next').click(function(event) { + + event.preventDefault(); + + if(this.id == $('#next').attr('id') && $("#next").parent().hasClass('disabled') || this.id == $('#previous').attr('id') && $("#previous").parent().hasClass('disabled')) + return 0; + + if (this.id == $('#next').attr('id')) { + str = $("#next").attr('href'); + url = "/search?page="+/([0-9]+)/.exec(str)[0]; + }else if (this.id == $('#previous').attr('id')) { + str = $("#previous").attr('href'); + url = "/search?page="+/([0-9]+)/.exec(str)[0]; + }else { + url = "/search"; + } + + $('#oeuvreRes').empty(); + dataSend = { + _token : $('#_tokenRes').val(), + auteur: $('#auteur').val(), + designation: $('#designation').val(), + matiere: $('#matiere').val(), + domaine: $('#domaine').val(), + technique: $('#technique').val(), + debut: $('#debut').val(), + fin: $('#fin').val() + }; + $.post(url, + dataSend, + function( data ) { + if (data.length == 0 ) + $("#oeuvreRes").append("Aucune Oeuvre Trouvé.."); + data.data.forEach( function(el) { + $("#oeuvreRes").append('
' + +'' + +'' + +'
'); + }); + + if(data.prev_page_url == null) { + $("#previous").parent().addClass('disabled'); + }else { + $("#previous").attr('href', data.prev_page_url); + $("#previous").parent().removeClass('disabled'); + } + + if(data.next_page_url == null) { + $("#next").parent().addClass('disabled'); + }else { + $("#next").attr('href', data.next_page_url); + $("#next").parent().removeClass('disabled'); + } + + }, "json" ) + + .fail(function() { + $("#oeuvreRes").append('
' + +'Oouups! Il y a un problème.

' + +'' + +'
' + ); + }); +}); + + diff --git a/SRC/public/pictures/pic/Game.png b/SRC/public/pictures/pic/Game.png new file mode 100644 index 0000000..84055f4 Binary files /dev/null and b/SRC/public/pictures/pic/Game.png differ diff --git a/SRC/resources/views/home.blade.php b/SRC/resources/views/home.blade.php index 23dc714..b3c39b2 100755 --- a/SRC/resources/views/home.blade.php +++ b/SRC/resources/views/home.blade.php @@ -1,6 +1,7 @@ @extends('app') @section('content') +
diff --git a/SRC/resources/views/referent.blade.php b/SRC/resources/views/referent.blade.php index d204d44..06e9f3b 100755 --- a/SRC/resources/views/referent.blade.php +++ b/SRC/resources/views/referent.blade.php @@ -19,7 +19,7 @@

Mes listes d'oeuvres: - + @@ -107,11 +107,16 @@ Recherche avancée
- + +
+<<<<<<< HEAD +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c @foreach ($data['auteur'] as $val) @@ -122,7 +127,11 @@
+<<<<<<< HEAD +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c @foreach ($data['designation'] as $val) @@ -133,7 +142,7 @@
- @foreach ($data['domaine'] as $val) @@ -144,7 +153,7 @@
- @foreach ($data['matiere'] as $val) @@ -155,9 +164,13 @@
- +<<<<<<< HEAD @foreach ($data['designation'] as $val) +======= + @foreach ($data['technique'] as $val) +>>>>>>> 407a955444da6207f59c5f05d283275510b2169c @endforeach @@ -166,23 +179,23 @@
- +
-
- +
+
-
- +
+
-
+
@@ -191,28 +204,20 @@ Résultat de ma recherche Sélectionner tout -- Annuler sélection
-
+
-
- - - -
-
- - - -
-
- - - -
+
- + + +
@endsection - diff --git a/SRC/resources/views/referent_games.blade.php b/SRC/resources/views/referent_games.blade.php index aba6c43..18c14f3 100644 --- a/SRC/resources/views/referent_games.blade.php +++ b/SRC/resources/views/referent_games.blade.php @@ -1,9 +1,13 @@ @extends('app') +<<<<<<< HEAD

Games



+======= +
Game
+>>>>>>> 407a955444da6207f59c5f05d283275510b2169c
NomActionSupprimer