Fonctionnalité sur addedit_project essentiellement
This commit is contained in:
parent
e6c64912c3
commit
d5609324ab
175 changed files with 8333 additions and 12477 deletions
|
|
@ -107,7 +107,7 @@
|
|||
* Fonction de recherche d'un seul projet
|
||||
* @param int $intId
|
||||
* @return array
|
||||
*/
|
||||
*/
|
||||
public function findOne(int $intId) :array{
|
||||
$strRq = "SELECT project.*,
|
||||
CONCAT(users.user_firstname, ' ', users.user_name) AS 'project_creatorname',
|
||||
|
|
@ -178,20 +178,53 @@
|
|||
* @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,
|
||||
project_thumbnail = :thumbnail
|
||||
WHERE project_id = :id";
|
||||
|
||||
$strRq = "UPDATE project
|
||||
SET project_title = :title, project_description = :description, project_content = :content
|
||||
WHERE project_id = :id";
|
||||
|
||||
//Requête préparé
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
$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);
|
||||
$rqPrep->bindValue(":thumbnail", $objProject->getThumbnail(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":id", $objProject->getId(), PDO::PARAM_INT);
|
||||
|
||||
|
||||
// Executer la requête
|
||||
return $rqPrep->execute();
|
||||
}
|
||||
|
||||
public function getImagesByProjectId(int $projectId): array {
|
||||
$strRq = "SELECT image_id, image_name, image_alt
|
||||
FROM image
|
||||
WHERE image_project = :id AND image_status = 1";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
$rqPrep->bindValue(":id", $projectId, PDO::PARAM_INT);
|
||||
$rqPrep->execute();
|
||||
|
||||
return $rqPrep->fetchAll(PDO::FETCH_ASSOC);
|
||||
}
|
||||
|
||||
public function addImageInProject(string $fileName, int $projectId, string $alt = "Image projet"): bool {
|
||||
$strRq = "INSERT INTO image (
|
||||
image_name,
|
||||
image_alt,
|
||||
image_status,
|
||||
image_project
|
||||
)
|
||||
VALUES (:name, :alt, :status, :project)";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
||||
$rqPrep->bindValue(":name", $fileName, PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":alt", $alt, PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":status", "en_attente", PDO::PARAM_STR); // Valeur string brute
|
||||
$rqPrep->bindValue(":project", $projectId, PDO::PARAM_INT);
|
||||
|
||||
return $rqPrep->execute();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue