Fonctionnalité de modification/ajout de projet terminer
This commit is contained in:
parent
9c19aa5525
commit
374085d0fe
149 changed files with 12892 additions and 657 deletions
|
|
@ -18,7 +18,7 @@
|
|||
* @return array
|
||||
*/
|
||||
public function findAllUsers():array{
|
||||
$strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name
|
||||
$strRq = "SELECT user_id, user_firstname, user_name, user_image, user_status, authorisation_name, user_pseudo
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_deleted_at IS NULL";
|
||||
return $this->_db->query($strRq)->fetchAll();
|
||||
|
|
@ -32,7 +32,7 @@
|
|||
*/
|
||||
public function verifUser(string $strMail, string $strPwd):array|bool{
|
||||
|
||||
$strRq = "SELECT user_id, user_name, user_firstname, user_password, user_image, user_status, authorisation_name
|
||||
$strRq = "SELECT user_id, user_name, user_firstname, user_password, user_image, user_status, authorisation_name, user_pseudo
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_mail = '".$strMail."'";
|
||||
|
||||
|
|
@ -52,7 +52,7 @@
|
|||
*/
|
||||
public function insert(object $objUser):bool{
|
||||
|
||||
$strRq = "INSERT INTO users (user_name, user_firstname, user_pseudo, user_mail, user_password, user_phone, user_work, user_location, user_description)
|
||||
$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)";
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
|
@ -70,6 +70,37 @@
|
|||
return $rqPrep->execute();
|
||||
}
|
||||
|
||||
public function update(object $objUser):bool{
|
||||
$strRq = "UPDATE users SET
|
||||
user_name = :name,
|
||||
user_firstname = :firstname,
|
||||
user_pseudo = :pseudo,
|
||||
user_mail = :mail,
|
||||
user_phone = :phone,
|
||||
user_work = :work,
|
||||
user_location = :location,
|
||||
user_description = :description,
|
||||
user_image = :image
|
||||
WHERE user_id = :id";
|
||||
|
||||
|
||||
$rqPrep = $this->_db->prepare($strRq);
|
||||
|
||||
$rqPrep->bindValue(":id", $objUser->getId(), PDO::PARAM_INT);
|
||||
$rqPrep->bindValue(":name", $objUser->getName(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":firstname", $objUser->getFirstname(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":pseudo", $objUser->getPseudo(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(":mail", $objUser->getMail(), PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':phone', $objUser->getPhone() ?? "", PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':work', $objUser->getWork() ?? "", PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':location', $objUser->getLocation() ?? "", PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':description', $objUser->getDescription() ?? "", PDO::PARAM_STR);
|
||||
$rqPrep->bindValue(':image', $objUser->getImage() ?? "", PDO::PARAM_STR);
|
||||
|
||||
return $rqPrep->execute();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Fonction de vérification de mail
|
||||
* @param string $mail
|
||||
|
|
@ -125,7 +156,9 @@
|
|||
*/
|
||||
public function findUserById(int $intId): array|bool {
|
||||
|
||||
$strRq = "SELECT * FROM users WHERE user_id = :id";
|
||||
$strRq = "SELECT user_id,user_status ,user_image ,user_name, user_firstname, user_pseudo, user_mail, user_phone, user_work, user_location, user_description, authorisation_name
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_id = :id";
|
||||
|
||||
$prep = $this->_db->prepare($strRq);
|
||||
$prep->bindValue(':id', $intId, PDO::PARAM_INT);
|
||||
|
|
@ -133,4 +166,26 @@
|
|||
|
||||
return $prep->fetch();
|
||||
}
|
||||
|
||||
public function findUserByPseudo(string $strPseudo): array|bool {
|
||||
|
||||
$strRq = "SELECT user_id,user_image, user_status ,user_name, user_firstname, user_pseudo, user_mail, user_phone, user_work, user_location, user_description, authorisation_name
|
||||
FROM users INNER JOIN authorisation ON authorisation.authorisation_id = users.user_status
|
||||
WHERE user_pseudo = :pseudo";
|
||||
|
||||
$prep = $this->_db->prepare($strRq);
|
||||
$prep->bindValue(':pseudo', $strPseudo, PDO::PARAM_STR);
|
||||
$prep->execute();
|
||||
|
||||
return $prep->fetch();
|
||||
}
|
||||
|
||||
public function pseudoExists(string $pseudo): bool{
|
||||
|
||||
$rq = $this->_db->prepare("SELECT 1 FROM users WHERE user_pseudo = :pseudo LIMIT 1");
|
||||
$rq->bindValue(":pseudo", $pseudo, PDO::PARAM_STR);
|
||||
$rq->execute();
|
||||
|
||||
return $rq->fetchColumn();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue