From 124381521f226c66dce9f4701413460b5306c001 Mon Sep 17 00:00:00 2001
From: "laura.chevillet"
Date: Fri, 23 Jan 2026 14:24:35 +0100
Subject: [PATCH 1/4] =?UTF-8?q?Pr=C3=A9paration=20page=20admin=20et=20ajou?=
=?UTF-8?q?t=20cat=C3=A9gorie=20par=20l'admin=20(controller,=20model=20et?=
=?UTF-8?q?=20update=20entity)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admin_controller.php | 45 ++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)
create mode 100644 app/controllers/admin_controller.php
diff --git a/app/controllers/admin_controller.php b/app/controllers/admin_controller.php
new file mode 100644
index 0000000..511e117
--- /dev/null
+++ b/app/controllers/admin_controller.php
@@ -0,0 +1,45 @@
+setName($_POST['category_name'] ?? "");
+ $objCategory->setParent($_POST['category_parent'] ?? "");
+
+ $objCategoryModel = new CategoryModel();
+ $boolInsert = $objCategoryModel->insert($objCategory);
+
+ /* EN ATTENTE
+ if ($boolInsert === true) {
+ $_SESSION['success'] = "Catégorie ajoutée avec succès";
+ header("Location:index.php?ctrl=admin&action=admin");
+ exit;
+ } else {
+ // Erreur globale
+ $arrError['global'] = "Erreur lors de l'ajout";
+ }
+ */
+
+ include('../app/views/partials/header.php');
+ include('../app/views/admin.php');
+ include('../app/views/partials/footer.php');
+
+ }
+
+ }
\ No newline at end of file
From 11f0595801d3c14c278b280672d886792cf94291 Mon Sep 17 00:00:00 2001
From: "laura.chevillet"
Date: Mon, 26 Jan 2026 15:24:30 +0100
Subject: [PATCH 2/4] maj commentaires
---
app/controllers/project_controller.php | 7 ++-----
app/entities/category_entity.php | 20 ++++++++++++++++--
app/models/category_model.php | 28 +++++++++++++++++++++++---
app/models/image_model.php | 7 +++++--
app/models/user_model.php | 6 +-----
5 files changed, 51 insertions(+), 17 deletions(-)
diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php
index b8cf009..217cd24 100644
--- a/app/controllers/project_controller.php
+++ b/app/controllers/project_controller.php
@@ -39,13 +39,10 @@
public function search(){
- //variable pour faire fonctionner le script en footer
- $strPage = "search";
-
// inclusion du header
include('../app/views/partials/header.php');
- //Récupérer les informations du Formulaire
+ //Récupérer les informations du formulaire
$strKeywords = $_POST['keywords']??'';
$intAuthor = $_POST['author']??0;
$intPeriod = $_POST['period']??0;
@@ -56,7 +53,7 @@
// Récupération des projetc
$objProjectModel = new ProjectModel;
$arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate,
- strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory);
+ strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory);
// Initialisation d'un tableau => objets
$arrProjectToDisplay = array();
diff --git a/app/entities/category_entity.php b/app/entities/category_entity.php
index 72ac739..3b51e5b 100644
--- a/app/entities/category_entity.php
+++ b/app/entities/category_entity.php
@@ -9,8 +9,9 @@ require_once("mother_entity.php");
class Category extends Entity{
- private int $_id;
- protected string $_name = '';
+ private int $_id;
+ protected string $_name = '';
+ protected string $_parent = '';
/**
* Constructeur (j'ai toujours pas compris à quoi ça sert)
@@ -53,5 +54,20 @@ class Category extends Entity{
$this->_name = $name;
}
+ /**
+ * Récuperation du nom du parent de la catégorie
+ * @return string nom de la catégorie
+ */
+ public function getParent(){
+ return $this->_parent;
+ }
+
+ /**
+ * Mise à jour du nom du parent de la catégorie
+ * @param string le nouveau nom de la catégorie
+ */
+ public function setParent($parent){
+ $this->_parent = $parent;
+ }
}
\ No newline at end of file
diff --git a/app/models/category_model.php b/app/models/category_model.php
index 4aa3e6c..67c309b 100644
--- a/app/models/category_model.php
+++ b/app/models/category_model.php
@@ -8,18 +8,40 @@
class CategoryModel extends Connect{
+ /**
+ * Fonction de récupération des catégories
+ * @return array
+ */
+
public function findAllCategory(int $intLimit=0):array{
- // Ecrire la requête
$strRq = "SELECT category.*
FROM category";
-
if ($intLimit > 0){
$strRq .= " LIMIT ".$intLimit;
}
- // Lancer la requête et récupérer les résultats
return $this->_db->query($strRq)->fetchAll();
}
+
+ /**
+ * fonction d'insertion d'une nouvelle catégorie dans la bdd
+ * @param object $objUser L'objet utilisateur
+ * @return bool Est-ce que la requête s'est bien passée (true/false)
+ */
+
+ public function insert(object $objCategory):bool{
+
+ $strRq = "INSERT INTO category (category_name, category_parent)
+ VALUES (:name, :parent)";
+
+ $rqPrep = $this->_db->prepare($strRq);
+
+ $rqPrep->bindValue(":name", $objCategory->getName(), PDO::PARAM_STR);
+ $rqPrep->bindValue(":parent", $objCategory->getParent(), PDO::PARAM_STR);
+
+ return $rqPrep->execute();
+
+ }
}
\ No newline at end of file
diff --git a/app/models/image_model.php b/app/models/image_model.php
index 6c0ca45..438dfbb 100644
--- a/app/models/image_model.php
+++ b/app/models/image_model.php
@@ -8,9 +8,13 @@
class ImageModel extends Connect{
+ /**
+ * Fonction de récupération des images
+ * @return array
+ */
+
public function findAllImage(int $intLimit=0):array{
- // Ecrire la requête
$strRq = "SELECT image.*
FROM image";
@@ -19,7 +23,6 @@
$strRq .= " LIMIT ".$intLimit;
}
- // Lancer la requête et récupérer les résultats
return $this->_db->query($strRq)->fetchAll();
}
}
\ No newline at end of file
diff --git a/app/models/user_model.php b/app/models/user_model.php
index 706931b..86c3c19 100644
--- a/app/models/user_model.php
+++ b/app/models/user_model.php
@@ -58,11 +58,7 @@
public function insert(object $objUser):bool{
// 2. Construire la requête
- /*$strRq = "INSERT INTO users (user_name, user_firstname, user_mail, user_pwd)
- VALUES ('".$objUser->getName()."',
- '".$objUser->getFirstname()."',
- '".$objUser->getMail()."',
- '".$objUser->getPwdHash()."')";*/
+
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
VALUES (:name, :firstname, :pseudo,:mail, :pwd, :phone, :work, :location,:description)";
// Préparer la requête
From 08cf6cc31c58bcdcd30e8489bffcbf63e7ce27a7 Mon Sep 17 00:00:00 2001
From: "laura.chevillet"
Date: Mon, 26 Jan 2026 16:25:08 +0100
Subject: [PATCH 3/4] =?UTF-8?q?Bensik=20le=20goat=20a=20corrig=C3=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/entities/user_entity.php | 109 ++++++--
app/entity/user_entity.php | 124 ---------
app/views/admin.php | 13 +-
app/views/home.php | 4 +-
app/views/inscription.php | 475 ++++++++++-------------------------
5 files changed, 228 insertions(+), 497 deletions(-)
delete mode 100644 app/entity/user_entity.php
diff --git a/app/entities/user_entity.php b/app/entities/user_entity.php
index 6fa9d08..0d4a9e8 100644
--- a/app/entities/user_entity.php
+++ b/app/entities/user_entity.php
@@ -2,50 +2,123 @@
require_once("mother_entity.php");
class User extends Entity{
- // Attributs
+ private int $_id;
private string $_name = '';
private string $_firstname = '';
+ private string $_pseudo = '';
+ private string $_image = '';
private string $_mail = '';
- private string $_pwd;
+ private string $_pwd;
+ private string $_phone = '';
+ private string $_work = '';
+ private string $_birth = '';
+ private string $_location = '';
+ private string $_description = '';
+ private string $_account_creation = '';
+ private int $_status;
- /**
- * Constructeur
- */
public function __construct(){
- // Préfixe de la table pour hydratation
- $this->_prefixe = 'user_';
+ $this->_prefix = 'user_';
+ }
+
+ public function getId():int{
+ return $this->_id;
+ }
+ public function setId(int $id){
+ $this->_id = $id;
}
- // Méthodes - getters et setters
public function getName():string{
return $this->_name;
}
- public function setName(string $strNewName){
- $this->_name = $this->nettoyer($strNewName);
+ public function setName(string $name){
+ $this->_name = $name;
}
+
public function getFirstname():string{
return $this->_firstname;
}
- public function setFirstname(string $strFirstname){
- $this->_firstname = $this->nettoyer($strFirstname);
+ public function setFirstname(string $firstname){
+ $this->_firstname = $firstname;
}
+
+ public function getPseudo():string{
+ return $this->_pseudo;
+ }
+ public function setPseudo(string $pseudo){
+ $this->_pseudo = $pseudo;
+ }
+
+ public function getImage():string{
+ return $this->_image;
+ }
+ public function setImage(string $image){
+ $this->_image = $image;
+ }
+
public function getMail():string{
return $this->_mail;
}
- public function setMail(string $strMail){
- $this->_mail = strtolower($this->nettoyer($strMail));
+ public function setMail(string $mail){
+ $this->_mail = strtolower($mail);
}
+
public function getPwd():string{
return $this->_pwd;
}
public function getPwdHash():string{
return password_hash($this->_pwd, PASSWORD_DEFAULT);
}
- public function setPwd(string $strPwd){
- $this->_pwd = $strPwd;
- }
+ public function setPwd(string $pwd){
+ $this->_pwd = $pwd;
+ }
+ public function getPhone():string{
+ return $this->_phone;
+ }
+ public function setPhone(string $phone){
+ $this->_phone = $phone;
+ }
+ public function getWork():string{
+ return $this->_work;
+ }
+ public function setWork(string $work){
+ $this->_work = $work;
+ }
+ public function getBirth():string{
+ return $this->_birth;
+ }
+ public function setBirth(string $birth){
+ $this->_birth = $birth;
+ }
- }
\ No newline at end of file
+ public function getLocation():string{
+ return $this->_location;
+ }
+ public function setLocation(string $location){
+ $this->_location = $location;
+ }
+
+ public function getDescription():string{
+ return $this->_description;
+ }
+ public function setDescription(string $description){
+ $this->_description = $description;
+ }
+
+ public function getAccountCreation():string{
+ return $this->_account_creation;
+ }
+ public function setAccountCreation(string $account_creation){
+ $this->_account_creation = $account_creation;
+ }
+
+ public function getStatus():int{
+ return $this->_status;
+ }
+ public function setStatus(int $status){
+ $this->_status = $status;
+ }
+ }
diff --git a/app/entity/user_entity.php b/app/entity/user_entity.php
deleted file mode 100644
index 5e19525..0000000
--- a/app/entity/user_entity.php
+++ /dev/null
@@ -1,124 +0,0 @@
-_prefix = 'user_';
- }
-
- public function getId():int{
- return $this->_id;
- }
- public function setId(int $id){
- $this->_id = $id;
- }
-
- public function getName():string{
- return $this->_name;
- }
- public function setName(string $name){
- $this->_name = $name;
- }
-
- public function getFirstname():string{
- return $this->_firstname;
- }
- public function setFirstname(string $firstname){
- $this->_firstname = $firstname;
- }
-
- public function getPseudo():string{
- return $this->_pseudo;
- }
- public function setPseudo(string $pseudo){
- $this->_pseudo = $pseudo;
- }
-
- public function getImage():string{
- return $this->_image;
- }
- public function setImage(string $image){
- $this->_image = $image;
- }
-
- public function getMail():string{
- return $this->_mail;
- }
- public function setMail(string $mail){
- $this->_mail = strtolower($mail);
- }
-
- public function getPwd():string{
- return $this->_pwd;
- }
- public function getPwdHash():string{
- return password_hash($this->_pwd, PASSWORD_DEFAULT);
- }
- public function setPwd(string $pwd){
- $this->_pwd = $pwd;
- }
-
- public function getPhone():string{
- return $this->_phone;
- }
- public function setPhone(string $phone){
- $this->_phone = $phone;
- }
-
- public function getWork():string{
- return $this->_work;
- }
- public function setWork(string $work){
- $this->_work = $work;
- }
-
- public function getBirth():string{
- return $this->_birth;
- }
- public function setBirth(string $birth){
- $this->_birth = $birth;
- }
-
- public function getLocation():string{
- return $this->_location;
- }
- public function setLocation(string $location){
- $this->_location = $location;
- }
-
- public function getDescription():string{
- return $this->_description;
- }
- public function setDescription(string $description){
- $this->_description = $description;
- }
-
- public function getAccountCreation():string{
- return $this->_account_creation;
- }
- public function setAccountCreation(string $account_creation){
- $this->_account_creation = $account_creation;
- }
-
- public function getStatus():int{
- return $this->_status;
- }
- public function setStatus(int $status){
- $this->_status = $status;
- }
- }
diff --git a/app/views/admin.php b/app/views/admin.php
index e3159b0..8cfe210 100644
--- a/app/views/admin.php
+++ b/app/views/admin.php
@@ -1,15 +1,4 @@
- php
-
-
-
-
-
- Dashboard - Folliow Admin
-
-
-
-
-
+
-
+
Les 4 derniers articles
diff --git a/app/views/inscription.php b/app/views/inscription.php
index 0856e2e..f534417 100644
--- a/app/views/inscription.php
+++ b/app/views/inscription.php
@@ -1,382 +1,175 @@
+
+
-
-
-
-
-
-
+
-
+
-
-
Inscription
-
-
-
- Créez votre compte utilisateur.
-
-
-
-
-
-
-
+
+
\ No newline at end of file
From 466c4b062532845268a545d9317860e03d6f566f Mon Sep 17 00:00:00 2001
From: "laura.chevillet"
Date: Tue, 27 Jan 2026 16:23:47 +0100
Subject: [PATCH 4/4] =?UTF-8?q?Fractionnement=20de=20la=20page=20admin=20p?=
=?UTF-8?q?our=20enlever=20le=20header=20et=20footer=20car=20d=C3=A9j?=
=?UTF-8?q?=C3=A0=20pr=C3=A9sent=20en=20partial.=20Attente=20de=20maj=20CS?=
=?UTF-8?q?S/HTML=20du=20la=20page=20Admin=20de=20Guillaume=20pour=20pouvo?=
=?UTF-8?q?ir=20avancer=20sur=20le=20PHP?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/admin_controller.php | 7 +++----
app/views/admin.php | 6 +-----
app/views/partials/footer.php | 2 ++
app/views/partials/header.php | 5 +++--
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/app/controllers/admin_controller.php b/app/controllers/admin_controller.php
index 511e117..35efe39 100644
--- a/app/controllers/admin_controller.php
+++ b/app/controllers/admin_controller.php
@@ -14,18 +14,18 @@
* @author Laura
*/
- class Admin{
+ class AdminCtrl{
public function admin() {
- $objCategory = new Category ();
+ /* $objCategory = new Category ();
$objCategory->setName($_POST['category_name'] ?? "");
$objCategory->setParent($_POST['category_parent'] ?? "");
$objCategoryModel = new CategoryModel();
$boolInsert = $objCategoryModel->insert($objCategory);
- /* EN ATTENTE
+ EN ATTENTE
if ($boolInsert === true) {
$_SESSION['success'] = "Catégorie ajoutée avec succès";
header("Location:index.php?ctrl=admin&action=admin");
@@ -41,5 +41,4 @@
include('../app/views/partials/footer.php');
}
-
}
\ No newline at end of file
diff --git a/app/views/admin.php b/app/views/admin.php
index 8cfe210..4441546 100644
--- a/app/views/admin.php
+++ b/app/views/admin.php
@@ -115,8 +115,4 @@
-
-
-
-
-
+
\ No newline at end of file
diff --git a/app/views/partials/footer.php b/app/views/partials/footer.php
index c380f5b..38e86aa 100644
--- a/app/views/partials/footer.php
+++ b/app/views/partials/footer.php
@@ -28,5 +28,7 @@
Suivez-nous
+
+