Merge pull request #37 from Yasder5/laura
Correction affichage recherche, maj bouton, suppression requêtes de c…
This commit is contained in:
commit
6c21a5f1cb
20 changed files with 244 additions and 282 deletions
|
|
@ -26,7 +26,6 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gestion de l'user
|
|
||||||
$objCategoryModel = new CategoryModel;
|
$objCategoryModel = new CategoryModel;
|
||||||
|
|
||||||
if (!empty($_POST['new_category'])) {
|
if (!empty($_POST['new_category'])) {
|
||||||
|
|
@ -48,7 +47,6 @@
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
//affichage select des catégories
|
|
||||||
$arrCategory = $objCategoryModel->findAllCategory();
|
$arrCategory = $objCategoryModel->findAllCategory();
|
||||||
$arrCategoryToDisplay = array();
|
$arrCategoryToDisplay = array();
|
||||||
|
|
||||||
|
|
@ -58,7 +56,6 @@
|
||||||
$arrCategoryToDisplay[] = $objCategory;
|
$arrCategoryToDisplay[] = $objCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gestion de l'user
|
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
|
|
||||||
if (!empty($_POST['action'])) {
|
if (!empty($_POST['action'])) {
|
||||||
|
|
@ -82,7 +79,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//affichage select des users
|
|
||||||
$arrUser = $objUserModel->findAllUsers();
|
$arrUser = $objUserModel->findAllUsers();
|
||||||
$arrUserToDisplay = array();
|
$arrUserToDisplay = array();
|
||||||
|
|
||||||
|
|
@ -92,7 +88,6 @@
|
||||||
$arrUserToDisplay[] = $objUser;
|
$arrUserToDisplay[] = $objUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
//affichage select des authorisations
|
|
||||||
$objAuthorisationModel = new AuthorisationModel;
|
$objAuthorisationModel = new AuthorisationModel;
|
||||||
$arrAuthorisation = $objAuthorisationModel->findAllAuthorisation();
|
$arrAuthorisation = $objAuthorisationModel->findAllAuthorisation();
|
||||||
$arrAuthorisationToDisplay = array();
|
$arrAuthorisationToDisplay = array();
|
||||||
|
|
@ -103,7 +98,6 @@
|
||||||
$arrAuthorisationToDisplay[] = $objAuthorisation;
|
$arrAuthorisationToDisplay[] = $objAuthorisation;
|
||||||
}
|
}
|
||||||
|
|
||||||
//gérer l'affichage
|
|
||||||
$this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay;
|
$this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay;
|
||||||
$this->_arrData['arrUserToDisplay'] = $arrUserToDisplay;
|
$this->_arrData['arrUserToDisplay'] = $arrUserToDisplay;
|
||||||
$this->_arrData['arrAuthorisationToDisplay'] = $arrAuthorisationToDisplay;
|
$this->_arrData['arrAuthorisationToDisplay'] = $arrAuthorisationToDisplay;
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le contrôleur des erreurs
|
* Le contrôleur des erreurs
|
||||||
* @author Laura (largement inspiré de Christel)
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
class ErrorCtrl extends MotherCtrl{
|
class ErrorCtrl extends MotherCtrl{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,35 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Le controller de la page d'aide utilisateur
|
* Le controller de la page d'aide utilisateur
|
||||||
* @author Laura
|
* @author Laura & Besnik
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class PageCtrl extends MotherCtrl{
|
class PageCtrl extends MotherCtrl{
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page aide utilisateur
|
||||||
|
*/
|
||||||
public function help(){
|
public function help(){
|
||||||
|
|
||||||
$this->_display("help");
|
$this->_display("help");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page mentions légales
|
||||||
|
*/
|
||||||
|
public function mentions(){
|
||||||
|
// Afficher
|
||||||
|
$this->_display("mentions");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Page à propos
|
||||||
|
*/
|
||||||
|
public function about(){
|
||||||
|
// Afficher
|
||||||
|
$this->_display("about");
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -16,12 +16,12 @@
|
||||||
* Le controler des Project
|
* Le controler des Project
|
||||||
* @author Yasser, Laura, Besnik & Guillaume
|
* @author Yasser, Laura, Besnik & Guillaume
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ProjectCtrl extends MotherCtrl{
|
class ProjectCtrl extends MotherCtrl{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction d'affichage de la page d'acceuil
|
* Fonction d'affichage de la page d'acceuil
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public function home(){
|
public function home(){
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -75,7 +75,6 @@
|
||||||
*/
|
*/
|
||||||
public function search(){
|
public function search(){
|
||||||
|
|
||||||
//Récupérer les informations du formulaire
|
|
||||||
$strKeywords = $_POST['keywords']??'';
|
$strKeywords = $_POST['keywords']??'';
|
||||||
$intAuthor = $_POST['author']??0;
|
$intAuthor = $_POST['author']??0;
|
||||||
$intPeriod = $_POST['period']??0;
|
$intPeriod = $_POST['period']??0;
|
||||||
|
|
@ -84,7 +83,6 @@
|
||||||
$strEndDate = $_POST['enddate']??'';
|
$strEndDate = $_POST['enddate']??'';
|
||||||
$intCategory = $_POST['category']??0;
|
$intCategory = $_POST['category']??0;
|
||||||
|
|
||||||
// Récupération des projets
|
|
||||||
$objProjectModel = new ProjectModel;
|
$objProjectModel = new ProjectModel;
|
||||||
$arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate,
|
$arrProject = $objProjectModel->findAll(intAuthor:$intAuthor, intPeriod:$intPeriod, strDate:$strDate,
|
||||||
strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory);
|
strKeywords:$strKeywords, strStartDate:$strStartDate, strEndDate:$strEndDate, intCategory:$intCategory);
|
||||||
|
|
@ -96,11 +94,9 @@
|
||||||
$arrProjectToDisplay[] = $objProject;
|
$arrProjectToDisplay[] = $objProject;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Récupération des utilisateurs
|
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
$arrUser = $objUserModel->findAllUsers();
|
$arrUser = $objUserModel->findAllUsers();
|
||||||
|
|
||||||
// Récupération des catégories
|
|
||||||
$objCategoryModel = new CategoryModel;
|
$objCategoryModel = new CategoryModel;
|
||||||
$arrCategory = $objCategoryModel->findAllCategory();
|
$arrCategory = $objCategoryModel->findAllCategory();
|
||||||
|
|
||||||
|
|
@ -108,6 +104,13 @@
|
||||||
$this->_arrData['arrCategory'] = $arrCategory;
|
$this->_arrData['arrCategory'] = $arrCategory;
|
||||||
$this->_arrData['arrProject'] = $arrProject;
|
$this->_arrData['arrProject'] = $arrProject;
|
||||||
$this->_arrData['arrUser'] = $arrUser;
|
$this->_arrData['arrUser'] = $arrUser;
|
||||||
|
$this->_arrData['strKeywords'] = $strKeywords;
|
||||||
|
$this->_arrData['intAuthor'] = $intAuthor;
|
||||||
|
$this->_arrData['intPeriod'] = $intPeriod;
|
||||||
|
$this->_arrData['strDate'] = $strDate;
|
||||||
|
$this->_arrData['strStartDate'] = $strStartDate;
|
||||||
|
$this->_arrData['strEndDate'] = $strEndDate;
|
||||||
|
$this->_arrData['intCategory'] = $intCategory;
|
||||||
|
|
||||||
$this->_display("search");
|
$this->_display("search");
|
||||||
}
|
}
|
||||||
|
|
@ -131,7 +134,7 @@
|
||||||
header("Location:index.php?ctrl=error&action=error_403");
|
header("Location:index.php?ctrl=error&action=error_403");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
$objProject->hydrate($arrProject); // BDD
|
$objProject->hydrate($arrProject);
|
||||||
$this->_arrData['arrImages'] = $objProjectModel->getImagesByProjectId($objProject->getId());
|
$this->_arrData['arrImages'] = $objProjectModel->getImagesByProjectId($objProject->getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +154,6 @@
|
||||||
$arrError['content'] = "Le contenu est obligatoire";
|
$arrError['content'] = "Le contenu est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérification de l'image (Thumbnail)
|
|
||||||
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
||||||
if ($_FILES['thumbnail']['error'] != 4){
|
if ($_FILES['thumbnail']['error'] != 4){
|
||||||
if (!in_array($_FILES['thumbnail']['type'], $arrTypeAllowed)){
|
if (!in_array($_FILES['thumbnail']['type'], $arrTypeAllowed)){
|
||||||
|
|
@ -186,18 +188,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SI pas d'erreur : on traite l'image principale
|
|
||||||
if (count($arrError) == 0){
|
if (count($arrError) == 0){
|
||||||
|
|
||||||
$boolImageOk = true;
|
$boolImageOk = true;
|
||||||
|
|
||||||
// On peux changer ces dimensions si on veux que la miniature soit plus grande/petite
|
|
||||||
if (isset($strImageName)){
|
if (isset($strImageName)){
|
||||||
$strDest = $_ENV['IMG_PROJECT_PATH'].$strImageName;
|
$strDest = $_ENV['IMG_PROJECT_PATH'].$strImageName;
|
||||||
$strSource = $_FILES['thumbnail']['tmp_name'];
|
$strSource = $_FILES['thumbnail']['tmp_name'];
|
||||||
list($intWidth, $intHeight) = getimagesize($strSource);
|
list($intWidth, $intHeight) = getimagesize($strSource);
|
||||||
|
|
||||||
// Redimensionnement de la Thumbnail
|
|
||||||
$intDestWidth = 200; $intDestHeight = 250;
|
$intDestWidth = 200; $intDestHeight = 250;
|
||||||
$fltDestRatio = $intDestWidth / $intDestHeight;
|
$fltDestRatio = $intDestWidth / $intDestHeight;
|
||||||
$fltSourceRatio = $intWidth / $intHeight;
|
$fltSourceRatio = $intWidth / $intHeight;
|
||||||
|
|
@ -230,12 +228,10 @@
|
||||||
imagecopyresampled($objDest, $objSource, 0, 0, $intCropX, $intCropY, $intDestWidth, $intDestHeight, $intCropWidth, $intCropHeight);
|
imagecopyresampled($objDest, $objSource, 0, 0, $intCropX, $intCropY, $intDestWidth, $intDestHeight, $intCropWidth, $intCropHeight);
|
||||||
$boolImageOk = imagewebp($objDest, $strDest);
|
$boolImageOk = imagewebp($objDest, $strDest);
|
||||||
|
|
||||||
//Suppression des doublons pour la mémoire vive
|
|
||||||
imagedestroy($objDest);
|
imagedestroy($objDest);
|
||||||
imagedestroy($objSource);
|
imagedestroy($objSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
// SI image ok, on balance tout dans la bdd
|
|
||||||
if ($boolImageOk){
|
if ($boolImageOk){
|
||||||
if (!isset($_GET['id'])){
|
if (!isset($_GET['id'])){
|
||||||
$objProject->setUser_id($_SESSION['user']['user_id']);
|
$objProject->setUser_id($_SESSION['user']['user_id']);
|
||||||
|
|
@ -244,28 +240,21 @@
|
||||||
$boolOk = $objProjectModel->updateProject($objProject);
|
$boolOk = $objProjectModel->updateProject($objProject);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Gestion des 20 Images après l'envoie de la Thumbnail en BDD
|
|
||||||
if ($boolOk){
|
if ($boolOk){
|
||||||
//Si pas d'erreur
|
|
||||||
if (isset($_FILES['imageProject']) && $_FILES['imageProject']['error'][0] != 4) {
|
if (isset($_FILES['imageProject']) && $_FILES['imageProject']['error'][0] != 4) {
|
||||||
$files = $_FILES['imageProject'];
|
$files = $_FILES['imageProject'];
|
||||||
$maxPhotos = 20;
|
$maxPhotos = 20;
|
||||||
|
|
||||||
// 1. On compte combien d'images le projet possède déjà en BDD
|
|
||||||
$currentImages = $objProjectModel->getImagesByProjectId($objProject->getId());
|
$currentImages = $objProjectModel->getImagesByProjectId($objProject->getId());
|
||||||
$totalExisting = count($currentImages);
|
$totalExisting = count($currentImages);
|
||||||
|
|
||||||
// 2. On calcule combien de photos on peut encore ajouter
|
|
||||||
$remainingSlots = $maxPhotos - $totalExisting;
|
$remainingSlots = $maxPhotos - $totalExisting;
|
||||||
|
|
||||||
// Si on a déjà atteint ou dépassé la limite, on ne traite même pas les fichiers
|
|
||||||
if ($remainingSlots <= 0) {
|
if ($remainingSlots <= 0) {
|
||||||
$_SESSION['error'] = "Limite de $maxPhotos photos atteinte. Supprimez-en pour en ajouter de nouvelles.";
|
$_SESSION['error'] = "Limite de $maxPhotos photos atteinte. Supprimez-en pour en ajouter de nouvelles.";
|
||||||
} else {
|
} else {
|
||||||
$uploadedCount = 0;
|
$uploadedCount = 0;
|
||||||
|
|
||||||
foreach ($files['name'] as $key => $name) {
|
foreach ($files['name'] as $key => $name) {
|
||||||
// 3. On utilise le quota restant comme condition d'arrêt
|
|
||||||
if ($uploadedCount >= $remainingSlots) break;
|
if ($uploadedCount >= $remainingSlots) break;
|
||||||
|
|
||||||
if ($files['error'][$key] === 0 && in_array($files['type'][$key], $arrTypeAllowed)) {
|
if ($files['error'][$key] === 0 && in_array($files['type'][$key], $arrTypeAllowed)) {
|
||||||
|
|
@ -274,10 +263,8 @@
|
||||||
$strDestGallery = $_ENV['IMG_PROJECT_PATH'].$galleryName;
|
$strDestGallery = $_ENV['IMG_PROJECT_PATH'].$galleryName;
|
||||||
$strSourceGallery = $files['tmp_name'][$key];
|
$strSourceGallery = $files['tmp_name'][$key];
|
||||||
|
|
||||||
// Reprise de la logique de redimensionnement
|
|
||||||
list($intW, $intH) = getimagesize($strSourceGallery);
|
list($intW, $intH) = getimagesize($strSourceGallery);
|
||||||
|
|
||||||
// On peux changer ces dimensions si on veux que la galerie soit plus grande/petite
|
|
||||||
$intDestW = 150; $intDestH = 150;
|
$intDestW = 150; $intDestH = 150;
|
||||||
$fltDestR = $intDestW / $intDestH;
|
$fltDestR = $intDestW / $intDestH;
|
||||||
$fltSourceR = $intW / $intH;
|
$fltSourceR = $intW / $intH;
|
||||||
|
|
@ -296,7 +283,6 @@
|
||||||
|
|
||||||
$objDestGallery = imagecreatetruecolor($intDestW, $intDestH);
|
$objDestGallery = imagecreatetruecolor($intDestW, $intDestH);
|
||||||
|
|
||||||
// Création de la source selon le type de chaque image de la boucle
|
|
||||||
switch ($files['type'][$key]) {
|
switch ($files['type'][$key]) {
|
||||||
case 'image/jpeg' :
|
case 'image/jpeg' :
|
||||||
$objSourceGallery = imagecreatefromjpeg($strSourceGallery);
|
$objSourceGallery = imagecreatefromjpeg($strSourceGallery);
|
||||||
|
|
@ -313,7 +299,6 @@
|
||||||
imagecopyresampled($objDestGallery, $objSourceGallery, 0, 0, $intCropX, $intCropY, $intDestW, $intDestH, $intCropW, $intCropH);
|
imagecopyresampled($objDestGallery, $objSourceGallery, 0, 0, $intCropX, $intCropY, $intDestW, $intDestH, $intCropW, $intCropH);
|
||||||
|
|
||||||
if (imagewebp($objDestGallery, $strDestGallery)) {
|
if (imagewebp($objDestGallery, $strDestGallery)) {
|
||||||
// Insertion en BDD
|
|
||||||
$objProjectModel->addImageInProject($galleryName, $objProject->getId());
|
$objProjectModel->addImageInProject($galleryName, $objProject->getId());
|
||||||
$uploadedCount++;
|
$uploadedCount++;
|
||||||
}
|
}
|
||||||
|
|
@ -330,7 +315,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Suppression de l'ancienne miniature
|
|
||||||
if(isset($strOldImg) && !empty($strOldImg) && isset($strImageName)){
|
if(isset($strOldImg) && !empty($strOldImg) && isset($strImageName)){
|
||||||
$strOldFile = $_ENV['IMG_PROJECT_PATH'].$strOldImg;
|
$strOldFile = $_ENV['IMG_PROJECT_PATH'].$strOldImg;
|
||||||
if (file_exists($strOldFile)) unlink($strOldFile);
|
if (file_exists($strOldFile)) unlink($strOldFile);
|
||||||
|
|
@ -348,17 +332,13 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Données pour la vue
|
|
||||||
$this->_arrData['arrCategory'] = $objCategoryModel->findAllCategory();
|
$this->_arrData['arrCategory'] = $objCategoryModel->findAllCategory();
|
||||||
$this->_arrData['objProject'] = $objProject;
|
$this->_arrData['objProject'] = $objProject;
|
||||||
$this->_arrData['arrError'] = $arrError;
|
$this->_arrData['arrError'] = $arrError;
|
||||||
|
|
||||||
// Si on est en modifications de projet, on récupère les images pour les afficher dans le formulaire
|
|
||||||
if ($objProject->getId()) {
|
if ($objProject->getId()) {
|
||||||
// On récupère les images via le modèle et on les stocke dans le tableau de données
|
|
||||||
$this->_arrData['arrImages'] = $objProjectModel->getImagesByProjectId($objProject->getId());
|
$this->_arrData['arrImages'] = $objProjectModel->getImagesByProjectId($objProject->getId());
|
||||||
} else {
|
} else {
|
||||||
// Sinon on initialise un tableau vide pour éviter que Smarty ne râle
|
|
||||||
$this->_arrData['arrImages'] = [];
|
$this->_arrData['arrImages'] = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -376,7 +356,6 @@
|
||||||
$objProjectModel = new ProjectModel();
|
$objProjectModel = new ProjectModel();
|
||||||
$arrProject = $objProjectModel->findOne((int)$intId);
|
$arrProject = $objProjectModel->findOne((int)$intId);
|
||||||
|
|
||||||
// CORRECTION ICI : on utilise $intId (pas $id)
|
|
||||||
$arrImages = $objProjectModel->getImagesByProjectId((int)$intId);
|
$arrImages = $objProjectModel->getImagesByProjectId((int)$intId);
|
||||||
|
|
||||||
if ($arrProject) {
|
if ($arrProject) {
|
||||||
|
|
@ -432,8 +411,6 @@
|
||||||
$objMail->Username = 'a2a67e001@smtp-brevo.com';
|
$objMail->Username = 'a2a67e001@smtp-brevo.com';
|
||||||
$objMail->Password = 'xsmtpsib-f2af87e12d3db6f1b99802a92c1acda32d45fc32a8446eeed7e49ec91c4ec7ef-AX8Y7YkRWYSmKHwS';
|
$objMail->Password = 'xsmtpsib-f2af87e12d3db6f1b99802a92c1acda32d45fc32a8446eeed7e49ec91c4ec7ef-AX8Y7YkRWYSmKHwS';
|
||||||
|
|
||||||
// Désactive la vérification du certificat SSL
|
|
||||||
// Cela permet d'éviter les erreurs liées au certificat, mais réduit la sécurité de la connexion.
|
|
||||||
$objMail->SMTPOptions = [
|
$objMail->SMTPOptions = [
|
||||||
'ssl' => [
|
'ssl' => [
|
||||||
'verify_peer' => false,
|
'verify_peer' => false,
|
||||||
|
|
@ -470,46 +447,37 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de modération de projet = accepté
|
* Fonction de modération de projet = accepté
|
||||||
* @author Guillaume
|
|
||||||
*/
|
*/
|
||||||
public function accept(){
|
public function accept(){
|
||||||
|
|
||||||
//Récupéré l'id dans l'url
|
|
||||||
$intId = $_GET['id'];
|
$intId = $_GET['id'];
|
||||||
|
|
||||||
//Je créer un nouveau model pour exec la commande SQL
|
|
||||||
$objProjectModel = new ProjectModel;
|
$objProjectModel = new ProjectModel;
|
||||||
$objProjectModel->accept($intId);
|
$objProjectModel->accept($intId);
|
||||||
|
|
||||||
//Redirection vers la page
|
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de modération de projet = refusé
|
* Fonction de modération de projet = refusé
|
||||||
* @author Guillaume
|
|
||||||
*/
|
*/
|
||||||
public function refuse(){
|
public function refuse(){
|
||||||
|
|
||||||
//Récupéré l'id dans l'url
|
|
||||||
$intId = $_GET['id'];
|
$intId = $_GET['id'];
|
||||||
|
|
||||||
//Je créer un nouveau model pour exec la commande SQL
|
|
||||||
$objProjectModel = new ProjectModel;
|
$objProjectModel = new ProjectModel;
|
||||||
$objProjectModel->refuse($intId);
|
$objProjectModel->refuse($intId);
|
||||||
|
|
||||||
//Redirection vers la page
|
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de suppression de projet
|
* Fonction de suppression de projet
|
||||||
* @author Guillaume
|
|
||||||
*/
|
*/
|
||||||
public function delete(){
|
public function delete(){
|
||||||
//Vérif utilisateur soit bien modérateur
|
|
||||||
if (!isset($_SESSION['user']) || $_SESSION['user']['user_status'] != 2) {
|
if (!isset($_SESSION['user']) || $_SESSION['user']['user_status'] != 2) {
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
|
|
@ -526,29 +494,25 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Redirection vers la page
|
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de changement de statut (Approuvé, Refusé, En attente)
|
* Fonction de changement de statut (Approuvé, Refusé, En attente)
|
||||||
* @author Guillaume
|
|
||||||
*/
|
*/
|
||||||
public function change_image_status() {
|
public function change_image_status() {
|
||||||
if (isset($_GET['id_img']) && isset($_GET['status'])) {
|
if (isset($_GET['id_img']) && isset($_GET['status'])) {
|
||||||
$idImg = (int)$_GET['id_img'];
|
$idImg = (int)$_GET['id_img'];
|
||||||
$status = $_GET['status']; // "en_attente" passage à "approuvé"
|
$status = $_GET['status'];
|
||||||
|
|
||||||
$objProjectModel = new ProjectModel();
|
$objProjectModel = new ProjectModel();
|
||||||
|
|
||||||
// On passe le statut texte directement à ta méthode de modèle
|
|
||||||
if ($objProjectModel->updateImageStatus($idImg, $status)) {
|
if ($objProjectModel->updateImageStatus($idImg, $status)) {
|
||||||
$_SESSION['success'] = "Le statut de l'image est désormais : " . ucfirst($status);
|
$_SESSION['success'] = "Le statut de l'image est désormais : " . ucfirst($status);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// La redirection : Si on sait d'où on vient, on y retourne, sinon index
|
|
||||||
$urlRedirect = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "index.php";
|
$urlRedirect = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : "index.php";
|
||||||
header("Location: " . $urlRedirect);
|
header("Location: " . $urlRedirect);
|
||||||
exit;
|
exit;
|
||||||
|
|
@ -557,14 +521,12 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fonction de validation de l'image de projet
|
* Fonction de validation de l'image de projet
|
||||||
* @author Guillaume
|
|
||||||
*/
|
*/
|
||||||
public function delete_image() {
|
public function delete_image() {
|
||||||
// Vérifier l'id de l'image
|
|
||||||
$idImg = $_GET['id_img'];
|
$idImg = $_GET['id_img'];
|
||||||
$objProjectModel = new ProjectModel();
|
$objProjectModel = new ProjectModel();
|
||||||
|
|
||||||
// Récupérer le nom du fichier pour le supprimer physiquement
|
|
||||||
$image = $objProjectModel->findImage($idImg);
|
$image = $objProjectModel->findImage($idImg);
|
||||||
if ($image) {
|
if ($image) {
|
||||||
$filePath = $_ENV['IMG_PROJECT_PATH'] . $image['image_name'];
|
$filePath = $_ENV['IMG_PROJECT_PATH'] . $image['image_name'];
|
||||||
|
|
@ -574,70 +536,10 @@
|
||||||
$_SESSION['success'] = "Image supprimée !";
|
$_SESSION['success'] = "Image supprimée !";
|
||||||
}
|
}
|
||||||
|
|
||||||
// La redirection : Si on sait d'où on vient, on y retourne, sinon index
|
|
||||||
$url = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : "index.php";
|
$url = (isset($_SERVER['HTTP_REFERER'])) ? $_SERVER['HTTP_REFERER'] : "index.php";
|
||||||
header("Location: " . $url);
|
header("Location: " . $url);
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction d'ajout des 20 images max du projet
|
|
||||||
* @author Guillaume
|
|
||||||
* @param string $fileName = le nom de l'image, int $projectId = L'Id du projet que l'on veut afficher, string $alt = qui affichera pars défaut "Image de projet"
|
|
||||||
* @return bool Est-ce que la requête s'est bien passée
|
|
||||||
*/
|
|
||||||
public function addImageInProject(string $fileName, int $projectId, string $alt = "Image de 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 en brute
|
|
||||||
$rqPrep->bindValue(":project", $projectId, PDO::PARAM_INT);
|
|
||||||
|
|
||||||
return $rqPrep->execute();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fonction d'affichage des 20 images max du projet
|
|
||||||
* @author Guillaume
|
|
||||||
* @param array $ProjectId L'Id du projet que l'on veut afficher
|
|
||||||
* @return bool Est-ce que la requête s'est bien passée
|
|
||||||
*/
|
|
||||||
public function getImagesByProjectId(int $projectId): array {
|
|
||||||
$strRq = "SELECT image_id, image_name, image_alt, image_status
|
|
||||||
FROM image
|
|
||||||
WHERE image_project = :id";
|
|
||||||
|
|
||||||
$rqPrep = $this->_db->prepare($strRq);
|
|
||||||
$rqPrep->bindValue(":id", $projectId, PDO::PARAM_INT);
|
|
||||||
$rqPrep->execute();
|
|
||||||
|
|
||||||
return $rqPrep->fetchAll(PDO::FETCH_ASSOC);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Page mentions légales
|
|
||||||
*/
|
|
||||||
public function mentions(){
|
|
||||||
// Afficher
|
|
||||||
$this->_display("mentions");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Page à propos
|
|
||||||
*/
|
|
||||||
public function about(){
|
|
||||||
// Afficher
|
|
||||||
$this->_display("about");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,11 @@
|
||||||
require("./models/project_model.php");
|
require("./models/project_model.php");
|
||||||
require("./entities/project_entity.php");
|
require("./entities/project_entity.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Le controller de la page d'aide utilisateur
|
||||||
|
* @author Guillaume & Besnik & Yasser
|
||||||
|
*/
|
||||||
|
|
||||||
class UserCtrl extends MotherCtrl {
|
class UserCtrl extends MotherCtrl {
|
||||||
|
|
||||||
public function login(){
|
public function login(){
|
||||||
|
|
@ -13,10 +18,8 @@ class UserCtrl extends MotherCtrl {
|
||||||
$strMail = $_POST['user_mail']??"";
|
$strMail = $_POST['user_mail']??"";
|
||||||
$strPwd = $_POST['user_password']??"";
|
$strPwd = $_POST['user_password']??"";
|
||||||
|
|
||||||
// Tester le formulaire
|
|
||||||
$arrError = [];
|
$arrError = [];
|
||||||
if (count($_POST) > 0) {
|
if (count($_POST) > 0) {
|
||||||
// Vérifier le formulaire
|
|
||||||
if ($strMail == ""){
|
if ($strMail == ""){
|
||||||
$arrError['mail'] = "Le mail est obligatoire";
|
$arrError['mail'] = "Le mail est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
@ -24,16 +27,12 @@ class UserCtrl extends MotherCtrl {
|
||||||
$arrError['pwd'] = "Le mot de passe est obligatoire";
|
$arrError['pwd'] = "Le mot de passe est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si le formulaire est rempli correctement
|
|
||||||
if (count($arrError) == 0){
|
if (count($arrError) == 0){
|
||||||
// Vérifier l'utilisateur en BDD
|
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
$arrResult = $objUserModel->verifUser($strMail, $strPwd);
|
$arrResult = $objUserModel->verifUser($strMail, $strPwd);
|
||||||
//var_dump($arrResult);
|
if ($arrResult === false){
|
||||||
if ($arrResult === false){ // Si la base de données ne renvoie rien
|
|
||||||
$arrError[] = "Mail ou mot de passe invalide";
|
$arrError[] = "Mail ou mot de passe invalide";
|
||||||
}else{
|
}else{
|
||||||
// Ajoute l'utilisateur en session
|
|
||||||
$_SESSION['user'] = $arrResult;
|
$_SESSION['user'] = $arrResult;
|
||||||
$_SESSION['success'] = "Bienvenue, vous êtes bien connecté";
|
$_SESSION['success'] = "Bienvenue, vous êtes bien connecté";
|
||||||
if (isset($_POST['remember_me'])) {
|
if (isset($_POST['remember_me'])) {
|
||||||
|
|
@ -77,39 +76,27 @@ class UserCtrl extends MotherCtrl {
|
||||||
/**
|
/**
|
||||||
* Fonction d'inscription d'un utilisateur
|
* Fonction d'inscription d'un utilisateur
|
||||||
* Effectue les validations du formulaire,
|
* Effectue les validations du formulaire,
|
||||||
* vérifie l'unicité du mail et du pseudo,
|
* vérifie l'unicité du mail et du pseudo, puis insère l'utilisateur en base de données
|
||||||
* puis insère l'utilisateur en base de données
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function signup(){
|
public function signup(){
|
||||||
|
|
||||||
// Entité pour réafficher les valeurs dans le formulaire
|
|
||||||
$objUser = new User();
|
$objUser = new User();
|
||||||
|
|
||||||
// Récupération des champs
|
|
||||||
$strPwdConfirm = $_POST['pwd_confirm'] ?? "";
|
$strPwdConfirm = $_POST['pwd_confirm'] ?? "";
|
||||||
|
|
||||||
// Tableau d'erreurs
|
|
||||||
$arrError = [];
|
$arrError = [];
|
||||||
|
|
||||||
// Traitement du formulaire uniquement si POST
|
|
||||||
if (!empty($_POST)) {
|
if (!empty($_POST)) {
|
||||||
|
|
||||||
// Hydratation
|
|
||||||
$objUser->setName($_POST['user_name'] ?? "");
|
$objUser->setName($_POST['user_name'] ?? "");
|
||||||
$objUser->setFirstname($_POST['user_firstname'] ?? "");
|
$objUser->setFirstname($_POST['user_firstname'] ?? "");
|
||||||
$objUser->setMail($_POST['user_mail'] ?? "");
|
$objUser->setMail($_POST['user_mail'] ?? "");
|
||||||
$objUser->setPseudo($_POST['user_pseudo'] ?? "");
|
$objUser->setPseudo($_POST['user_pseudo'] ?? "");
|
||||||
$objUser->setPwd($_POST['user_password'] ?? "");
|
$objUser->setPwd($_POST['user_password'] ?? "");
|
||||||
|
|
||||||
// Champs optionnels : on les stocke aussi même si ils sont vides
|
|
||||||
$objUser->setPhone($_POST['user_phone'] ?? "");
|
$objUser->setPhone($_POST['user_phone'] ?? "");
|
||||||
$objUser->setWork($_POST['user_work'] ?? "");
|
$objUser->setWork($_POST['user_work'] ?? "");
|
||||||
$objUser->setLocation($_POST['user_location'] ?? "");
|
$objUser->setLocation($_POST['user_location'] ?? "");
|
||||||
$objUser->setDescription($_POST['user_description'] ?? "");
|
$objUser->setDescription($_POST['user_description'] ?? "");
|
||||||
|
|
||||||
|
|
||||||
// --- VALIDATIONS (obligatoires) ---
|
|
||||||
if (trim($objUser->getName()) === "") {
|
if (trim($objUser->getName()) === "") {
|
||||||
$arrError['user_name'] = "Le nom est obligatoire";
|
$arrError['user_name'] = "Le nom est obligatoire";
|
||||||
}
|
}
|
||||||
|
|
@ -137,21 +124,14 @@ class UserCtrl extends MotherCtrl {
|
||||||
$arrError['pwd_confirm'] = "La confirmation du mot de passe ne correspond pas";
|
$arrError['pwd_confirm'] = "La confirmation du mot de passe ne correspond pas";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si pas d'erreurs => insertion
|
|
||||||
if (count($arrError) === 0) {
|
if (count($arrError) === 0) {
|
||||||
$objUserModel = new UserModel();
|
$objUserModel = new UserModel();
|
||||||
|
|
||||||
// Vérif mail
|
|
||||||
if ($objUserModel->mailExists($objUser->getMail())) {
|
if ($objUserModel->mailExists($objUser->getMail())) {
|
||||||
$arrError['user_mail'] = "Impossible de créer le compte avec ces informations";
|
$arrError['user_mail'] = "Impossible de créer le compte avec ces informations";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Vérif pseudo
|
|
||||||
if ($objUserModel->pseudoExists($objUser->getPseudo())) {
|
if ($objUserModel->pseudoExists($objUser->getPseudo())) {
|
||||||
$arrError['user_pseudo'] = "Ce pseudo existe déjà";
|
$arrError['user_pseudo'] = "Ce pseudo existe déjà";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Si aucune erreur => insert
|
|
||||||
if (count($arrError) === 0) {
|
if (count($arrError) === 0) {
|
||||||
$boolInsert = $objUserModel->insert($objUser);
|
$boolInsert = $objUserModel->insert($objUser);
|
||||||
|
|
||||||
|
|
@ -166,37 +146,17 @@ class UserCtrl extends MotherCtrl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Affichage de la vue inscription
|
|
||||||
$this->_arrData['objUser'] = $objUser;
|
$this->_arrData['objUser'] = $objUser;
|
||||||
$this->_arrData['arrError'] = $arrError;
|
$this->_arrData['arrError'] = $arrError;
|
||||||
$this->_display("signup");
|
$this->_display("signup");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* le controlleur affichage de la page user
|
* le controlleur affichage de la page user
|
||||||
*/
|
*/
|
||||||
public function user(){
|
public function user(){
|
||||||
|
|
||||||
/**$intId = isset($_GET['id']) ? (int)$_GET['id'] : 0;
|
|
||||||
|
|
||||||
if ($intId <= 0) {
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
//affichage info utilisateur
|
|
||||||
$objUserModel = new UserModel;
|
|
||||||
$arrUserData = $objUserModel->findUserById($intId);
|
|
||||||
|
|
||||||
if ($arrUserData === false) {
|
|
||||||
header("Location: index.php");
|
|
||||||
exit;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
$strPseudo = $_GET['pseudo']??'';
|
$strPseudo = $_GET['pseudo']??'';
|
||||||
|
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
|
|
@ -209,8 +169,6 @@ class UserCtrl extends MotherCtrl {
|
||||||
|
|
||||||
$objUser = new User;
|
$objUser = new User;
|
||||||
$objUser->hydrate($arrUserData);
|
$objUser->hydrate($arrUserData);
|
||||||
|
|
||||||
//affichage projet de l'utilisateur
|
|
||||||
$objProjectModel = new ProjectModel;
|
$objProjectModel = new ProjectModel;
|
||||||
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
|
$arrProjects = $objProjectModel->findAll(0,'',$objUser->getId());
|
||||||
|
|
||||||
|
|
@ -226,12 +184,14 @@ class UserCtrl extends MotherCtrl {
|
||||||
$this->_display("user");
|
$this->_display("user");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* le controlleur de la modification d'un user
|
||||||
|
*/
|
||||||
public function edit(){
|
public function edit(){
|
||||||
if(!isset($_SESSION['user'])){
|
if(!isset($_SESSION['user'])){
|
||||||
header("Location: index.php");
|
header("Location: index.php");
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$objUserModel = new UserModel;
|
$objUserModel = new UserModel;
|
||||||
$arrError = [];
|
$arrError = [];
|
||||||
$objUser = new User;
|
$objUser = new User;
|
||||||
|
|
@ -248,7 +208,6 @@ class UserCtrl extends MotherCtrl {
|
||||||
$objUser->hydrate($_POST);
|
$objUser->hydrate($_POST);
|
||||||
$objUser->setId($_SESSION['user']['user_id']);
|
$objUser->setId($_SESSION['user']['user_id']);
|
||||||
|
|
||||||
// Vérification de l'image
|
|
||||||
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
$arrTypeAllowed = array('image/jpeg', 'image/png', 'image/webp');
|
||||||
$boolImageOk = true;
|
$boolImageOk = true;
|
||||||
|
|
||||||
|
|
@ -279,7 +238,6 @@ class UserCtrl extends MotherCtrl {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Traitement de l'image si pas d'erreur
|
|
||||||
if (count($arrError) == 0 && isset($strImageName)) {
|
if (count($arrError) == 0 && isset($strImageName)) {
|
||||||
$strDest = $_ENV['IMG_USER_PATH'] . $strImageName;
|
$strDest = $_ENV['IMG_USER_PATH'] . $strImageName;
|
||||||
$strSource = $_FILES['image']['tmp_name'];
|
$strSource = $_FILES['image']['tmp_name'];
|
||||||
|
|
|
||||||
|
|
@ -1,26 +1,50 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("mother_entity.php");
|
require_once("mother_entity.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe d'un objet Authorisation
|
||||||
|
* @author Laura
|
||||||
|
*/
|
||||||
class Authorisation extends Entity{
|
class Authorisation extends Entity{
|
||||||
|
|
||||||
private int $_id;
|
private int $_id;
|
||||||
private string $_name = '';
|
private string $_name = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* le constructeur de la table authorisation
|
||||||
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->_prefix = 'authorisation_';
|
$this->_prefix = 'authorisation_';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de l'id du statut d'un utilisateur
|
||||||
|
* @return int l'id du statut
|
||||||
|
*/
|
||||||
public function getId():int{
|
public function getId():int{
|
||||||
return $this->_id;
|
return $this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de l'id du statut d'un utilisateur
|
||||||
|
* @param int le nouvelle id du statut
|
||||||
|
*/
|
||||||
public function setId(int $id){
|
public function setId(int $id){
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de l'intitulé du statut d'un utilisateur
|
||||||
|
* @return string l'intitulé du statut
|
||||||
|
*/
|
||||||
public function getName():string{
|
public function getName():string{
|
||||||
return $this->_name;
|
return $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de l'intitulé du statut d'un utilisateur
|
||||||
|
* @return string le nouvel intitulé du statut
|
||||||
|
*/
|
||||||
public function setName(string $name){
|
public function setName(string $name){
|
||||||
$this->_name = $name;
|
$this->_name = $name;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
require_once("mother_entity.php");
|
require_once("mother_entity.php");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Classe d'un objet Projet
|
* Classe d'un objet Category
|
||||||
* @author Laura
|
* @author Laura
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Category extends Entity{
|
||||||
protected ?int $_parent = null;
|
protected ?int $_parent = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur (j'ai toujours pas compris à quoi ça sert)
|
* le constructeur de la table category
|
||||||
*/
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->_prefix = 'category_';
|
$this->_prefix = 'category_';
|
||||||
|
|
|
||||||
|
|
@ -16,8 +16,9 @@ require_once("mother_entity.php");
|
||||||
private int $_project = 0;
|
private int $_project = 0;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
//le construc habituel
|
* le constructeur de la table image
|
||||||
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->_prefix = 'image_';
|
$this->_prefix = 'image_';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ class Project extends Entity{
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructeur (logique mdrr)
|
* le constructeur de la table project
|
||||||
*/
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->_prefix = 'project_';
|
$this->_prefix = 'project_';
|
||||||
|
|
@ -31,7 +31,7 @@ class Project extends Entity{
|
||||||
// Méthode Getter et Setter
|
// Méthode Getter et Setter
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récuperation de l'id du Projet
|
* Récuperation de l'id du projet
|
||||||
* @return int l'id du projet
|
* @return int l'id du projet
|
||||||
*/
|
*/
|
||||||
public function getId():?int{
|
public function getId():?int{
|
||||||
|
|
@ -97,16 +97,16 @@ class Project extends Entity{
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Récuperation du contenue
|
* Récuperation du contenu
|
||||||
* @return string contenue du projet
|
* @return string contenu du projet
|
||||||
*/
|
*/
|
||||||
public function getContent(){
|
public function getContent(){
|
||||||
return $this->_content;
|
return $this->_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mise à jour du contenue
|
* Mise à jour du contenu
|
||||||
* @param string le nouveau contenue
|
* @param string le nouveau contenu
|
||||||
*/
|
*/
|
||||||
public function setContent($content){
|
public function setContent($content){
|
||||||
$this->_content = $content;
|
$this->_content = $content;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
<?php
|
<?php
|
||||||
require_once("mother_entity.php");
|
require_once("mother_entity.php");
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Classe d'un objet User
|
||||||
|
* @author Besnik & Laura
|
||||||
|
*/
|
||||||
class User extends Entity{
|
class User extends Entity{
|
||||||
private int $_id;
|
private int $_id;
|
||||||
private string $_name = '';
|
private string $_name = '';
|
||||||
|
|
@ -17,107 +21,241 @@
|
||||||
private string $_account_creation = '';
|
private string $_account_creation = '';
|
||||||
private int $_status;
|
private int $_status;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* le constructeur de la table user
|
||||||
|
*/
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
$this->_prefix = 'user_';
|
$this->_prefix = 'user_';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de l'id d'un utilisateur
|
||||||
|
* @return int l'id de l'utilisateur
|
||||||
|
*/
|
||||||
public function getId():int{
|
public function getId():int{
|
||||||
return $this->_id;
|
return $this->_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de l'id d'un utilisateur
|
||||||
|
* @param int le nouvelle id de l'utilisateur
|
||||||
|
*/
|
||||||
public function setId(int $id){
|
public function setId(int $id){
|
||||||
$this->_id = $id;
|
$this->_id = $id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du nom d'un utilisateur
|
||||||
|
* @return string le nom de l'utilisateur
|
||||||
|
*/
|
||||||
public function getName():string{
|
public function getName():string{
|
||||||
return $this->_name;
|
return $this->_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du nom d'un utilisateur
|
||||||
|
* @return string le nouveau nom de l'utilisateur
|
||||||
|
*/
|
||||||
public function setName(string $name){
|
public function setName(string $name){
|
||||||
$this->_name = $name;
|
$this->_name = $name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du prénom d'un utilisateur
|
||||||
|
* @return string le prénom de l'utilisateur
|
||||||
|
*/
|
||||||
public function getFirstname():string{
|
public function getFirstname():string{
|
||||||
return $this->_firstname;
|
return $this->_firstname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du prénom d'un utilisateur
|
||||||
|
* @return string le nouveau prénom de l'utilisateur
|
||||||
|
*/
|
||||||
public function setFirstname(string $firstname){
|
public function setFirstname(string $firstname){
|
||||||
$this->_firstname = $firstname;
|
$this->_firstname = $firstname;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du pseudo unique d'un utilisateur
|
||||||
|
* @return string le pseudo de l'utilisateur
|
||||||
|
*/
|
||||||
public function getPseudo():string{
|
public function getPseudo():string{
|
||||||
return $this->_pseudo;
|
return $this->_pseudo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du pseudo unique d'un utilisateur
|
||||||
|
* @return string le nouveau pseudo de l'utilisateur
|
||||||
|
*/
|
||||||
public function setPseudo(string $pseudo){
|
public function setPseudo(string $pseudo){
|
||||||
$this->_pseudo = $pseudo;
|
$this->_pseudo = $pseudo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du nom de l'image d'un utilisateur
|
||||||
|
* @return string du nom de l'image de l'utilisateur
|
||||||
|
*/
|
||||||
public function getImage():?string{
|
public function getImage():?string{
|
||||||
return $this->_image;
|
return $this->_image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du nom de l'image d'un utilisateur
|
||||||
|
* @return string le nouveau nom de l'image de l'utilisateur
|
||||||
|
*/
|
||||||
public function setImage(?string $image){
|
public function setImage(?string $image){
|
||||||
$this->_image = $image;
|
$this->_image = $image;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de l'email d'un utilisateur
|
||||||
|
* @return string l'email de l'utilisateur
|
||||||
|
*/
|
||||||
public function getMail():string{
|
public function getMail():string{
|
||||||
return $this->_mail;
|
return $this->_mail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de l'email d'un utilisateur
|
||||||
|
* @return string le nouvel email de l'utilisateur
|
||||||
|
*/
|
||||||
public function setMail(string $mail){
|
public function setMail(string $mail){
|
||||||
$this->_mail = strtolower($mail);
|
$this->_mail = strtolower($mail);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du mot de passe d'un utilisateur
|
||||||
|
* @return string le mot de passe de l'utilisateur
|
||||||
|
*/
|
||||||
public function getPwd():string{
|
public function getPwd():string{
|
||||||
return $this->_pwd;
|
return $this->_pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du mot de passe haché d'un utilisateur
|
||||||
|
* @return string le mot de passe haché de l'utilisateur
|
||||||
|
*/
|
||||||
public function getPwdHash():string{
|
public function getPwdHash():string{
|
||||||
return password_hash($this->_pwd, PASSWORD_DEFAULT);
|
return password_hash($this->_pwd, PASSWORD_DEFAULT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du mot de passe d'un utilisateur
|
||||||
|
* @return string le nouveau mot de passe de l'utilisateur
|
||||||
|
*/
|
||||||
public function setPwd(string $pwd){
|
public function setPwd(string $pwd){
|
||||||
$this->_pwd = $pwd;
|
$this->_pwd = $pwd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation du numéro de téléphone d'un utilisateur
|
||||||
|
* @return string le numéro de téléphone de l'utilisateur
|
||||||
|
*/
|
||||||
public function getPhone():string{
|
public function getPhone():string{
|
||||||
return $this->_phone;
|
return $this->_phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour du numéro de téléphone d'un utilisateur
|
||||||
|
* @return string le nouveau numéro de téléphone de l'utilisateur
|
||||||
|
*/
|
||||||
public function setPhone(string $phone){
|
public function setPhone(string $phone){
|
||||||
$this->_phone = $phone;
|
$this->_phone = $phone;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de la profession d'un utilisateur
|
||||||
|
* @return string la profession de l'utilisateur
|
||||||
|
*/
|
||||||
public function getWork():string{
|
public function getWork():string{
|
||||||
return $this->_work;
|
return $this->_work;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de la profession d'un utilisateur
|
||||||
|
* @return string la nouvelle profession de l'utilisateur
|
||||||
|
*/
|
||||||
public function setWork(string $work){
|
public function setWork(string $work){
|
||||||
$this->_work = $work;
|
$this->_work = $work;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de la date de naissance d'un utilisateur
|
||||||
|
* @return string la date de naissance de l'utilisateur
|
||||||
|
*/
|
||||||
public function getBirth():?string{
|
public function getBirth():?string{
|
||||||
return $this->_birth;
|
return $this->_birth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de la date de naissance d'un utilisateur
|
||||||
|
* @return string la nouvelle date de naissance de l'utilisateur
|
||||||
|
*/
|
||||||
public function setBirth(?string $birth){
|
public function setBirth(?string $birth){
|
||||||
$this->_birth = $birth;
|
$this->_birth = $birth;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de la localisation d'un utilisateur
|
||||||
|
* @return string la localisation de l'utilisateur
|
||||||
|
*/
|
||||||
public function getLocation():string{
|
public function getLocation():string{
|
||||||
return $this->_location;
|
return $this->_location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de la localisation d'un utilisateur
|
||||||
|
* @return string la nouvelle localisation de l'utilisateur
|
||||||
|
*/
|
||||||
public function setLocation(string $location){
|
public function setLocation(string $location){
|
||||||
$this->_location = $location;
|
$this->_location = $location;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de la description d'un utilisateur
|
||||||
|
* @return string la description de l'utilisateur
|
||||||
|
*/
|
||||||
public function getDescription():string{
|
public function getDescription():string{
|
||||||
return $this->_description;
|
return $this->_description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de la description d'un utilisateur
|
||||||
|
* @return string la nouvelle description de l'utilisateur
|
||||||
|
*/
|
||||||
public function setDescription(string $description){
|
public function setDescription(string $description){
|
||||||
$this->_description = $description;
|
$this->_description = $description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de la date de création d'un utilisateur
|
||||||
|
* @return string la date de création de l'utilisateur
|
||||||
|
*/
|
||||||
public function getAccountCreation():string{
|
public function getAccountCreation():string{
|
||||||
return $this->_account_creation;
|
return $this->_account_creation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de la date de création d'un utilisateur
|
||||||
|
* @return string la nouvelle date de création de l'utilisateur
|
||||||
|
*/
|
||||||
public function setAccountCreation(string $account_creation){
|
public function setAccountCreation(string $account_creation){
|
||||||
$this->_account_creation = $account_creation;
|
$this->_account_creation = $account_creation;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Récuperation de l'id du statut d'un utilisateur
|
||||||
|
* @return int l'id du statut de l'utilisateur
|
||||||
|
*/
|
||||||
public function getStatus():int{
|
public function getStatus():int{
|
||||||
return $this->_status;
|
return $this->_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Mise à jour de l'id du statut d'un utilisateur
|
||||||
|
* @return int le nouvel id du statut de l'utilisateur
|
||||||
|
*/
|
||||||
public function setStatus(int $status){
|
public function setStatus(int $status){
|
||||||
$this->_status = $status;
|
$this->_status = $status;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,32 +5,16 @@
|
||||||
|
|
||||||
public function __construct(){
|
public function __construct(){
|
||||||
try{
|
try{
|
||||||
// Connexion à la base de données
|
|
||||||
$this->_db = new PDO(
|
$this->_db = new PDO(
|
||||||
"mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD "mysql:host=localhost;dbname=projet_folliow",
|
"mysql:host=boulayoune.com;dbname=projet_folliow",
|
||||||
"projet_user", //Nom d'utilisateur de la base de données root
|
"projet_user",
|
||||||
"F0lliowRules!",// Mot de passe de la base de données
|
"F0lliowRules!",
|
||||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi
|
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
|
||||||
);
|
);
|
||||||
// Pour résoudre les problèmes d’encodage
|
|
||||||
$this->_db->exec("SET CHARACTER SET utf8");
|
$this->_db->exec("SET CHARACTER SET utf8");
|
||||||
// Configuration des exceptions
|
|
||||||
$this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
$this->_db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||||
} catch(PDOException$e) {
|
} catch(PDOException$e) {
|
||||||
echo "Échec : " . $e->getMessage();
|
echo "Échec : " . $e->getMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
*Pour passer sur le serveur de YASS:
|
|
||||||
*"mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD
|
|
||||||
"projet_user", //Nom d'utilisateur de la base de données
|
|
||||||
"F0lliowRules!",// Mot de passe de la base de données
|
|
||||||
Site pour BDD: https://phpmyadmin.boulayoune.com/index.php?route=/sql&pos=0&db=projet_folliow&table=project
|
|
||||||
|
|
||||||
*Pour passer en local:
|
|
||||||
*"mysql:host=localhost;dbname=projet_folliow", // Serveur et BDD
|
|
||||||
*"root", //Nom d'utilisateur de la base de données
|
|
||||||
*"",// Mot de passe de la base de données
|
|
||||||
*/
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traitement des requêtes pour les projets
|
* Traitement des requêtes pour les projets
|
||||||
* @author : Laura
|
* @author Laura & Guillaume
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class ProjectModel extends Connect{
|
class ProjectModel extends Connect{
|
||||||
|
|
@ -30,7 +30,6 @@
|
||||||
|
|
||||||
$strAnd = " AND ";
|
$strAnd = " AND ";
|
||||||
|
|
||||||
// Recherche par mot clé avec quote pour éviter bug du '
|
|
||||||
if ($strKeywords != '') {
|
if ($strKeywords != '') {
|
||||||
|
|
||||||
$strSafeKeywords = $this->_db->quote("%" . $strKeywords . "%");
|
$strSafeKeywords = $this->_db->quote("%" . $strKeywords . "%");
|
||||||
|
|
@ -40,23 +39,16 @@
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recherche par auteur
|
|
||||||
if ($intAuthor > 0){
|
if ($intAuthor > 0){
|
||||||
$strRq .= $strAnd." user_id = ".$intAuthor;
|
$strRq .= $strAnd." user_id = ".$intAuthor;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recherche par catégorie
|
|
||||||
if ($intCategory > 0){
|
if ($intCategory > 0){
|
||||||
$strRq .= $strAnd." project_category = ".$intCategory;
|
$strRq .= $strAnd." project_category = ".$intCategory;
|
||||||
}
|
}
|
||||||
|
|
||||||
//recherche par ancienneté
|
|
||||||
if ($boolOlderThan6Months === true) {
|
if ($boolOlderThan6Months === true) {
|
||||||
$strRq .= $strAnd . " project_creation_date <= DATE_SUB(NOW(), INTERVAL 6 MONTH) ";
|
$strRq .= $strAnd . " project_creation_date <= DATE_SUB(NOW(), INTERVAL 6 MONTH) ";
|
||||||
}
|
}
|
||||||
|
|
||||||
// Recherche par dates
|
|
||||||
if ($intPeriod == 0){
|
if ($intPeriod == 0){
|
||||||
if ($strDate != ''){
|
if ($strDate != ''){
|
||||||
$strRq .= $strAnd." project_creation_date = '".$strDate."'";
|
$strRq .= $strAnd." project_creation_date = '".$strDate."'";
|
||||||
|
|
@ -103,12 +95,9 @@
|
||||||
$rqPrep->bindValue(":project_user_id", $objProject->getUser_id(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":project_user_id", $objProject->getUser_id(), PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":project_category", $objProject->getCategory(), PDO::PARAM_STR);
|
$rqPrep->bindValue(":project_category", $objProject->getCategory(), PDO::PARAM_STR);
|
||||||
|
|
||||||
// On met une variable boolOk pour récupérer l'id du projet
|
|
||||||
$boolOk = $rqPrep->execute();
|
$boolOk = $rqPrep->execute();
|
||||||
|
|
||||||
// Si boolOk est remplis
|
|
||||||
if ($boolOk) {
|
if ($boolOk) {
|
||||||
// On récupère l'ID auto-incrémenté et on l'injecte dans l'objet
|
|
||||||
$objProject->setId($this->_db->lastInsertId());
|
$objProject->setId($this->_db->lastInsertId());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,11 +280,10 @@
|
||||||
|
|
||||||
$rqPrep->bindValue(":name", $fileName, PDO::PARAM_STR);
|
$rqPrep->bindValue(":name", $fileName, PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":alt", $alt, PDO::PARAM_STR);
|
$rqPrep->bindValue(":alt", $alt, PDO::PARAM_STR);
|
||||||
// On met le statut par défaut en "en_attente" pour la modération
|
|
||||||
$rqPrep->bindValue(":status", "en_attente", PDO::PARAM_STR);
|
$rqPrep->bindValue(":status", "en_attente", PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":project", $projectId, PDO::PARAM_INT);
|
$rqPrep->bindValue(":project", $projectId, PDO::PARAM_INT);
|
||||||
|
|
||||||
return $rqPrep->execute();
|
return $rqPrep->execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Traitement des requêtes pour les utilisateurs
|
* Traitement des requêtes pour les utilisateurs
|
||||||
* @author : meilleurGroup
|
* @author : Yasser, Guillaume & Besnik
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class UserModel extends Connect{
|
class UserModel extends Connect{
|
||||||
|
|
@ -76,7 +76,6 @@
|
||||||
$rqPrep->bindValue(":id", $userId, PDO::PARAM_INT);
|
$rqPrep->bindValue(":id", $userId, PDO::PARAM_INT);
|
||||||
$rqPrep->bindValue(":token", $token, PDO::PARAM_STR);
|
$rqPrep->bindValue(":token", $token, PDO::PARAM_STR);
|
||||||
$rqPrep->bindValue(":exp",
|
$rqPrep->bindValue(":exp",
|
||||||
//pour faire que le cookies soit valable 15 jours
|
|
||||||
date('Y-m-d H:i:s', time() + (15*24*60*60))
|
date('Y-m-d H:i:s', time() + (15*24*60*60))
|
||||||
, PDO::PARAM_STR);
|
, PDO::PARAM_STR);
|
||||||
return $rqPrep->execute();
|
return $rqPrep->execute();
|
||||||
|
|
|
||||||
|
|
@ -12,17 +12,14 @@
|
||||||
<body class="d-flex flex-column min-vh-100">
|
<body class="d-flex flex-column min-vh-100">
|
||||||
<nav class="navbar navbar-expand-lg navbar-light">
|
<nav class="navbar navbar-expand-lg navbar-light">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
{* Logo *}
|
|
||||||
<a class="navbar-brand d-flex align-items-center" href="index.php">
|
<a class="navbar-brand d-flex align-items-center" href="index.php">
|
||||||
<img src="assests/img/logo.png" alt="Logo" class="logo-image">
|
<img src="assests/img/logo.png" alt="Logo" class="logo-image">
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
{* Toggler pour mobile *}
|
|
||||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{* Menu de navigation *}
|
|
||||||
<div class="collapse navbar-collapse" id="navbarNav">
|
<div class="collapse navbar-collapse" id="navbarNav">
|
||||||
<ul class="navbar-nav me-auto">
|
<ul class="navbar-nav me-auto">
|
||||||
|
|
||||||
|
|
@ -45,10 +42,8 @@
|
||||||
{/if}
|
{/if}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
{* Menu secondaire *}
|
|
||||||
<nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
|
<nav class="col-4 d-flex justify-content-end align-items-center" aria-label="Connexion utilisateur">
|
||||||
{if !isset($smarty.session.user)}
|
{if !isset($smarty.session.user)}
|
||||||
{* Utilisateur non connecté *}
|
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?ctrl=user&action=signup" title="Créer un compte" aria-label="Créer un compte">
|
<a class="nav-link" href="index.php?ctrl=user&action=signup" title="Créer un compte" aria-label="Créer un compte">
|
||||||
|
|
@ -62,7 +57,6 @@
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
{else}
|
{else}
|
||||||
{* Utilisateur connecté *}
|
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.php?ctrl=user&action=user&pseudo={$smarty.session.user.user_pseudo}" title="Modifier mon compte" aria-label="Modifier mon compte">
|
<a class="nav-link" href="index.php?ctrl=user&action=user&pseudo={$smarty.session.user.user_pseudo}" title="Modifier mon compte" aria-label="Modifier mon compte">
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
<article class="col-md-3 mb-5 {if isset($smarty.session.user) and $smarty.session.user.user_status == 2} pb-5 {/if}" style="border-radius: 100px ;">
|
<article class="col-md-3 mb-5 {if isset($smarty.session.user) and $smarty.session.user.user_status == 2} pb-5 {/if}" 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;">
|
||||||
|
|
||||||
{* IMAGE (partie supérieure - plus grande) *}
|
|
||||||
<div class="ratio ratio-4x3">
|
<div class="ratio ratio-4x3">
|
||||||
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"></a>
|
<a href="index.php?ctrl=project&action=display&id={$objProject->getId()}"></a>
|
||||||
<img src="{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
|
<img src="{$smarty.env.IMG_PROJECT_PATH}{$objProject->getThumbnail()}"
|
||||||
|
|
@ -11,17 +11,15 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* CONTENU (photo profil + infos) *}
|
|
||||||
<div class="card-body p-3 bg-light">
|
<div class="card-body p-3 bg-light">
|
||||||
<div class="d-flex align-items-start gap-3">
|
<div class="d-flex align-items-start gap-3">
|
||||||
{* PHOTO DE PROFIL (cercle à gauche - plus grand) *}
|
|
||||||
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}">
|
<a href="index.php?ctrl=user&action=user&id={$objProject->getUser_id()}">
|
||||||
<img src="{$smarty.env.IMG_USER_PATH}{$objProject->getUser_image() ?? "images.jpg"}"
|
<img src="{$smarty.env.IMG_USER_PATH}{$objProject->getUser_image() ?? "images.jpg"}"
|
||||||
class="rounded-circle flex-shrink-0 border border-2 border-white"
|
class="rounded-circle flex-shrink-0 border border-2 border-white"
|
||||||
style="width: 64px; height: 64px; object-fit: cover; margin-top: 8px;"
|
style="width: 64px; height: 64px; object-fit: cover; margin-top: 8px;"
|
||||||
alt="Photo de profil">
|
alt="Photo de profil">
|
||||||
</a>
|
</a>
|
||||||
{* INFOS À DROITE *}
|
|
||||||
<div class="flex-grow-1">
|
<div class="flex-grow-1">
|
||||||
<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">
|
||||||
|
|
@ -61,7 +59,6 @@
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* BOUTONS EN BAS *}
|
|
||||||
{if isset($smarty.session.user)
|
{if isset($smarty.session.user)
|
||||||
and $smarty.session.user.user_status == 2
|
and $smarty.session.user.user_status == 2
|
||||||
and $objProject->getStatus() == "en_attente"}
|
and $objProject->getStatus() == "en_attente"}
|
||||||
|
|
|
||||||
|
|
@ -9,8 +9,6 @@
|
||||||
|
|
||||||
<section aria-label="À propos de FOLLIOW">
|
<section aria-label="À propos de FOLLIOW">
|
||||||
<div class="row g-5">
|
<div class="row g-5">
|
||||||
|
|
||||||
<!-- Présentation principale -->
|
|
||||||
<div class="col-lg-8">
|
<div class="col-lg-8">
|
||||||
|
|
||||||
<section aria-labelledby="presentation">
|
<section aria-labelledby="presentation">
|
||||||
|
|
|
||||||
|
|
@ -60,12 +60,10 @@
|
||||||
<div class="alert alert-warning p-2">
|
<div class="alert alert-warning p-2">
|
||||||
<i class="fas fa-exclamation-triangle"></i> Quota de 20 photos atteint.
|
<i class="fas fa-exclamation-triangle"></i> Quota de 20 photos atteint.
|
||||||
</div>
|
</div>
|
||||||
{* On désactive l'input si le quota est plein *}
|
|
||||||
<input type="file" disabled class="form-control">
|
<input type="file" disabled class="form-control">
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{* Affichage de Images du projet (s'il y en a)*}
|
|
||||||
<div class="row mt-4">
|
<div class="row mt-4">
|
||||||
<label class="h5">Galerie du projet</label>
|
<label class="h5">Galerie du projet</label>
|
||||||
{foreach $arrImages as $image}
|
{foreach $arrImages as $image}
|
||||||
|
|
@ -78,7 +76,6 @@
|
||||||
|
|
||||||
<div class="card-body p-2">
|
<div class="card-body p-2">
|
||||||
<span class="badge {if $image.image_status == 'approuvé'}bg-success{elseif $image.image_status == 'refusé'}bg-danger{else}bg-warning text-dark{/if}">
|
<span class="badge {if $image.image_status == 'approuvé'}bg-success{elseif $image.image_status == 'refusé'}bg-danger{else}bg-warning text-dark{/if}">
|
||||||
{*Permet de remplacer certains character par d'autre*}
|
|
||||||
{$image.image_status|replace:'_':' '}
|
{$image.image_status|replace:'_':' '}
|
||||||
</span>
|
</span>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@
|
||||||
<input type="text" class="form-control" id="floatingInput" name="new_name">
|
<input type="text" class="form-control" id="floatingInput" name="new_name">
|
||||||
<label for="floatingInput">Nouveau nom de la catégorie</label>
|
<label for="floatingInput">Nouveau nom de la catégorie</label>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
|
<button type="submit" class="btn bg-success text-light">Valider</button>
|
||||||
</form>
|
</form>
|
||||||
<div>
|
<div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -75,7 +75,7 @@
|
||||||
<label for="floatingInput">Nom de la nouvelle catégorie</label>
|
<label for="floatingInput">Nom de la nouvelle catégorie</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
<button type="submit" class="btn bg-success text-light rounded-circle"> ✓</button>
|
<button type="submit" class="btn bg-success text-light">Valider</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,12 @@
|
||||||
{extends file="views/layout.tpl"}
|
{extends file="views/layout.tpl"}
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
<!-- Page : Inscription -->
|
|
||||||
|
|
||||||
|
|
||||||
<main class="container py-5">
|
<main class="container py-5">
|
||||||
|
|
||||||
<!-- Centrage horizontal du formulaire -->
|
|
||||||
<div class="row justify-content-center position-relative">
|
<div class="row justify-content-center position-relative">
|
||||||
<div class="col-12 col-md-10 col-lg-6">
|
<div class="col-12 col-md-10 col-lg-6">
|
||||||
|
|
||||||
<!-- Carte contenant le formulaire d'inscription -->
|
|
||||||
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
<div class="card shadow-sm border-0 rounded-4 p-4 p-lg-5">
|
||||||
|
|
||||||
<!-- Titre principal de la page -->
|
|
||||||
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
<h1 class="h3 fw-bold mb-1">Inscription</h1>
|
||||||
|
<p class="text-secondary mb-4">Créez votre compte utilisateur.</p>
|
||||||
<!-- Texte descriptif -->
|
|
||||||
<p class="text-secondary mb-4">
|
|
||||||
Créez votre compte utilisateur.
|
|
||||||
</p>
|
|
||||||
{if (isset($arrError) && count($arrError) > 0) }
|
{if (isset($arrError) && count($arrError) > 0) }
|
||||||
<div class="alert alert-danger">
|
<div class="alert alert-danger">
|
||||||
{foreach $arrError as $strError}
|
{foreach $arrError as $strError}
|
||||||
|
|
@ -27,13 +14,9 @@
|
||||||
{/foreach}
|
{/foreach}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<!-- Formulaire d'inscription -->
|
|
||||||
<!-- Les données seront traitées côté serveur en PHP via la méthode POST -->
|
|
||||||
<form method="POST">
|
<form method="POST">
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
|
|
||||||
<!-- Champ : prénom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label" for="user_firstname">
|
<label class="form-label" for="user_firstname">
|
||||||
Prénom *
|
Prénom *
|
||||||
|
|
@ -45,8 +28,6 @@
|
||||||
name="user_firstname"
|
name="user_firstname"
|
||||||
required >
|
required >
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Champ : nom de l'utilisateur -->
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label class="form-label" for="user_name">
|
<label class="form-label" for="user_name">
|
||||||
Nom *
|
Nom *
|
||||||
|
|
@ -56,11 +37,8 @@
|
||||||
type="text"
|
type="text"
|
||||||
id="user_name"
|
id="user_name"
|
||||||
name="user_name"
|
name="user_name"
|
||||||
required
|
required>
|
||||||
>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Champ : pseudo -->
|
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<label class="form-label" for="user_pseudo">
|
<label class="form-label" for="user_pseudo">
|
||||||
Pseudo *
|
Pseudo *
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,32 @@
|
||||||
{block name="title" append} - Rechercher{/block}
|
{block name="title" append} - Rechercher{/block}
|
||||||
|
|
||||||
{block name="h2"}Rechercher{/block}
|
{block name="h2"}Rechercher{/block}
|
||||||
{block name="p"}Recherche de portfolios par mot clés, date, auteur et catégorie.{/block}
|
{block name="p"}Recherche de projets par mot clés, date, auteur et catégorie.{/block}
|
||||||
|
|
||||||
|
|
||||||
{block name="content"}
|
{block name="content"}
|
||||||
<section aria-label="Blog">
|
<section aria-label="Blog">
|
||||||
<h2 class="visually-hidden">Rechercher parmi les articles</h2>
|
<h2 class="visually-hidden">Rechercher parmi les projets</h2>
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<section class="mb-5" aria-labelledby="search-heading">
|
<section class="mb-5" aria-labelledby="search-heading">
|
||||||
<form name="formSearch" method="post" action="?ctrl=project&action=search" class="border rounded p-4 bg-light">
|
<form name="formSearch" method="post" action="?ctrl=project&action=search" class="border rounded p-4 bg-light">
|
||||||
<h3 id="search-heading" class="h4 mb-4">
|
<h3 id="search-heading" class="h4 mb-4">
|
||||||
<i class="fas fa-search me-2" aria-hidden="true"></i>
|
<i class="fas fa-search me-2" aria-hidden="true"></i>
|
||||||
Rechercher des articles
|
Rechercher des projets
|
||||||
</h3>
|
</h3>
|
||||||
|
|
||||||
<div class="row g-3">
|
<div class="row g-3">
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="keywords" class="form-label">Mots-clés</label>
|
<label for="keywords" class="form-label">Mots-clés</label>
|
||||||
<input
|
<input
|
||||||
value=""
|
value="{$strKeywords}" type="text" class="form-control" id="keywords" name="keywords" placeholder="Design, IA, back-end" aria-describedby="keywords-help">
|
||||||
type="text"
|
|
||||||
class="form-control"
|
|
||||||
id="keywords"
|
|
||||||
name="keywords"
|
|
||||||
placeholder="Design, IA, back-end"
|
|
||||||
aria-describedby="keywords-help">
|
|
||||||
<small id="keywords-help" class="form-text text-muted">
|
<small id="keywords-help" class="form-text text-muted">
|
||||||
Recherchez dans les titres et contenus
|
Recherchez dans les titres et contenus
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-6">
|
<div class="col-md-6">
|
||||||
<label for="author" class="form-label">Auteur</label>
|
<label for="author" class="form-label">Auteurs</label>
|
||||||
<select class="form-select" id="author" name="author">
|
<select class="form-select" id="author" name="author">
|
||||||
<option value="0" {if $intAuthor == 0}selected{/if}>Tous les auteurs</option>
|
<option value="0" {if $intAuthor == 0}selected{/if}>Tous les auteurs</option>
|
||||||
{foreach $arrUser as $arrDetUser}
|
{foreach $arrUser as $arrDetUser}
|
||||||
|
|
@ -117,7 +111,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- AJOUT RECHERCHE PAR CATEGORIE -->
|
|
||||||
<div class="col-6">
|
<div class="col-6">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend class="form-label">Recherche par catégories</legend>
|
<legend class="form-label">Recherche par catégories</legend>
|
||||||
|
|
@ -150,7 +143,6 @@
|
||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<!-- Liste des articles -->
|
|
||||||
<section aria-labelledby="articles-heading">
|
<section aria-labelledby="articles-heading">
|
||||||
<h3 id="articles-heading" class="visually-hidden">Liste des projets</h3>
|
<h3 id="articles-heading" class="visually-hidden">Liste des projets</h3>
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
|
|
@ -179,7 +171,6 @@
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<script>
|
<script>
|
||||||
// Gestion de l'affichage des champs de date
|
|
||||||
const periodRadios = document.querySelectorAll('input[name="period"]');
|
const periodRadios = document.querySelectorAll('input[name="period"]');
|
||||||
const dateExact = document.getElementById('date-exact');
|
const dateExact = document.getElementById('date-exact');
|
||||||
const dateRange = document.getElementById('date-range');
|
const dateRange = document.getElementById('date-range');
|
||||||
|
|
@ -199,8 +190,6 @@
|
||||||
periodRadios.forEach(radio => {
|
periodRadios.forEach(radio => {
|
||||||
radio.addEventListener('change', toggleDateFields);
|
radio.addEventListener('change', toggleDateFields);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialisation au chargement
|
|
||||||
toggleDateFields();
|
toggleDateFields();
|
||||||
</script>
|
</script>
|
||||||
{/block}
|
{/block}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue