diff --git a/.idea/deployment.xml b/.idea/deployment.xml index 836817668065324f690c7cbd75e5feb94d6ae8f0..681238ba2e42e19992d3366f4b72ce272700f560 100644 --- a/.idea/deployment.xml +++ b/.idea/deployment.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <project version="4"> - <component name="PublishConfigData" autoUpload="Always" serverName="VPS 1" autoUploadExternalChanges="true"> + <component name="PublishConfigData" autoUpload="Always" serverName="VPS 1" confirmBeforeDeletion="false" autoUploadExternalChanges="true"> + <option name="confirmBeforeDeletion" value="false" /> <serverData> <paths name="VPS 1"> <serverdata> diff --git a/TP4/ex1/controller/ControleurAdherent.php b/TP4/ex1/controller/ControleurAdherent.php index 3b12d304fca8b37e884402e1bf9368a7a76bf9e1..bf36073b46d229afb791b8dd03f48f04f283f9c6 100644 --- a/TP4/ex1/controller/ControleurAdherent.php +++ b/TP4/ex1/controller/ControleurAdherent.php @@ -11,7 +11,18 @@ class ControleurAdherent public static function lireAdherents(): string { $adherents = Adherent::getAllAdherents(); - return view('adherents.les-adherents', ['adherents' => $adherents]); + $objects = []; + foreach ($adherents as $adherent){ + $object['title'] = $adherent->getPrenomAdherent() . " " . $adherent->getNomAdherent(); + $object['desc'] = "ID: {$adherent->getLogin()}<br>Date d'adhésion: {$adherent->getDateAdhesion()->format("Y-m-d")}"; + $object['url'] = "index.php?action=lireAdherent&login={$adherent->getLogin()}"; + $objects[] = $object; + } + return view('data-grid', [ + 'pageTitle' => 'Liste des adhérents', + 'pageDesc' => 'Voici la liste de tous les adhérents', + 'objects' => $objects + ]); } /** @@ -25,6 +36,9 @@ class ControleurAdherent die("Le paramètre login n'est pas spécifié."); } $adherent = Adherent::getAdherentByLogin($_GET["login"]); - return view('adherents.un-adherent', ['adherent' => $adherent]); + return view('simple-data', [ + 'pageTitle' => 'Information du libre', + 'pageContent' => $adherent->afficher() + ]); } } \ No newline at end of file diff --git a/TP4/ex1/controller/ControleurAuteur.php b/TP4/ex1/controller/ControleurAuteur.php index 08a476c526a4c376fbfdfdc5f78bc5b691f3050a..ec6ce17d8d7f8192fcd8c6e1abcc35f50bd69ade 100644 --- a/TP4/ex1/controller/ControleurAuteur.php +++ b/TP4/ex1/controller/ControleurAuteur.php @@ -13,7 +13,19 @@ class ControleurAuteur public static function lireAuteurs() : string { $auteurs = Auteur::getAllAuteurs(); - return view('auteurs.les-auteurs', ['auteurs' => $auteurs]); + + $objects = []; + foreach ($auteurs as $auteur){ + $object['title'] = $auteur->getPrenom() . " " . $auteur->getNom(); + $object['desc'] = "ID: {$auteur->getNumAuteur()}<br>Date de naissance: {$auteur->getAnneeNaissance()}"; + $object['url'] = "index.php?action=lireAuteur&numAuteur={$auteur->getNumAuteur()}"; + $objects[] = $object; + } + return view('data-grid', [ + 'pageTitle' => 'Liste des auteurs', + 'pageDesc' => 'Voici la liste de tous les auteurs', + 'objects' => $objects + ]); } /** @@ -26,7 +38,10 @@ class ControleurAuteur die("Le paramètre numAuteur n'est pas spécifié."); } $auteur = Auteur::getAuteurByNum($_GET["numAuteur"]); - return view('auteurs.un-auteur', ['auteur' => $auteur]); + return view('simple-data', [ + 'pageTitle' => 'Information du libre', + 'pageContent' => $auteur->afficher() + ]); } } diff --git a/TP4/ex1/controller/ControleurLivre.php b/TP4/ex1/controller/ControleurLivre.php index 52cbc8602e9de3e5a99ce4d75080631dbd2a07a0..bdbaca9a7fdc3480e014db3b227392413b88f861 100644 --- a/TP4/ex1/controller/ControleurLivre.php +++ b/TP4/ex1/controller/ControleurLivre.php @@ -11,7 +11,19 @@ class ControleurLivre public static function lireLivres(): string { $livres = Livre::getAllLivres(); - return view('livres.les-livres', ['livres' => $livres]); + + $objects = []; + foreach ($livres as $livre){ + $object['title'] = $livre->getTitre(); + $object['desc'] = "ID: {$livre->getNumLivre()}<br>Année de parution: {$livre->getAnneeParution()}"; + $object['url'] = "index.php?action=lireLivre&numLivre={$livre->getNumLivre()}"; + $objects[] = $object; + } + return view('data-grid', [ + 'pageTitle' => 'Liste des livres', + 'pageDesc' => 'Voici la liste de tous les livres', + 'objects' => $objects + ]); } /** @@ -25,6 +37,10 @@ class ControleurLivre die("Le paramètre numLivre n'est pas spécifié."); } $livre = Livre::getLivreByNumLivre($_GET["numLivre"]); - return view('livres.un-livre', ['livre' => $livre]); + + return view('simple-data', [ + 'pageTitle' => 'Information du libre', + 'pageContent' => $livre->afficher() + ]); } } \ No newline at end of file diff --git a/TP4/ex1/models/Adherent.php b/TP4/ex1/models/Adherent.php index 5b85281c96c52fb9db425d800f4c912b12a6c429..218c2533976ec2cc9487dd4aeae0185d4b2782dc 100644 --- a/TP4/ex1/models/Adherent.php +++ b/TP4/ex1/models/Adherent.php @@ -208,11 +208,11 @@ class Adherent } /** - * @return void + * @return string */ - public function afficher(): void + public function afficher(): string { - echo "<p>" . $this->prenomAdherent . " " . $this->nomAdherent . " a rejoint le " + return "<p>" . $this->prenomAdherent . " " . $this->nomAdherent . " a rejoint le " .$this->dateAdhesion->format('Y-m-d H:i:s'); } } \ No newline at end of file diff --git a/TP4/ex1/models/Auteur.php b/TP4/ex1/models/Auteur.php index c73ec32f63a939e0d5f96923a13894a0f2520d27..e0d2c52781b4b05c2c4545d9acb918b89a321bc1 100644 --- a/TP4/ex1/models/Auteur.php +++ b/TP4/ex1/models/Auteur.php @@ -107,7 +107,7 @@ class Auteur public function afficher() { - echo "<p>auteur $this->prenom $this->nom, né(e) en $this->anneeNaissance </p>"; + return "<p>auteur $this->prenom $this->nom, né(e) en $this->anneeNaissance </p>"; } } diff --git a/TP4/ex1/models/Livre.php b/TP4/ex1/models/Livre.php index 91e7a832d672b3ef2b5af487cff7edc07f703445..40a343fc7a1b1fbb1577fa9a2ce82db7f60a32a6 100644 --- a/TP4/ex1/models/Livre.php +++ b/TP4/ex1/models/Livre.php @@ -128,11 +128,11 @@ class Livre } /** - * @return void + * @return string */ - public function afficher(): void + public function afficher(): string { - echo "<p>" . $this->titre . " est paru en " + return "<p>" . $this->titre . " est paru en " . $this->anneeParution; } } \ No newline at end of file diff --git a/TP4/ex1/resources/views/adherents/les-adherents.php b/TP4/ex1/resources/views/adherents/les-adherents.php deleted file mode 100644 index 49444c3b189eb291d5a0f1ef4569bc64b4f82c63..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/adherents/les-adherents.php +++ /dev/null @@ -1,25 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Liste des adhérents') - -@section('content') - <div class="container"> - <h1>Liste de tous les adhérents</h1> - <p>Voici la liste de tous les adhérents</p> - <div class="d-flex flex-wrap justify-content-between"> - @foreach($adherents as $adherent) - <div class="card mb-2" style="width: 18rem;"> - <div class="card-body"> - <h5 class="card-title">{{ $adherent->getPrenomAdherent() }} {{ $adherent->getNomAdherent() }}</h5> - <p class="card-text">ID: {{ $adherent->getLogin() }}<br> - Date de naissance: {{ $adherent->getDateAdhesion()->format("Y-m-d") }}</p> - <a class="btn btn-primary" - href="index.php?action=lireAdherent&login={{ $adherent->getLogin() }}"> - Lire les détails - </a> - </div> - </div> - @endforeach - </div> - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/adherents/un-adherent.php b/TP4/ex1/resources/views/adherents/un-adherent.php deleted file mode 100644 index 664a9910446860ac1e5a3c5313fb2c9029c33eba..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/adherents/un-adherent.php +++ /dev/null @@ -1,10 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Information de l'adhérent') - -@section('content') - <div class="container"> - <h1>Information de l'adhérent</h1> - {{ $adherent->afficher() }} - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/auteurs/les-auteurs.php b/TP4/ex1/resources/views/auteurs/les-auteurs.php deleted file mode 100644 index a9e2c3b7b36eb5fee70d6a426475821f00d88adf..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/auteurs/les-auteurs.php +++ /dev/null @@ -1,25 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Liste des auteurs') - -@section('content') - <div class="container"> - <h1>Liste de tous les auteurs</h1> - <p>Voici la liste de tous les auteurs</p> - <div class="d-flex flex-wrap justify-content-between"> - @foreach ($auteurs as $auteur) - <div class="card mb-2" style="width: 18rem;"> - <div class="card-body"> - <h5 class="card-title">{{ $auteur->getPrenom() }} {{ $auteur->getNom() }}</h5> - <p class="card-text">ID: {{ $auteur->getNumAuteur() }}<br> - Date de naissance: {{ $auteur->getAnneeNaissance() }}</p> - <a class="btn btn-primary" - href="index.php?action=lireAuteur&numAuteur={{ $auteur->getNumAuteur() }}"> - Lire les détails - </a> - </div> - </div> - @endforeach - </div> - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/auteurs/un-auteur.php b/TP4/ex1/resources/views/auteurs/un-auteur.php deleted file mode 100644 index dcc3dc3d7daacd81a3ce5ef1cb7145dcf8bb16c8..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/auteurs/un-auteur.php +++ /dev/null @@ -1,10 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Information de l'auteur') - -@section('content') - <div class="container"> - <h1>Information de l'auteur</h1> - {{ $auteur->afficher() }} - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/data-grid.php b/TP4/ex1/resources/views/data-grid.php new file mode 100644 index 0000000000000000000000000000000000000000..bab5121ada6f840b13e62a0122b77bce0280fbbf --- /dev/null +++ b/TP4/ex1/resources/views/data-grid.php @@ -0,0 +1,26 @@ +@extends('layouts.page-layout') + +@section('title', '{{ $pageTitle }}') + +@section('content') +<div class="container"> + <h1>{{ $pageTitle }}</h1> + <p>{{ $pageDesc }}</p> + <div class="d-flex flex-wrap justify-content-between"> + @foreach($objects as $object) + <div class="card mb-2" style="width: 18rem;"> + <div class="card-body"> + <h5 class="card-title">{{ $object['title'] }}</h5> + <p class="card-text"> + {{ $object['desc'] }} + </p> + <a class="btn btn-primary" + href="{{ $object['url'] }}"> + Lire les détails + </a> + </div> + </div> + @endforeach + </div> +</div> +@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/livres/les-livres.php b/TP4/ex1/resources/views/livres/les-livres.php deleted file mode 100644 index f33924d96df79a14544660d2a0a209428f3f889d..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/livres/les-livres.php +++ /dev/null @@ -1,25 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Liste des livres') - -@section('content') - <div class="container"> - <h1>Liste de tous les livres</h1> - <p>Voici la liste de tous les livres</p> - <div class="d-flex flex-wrap justify-content-between"> - @foreach($livres as $livre) - <div class="card mb-2" style="width: 18rem;"> - <div class="card-body"> - <h5 class="card-title">{{ $livre->getTitre() }}</h5> - <p class="card-text">ID: {{ $livre->getNumLivre() }}<br> - Année de parution: {{ $livre->getAnneeParution() }}</p> - <a class="btn btn-primary" - href="index.php?action=lireLivre&numLivre={{ $livre->getNumLivre() }}"> - Lire les détails - </a> - </div> - </div> - @endforeach - </div> - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/livres/un-livre.php b/TP4/ex1/resources/views/livres/un-livre.php deleted file mode 100644 index ef0c1b6ca8169fb50c926d6eae738fe49adc177e..0000000000000000000000000000000000000000 --- a/TP4/ex1/resources/views/livres/un-livre.php +++ /dev/null @@ -1,10 +0,0 @@ -@extends('layouts.page-layout') - -@section('title', 'Information du livre') - -@section('content') - <div class="container"> - <h1>Information du livre</h1> - {{ $livre->afficher() }} - </div> -@endsection \ No newline at end of file diff --git a/TP4/ex1/resources/views/simple-data.php b/TP4/ex1/resources/views/simple-data.php new file mode 100644 index 0000000000000000000000000000000000000000..17bbe514fbf2970fda934a6cb34b98299e6987cf --- /dev/null +++ b/TP4/ex1/resources/views/simple-data.php @@ -0,0 +1,10 @@ +@extends('layouts.page-layout') + +@section('title', '{{ $pageTitle }}') + +@section('content') +<div class="container"> + <h1>{{ $pageTitle }}</h1> + {{ $pageContent }} +</div> +@endsection \ No newline at end of file