modification pour afficher user par pseudo et non par id
This commit is contained in:
parent
190554d966
commit
b11f67793a
9 changed files with 47 additions and 25 deletions
|
|
@ -151,7 +151,7 @@ class UserCtrl extends MotherCtrl {
|
||||||
*/
|
*/
|
||||||
public function user(){
|
public function user(){
|
||||||
|
|
||||||
$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
/**$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
||||||
|
|
||||||
if ($intId <= 0) {
|
if ($intId <= 0) {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
|
|
@ -162,16 +162,27 @@ class UserCtrl extends MotherCtrl {
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
$arrUserData = $objUserModel->findUserById($intId);
|
$arrUserData = $objUserModel->findUserById($intId);
|
||||||
|
|
||||||
|
if ($arrUserData === false) {
|
||||||
|
header("Location: index.php");
|
||||||
|
exit;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
$strPseudo = $_GET['pseudo']??'';
|
||||||
|
|
||||||
|
$objUserModel = new UserModel;
|
||||||
|
$arrUserData = $objUserModel->findUserByPseudo($strPseudo);
|
||||||
|
|
||||||
if ($arrUserData === false) {
|
if ($arrUserData === false) {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$objUser = new User;
|
$objUser = new User;
|
||||||
$objUser->hydrate($arrUserData);
|
$objUser->hydrate($arrUserData);
|
||||||
|
|
||||||
//affichage projet de l'utilisateur
|
//affichage projet de l'utilisateur
|
||||||
$objProjectModel = new ProjectModel;
|
$objProjectModel = new ProjectModel;
|
||||||
$arrProjects = $objProjectModel->findAll(0,'',$intId);
|
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
|
||||||
|
|
||||||
$arrProjectToDisplay = array();
|
$arrProjectToDisplay = array();
|
||||||
foreach($arrProjects as $projectData) {
|
foreach($arrProjects as $projectData) {
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,7 @@
|
||||||
string $strEndDate='', int $intCategory=0, bool $bool6Months=false):array{
|
string $strEndDate='', int $intCategory=0, bool $bool6Months=false):array{
|
||||||
|
|
||||||
$strRq = "SELECT project.*,
|
$strRq = "SELECT project.*,
|
||||||
CONCAT(user_firstname, ' ', user_name) AS 'project_creatorname',
|
user_pseudo AS 'project_creatorname',
|
||||||
user_image
|
user_image
|
||||||
FROM project
|
FROM project
|
||||||
INNER JOIN users ON user_id = project_user_id";
|
INNER JOIN users ON user_id = project_user_id";
|
||||||
|
|
|
||||||
|
|
@ -162,4 +162,15 @@
|
||||||
|
|
||||||
return $prep->fetch();
|
return $prep->fetch();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function findUserByPseudo(string $strPseudo): array|bool {
|
||||||
|
|
||||||
|
$strRq = "SELECT * FROM users WHERE user_pseudo = :pseudo";
|
||||||
|
|
||||||
|
$prep = $this->_db->prepare($strRq);
|
||||||
|
$prep->bindValue(':pseudo', $strPseudo, PDO::PARAM_STR);
|
||||||
|
$prep->execute();
|
||||||
|
|
||||||
|
return $prep->fetch();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/* Smarty version 5.7.0, created on 2026-02-19 19:37:38
|
/* Smarty version 5.7.0, created on 2026-02-19 20:09:19
|
||||||
from 'file:views/home.tpl' */
|
from 'file:views/home.tpl' */
|
||||||
|
|
||||||
/* @var \Smarty\Template $_smarty_tpl */
|
/* @var \Smarty\Template $_smarty_tpl */
|
||||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'version' => '5.7.0',
|
'version' => '5.7.0',
|
||||||
'unifunc' => 'content_69976682c1c284_75435092',
|
'unifunc' => 'content_69976def59c414_70095814',
|
||||||
'has_nocache_code' => false,
|
'has_nocache_code' => false,
|
||||||
'file_dependency' =>
|
'file_dependency' =>
|
||||||
array (
|
array (
|
||||||
|
|
@ -21,20 +21,20 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'file:views/_partial/preview.tpl' => 1,
|
'file:views/_partial/preview.tpl' => 1,
|
||||||
),
|
),
|
||||||
))) {
|
))) {
|
||||||
function content_69976682c1c284_75435092 (\Smarty\Template $_smarty_tpl) {
|
function content_69976def59c414_70095814 (\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||||
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
|
$_smarty_tpl->getInheritance()->init($_smarty_tpl, true);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_144579886869976682c18113_46108017', "content");
|
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_133394531269976def598252_85195320', "content");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
|
<?php $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir);
|
||||||
}
|
}
|
||||||
/* {block "content"} */
|
/* {block "content"} */
|
||||||
class Block_144579886869976682c18113_46108017 extends \Smarty\Runtime\Block
|
class Block_133394531269976def598252_85195320 extends \Smarty\Runtime\Block
|
||||||
{
|
{
|
||||||
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/* Smarty version 5.7.0, created on 2026-02-19 19:37:45
|
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||||
from 'file:views/layout.tpl' */
|
from 'file:views/layout.tpl' */
|
||||||
|
|
||||||
/* @var \Smarty\Template $_smarty_tpl */
|
/* @var \Smarty\Template $_smarty_tpl */
|
||||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'version' => '5.7.0',
|
'version' => '5.7.0',
|
||||||
'unifunc' => 'content_69976689b01014_92688396',
|
'unifunc' => 'content_69976e0ca03d67_47539078',
|
||||||
'has_nocache_code' => false,
|
'has_nocache_code' => false,
|
||||||
'file_dependency' =>
|
'file_dependency' =>
|
||||||
array (
|
array (
|
||||||
|
|
@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'file:views/_partial/footer.tpl' => 1,
|
'file:views/_partial/footer.tpl' => 1,
|
||||||
),
|
),
|
||||||
))) {
|
))) {
|
||||||
function content_69976689b01014_92688396 (\Smarty\Template $_smarty_tpl) {
|
function content_69976e0ca03d67_47539078 (\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||||
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
|
$_smarty_tpl->getInheritance()->init($_smarty_tpl, false);
|
||||||
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
$_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_210858053669976689aff6c2_11310529', "content");
|
$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_27929295869976e0ca01fb9_36548139', "content");
|
||||||
?>
|
?>
|
||||||
|
|
||||||
|
|
||||||
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
<?php $_smarty_tpl->renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir);
|
||||||
}
|
}
|
||||||
/* {block "content"} */
|
/* {block "content"} */
|
||||||
class Block_210858053669976689aff6c2_11310529 extends \Smarty\Runtime\Block
|
class Block_27929295869976e0ca01fb9_36548139 extends \Smarty\Runtime\Block
|
||||||
{
|
{
|
||||||
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
public function callBlock(\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views';
|
$_smarty_current_dir = 'D:\\projetphp\\views';
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/* Smarty version 5.7.0, created on 2026-02-19 19:37:45
|
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||||
from 'file:views/_partial/footer.tpl' */
|
from 'file:views/_partial/footer.tpl' */
|
||||||
|
|
||||||
/* @var \Smarty\Template $_smarty_tpl */
|
/* @var \Smarty\Template $_smarty_tpl */
|
||||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'version' => '5.7.0',
|
'version' => '5.7.0',
|
||||||
'unifunc' => 'content_69976689ccd1e8_62225255',
|
'unifunc' => 'content_69976e0cbdbc02_44067705',
|
||||||
'has_nocache_code' => false,
|
'has_nocache_code' => false,
|
||||||
'file_dependency' =>
|
'file_dependency' =>
|
||||||
array (
|
array (
|
||||||
|
|
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
))) {
|
))) {
|
||||||
function content_69976689ccd1e8_62225255 (\Smarty\Template $_smarty_tpl) {
|
function content_69976e0cbdbc02_44067705 (\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||||
?>
|
?>
|
||||||
<footer class="footer container-fluid d-flex justify-content-around mt-auto">
|
<footer class="footer container-fluid d-flex justify-content-around mt-auto">
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,18 @@
|
||||||
<?php
|
<?php
|
||||||
/* Smarty version 5.7.0, created on 2026-02-19 19:37:43
|
/* Smarty version 5.7.0, created on 2026-02-19 20:09:26
|
||||||
from 'file:views/_partial/preview.tpl' */
|
from 'file:views/_partial/preview.tpl' */
|
||||||
|
|
||||||
/* @var \Smarty\Template $_smarty_tpl */
|
/* @var \Smarty\Template $_smarty_tpl */
|
||||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'version' => '5.7.0',
|
'version' => '5.7.0',
|
||||||
'unifunc' => 'content_69976687c2cde7_58748034',
|
'unifunc' => 'content_69976df6e78664_25243843',
|
||||||
'has_nocache_code' => false,
|
'has_nocache_code' => false,
|
||||||
'file_dependency' =>
|
'file_dependency' =>
|
||||||
array (
|
array (
|
||||||
'67e1ae3a210fc2d1bf8782993687bad91a1cf0f6' =>
|
'67e1ae3a210fc2d1bf8782993687bad91a1cf0f6' =>
|
||||||
array (
|
array (
|
||||||
0 => 'views/_partial/preview.tpl',
|
0 => 'views/_partial/preview.tpl',
|
||||||
1 => 1771519241,
|
1 => 1771531758,
|
||||||
2 => 'file',
|
2 => 'file',
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
|
@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
array (
|
array (
|
||||||
),
|
),
|
||||||
))) {
|
))) {
|
||||||
function content_69976687c2cde7_58748034 (\Smarty\Template $_smarty_tpl) {
|
function content_69976df6e78664_25243843 (\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||||
?><article class="col-md-3 mb-5 <?php if ((true && (true && null !== ($_SESSION['user'] ?? null))) && $_SESSION['user']['user_status'] == 2) {?> pb-5 <?php }?>" style="border-radius: 100px ;">
|
?><article class="col-md-3 mb-5 <?php if ((true && (true && null !== ($_SESSION['user'] ?? null))) && $_SESSION['user']['user_status'] == 2) {?> pb-5 <?php }?>" style="border-radius: 100px ;">
|
||||||
<div class="card h-100 shadow article-card rounded-4" style="border-width: 2px; overflow: hidden;">
|
<div class="card h-100 shadow article-card rounded-4" style="border-width: 2px; overflow: hidden;">
|
||||||
|
|
@ -46,7 +46,7 @@ $_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||||
</h3>
|
</h3>
|
||||||
<p class="small text-muted mb-1">
|
<p class="small text-muted mb-1">
|
||||||
<i class="bi bi-person"></i>
|
<i class="bi bi-person"></i>
|
||||||
<a href="index.php?ctrl=user&action=user&id=<?php echo $_smarty_tpl->getValue('objProject')->getUser_id();?>
|
<a href="index.php?ctrl=user&action=user&pseudo=<?php echo $_smarty_tpl->getValue('objProject')->getCreatorname();?>
|
||||||
"
|
"
|
||||||
class="text-decoration-none text-muted"
|
class="text-decoration-none text-muted"
|
||||||
style="position: relative; z-index: 2;">
|
style="position: relative; z-index: 2;">
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
<?php
|
<?php
|
||||||
/* Smarty version 5.7.0, created on 2026-02-19 19:37:45
|
/* Smarty version 5.7.0, created on 2026-02-19 20:09:48
|
||||||
from 'file:views/_partial/header.tpl' */
|
from 'file:views/_partial/header.tpl' */
|
||||||
|
|
||||||
/* @var \Smarty\Template $_smarty_tpl */
|
/* @var \Smarty\Template $_smarty_tpl */
|
||||||
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'version' => '5.7.0',
|
'version' => '5.7.0',
|
||||||
'unifunc' => 'content_69976689b86271_22891813',
|
'unifunc' => 'content_69976e0ca81001_88880615',
|
||||||
'has_nocache_code' => false,
|
'has_nocache_code' => false,
|
||||||
'file_dependency' =>
|
'file_dependency' =>
|
||||||
array (
|
array (
|
||||||
|
|
@ -21,7 +21,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array (
|
||||||
'file:views/_partial/messages.tpl' => 1,
|
'file:views/_partial/messages.tpl' => 1,
|
||||||
),
|
),
|
||||||
))) {
|
))) {
|
||||||
function content_69976689b86271_22891813 (\Smarty\Template $_smarty_tpl) {
|
function content_69976e0ca81001_88880615 (\Smarty\Template $_smarty_tpl) {
|
||||||
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
$_smarty_current_dir = 'D:\\projetphp\\views\\_partial';
|
||||||
?><!DOCTYPE html>
|
?><!DOCTYPE html>
|
||||||
<html lang="fr">
|
<html lang="fr">
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
<h3 class="h6 fw-bold mb-2 mt-1">{$objProject->getTitle()}</h3>
|
<h3 class="h6 fw-bold mb-2 mt-1">{$objProject->getTitle()}</h3>
|
||||||
<p class="small text-muted mb-1">
|
<p class="small text-muted mb-1">
|
||||||
<i class="bi bi-person"></i>
|
<i class="bi bi-person"></i>
|
||||||
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}"
|
<a href="index.php?ctrl=user&action=user&pseudo={$objProject->getCreatorname()}"
|
||||||
class="text-decoration-none text-muted"
|
class="text-decoration-none text-muted"
|
||||||
style="position: relative; z-index: 2;">
|
style="position: relative; z-index: 2;">
|
||||||
{$objProject->getCreatorname()}
|
{$objProject->getCreatorname()}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue