This commit is contained in:
sidya82 2015-02-18 23:23:25 +01:00
commit 887f1c9ebb
14 changed files with 169 additions and 60 deletions

10
SRC/app/AssoListeAJeu.php Normal file
View File

@ -0,0 +1,10 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class AssoListeAJeu extends Model {
protected $table = 'assolisteajeu';
public $timestamps = false;
}

View File

@ -0,0 +1,10 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class AssoListeAOeuvre extends Model {
protected $table = 'assolisteaoeuvre';
public $timestamps = false;
}

View File

@ -45,7 +45,7 @@ class AdminController extends Controller {
$user->droits = (Input::get('isadmin'))?1:0; $user->droits = (Input::get('isadmin'))?1:0;
$user->city = Input::get('city'); $user->city = Input::get('city');
$user->lastname = Input::get('lastname'); $user->lastname = Input::get('lastname');
$user->image = "pictures/user_picture/default.png"; $user->image = "pictures/user_picture/default.jpg";
$user->save(); $user->save();
return redirect('/admin')->with('message_add', 'User ajouté avec succès'); return redirect('/admin')->with('message_add', 'User ajouté avec succès');

View File

@ -3,6 +3,9 @@
use App\User; use App\User;
use Input; use Input;
use Request; use Request;
use App\ListeOeuvre;
use App\AssoListeAOeuvre;
class ReferentController extends Controller { class ReferentController extends Controller {
@ -26,11 +29,16 @@ class ReferentController extends Controller {
{ {
$me = User::current(); $me = User::current();
$user = User::all(); $user = User::all();
return view('referent', ['nameRoute' => 'Référent', 'me' => $me]);
// List Oeuvre of one user
$sessions = ListeOeuvre::currentUser()->get();
echo $sessions[0]->oeuvres()->get();
//return view('referent', ['nameRoute' => 'Référent', 'me' => $me, 'sessions' => $sessions]);
} }
/** /**
* updateUser an user in database. * updateUser an user informations in database.
* *
* *
*/ */
@ -55,4 +63,42 @@ class ReferentController extends Controller {
return redirect('/referent')->with('message_update', 'Referent mis à jour avec succès'); return redirect('/referent')->with('message_update', 'Referent mis à jour avec succès');
} }
/**
* create a new session
*
*/
public function addSession()
{
// TODO
$ListeOeuvre = new ListeOeuvre;
$ListeOeuvre->idusers = 2;
$ListeOeuvre->nom = "Linux";
$ListeOeuvre->etat = 1;
$ListeOeuvre->save();
$assolistaoeuvre = new AssoListeAOeuvre;
$assolistaoeuvre->liste_oeuvre_id = 1;
$assolistaoeuvre->oeuvre_id = 1;
$assolistaoeuvre->save();
$assolistaoeuvre2 = new AssoListeAOeuvre;
$assolistaoeuvre2->liste_oeuvre_id = 1;
$assolistaoeuvre2->oeuvre_id = 2;
$assolistaoeuvre2->save();
}
/**
* get all user sessions
*
*/
private function getSessions()
{
// TODO
}
} }

View File

@ -36,6 +36,8 @@ Route::group(['middleware' => 'auth'], function ()
Route::get('referent', 'ReferentController@index'); Route::get('referent', 'ReferentController@index');
Route::get('logout', 'LoginController@logout'); Route::get('logout', 'LoginController@logout');
Route::post('update', 'ReferentController@update'); Route::post('update', 'ReferentController@update');
Route::post('addSession', 'ReferentController@addSession');
}); });
Route::group(['middleware' => 'admin'], function () Route::group(['middleware' => 'admin'], function ()

10
SRC/app/Jeu.php Normal file
View File

@ -0,0 +1,10 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Jeu extends Model {
protected $table = 'jeu';
public $timestamps = false;
}

27
SRC/app/ListeOeuvre.php Normal file
View File

@ -0,0 +1,27 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
use Auth;
class ListeOeuvre extends Model {
protected $table = 'listeoeuvre';
public $timestamps = false;
public function oeuvres()
{
return $this->belongsToMany('App\Oeuvre', 'assolisteaoeuvre');
}
public function jeux()
{
return $this->belongsToMany('App\Jeu', 'assolisteajeu');
}
public function scopeCurrentUser($query)
{
$idUser = Auth::user()->id;
return $query->where('idusers', $idUser);
}
}

10
SRC/app/Oeuvre.php Normal file
View File

@ -0,0 +1,10 @@
<?php namespace App;
use Illuminate\Database\Eloquent\Model;
class Oeuvre extends Model {
protected $table = 'oeuvre';
public $timestamps = false;
}

View File

@ -31,8 +31,8 @@ class User extends Model implements AuthenticatableContract, CanResetPasswordCon
public function scopeCurrent($query) public function scopeCurrent($query)
{ {
$email = Auth::user()->email; $idUser = Auth::user()->id;
return $query->where('email', $email)->first(); return $query->where('id', $idUser)->first();
} }
public function scopeReferents($query) public function scopeReferents($query)

View File

@ -106,23 +106,22 @@ CREATE TABLE oeuvre (
); );
CREATE TABLE assodesignationaoeuvre ( CREATE TABLE assodesignationaoeuvre (
idoeuvre INT NOT NULL, oeuvre_id INT NOT NULL,
iddesignation INT NOT NULL, designation_id INT NOT NULL,
PRIMARY KEY (iddesignation,idoeuvre), PRIMARY KEY (designation_id,oeuvre_id),
FOREIGN KEY (iddesignation) REFERENCES designation(iddesignation), FOREIGN KEY (designation_id) REFERENCES designation(iddesignation),
FOREIGN KEY (idoeuvre) REFERENCES oeuvre(idoeuvre) FOREIGN KEY (oeuvre_id) REFERENCES oeuvre(idoeuvre)
); );
CREATE TABLE assoauteuraoeuvre ( CREATE TABLE assoauteuraoeuvre (
idoeuvre INT NOT NULL, oeuvre_id INT NOT NULL,
idauteur INT NOT NULL, auteur_id INT NOT NULL,
PRIMARY KEY (idauteur,idoeuvre), PRIMARY KEY (auteur_id,oeuvre_id),
FOREIGN KEY (idauteur) REFERENCES auteur(idauteur), FOREIGN KEY (auteur_id) REFERENCES auteur(idauteur),
FOREIGN KEY (idoeuvre) REFERENCES oeuvre(idoeuvre) FOREIGN KEY (oeuvre_id) REFERENCES oeuvre(idoeuvre)
); );
CREATE TABLE listeoeuvre ( CREATE TABLE listeoeuvre (
idlisteoeuvre INT NOT NULL AUTO_INCREMENT, idlisteoeuvre INT NOT NULL AUTO_INCREMENT,
idusers INT NOT NULL, idusers INT NOT NULL,
@ -135,23 +134,21 @@ CREATE TABLE listeoeuvre (
); );
CREATE TABLE assolisteaoeuvre ( CREATE TABLE assolisteaoeuvre (
idlisteoeuvre INT NOT NULL, liste_oeuvre_id INT NOT NULL,
idoeuvre INT NOT NULL, oeuvre_id INT NOT NULL,
PRIMARY KEY (idlisteoeuvre,idoeuvre), PRIMARY KEY (liste_oeuvre_id,oeuvre_id),
FOREIGN KEY (idlisteoeuvre) REFERENCES listeoeuvre(idlisteoeuvre), FOREIGN KEY (liste_oeuvre_id) REFERENCES listeoeuvre(idlisteoeuvre),
FOREIGN KEY (idoeuvre) REFERENCES oeuvre(idoeuvre) FOREIGN KEY (oeuvre_id) REFERENCES oeuvre(idoeuvre)
); );
CREATE TABLE assolisteajeu ( CREATE TABLE assolisteajeu (
idlisteoeuvre INT NOT NULL, liste_oeuvre_id INT NOT NULL,
idjeu INT NOT NULL, jeu_id INT NOT NULL,
PRIMARY KEY (idlisteoeuvre,idjeu), PRIMARY KEY (liste_oeuvre_id,jeu_id),
FOREIGN KEY (idlisteoeuvre) REFERENCES listeoeuvre(idlisteoeuvre), FOREIGN KEY (liste_oeuvre_id) REFERENCES listeoeuvre(idlisteoeuvre),
FOREIGN KEY (idjeu) REFERENCES jeu(idjeu) FOREIGN KEY (jeu_id) REFERENCES jeu(idjeu)
); );
CREATE TABLE description ( CREATE TABLE description (
iddescription INT NOT NULL AUTO_INCREMENT, iddescription INT NOT NULL AUTO_INCREMENT,
idoeuvre INT NOT NULL, idoeuvre INT NOT NULL,

View File

@ -3,6 +3,8 @@ html {
font-family: sans-serif; font-family: sans-serif;
-ms-text-size-adjust: 100%; -ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%; -webkit-text-size-adjust: 100%;
height: 100%;
width: 100%
} }
body { body {
margin: 0; margin: 0;
@ -5349,13 +5351,13 @@ a.list-group-item-danger.active:focus {
padding-bottom: 75%; padding-bottom: 75%;
} }
.well { .well {
min-height: 20px; min-height: 10px;
padding: 19px; padding: 19px;
margin-bottom: 20px; margin-bottom: 20px;
background-color: #015402; background-color: #015402;
color : white; color : white;
font-weight: bold; font-weight: bold;
font-size: 25px; font-size: 15px;
border: 5px solid #7F2403; border: 5px solid #7F2403;
border-radius: 4px; border-radius: 4px;
box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05); box-shadow: inset 0 1px 1px rgba(0, 0, 0, 0.05);
@ -5365,10 +5367,10 @@ a.list-group-item-danger.active:focus {
border-color: rgba(0, 0, 0, 0.15); border-color: rgba(0, 0, 0, 0.15);
} }
.well-lg { .well-lg {
padding: 24px; padding: 15px;
margin: 5%; margin: 5%;
margin-left : 25%; margin-left : 40%;
margin-right: 25%; margin-right: 40%;
border-radius: 6px; border-radius: 6px;
} }
@ -6264,3 +6266,5 @@ label,
.checkbox label { .checkbox label {
font-weight: 300; font-weight: 300;
} }
html, body, a, a:hover { cursor:url('http://www.snazzyspace.com/cursorsfolder/mickey-big-pointer.png'), auto !important; }

View File

@ -2,8 +2,19 @@
@section('content') @section('content')
{{ Session::get('message_add') }} <div class="col-sm-12">
{{ Session::get('message_delete') }} @if (session('message_add'))
<div class="alert alert-success col-sm-4">
{{ Session::get('message_add') }}
</div>
@endif
@if (session('message_delete'))
<div class="alert alert-success col-sm-4">
{{ Session::get('message_delete') }}
</div>
@endif
</div>
<br> <br>
<div class="col-md-2"></div> <div class="col-md-2"></div>

View File

@ -38,8 +38,8 @@
<div class="item"> <div class="item">
@endif @endif
<br> <br>
<a href="/referents/vive.linux/games"><img style="border: 7px solid white; box-shadow: 0px 0px 3px black; max-height: 500px;" src="{{$ref -> image}}" width="250px" alt="{{ $ref -> name }}-Nom"></a> <a href="/referents/vive.linux/games"><img style="border: 7px solid white; box-shadow: 0px 0px 3px black; max-height: 350px;" src="{{$ref -> image}}" width="300px" alt="{{ $ref -> name }}-Nom"></a>
<div class="well well-lg">{{$ref -> firstname}}, {{$ref -> lastname}}</div> <a href="/referents/vive.linux/games"><div class="well well-lg col-xs-4 col-md-2">{{$ref -> firstname}}, {{$ref -> lastname}}</div></a>
</div> </div>
@endforeach @endforeach
</div> </div>
@ -55,12 +55,8 @@
</a> </a>
</div> </div>
<script type="text/javascript" src="http://www.themesltd.com/tumblr/cursors/mouse-cursors/cursors.js?cat=mouse-cursors&theme=mickey_mouse_finger&path=cartoon"></script>
<script type="text/javascript"> <script type="text/javascript">
//<!-- bloque le clique droit
document.oncontextmenu = new Function("return false"); document.oncontextmenu = new Function("return false");
//-->
</script> </script>
</center> </center>
@endsection @endsection

View File

@ -18,26 +18,12 @@
<br><br> <br><br>
<legend>Mes sessions:</legend> <legend>Mes sessions:</legend>
<table class="table table-hover"> <table class="table table-hover">
@foreach ($sessions as $session)
<tr class="active"> <tr class="active">
<td>Falbala</td> <td>{{$session->nom}}</td>
<td>Supprimer</td>
</tr>
<tr>
<td>biblo</td>
<td>Supprimer</td>
</tr>
<tr>
<td>Tralala</td>
<td>Supprimer</td>
</tr>
<tr>
<td>Redmin</td>
<td>Supprimer</td>
</tr>
<tr>
<td>Vive arch linux</td>
<td>Supprimer</td> <td>Supprimer</td>
</tr> </tr>
@endforeach
</table> </table>
</div> </div>