diff --git a/app/controllers/admin_controller.php b/app/controllers/admin_controller.php index e005fc5..1565ddd 100644 --- a/app/controllers/admin_controller.php +++ b/app/controllers/admin_controller.php @@ -1,11 +1,44 @@ -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 + } + } diff --git a/app/controllers/project_controller.php b/app/controllers/project_controller.php index ee47bad..6503a30 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/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/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 diff --git a/app/views/home.php b/app/views/home.php index 0193654..4d3d921 100644 --- a/app/views/home.php +++ b/app/views/home.php @@ -6,7 +6,7 @@ directement en contact avec les entreprises.

-
+

Les 4 derniers articles

+ +
- -
- -
- -
+
- +
- -

Inscription

- - -

- Créez votre compte utilisateur. -

- - - -
- -
- - -
- - -
- - -
- - -
- - -
- -
- @ - -
- -
- - +

Inscription

+ +

- Créez votre compte utilisateur. + Créez votre compte utilisateur.

- - - - - - - + + +
- -
- - -
- - +
+
+ + +
+ +
- +
- @ - -
-
- - -
- + @
+
- -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - Déjà un compte ? - Se connecter - -
- - -
- + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ +
+ + Déjà un compte ? + Se connecter +
-
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- - -
- -
- - -
- - Déjà un compte ? - Se connecter - -
- -
-
+
-
-
-
+
+
\ 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

+ + \ No newline at end of file diff --git a/app/views/partials/header.php b/app/views/partials/header.php index 1c00337..1180732 100644 --- a/app/views/partials/header.php +++ b/app/views/partials/header.php @@ -11,10 +11,11 @@ + Folliow -