Merge branch 'master' of https://github.com/matthieupenchenat81/ModuleWeb
Conflicts: SRC/app/Http/Controllers/ReferentController.php SRC/public/css/game.css SRC/public/css/home.css SRC/resources/views/referent.blade.php SRC/resources/views/referent_games.blade.php
This commit is contained in:
		| @@ -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()); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -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 () | ||||
|   | ||||
| @@ -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); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -5,4 +5,14 @@ body | ||||
|   background-repeat:no-repeat; | ||||
|   background-position:100% 100%; | ||||
|   background-size:cover; | ||||
| } | ||||
| <<<<<<< HEAD | ||||
| } | ||||
| ======= | ||||
| } | ||||
|  | ||||
| .iconGame | ||||
| { | ||||
| 	width: 13%; | ||||
| 	height: 23%; | ||||
| } | ||||
| >>>>>>> 407a955444da6207f59c5f05d283275510b2169c | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
| @@ -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('<div class="col-xs-4 col-md-3">' | ||||
|                 +'<a href="#" class="thumbnail">' | ||||
|                 +'<img src="http://www.augustins.org/documents/10180/156407/' + el.urlPhoto + '"/>' | ||||
|                 +'</a></div>'); | ||||
|             }); | ||||
|  | ||||
|             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('<div class="alert alert-danger">' | ||||
|         +'<strong>Oouups!</strong> Il y a un problème.<br><br>' | ||||
|         +'<ul>' | ||||
|         +'<li>Erreur lors de la récupération</li>' | ||||
|         +'</ul>' | ||||
|         +'</div>' | ||||
|         ); | ||||
|     }); | ||||
| }); | ||||
|  | ||||
|  | ||||
|   | ||||
							
								
								
									
										
											BIN
										
									
								
								SRC/public/pictures/pic/Game.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								SRC/public/pictures/pic/Game.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 9.6 KiB | 
| @@ -1,6 +1,7 @@ | ||||
| @extends('app') | ||||
| @section('content') | ||||
| <link href="css/home.css" rel="stylesheet" type="text/css"/> | ||||
| <link href="css/coverflow.css" rel="stylesheet" type="text/css"/> | ||||
| <br> | ||||
| <center> | ||||
|   <img style="height:auto; width:auto; max-width:100px;" alt="" src="./pictures/homePic/home.png">  | ||||
|   | ||||
| @@ -19,7 +19,7 @@ | ||||
| 	<br><br> | ||||
| 	<legend>Mes listes d'oeuvres:</legend> | ||||
| 	<table class="table table-hover"> | ||||
|     <thead> | ||||
|     <thead class="tablethead"> | ||||
|       <tr> | ||||
|         <th>Nom</th><th>Action</th><th>Supprimer</th> | ||||
|       </tr>  | ||||
| @@ -107,11 +107,16 @@ | ||||
|  | ||||
|   <!-- PART CHOOSE AND FILL FILTER --> | ||||
|   <legend>Recherche avancée</legend><br> | ||||
|   <form class="form-horizontal"> | ||||
|   <form class="form-horizontal" role="form" action="search" method="post"> | ||||
|     <input type="hidden" id="_tokenRes" name="_token" value="{{{ csrf_token() }}}" /> | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Auteur</label> | ||||
|       <div class="col-sm-10"> | ||||
| <<<<<<< HEAD | ||||
|         <select data-placeholder="Choisissez un auteur" class="chosen-select" multiple tabindex="4"> | ||||
| ======= | ||||
|         <select data-placeholder="Choisissez un auteur" id="auteur" name="auteur[]" class="chosen-select" multiple tabindex="4"> | ||||
| >>>>>>> 407a955444da6207f59c5f05d283275510b2169c | ||||
|           <option value=""></option> | ||||
|           @foreach ($data['auteur'] as $val) | ||||
|             <option value="{{$val -> id}}">{{$val -> nom}}</option> | ||||
| @@ -122,7 +127,11 @@ | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Désignation</label> | ||||
|       <div class="col-sm-10"> | ||||
| <<<<<<< HEAD | ||||
|         <select data-placeholder="Choisissez une désignation" class="chosen-select" multiple tabindex="4"> | ||||
| ======= | ||||
|         <select data-placeholder="Choisissez une désignation" id="designation" name="designation[]" class="chosen-select" multiple tabindex="4"> | ||||
| >>>>>>> 407a955444da6207f59c5f05d283275510b2169c | ||||
|           <option value=""></option> | ||||
|           @foreach ($data['designation'] as $val) | ||||
|             <option value="{{$val->id}}">{{$val->nom}}</option> | ||||
| @@ -133,7 +142,7 @@ | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Domaine</label> | ||||
|       <div class="col-sm-10"> | ||||
|         <select data-placeholder="Choisissez un domaine" class="chosen-select" multiple style="width:350px;" tabindex="4"> | ||||
|         <select data-placeholder="Choisissez un domaine" id="domaine" name="domaine[]" class="chosen-select" multiple tabindex="4"> | ||||
|           <option value=""></option> | ||||
|           @foreach ($data['domaine'] as $val) | ||||
|             <option value="{{$val->id}}">{{$val->nom}}</option> | ||||
| @@ -144,7 +153,7 @@ | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Matière</label> | ||||
|       <div class="col-sm-10"> | ||||
|         <select data-placeholder="Choisissez une matière" class="chosen-select" multiple style="width:350px;" tabindex="4"> | ||||
|         <select data-placeholder="Choisissez une matière" id="matiere" name="matiere[]" class="chosen-select" multiple tabindex="4"> | ||||
|           <option value=""></option> | ||||
|           @foreach ($data['matiere'] as $val) | ||||
|             <option value="{{$val->id}}">{{$val->nom}}</option> | ||||
| @@ -155,9 +164,13 @@ | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Technique</label> | ||||
|       <div class="col-sm-10"> | ||||
|         <select data-placeholder="Choisissez une technique" class="chosen-select" multiple style="width:350px;" tabindex="4"> | ||||
|         <select data-placeholder="Choisissez une technique" id="technique" name="technique[]" class="chosen-select" multiple tabindex="4"> | ||||
|           <option value=""></option> | ||||
| <<<<<<< HEAD | ||||
|           @foreach ($data['designation'] as $val) | ||||
| ======= | ||||
|           @foreach ($data['technique'] as $val) | ||||
| >>>>>>> 407a955444da6207f59c5f05d283275510b2169c | ||||
|             <option value="{{$val->id}}">{{$val->nom}}</option> | ||||
|           @endforeach | ||||
|         </select> | ||||
| @@ -166,23 +179,23 @@ | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Mot clé</label> | ||||
|       <div class="col-sm-2"> | ||||
|         <input type="text" class="form-control" id="exampleInputName2" placeholder="Mot clé"> | ||||
|         <input type="text" class="form-control" name="motcle" disabled id="motcle" placeholder="Mot clé"> | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Date Début</label> | ||||
|       <div class="col-sm-2"> | ||||
|         <input type="text" class="form-control" id="exampleInputName2" placeholder="date début"> | ||||
|       <div class="col-sm-3"> | ||||
|         <input type="date" class="form-control" name="debut" id="debut" placeholder="date début"> | ||||
|       </div> | ||||
|     </div> | ||||
|     <div class="form-group"> | ||||
|       <label for="inputEmail3" class="col-sm-2 control-label">Date Fin</label> | ||||
|       <div class="col-sm-2"> | ||||
|         <input type="text" class="form-control" id="exampleInputName2" placeholder="date fin"> | ||||
|       <div class="col-sm-3"> | ||||
|         <input type="date" class="form-control" name="fin" id="fin" placeholder="date fin"> | ||||
|       </div> | ||||
|     </div> | ||||
|  | ||||
|     <center><button type="submit" class="btn btn-primary">Rechercher</button></center> | ||||
|     <center><button type="button" class="btn btn-primary" id="search_button">Rechercher</button></center> | ||||
|   </form> | ||||
|  | ||||
|  | ||||
| @@ -191,28 +204,20 @@ | ||||
|   <legend>Résultat de ma recherche</legend> | ||||
|   <span style="float: right"><a href="">Sélectionner tout</a> -- <a href="">Annuler sélection</a></span><br> | ||||
|   <div class="panel panel-default"> | ||||
|     <div class="panel-body" id="oeuvrePic"> | ||||
|     <div class="panel-body" id="oeuvreRes"> | ||||
|  | ||||
|       <div class="col-xs-4 col-md-3"> | ||||
|         <a href="#" class="thumbnail"> | ||||
|         <img src="http://www.augustins.org/documents/10180/156407/1"/> | ||||
|         </a> | ||||
|       </div> | ||||
|       <div class="col-xs-4 col-md-3"> | ||||
|         <a href="#" class="thumbnail"> | ||||
|         <img src="http://www.augustins.org/documents/10180/156407/1"/> | ||||
|         </a> | ||||
|       </div> | ||||
|       <div class="col-xs-4 col-md-3"> | ||||
|         <a href="#" class="thumbnail"> | ||||
|         <img src="http://www.augustins.org/documents/10180/156407/1"/> | ||||
|         </a> | ||||
|       </div> | ||||
|       <!-- TODO --> | ||||
|  | ||||
|     </div> | ||||
|   </div> | ||||
|   <button style="float: right" class="btn btn-primary" id="enregistrer">Enregistrer</button> | ||||
|  | ||||
|     <nav> | ||||
|       <ul class="pager"> | ||||
|         <li class="previous disabled"><a id="previous" href=""><span aria-hidden="true">←</span> Précédent</a></li> | ||||
|         <li class="next disabled"><a id="next" href="">Suivant <span aria-hidden="true">→</span></a></li> | ||||
|       </ul> | ||||
|     </nav> | ||||
|   <button style="float: right" class="btn btn-primary" id="ajouter">Ajouter à ma liste d'oeuvre</button> | ||||
| </div> | ||||
|  | ||||
| @endsection | ||||
|  | ||||
|   | ||||
| @@ -1,9 +1,13 @@ | ||||
| @extends('app') | ||||
| <<<<<<< HEAD | ||||
| <link href="css/referent.css" rel="stylesheet" type="text/css"/> | ||||
| <br> | ||||
| <center><h1>Games</h1></center> | ||||
| <br> | ||||
| <br> | ||||
| ======= | ||||
| <center><img src="/pictures/pic/game.png" alt="Game" class="iconGame"/></center> | ||||
| >>>>>>> 407a955444da6207f59c5f05d283275510b2169c | ||||
| <div class="container"> | ||||
|   <div class="col-sm-6 col-md-4"> | ||||
|     <div class="thumbnail"> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user