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->city = Input::get('city');
$user->lastname = Input::get('lastname');
$user->image = "pictures/user_picture/default.png";
$user->image = "pictures/user_picture/default.jpg";
$user->save();
return redirect('/admin')->with('message_add', 'User ajouté avec succès');

View File

@ -3,6 +3,9 @@
use App\User;
use Input;
use Request;
use App\ListeOeuvre;
use App\AssoListeAOeuvre;
class ReferentController extends Controller {
@ -26,11 +29,16 @@ class ReferentController extends Controller {
{
$me = User::current();
$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.
*
*
*/
@ -53,6 +61,44 @@ class ReferentController extends Controller {
$user->save();
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('logout', 'LoginController@logout');
Route::post('update', 'ReferentController@update');
Route::post('addSession', 'ReferentController@addSession');
});
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)
{
$email = Auth::user()->email;
return $query->where('email', $email)->first();
$idUser = Auth::user()->id;
return $query->where('id', $idUser)->first();
}
public function scopeReferents($query)

View File

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

View File

@ -3,6 +3,8 @@ html {
font-family: sans-serif;
-ms-text-size-adjust: 100%;
-webkit-text-size-adjust: 100%;
height: 100%;
width: 100%
}
body {
margin: 0;
@ -5349,13 +5351,13 @@ a.list-group-item-danger.active:focus {
padding-bottom: 75%;
}
.well {
min-height: 20px;
min-height: 10px;
padding: 19px;
margin-bottom: 20px;
background-color: #015402;
color : white;
font-weight: bold;
font-size: 25px;
font-size: 15px;
border: 5px solid #7F2403;
border-radius: 4px;
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);
}
.well-lg {
padding: 24px;
padding: 15px;
margin: 5%;
margin-left : 25%;
margin-right: 25%;
margin-left : 40%;
margin-right: 40%;
border-radius: 6px;
}
@ -6263,4 +6265,6 @@ body,
label,
.checkbox label {
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')
{{ Session::get('message_add') }}
{{ Session::get('message_delete') }}
<div class="col-sm-12">
@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>
<div class="col-md-2"></div>

View File

@ -38,8 +38,8 @@
<div class="item">
@endif
<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>
<div class="well well-lg">{{$ref -> firstname}}, {{$ref -> lastname}}</div>
<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>
<a href="/referents/vive.linux/games"><div class="well well-lg col-xs-4 col-md-2">{{$ref -> firstname}}, {{$ref -> lastname}}</div></a>
</div>
@endforeach
</div>
@ -55,12 +55,8 @@
</a>
</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">
//<!-- bloque le clique droit
document.oncontextmenu = new Function("return false");
//-->
</script>
</center>
@endsection

View File

@ -18,26 +18,12 @@
<br><br>
<legend>Mes sessions:</legend>
<table class="table table-hover">
@foreach ($sessions as $session)
<tr class="active">
<td>Falbala</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>{{$session->nom}}</td>
<td>Supprimer</td>
</tr>
@endforeach
</table>
</div>