Ajout de la page user fonctionnelle (ctrl, model associé etc) update des liens en display pour fonctionnement. Correction nom fichier project_display

This commit is contained in:
laura.chevillet 2026-02-10 14:55:34 +01:00
parent 48108f717f
commit f4d5669e44
16 changed files with 471 additions and 364 deletions

View file

@ -104,9 +104,9 @@
/**
* Fonction de recherche d'un seul projet
* @param int $intId
* @return
* @return array
*/
public function findOne(int $intId) {
public function findOne(int $intId) :array{
$strRq = "SELECT project.*,
CONCAT(users.user_firstname, ' ', users.user_name) AS 'project_creatorname',
users.user_image,
@ -150,4 +150,26 @@
return $this->_db->query($strRq);
}
/**
* Fonction de mise à jour d'un projet en BDD
* @param object $objProject L'objet utilisateur
* @return bool Est-ce que la requête s'est bien passée
*/
public function updateProject(object $objProject):bool{
$strRq = "UPDATE project
SET project_title = :title, project_description = :description, project_content = :content
WHERE project_id = :id";
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":title", $objProject->getTitle(), PDO::PARAM_STR);
$rqPrep->bindValue(":description", $objProject->getDescription(), PDO::PARAM_STR);
$rqPrep->bindValue(":content", $objProject->getContent(), PDO::PARAM_STR);
// Executer la requête
return $rqPrep->execute();
}
}

View file

@ -116,5 +116,21 @@
$rqPrep = $this->_db->prepare($strRq);
$rqPrep->bindValue(":id", $intId, PDO::PARAM_INT);
return $rqPrep->execute();
}
}
/**
* Récupère les informations d'un utilisateur par son ID
* @param int $intId L'identifiant de l'utilisateur
* @return array Tableau associatif (ou false si pas trouvé)
*/
public function findUserById(int $intId): array|bool {
$strRq = "SELECT * FROM users WHERE user_id = :id";
$prep = $this->_db->prepare($strRq);
$prep->bindValue(':id', $intId, PDO::PARAM_INT);
$prep->execute();
return $prep->fetch();
}
}