Connexion et amelioration disposition index

This commit is contained in:
Yass 2026-01-15 17:22:54 +01:00
parent 4d1d758017
commit 024cf537ed
11 changed files with 109 additions and 34 deletions

View file

@ -17,6 +17,7 @@ class Project extends Entity{
private int $_user;
private int $_category;
private string $_creatorname;
private string $_user_image;
/**
@ -199,5 +200,21 @@ class Project extends Entity{
public function setCreatorName($creatorname){
$this->_creatorname = $creatorname;
}
/**
* Récupération du chemin photo profil
* @return string nom du chemin photo profil
*/
public function getUser_image(){
return $this->_user_image;
}
/**
* Mise à jour du chemin photo profil
* @param string chemin photo profil
*/
public function setUser_image($user_image){
$this->_user_image = $user_image;
}
}

View file

@ -9,7 +9,8 @@
// Ecrire la requête
$strRq = "SELECT project.*,
CONCAT(user_firstname, ' ', user_name) AS 'project_creatorname'
CONCAT(user_firstname, ' ', user_name) AS 'project_creatorname',
user_image
FROM project
INNER JOIN users ON user_id = project_user";
// Pour le where (un seul)

View file

@ -20,7 +20,7 @@
*/
public function findAllUsers():array{
// Ecrire la requête
$strRq = "SELECT user_id, user_firstname, user_name
$strRq = "SELECT user_id, user_firstname, user_name, user_image
FROM users ";
// Lancer la requête et récupérer les résultats
return $this->_db->query($strRq)->fetchAll();
@ -33,16 +33,16 @@
*/
public function verifUser(string $strMail, string $strPwd):array|bool{
// 2. Construire la requête
$strRq = "SELECT user_id, user_name, user_firstname, user_pwd
$strRq = "SELECT user_id, user_name, user_firstname, user_password, user_image
FROM users
WHERE user_mail = '".$strMail."'";
// Récupère mon utilisateur
// Executer la requête et récupérer les résultats
$arrUser = $this->_db->query($strRq)->fetch();
// Vérification du mot de passe haché
if (password_verify($strPwd, $arrUser['user_pwd'])){
if (password_verify($strPwd, $arrUser['user_password'])){
// Renvoi l'utilisateur
unset($arrUser['user_pwd']); // on enlève le pwd
unset($arrUser['user_password']); // on enlève le pwd
return $arrUser;
}else{
return false;

View file

@ -44,17 +44,41 @@
</ul>
<!-- Menu secondaire -->
<ul class="navbar-nav ms-auto align-items-center">
<li class="nav-item">
<i class="fas fa-bell notification-bell"></i>
</li>
<li class="nav-item">
<a href="?ctrl=user&action=login"><button class="btn btn-login">Se connecter</button></a>
</li>
<li class="nav-item">
<a href="?ctrl=user&action=signin"><button class="btn btn-signup">S'inscrire</button></a>
</li>
</ul>
<nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
<?php if (!isset($_SESSION['user'])){ ?>
<!--- Utilisateur non connecté -->
<ul class="navbar-nav ">
<li class="nav-item">
<a class="nav-link" href="index.php?ctrl=user&action=signin" title="Créer un compte" aria-label="Créer un compte">
S'inscrire
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="index.php?ctrl=user&action=login" title="Se connecter" aria-label="Se connecter">
Se connecter
</a>
</li>
</ul>
<?php }else{ ?>
<!--- Utilisateur connecté -->
<ul class="navbar-nav ">
<li class="nav-item ">
<a class="nav-link" href="edit_account.php" title="Modifier mon compte" aria-label="Modifier mon compte">
<img src=".<?php echo $_SESSION["user"]["user_image"]; ?>"
class="rounded-circle flex-shrink-0 mt-2 ml-5"
style="width: 36px; height: 36px; object-fit: cover;"
alt="Photo de profil">
</a>
</li>
<li class="nav-item ">
<a class="nav-link" href="index.php?ctrl=user&action=logout" title="Se déconnecter" aria-label="Se déconnecter">
Logout
</a>
</li>
</ul>
<?php } ?>
</nav>
</div>
</div>
</nav>

View file

@ -1,19 +1,38 @@
<article class="col-md-6 mb-4">
<div class="row g-0 border rounded overflow-hidden flex-md-row shadow-sm h-md-250 position-relative">
<div class="col p-4 d-flex flex-column position-static">
<h3 class="mb-2"><?php echo $objProject->getTitle(); ?></h3>
<div class="mb-2 text-body-secondary">
<time datetime="2017-05-11"><?php echo $objProject->getCreation_date(); ?></time>
<span> - <?php echo $objProject->getCreatorname(); ?> </span>
</div>
<p class="mb-auto"><?php echo $objProject->getDescription(); ?></p>
<a href="?id=<?php echo $objProject->getId()?>" class="icon-link gap-1 icon-link-hover stretched-link" aria-label="Lire l'article complet sur le devenir du JavaScript">
Lire la suite
<i class="fas fa-arrow-right" aria-hidden="true"></i>
</a>
</div>
<div class="col-auto d-none d-lg-block">
<img class="bd-placeholder-img" width="200" height="250" src="<?php echo $objProject->getThumbnail(); ?>" alt="" loading="lazy">
<article class="col-md-3 mb-4">
<div class="card h-100 shadow-sm article-card">
<!-- IMAGE (80%) -->
<div class="ratio ratio-16x9">
<img src=".<?php echo $objProject->getThumbnail(); ?>"
class="w-100 h-100 object-fit-cover"
alt=""
loading="lazy">
</div>
<div class="d-flex align-items-start gap-3">
<!-- PHOTO DE PROFIL -->
<img src=".<?php echo $objProject->getUser_image(); ?>"
class="rounded-circle flex-shrink-0 mt-2 ml-5"
style="width: 48px; height: 48px; object-fit: cover;"
alt="Photo de profil">
<!-- INFOS -->
<div class="flex-grow-1 card-body p-3">
<h3 class="h6 mb-1"><?php echo $objProject->getTitle(); ?></h3>
<small class="text-body-secondary d-block mb-1">
<time><?php echo $objProject->getCreation_date(); ?></time>
<?php echo $objProject->getCreatorname(); ?>
</small>
<a href="?id=<?php echo $objProject->getId()?>"
class="stretched-link small">
Lire la suite
</a>
</div>
</div>
</div>
</article>

View file

@ -82,3 +82,17 @@ body {
-webkit-text-fill-color: transparent;
background-clip: text;
}
.article-card {
height: 400px;
}
.article-img {
height: 50px;
width: 100%;
overflow: hidden;
}
.article-content {
height: 20%;
padding: 0.75rem;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 232 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB