diff --git a/.gitignore b/.gitignore index 426c53c..600b07e 100755 --- a/.gitignore +++ b/.gitignore @@ -8,9 +8,6 @@ ehthumbs_vista.db # Dump file *.stackdump -# Folder config file -[Dd]esktop.ini - # Recycle Bin used on file shares $RECYCLE.BIN/ @@ -77,12 +74,6 @@ Temporary Items ##### GPG secring.* -##### Dropbox -# Dropbox settings and caches -.dropbox -.dropbox.attr -.dropbox.cache - ##### SynopsysVCS # Waveform formats *.vcd @@ -165,23 +156,11 @@ Sessionx.vim # Temporary .netrwhist -*~ # Auto-generated tag files tags # Persistent undo [._]*.un~ -##### Emacs -# -*- mode: gitignore; -*- -*~ -\#*\# -/.emacs.desktop -/.emacs.desktop.lock -*.elc -auto-save-list -tramp -.\#* - # Org-mode .org-id-locations *_archive @@ -254,10 +233,6 @@ bh_unicode_properties.cache # https://packagecontrol.io/packages/sublime-github GitHub.sublime-settings -##### Notepad++ -# Notepad++ backups # -*.bak - ##### TextMate *.tmproj *.tmproject @@ -280,7 +255,6 @@ tmtags **/nbproject/Package-*.bash build/ nbbuild/ -dist/ nbdist/ .nb-gradle/ @@ -289,27 +263,27 @@ nbdist/ # Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 # User-specific stuff -.idea/**/workspace.xml -.idea/**/tasks.xml -.idea/**/usage.statistics.xml -.idea/**/dictionaries -.idea/**/shelf +php/.idea/**/workspace.xml +php/.idea/**/tasks.xml +php/.idea/**/usage.statistics.xml +php/.idea/**/dictionaries +php/.idea/**/shelf # Generated files -.idea/**/contentModel.xml +php/.idea/**/contentModel.xml # Sensitive or high-churn files -.idea/**/dataSources/ -.idea/**/dataSources.ids -.idea/**/dataSources.local.xml -.idea/**/sqlDataSources.xml -.idea/**/dynamic.xml -.idea/**/uiDesigner.xml -.idea/**/dbnavigator.xml +php/.idea/**/dataSources/ +php/.idea/**/dataSources.ids +php/.idea/**/dataSources.local.xml +php/.idea/**/sqlDataSources.xml +php/.idea/**/dynamic.xml +php/.idea/**/uiDesigner.xml +php/.idea/**/dbnavigator.xml # Gradle -.idea/**/gradle.xml -.idea/**/libraries +php/.idea/**/gradle.xml +php/.idea/**/libraries # Gradle and Maven with auto-import # When using Gradle or Maven with auto-import, you should exclude module files, @@ -328,7 +302,7 @@ nbdist/ cmake-build-*/ # Mongo Explorer plugin -.idea/**/mongoSettings.xml +php/.idea/**/mongoSettings.xml # File-based project format *.iws @@ -343,7 +317,7 @@ out/ atlassian-ide-plugin.xml # Cursive Clojure plugin -.idea/replstate.xml +php/.idea/replstate.xml # Crashlytics plugin (for Android Studio and IntelliJ) com_crashlytics_export_strings.xml @@ -352,17 +326,15 @@ crashlytics-build.properties fabric.properties # Editor-based Rest Client -.idea/httpRequests +php/.idea/httpRequests # Android studio 3.1+ serialized cache file -.idea/caches/build_file_checksums.ser +php/.idea/caches/build_file_checksums.ser ##### Eclipse .metadata bin/ tmp/ -*.tmp -*.bak *.swp *~.nib local.properties @@ -376,12 +348,6 @@ local.properties # Locally stored "Eclipse launch configurations" *.launch -# PyDev specific (Python IDE for Eclipse) -*.pydevproject - -# CDT-specific (C/C++ Development Tooling) -.cproject - # CDT- autotools .autotools @@ -410,11 +376,6 @@ local.properties .apt_generated/ .apt_generated_test/ -# Scala IDE specific (Scala & Java development for Eclipse) -.cache-main -.scala_dependencies -.worksheet - # Uncomment this line if you wish to ignore the project description file. # Typically, this file would be tracked if it contains build/dependency configurations: #.project @@ -452,12 +413,13 @@ gradle-app.setting # gradle/wrapper/gradle-wrapper.properties ##### Composer -composer.phar -/vendor/ +php/composer.phar +php/composer +php/vendor/ # Commit your application's lock file https://getcomposer.org/doc/01-basic-usage.md#commit-your-composer-lock-file-to-version-control # You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file -composer.lock +php/composer.lock ##### PHP CodeSniffer # gitignore for the PHP Codesniffer framework diff --git a/.idea/sqldialects.xml b/.idea/sqldialects.xml new file mode 100644 index 0000000..95a9d20 --- /dev/null +++ b/.idea/sqldialects.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/README.md b/README.md index a51568b..e69de29 100755 --- a/README.md +++ b/README.md @@ -1 +0,0 @@ -dqzdqd \ No newline at end of file diff --git a/dbAlica-3.sql b/dbAlica-3.sql new file mode 100644 index 0000000..5bad779 --- /dev/null +++ b/dbAlica-3.sql @@ -0,0 +1,372 @@ +-- phpMyAdmin SQL Dump +-- version 5.2.0 +-- https://www.phpmyadmin.net/ +-- +-- Hôte : localhost:8889 +-- Généré le : lun. 20 nov. 2023 à 20:05 +-- Version du serveur : 5.7.39 +-- Version de PHP : 8.2.0 + +SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; +START TRANSACTION; +SET time_zone = "+00:00"; + + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; + +-- +-- Base de données : `dbAlica` +-- + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Alumni` +-- + +CREATE TABLE `Alumni` ( + `id` int(11) NOT NULL, + `mail` varchar(128) NOT NULL, + `mdp` varchar(256) NOT NULL, + `role` varchar(16) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Déchargement des données de la table `Alumni` +-- + +INSERT INTO `Alumni` (`id`, `mail`, `mdp`, `role`) VALUES +(1, 'test', 'test', 'admin'), +(4, 'Admin@alica.com', '$2y$10$f2z.qWTtGhp.nZo0zBlw8Og9GpcQYcBOTIfqAj3UP2MEiN5uXS1Ue', 'Admin'), +(5, 'john@doe', '$2y$10$oOMH01Zxkz4yQPVs44fkHODMc78m8eeIOaSMF84K1w4ikPyUAiwwy', 'Membre'), +(6, 'jack@doe', '$2y$10$sFeUX9.evOansuqwj4nFuOLy9n3j6tkAFHmsL1kTDuUxhgF6WZRZy', 'Membre'), +(7, 'test@gmail.com', '$2y$10$41F6OQz9V1cr2D1rYX9np.5fTKe68dYrJlLpZf7t5G9c8g2mgOF9K', 'Membre'), +(8, 'admin@test', '$2y$10$mHKhDhpN7.Z1UyvE3..ZIuGPbjtmUa9QDhmuQyU1h68d/2z25DUDK', 'Admin'), +(9, 'membre@test', '$2y$10$hVS.BcHq.b/oneN0KiJI3u6CXGeb2UXRw5mJtvZByJG1./mIG4QbK', 'Membre'), +(10, 'test@e', '$2y$10$K3LBNsukXWvBqsbEid5Px.PnNQmomNa0tlnNvFlxDxRYdSbfOWdcK', 'Membre'), +(11, 'emma.dupont@email.com', '$2y$10$eg7ARpvdTqnpJ1tMi.AhcufFZtBQxkhnE8GF1/z4RRrTg3C1wpCsC', 'Membre'), +(12, 'lucas.martin@email.com', '$2y$10$yk7/MCHif6niCjqWrFxA2u1C69ThVb9tpduyTZtcDjnW.V.gM51Iu', 'Membre'), +(13, 'chloe.bernard@mail', '$2y$10$p0BjmKiuFbd3zBzBo6sWJ.tZi./2J7c3MZ9unCn/OkW6LBBvnC.FC', 'Membre'), +(14, 'ines.leroy@email.com', '$2y$10$QDoHq2B7m6WseAPe6kH6MuoaCREBWqChO95NxUVMrZDH1aShHD7zW', 'Membre'), +(15, 'te@te', '$2y$10$.kM.SFMvZnDEGuE8rxclc.UaJbKYesqzNNkE5VdE7NAPEwWOTS4u6', 'Membre'), +(16, 'lea.simon@email.com', '$2y$10$AckHtFDM3C.O.ACQlqh5FuVqSr3bB2.IjcPmdrrM/fYRYU6lU6OdW', 'Membre'), +(17, 'gabriel.michel@email.com', '$2y$10$bNoO9pNylyCL2hznrZ7OyO7aWVJUrZieda2uwnYo/Ly8TB7Nl7fLS', 'Membre'), +(18, 'Sarah@email', '$2y$10$50o/3cFzapPB90apopD5b.tWrRxCG0sYOni6TinI41cwHCzYFiUFO', 'Membre'), +(19, 'raphael.garcia@email.fr', '$2y$10$m2dHfABuizTRBGymKfO60eyzo13BPTSSH/EdEhXcDkauzuRuk7HR.', 'Membre'), +(20, 'Alice@a', '$2y$10$atRfojz7W0mQzv9l0IgRhOF5WWn7FjTRZtSbZkzQveYdInMsy5RrS', 'Membre'), +(21, 'maxime.pichon@email.com', '$2y$10$sA3N6D01ATFdCKqJ6fflNe484KMKejFIfaTYHGOH9AoPHOnRmSvi2', 'Membre'), +(22, 'zoe.Gauthier@gmail.com', '$2y$10$bVaPrdlcYOHcclq0OjZUTOwoLkmMXLw9Ww6OTSDnhFAujDL4nqBqG', 'Membre'); + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Article` +-- + +CREATE TABLE `Article` ( + `id` int(11) NOT NULL, + `auteur` int(11) NOT NULL, + `Titre` varchar(64) NOT NULL, + `sousTitre` varchar(64) NOT NULL, + `description` varchar(1024) NOT NULL, + `image` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Evenement` +-- + +CREATE TABLE `Evenement` ( + `id` int(11) NOT NULL, + `organisateur` int(11) NOT NULL, + `titre` varchar(64) NOT NULL, + `description` varchar(512) NOT NULL, + `image` varchar(256) NOT NULL, + `date` date NOT NULL, + `nbPlaceMax` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Déchargement des données de la table `Evenement` +-- + +INSERT INTO `Evenement` (`id`, `organisateur`, `titre`, `description`, `image`, `date`, `nbPlaceMax`) VALUES +(1, 1, 'Laser Game', 'Evement laser game avec tous les membres du réseau ALICA, vous êtes la bienvenue..', '18044Laser Game PBOB9302.jpg', '2023-11-18', 20), +(2, 1, 'Rencontre Annuelle des Anciens d\'Alica', 'Un rassemblement annuel pour tous les anciens étudiants, avec des discours inspirants, des ateliers de réseautage et un dîner de gala\r\nLieu : Centre de conférence de l\'IUT d’Aubière', '16494Bandeau CreerAsso.jpg', '2023-11-24', 30); + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Experience` +-- + +CREATE TABLE `Experience` ( + `id` int(11) NOT NULL, + `profil` int(11) NOT NULL, + `intitule` varchar(256) NOT NULL, + `dateDebut` date NOT NULL, + `dateFin` date NOT NULL, + `nomEntreprise` varchar(64) NOT NULL, + `currentJob` tinyint(1) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Formation` +-- + +CREATE TABLE `Formation` ( + `id` int(11) NOT NULL, + `profil` int(11) NOT NULL, + `nom` varchar(64) NOT NULL, + `ville` varchar(32) NOT NULL, + `dateDeb` date NOT NULL, + `dateFin` date NOT NULL, + `currentFormation` tinyint(1) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Image` +-- + +CREATE TABLE `Image` ( + `id` int(5) NOT NULL, + `nom` varchar(50) NOT NULL, + `taille` varchar(25) NOT NULL, + `type` varchar(25) NOT NULL, + `blob` longblob NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Offre` +-- + +CREATE TABLE `Offre` ( + `id` int(11) NOT NULL, + `offreur` int(11) NOT NULL, + `titre` varchar(128) NOT NULL, + `description` varchar(1024) NOT NULL, + `image` varchar(100) NOT NULL, + `logo` varchar(100) NOT NULL, + `typeContrat` varchar(16) NOT NULL, + `ville` varchar(64) NOT NULL, + `entreprise` varchar(64) NOT NULL, + `descriptifPoste` varchar(2028) NOT NULL, + `profil` varchar(2028) NOT NULL, + `experience` varchar(512) NOT NULL, + `niveauEtudes` varchar(16) NOT NULL, + `mailContact` varchar(128) NOT NULL, + `numero` varchar(12) NOT NULL, + `websiteURL` varchar(256) NOT NULL, + `remote` tinyint(1) NOT NULL, + `date` date NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Participer` +-- + +CREATE TABLE `Participer` ( + `alumni` int(11) NOT NULL, + `evenement` int(11) NOT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- -------------------------------------------------------- + +-- +-- Structure de la table `Profil` +-- + +CREATE TABLE `Profil` ( + `id` int(11) NOT NULL, + `alumni` int(11) NOT NULL, + `email` varchar(128) NOT NULL, + `cv` varchar(256) DEFAULT NULL, + `nom` varchar(64) NOT NULL, + `prenom` varchar(32) NOT NULL, + `linkedinURL` varchar(256) DEFAULT NULL, + `githubURL` varchar(256) DEFAULT NULL, + `portfolioURL` varchar(256) DEFAULT NULL, + `image` varchar(100) DEFAULT NULL +) ENGINE=InnoDB DEFAULT CHARSET=utf8; + +-- +-- Déchargement des données de la table `Profil` +-- + +INSERT INTO `Profil` (`id`, `alumni`, `email`, `cv`, `nom`, `prenom`, `linkedinURL`, `githubURL`, `portfolioURL`, `image`) VALUES +(4, 4, 'Admin@alica.com', NULL, 'TUAILLON', 'Leo', NULL, NULL, NULL, '19879.png'), +(5, 5, 'john@doe', NULL, 'Doe', 'John', NULL, NULL, NULL, '2.jpg'), +(6, 6, 'jack@doe', NULL, 'Doe', 'Jack', NULL, NULL, NULL, NULL), +(7, 7, 'test@gmail.com', NULL, 'test', 'test', NULL, NULL, NULL, NULL), +(8, 8, 'admin@test', NULL, 'Admin', 'CompteTest', NULL, NULL, NULL, '1.png'), +(9, 9, 'membre@test', NULL, 'Membre', 'compteTest', NULL, NULL, NULL, '3.jpg'), +(10, 10, 'test@e', NULL, 'nom', 'prénom', NULL, NULL, NULL, NULL), +(11, 11, 'emma.dupont@email.com', NULL, 'Dupont', 'Emma', NULL, NULL, NULL, NULL), +(12, 12, 'lucas.martin@email.com', NULL, 'Martin', 'Lucas', NULL, NULL, NULL, NULL), +(13, 13, 'chloe.bernard@mail', NULL, 'Bernard', 'Chloé', NULL, NULL, NULL, '1.png'), +(14, 14, 'ines.leroy@email.com', NULL, 'Leroy', 'Ines', NULL, NULL, NULL, NULL), +(15, 15, 'te@te', NULL, 'Moreau', 'Alexandre', NULL, NULL, NULL, NULL), +(16, 16, 'lea.simon@email.com', NULL, 'Simon', 'Léa', NULL, NULL, NULL, '3.jpg'), +(17, 17, 'gabriel.michel@email.com', NULL, 'Michel', 'Gabriel', NULL, NULL, NULL, NULL), +(18, 18, 'Sarah@email', NULL, 'Lefevre', 'Sarah', NULL, NULL, NULL, NULL), +(19, 19, 'raphael.garcia@email.fr', NULL, 'Garcia', 'Raphaël', NULL, NULL, NULL, NULL), +(20, 20, 'Alice@a', NULL, 'Alice', 'Alice', NULL, NULL, NULL, '2.jpg'), +(21, 21, 'maxime.pichon@email.com', NULL, 'Pichon', 'Maxime', NULL, NULL, NULL, NULL), +(22, 22, 'zoe.Gauthier@gmail.com', NULL, 'Gauthier', 'zoé', NULL, NULL, NULL, '3.jpg'); + +-- +-- Index pour les tables déchargées +-- + +-- +-- Index pour la table `Alumni` +-- +ALTER TABLE `Alumni` + ADD PRIMARY KEY (`id`), + ADD UNIQUE KEY `mail` (`mail`); + +-- +-- Index pour la table `Article` +-- +ALTER TABLE `Article` + ADD PRIMARY KEY (`id`), + ADD KEY `image` (`image`), + ADD KEY `auteur` (`auteur`); + +-- +-- Index pour la table `Evenement` +-- +ALTER TABLE `Evenement` + ADD PRIMARY KEY (`id`), + ADD KEY `organisateur` (`organisateur`); + +-- +-- Index pour la table `Experience` +-- +ALTER TABLE `Experience` + ADD PRIMARY KEY (`id`); + +-- +-- Index pour la table `Formation` +-- +ALTER TABLE `Formation` + ADD PRIMARY KEY (`id`); + +-- +-- Index pour la table `Image` +-- +ALTER TABLE `Image` + ADD PRIMARY KEY (`id`); + +-- +-- Index pour la table `Offre` +-- +ALTER TABLE `Offre` + ADD PRIMARY KEY (`id`), + ADD KEY `offreur` (`offreur`); + +-- +-- Index pour la table `Profil` +-- +ALTER TABLE `Profil` + ADD PRIMARY KEY (`id`), + ADD KEY `alumni` (`alumni`); + +-- +-- AUTO_INCREMENT pour les tables déchargées +-- + +-- +-- AUTO_INCREMENT pour la table `Alumni` +-- +ALTER TABLE `Alumni` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=30; + +-- +-- AUTO_INCREMENT pour la table `Article` +-- +ALTER TABLE `Article` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT pour la table `Evenement` +-- +ALTER TABLE `Evenement` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; + +-- +-- AUTO_INCREMENT pour la table `Experience` +-- +ALTER TABLE `Experience` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT pour la table `Formation` +-- +ALTER TABLE `Formation` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT pour la table `Image` +-- +ALTER TABLE `Image` + MODIFY `id` int(5) NOT NULL AUTO_INCREMENT; + +-- +-- AUTO_INCREMENT pour la table `Offre` +-- +ALTER TABLE `Offre` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=2; + +-- +-- AUTO_INCREMENT pour la table `Profil` +-- +ALTER TABLE `Profil` + MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=28; + +-- +-- Contraintes pour les tables déchargées +-- + +-- +-- Contraintes pour la table `Article` +-- +ALTER TABLE `Article` + ADD CONSTRAINT `article_ibfk_1` FOREIGN KEY (`image`) REFERENCES `Image` (`id`), + ADD CONSTRAINT `article_ibfk_2` FOREIGN KEY (`auteur`) REFERENCES `Alumni` (`id`); + +-- +-- Contraintes pour la table `Evenement` +-- +ALTER TABLE `Evenement` + ADD CONSTRAINT `evenement_ibfk_1` FOREIGN KEY (`organisateur`) REFERENCES `Alumni` (`id`); + +-- +-- Contraintes pour la table `Offre` +-- +ALTER TABLE `Offre` + ADD CONSTRAINT `offre_ibfk_1` FOREIGN KEY (`offreur`) REFERENCES `Alumni` (`id`); + +-- +-- Contraintes pour la table `Profil` +-- +ALTER TABLE `Profil` + ADD CONSTRAINT `fk_profil_alumni` FOREIGN KEY (`alumni`) REFERENCES `Alumni` (`id`); +COMMIT; + +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; diff --git a/php/.htaccess b/php/.htaccess index 095bf2a..9837fc7 100644 --- a/php/.htaccess +++ b/php/.htaccess @@ -1,6 +1,11 @@ - - RewriteEngine On - RewriteBase /php/public/ - RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ index.php [QSA,L] - +#RewriteEngine On +# +#RewriteCond %{REQUEST_FILENAME} !-f +#RewriteCond %{REQUEST_FILENAME} !-d +#RewriteRule ^(.*)$ index.php/$1 [L] + + +RewriteEngine on +RewriteCond %{REQUEST_FILENAME} !-f +RewriteRule . index.php [L] + diff --git a/php/composer.json b/php/composer.json index 01808c9..38be522 100644 --- a/php/composer.json +++ b/php/composer.json @@ -1,6 +1,7 @@ { "require": { "twig/twig": "^3.0", + "twig/extensions": "^1.5", "ext-pdo": "*", "ext-fileinfo": "*" }, diff --git a/php/index.php b/php/index.php new file mode 100755 index 0000000..f0cf101 --- /dev/null +++ b/php/index.php @@ -0,0 +1,22 @@ + false, + 'debug' => true +]); +$twig->addExtension(new \Twig\Extension\DebugExtension()); +$twig->addGlobal('dir', '/SAE_2A_FA-Reseau_ALICA/php'); + + + + +$cont = new \App\controleur\FrontControleur(); diff --git a/php/public/assets/bandeau.png b/php/public/assets/bandeau.png new file mode 100644 index 0000000..ba1261e Binary files /dev/null and b/php/public/assets/bandeau.png differ diff --git a/php/public/css/connexion.css b/php/public/css/connexion.css index 4c14d1d..1853cc0 100755 --- a/php/public/css/connexion.css +++ b/php/public/css/connexion.css @@ -12,13 +12,14 @@ a{ body{ display: flex; + flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; background: #fff; } -.container{ +.containerC{ position: relative; width: 500px; min-height: 500px; @@ -30,12 +31,13 @@ body{ -10px -10px 20px #ccc; border-radius: 30px; padding: 50px; + margin: 50px; } form{ position: relative; width: 100%; } -.container h3{ +.containerC h3{ color: #000; font-weight: 600; font-size: 2em; @@ -108,4 +110,4 @@ form{ color: #000; letter-spacing: 1px; font-size: 0.85em; -} \ No newline at end of file +} diff --git a/php/public/css/inscription.css b/php/public/css/inscription.css index 4c14d1d..fceb9de 100755 --- a/php/public/css/inscription.css +++ b/php/public/css/inscription.css @@ -12,13 +12,14 @@ a{ body{ display: flex; + flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; background: #fff; } -.container{ +.containerC{ position: relative; width: 500px; min-height: 500px; @@ -30,12 +31,13 @@ body{ -10px -10px 20px #ccc; border-radius: 30px; padding: 50px; + margin: 50px; } form{ position: relative; width: 100%; } -.container h3{ +.containerC h3{ color: #000; font-weight: 600; font-size: 2em; diff --git a/php/public/css/offres.css b/php/public/css/offres.css index de4ce90..01fa053 100644 --- a/php/public/css/offres.css +++ b/php/public/css/offres.css @@ -49,3 +49,12 @@ .row3 img { align-self: flex-start; } + +a{ + text-decoration: none; +} + +.current{ + + border-bottom: 1px solid black; +} diff --git a/php/public/css/profil.css b/php/public/css/profil.css new file mode 100644 index 0000000..f8603eb --- /dev/null +++ b/php/public/css/profil.css @@ -0,0 +1,122 @@ +/* profil.css */ +.profiles-container { + display: flex; + flex-wrap: wrap; + justify-content: space-around; + gap: 20px; + padding: 0; + list-style: none; +} + +.profile { + width: calc(50% - 20px); /* Ajustez la largeur si nécessaire pour correspondre au design */ + border: 1px solid #ccc; /* Bordure comme dans l'image */ + border-radius: 10px; + overflow: hidden; + background: #fff; + margin-bottom: 20px; + display: flex; + align-items: center; /* Alignement vertical */ +} + +.profile-image-container { + padding: 10px; + display: flex; + align-items: center; + justify-content: center; + background: #f0f0f0; + flex-shrink: 0; /* Empêche le conteneur de rétrécir */ +} + +.profile-image-container img { + width: 100px; + height: 100px; + border-radius: 50%; +} + +.profile-details { + padding: 10px; + flex-grow: 1; /* Permet à ce div de prendre l'espace restant */ +} + +.profile-details p { + margin: 5px 0; + font-weight: bold; /* Texte en gras comme dans l'image */ +} + +.profile-details .job-title { + color: #007bff; + font-size: 0.85em; +} + +.profile-details a { + display: block; /* Prend toute la largeur du conteneur */ + background: #007bff; + color: #fff; + padding: 5px 15px; + text-decoration: none; + border-radius: 5px; + font-size: 14px; + margin-top: 10px; /* Espace au-dessus du lien */ + text-align: center; /* Centre le texte dans le lien */ +} + +.profile-details a:hover { + background: #0056b3; +} + + + +/* profil.css */ +.pagination { + display: flex; + padding-left: 0; + list-style: none; + border-radius: 0.25rem; +} + +.page-link { + position: relative; + display: block; + padding: 0.5rem 0.75rem; + margin-left: -1px; + line-height: 1.25; + color: #007bff; + background-color: #fff; + border: 1px solid #dee2e6; +} + +.page-link:hover { + color: #0056b3; + text-decoration: none; + background-color: #e9ecef; + border-color: #dee2e6; +} + +.page-item:first-child .page-link { + margin-left: 0; + border-top-left-radius: 0.25rem; + border-bottom-left-radius: 0.25rem; +} + +.page-item:last-child .page-link { + border-top-right-radius: 0.25rem; + border-bottom-right-radius: 0.25rem; +} + +.page-item.active .page-link { + z-index: 1; + color: #fff; + background-color: #007bff; + border-color: #007bff; +} + +.page-item.disabled .page-link { + color: #6c757d; + pointer-events: none; + cursor: auto; + background-color: #fff; + border-color: #dee2e6; +} + + diff --git a/php/public/index.php b/php/public/index.php deleted file mode 100755 index 2bce566..0000000 --- a/php/public/index.php +++ /dev/null @@ -1,16 +0,0 @@ - false, - 'debug' => true -]); -$twig->addExtension(new \Twig\Extension\DebugExtension()); -$cont = new \App\controleur\FrontControleur(); \ No newline at end of file diff --git a/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png b/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png deleted file mode 100644 index b02459b..0000000 Binary files a/php/public/uploads/10246LOGO-CGI-1993-1998.svg.png and /dev/null differ diff --git a/php/public/uploads/11560Adidas 3D LOGO.jpg b/php/public/uploads/11560Adidas 3D LOGO.jpg deleted file mode 100644 index b3a36a5..0000000 Binary files a/php/public/uploads/11560Adidas 3D LOGO.jpg and /dev/null differ diff --git a/php/public/uploads/19879 .png b/php/public/uploads/19879 .png deleted file mode 100644 index 955bdb3..0000000 Binary files a/php/public/uploads/19879 .png and /dev/null differ diff --git a/php/src/TwigExtensions.php b/php/src/TwigExtensions.php deleted file mode 100644 index 64fe288..0000000 --- a/php/src/TwigExtensions.php +++ /dev/null @@ -1,24 +0,0 @@ -deleteAccount($profilId); + echo $twig->render('profil.html', []); + } catch (Exception $e) { + $dVueErreur[] = "Erreur lors de la suppression du compte"; + echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); + } } else { - $action = \App\config\Validation::nettoyerString($_REQUEST["action"]); + $dVueErreur[] = "ID du profil non spécifié."; + echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); } - switch ($action) { - case "supprimerCompte": - $this->supprimerCompte(); - break; - case "consulterSignalement": - $this->consulterSignalement(); - break; - case "creerEvenement": - $this->creerEvenement(); - break; - case "supprimerEvenement": - $this->supprimerEvenement(); - break; - case "supprimerOffre": - $this->supprimerOffre(); - break; - default: - parent::__construct(); - } - } - - protected function supprimerCompte() - { - //TODO } protected function consulterSignalement() @@ -43,14 +38,33 @@ class AdminControleur extends ModerateurControleur //TODO } - protected function creerEvenement() + public function creerEvenement() { - //TODO + global $twig; + + if (isset($_FILES["image"])) { + $img = ImageManager::SaveImage('image'); + + if (!Validation::validerEvenement($_SESSION["id"], $_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) { + $mdl = new AdminModele(); + $mdl->ajouterEvenement($_SESSION["id"], $_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1]); + + $this->listerEvenement(); + } else { + $dVueErreur[] ="Erreur lors de la création de l'évènement"; + echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]); + } + } else { + echo $twig->render('creerEvenement.html', []); + } } - protected function supprimerEvenement() + public function supprimerEvenement(?array $params) { - //TODO + $mdl = new AdminModele(); + $mdl->deleteEvenement($params["id2"]); + + $this->listerEvenement(); } protected function supprimerOffre() diff --git a/php/src/controleur/FrontControleur.php b/php/src/controleur/FrontControleur.php index d447374..d1f6c4e 100755 --- a/php/src/controleur/FrontControleur.php +++ b/php/src/controleur/FrontControleur.php @@ -1,55 +1,137 @@ [ - "supprimerCompte", "consulterSignalement","supprimerOffre" - ], - "Moderateur" => [ - //TODO - ], - "Membre" => [ - "deconnexion","proposerOffre","consulterProfil","modifierProfil","signaler","ajouterExperience","supprimerExperience", "listerExperience" - ], - "Utilisateur" => [ - - "connexion", "inscription", "accueil", "consulterProfilLimite", "publierOffre", "listerEvenement", "creerEvenement", "supprimerEvenement", "avoirDetailEvenement", "rechercherEvenement" - ] - ); - - $action = \App\config\Validation::nettoyerString($_GET["action"] ?? ""); - if(in_array($action,$actions['Admin'])) { - if (!isset($_SESSION["role"]) || $_SESSION["role"]!="admin") { - $dVueErreur[] = 'Veuillez vous connecter'; - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - } else{ - new AdminControleur(); - } + + if(!isset($_SESSION['nom']) && !isset($_SESSION['prenom']) && !isset($_SESSION['role']) && !isset($_SESSION['id'])) + { + $_SESSION['nom'] = NULL; + $_SESSION['prenom'] = NULL; + $_SESSION['role'] = "guest"; + $_SESSION['id'] = NULL; } - else if(in_array($action,$actions['Moderateur'])) { - if (!isset($_SESSION["role"]) || ($_SESSION["role"]!="moderateur" && $_SESSION["role"]!="admin")) { - $dVueErreur[] = 'Veuillez vous connecter'; - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - } else{ - new ModerateurControleur(); - } + else{ + $twig->addGlobal('nom', $_SESSION['nom']); + $twig->addGlobal('prenom', $_SESSION['prenom']); + $twig->addGlobal('role', $_SESSION['role']); + $twig->addGlobal('id', $_SESSION['id']); } - else if(in_array($action,$actions['Membre'])) { - if (!isset($_SESSION["utilisateur"])) { - $dVueErreur[] = 'Veuillez vous connecter'; - echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); - } else{ - new MembreControleur(); + + + $router = new AltoRouter(); + + $router->setBasePath('/SAE_2A_FA-Reseau_ALICA/php'); + + $router->map('GET|POST', '/', 'UtilisateurControleur'); + + $router->map('GET|POST','/[a:action]?','UtilisateurControleur'); + + $router->map('POST','/[a:action]?','UtilisateurControleur'); + + $router->map('GET','/[a:action]/[i:id]?','UtilisateurControleur'); + + $router->map('GET|POST', '/user/[a:action]?', 'MembreControleur'); + $router->map('GET|POST', '/user/[i:id]/[a:action]?', 'MembreControleur'); + + $router->map('GET|POST', '/user/[i:id]/[a:action]/[i:id2]?', 'MembreControleur'); + + + $router->map('GET|POST', '/admin/[i:id]/[a:action]?', 'AdminControleur'); + + $router->map('GET|POST', '/admin/[i:id]/[a:action]/[i:id2]?', 'AdminControleur'); + + $id = 0; + + $match = $router->match(); + + $action = array(); + + $id = array(); + + try{ + $twig->render("accueil.html",[]); + + if (!$match) { + + $dVueErreur[] = "Error 404 Page not found"; + echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); + } + + if ($match) { + + $controller = $match['target'] ?? NULL; + $action = $match['params']['action'] ?? NULL; + $id = $match['params']['id'] ?? NULL; + + $namespace = 'App\\controleur\\'; + + try { + if ($controller == "MembreControleur") { + if ($_SESSION["role"] != "Membre" && $_SESSION["role"] != "Admin") { + + echo $twig->render("connection.html", ['msg' => 'Vous devez vous connecter pour effectuer cette action']); + } else { + $controller = "MembreControleur"; + $controller = $namespace . $controller; + //echo "controller : ".$controller; + $controller = new $controller(); + + } + } + + if ($controller == "AdminControleur") { + if ($_SESSION["role"] != "Admin") { + $dVueErreur = ["Erreur : Vous n'avez pas les privileges pour cette action"]; + + global $twig; + echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); + return; + } else { + $controller = "AdminControleur"; + $controller = $namespace . $controller; + $controller = new $controller(); + } + } + + if ($controller == "UtilisateurControleur") { + $controller = $namespace . $controller; + $controller = new $controller(); + } + + if (is_callable(array($controller, $action))) { + + call_user_func(array($controller, $action), $match['params']); + } else { + + + echo $twig->render('accueil.html'); + } + + } catch (Error $error) { + $dVueErreur = ['Erreur : Action inconnue']; + + echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); + } } - }else{ - new UtilisateurControleur(); } - } + catch(Error $e) + { + $dVueErreur = ['Erreur : Action inconnue']; + + echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); + } +} + + + } diff --git a/php/src/controleur/MembreControleur.php b/php/src/controleur/MembreControleur.php index e941bda..2675573 100755 --- a/php/src/controleur/MembreControleur.php +++ b/php/src/controleur/MembreControleur.php @@ -1,69 +1,136 @@ deconnexion(); - break; - case "proposerOffre": - $this->proposerOffre(); - break; - case "consulterProfil": - $this->consulterProfil(); - break; - case "modifierProfil": - $this->modifierProfil(); - break; - case "signaler": - $this->signaler(); - break; - case "ajouterExperience": - $this->addExperience(); - break; - case "supprimerExperience": - $this->deleteExperience(); - break; - case "listerExperience": - $this->displayExperience(); - break; - default: - parent::__construct(); - } - } protected function deconnexion() { + session_unset(); session_destroy(); - header('Location: index.php?action=accueil'); + + header("Location: /SAE_2A_FA-Reseau_ALICA/php/"); exit(); } + public function createOfferForm() + { + global $twig; + echo $twig->render("CreateOffer.html", []); + } - protected function proposerOffre() + public function createOffer() { - //TODO + global $twig; + $taberror = []; + + $requiredFields = ['name', 'entreprise', 'description','typeContrat', 'descriptPoste', 'profilRecherche', 'choixExp', 'education', 'mail', 'num']; + + $error = false; + foreach ($requiredFields as $field) { + if (empty($_POST[$field])) { + $error = true; + $taberror[] = "Le champ {$field} est requis !"; + } + } + if($error) + { + echo $twig->render("CreateOffer.html", ['tabError' => $taberror ]); + return; + } + + if(!Validation::verifierEmail($_POST["mail"])) + { + $taberror[] = "Email non valide !"; + } + + if(!Validation::validateNumber($_POST["num"])) + { + $taberror[] = "Numero non valide !"; + } + + if (!Validation::validateImage("image")) + { + $taberror[] = "Image non valide !"; + + } + if(!Validation::validateImage("logo")) { + $taberror[] = "Logo non valide !"; + } + + if(count($taberror) > 0) + { + echo $twig->render("CreateOffer.html", ['tabError' => $taberror ]); + + } + else{ + $saveImg1 = ImageManager::SaveImage("image"); + $saveImg2 = ImageManager::SaveImage("logo"); + if($saveImg1[0] != NULL && $saveImg2[0] != NULL) + { + $mbrModel = new MembreModele(); + + $offre = $mbrModel->publishOffer($saveImg1[1], $saveImg2[1]); + + echo $twig->render("OffreDetailTest.html", ['offre' => $offre]); + } + else + { + $taberror[] = "Erreur lors de l'upload des images"; + echo $twig->render("CreateOffer.html", ['tabError' => $taberror ]); + } + } } - protected function consulterProfil() + + public function deleteOffer(?array $params) { - //TODO + global $twig; + $id = $params['id2']; + + $MemberModel = new MembreModele(); + $offre = $MemberModel->getOfferFromId($id); + if($offre != NULL) + { + $MemberModel->deleteOffer($offre); + + } + $this->consultOffers(); + + /*$offre = $MemberModel->getOfferFromId($id); + + if($offre->getOffreur()->getId() == $_SESSION['id'] + || $_SESSION['role'] == "admin") + { + $MemberModel = new MembreModele(); + $MemberModel->deleteOffer($offre); + $this->consultOffers(); + }*/ + } - protected function modifierProfil() + public function proposerOffre() { //TODO } - - protected function signaler() + public function consulterProfil() + { + //TODO + } + public function modifierProfil() + { + //TODO + } + public function signaler() { //TODO } diff --git a/php/src/controleur/ModerateurControleur.php b/php/src/controleur/ModerateurControleur.php old mode 100755 new mode 100644 diff --git a/php/src/controleur/UtilisateurControleur.php b/php/src/controleur/UtilisateurControleur.php index 42f3231..1156b59 100755 --- a/php/src/controleur/UtilisateurControleur.php +++ b/php/src/controleur/UtilisateurControleur.php @@ -3,86 +3,43 @@ namespace App\controleur; use App\config\Validation; -use App\gateway\ImageSaver; +use App\gateway\ImageManager; use App\metier\Alumni; use App\modele\OffreModele; use App\modele\UtilisateurModele; +use Exception; class UtilisateurControleur { - public function __construct() - { - global $twig; - if (!isset($_REQUEST["action"])) { - $action = NULL; - } else { - $action = Validation::nettoyerString($_REQUEST["action"]); - } - switch ($action) { - case NULL: - case "accueil": - $this->accueil(); - break; - case "inscription_success": - $this->inscription_success(); - break; - case "connection": - $this->connection(); - break; - case "inscription": - $this->inscription(); - break; - case "consultOffers": - $this->consultOffers(); - break; - case "consulterProfilLimite": - $this->consulterProfilLimite(); - break; - case "createOffer": - $this->createOffer(); - break; - case "createOfferForm": - $this->createOfferForm(); - break; - case "displayOffer": - $this->displayOffer(); - break; - case "listerEvenement": - $this->listerEvenement(); - break; - case "creerEvenement": - $this->creerEvenement(); - break; - case "supprimerEvenement": - $this->supprimerEvenement(); - break; - case "avoirDetailEvenement": - $this->avoirDetailEvenement(); - break; - case "rechercherEvenement": - $this->rechercherEvenement(); - break; - default: - $dVueErreur[] = "Action inconnue ou non autorisée"; - echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); - } - } - protected function connection() + public function connection() { global $twig; - $dVueErreur = []; // Tableau pour stocker les erreurs, le cas échéant + + $dVueErreur = []; $userModel = new UtilisateurModele(); if (isset($_POST['email'], $_POST['password'])) { $email = Validation::nettoyerString($_POST['email']); $motDePasse = Validation::nettoyerString($_POST['password']); + $utilisateur = $userModel->connection($email, $motDePasse); + if ($utilisateur instanceof Alumni) { - $_SESSION['utilisateur'] = $utilisateur; - header('Location: index.php?action=accueil'); - exit(); + $_SESSION['nom'] = $utilisateur->getNom(); + $_SESSION['prenom'] = $utilisateur->getPrenom(); + $_SESSION['role'] = $utilisateur->getRole(); + $_SESSION['id'] = $utilisateur->getId(); + + echo $twig->render('accueil.html',[ + 'nom' => $_SESSION['nom'], + 'prenom' => $_SESSION['prenom'], + 'role' => $_SESSION['role'], + 'id' => $_SESSION['id' + ]]); + + return; } else { $dVueErreur[] = "L'adresse email ou le mot de passe est incorrect."; } @@ -90,10 +47,11 @@ class UtilisateurControleur echo $twig->render('connection.html', ['dVueErreur' => $dVueErreur]); } - protected function inscription() + public function inscription() { + global $twig; - $dVueErreur = []; // Tableau pour stocker les erreurs, le cas échéant + $dVueErreur = []; $userModel = new UtilisateurModele(); if (isset($_POST['firstname'],$_POST['name'], $_POST['email'], $_POST['password'])) { @@ -102,23 +60,25 @@ class UtilisateurControleur $email = Validation::nettoyerString($_POST['email']); $motDePasse = Validation::nettoyerString($_POST['password']); $hash = password_hash($motDePasse, PASSWORD_DEFAULT); + try { + // verification que l'email est valide et unique : + if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { + $dVueErreur[] = "L'adresse email n'est pas valide ou est déjà utilisée."; + } else { + $utilisateur = $userModel->getUtilisateurByEmail($email); + if ($utilisateur instanceof Alumni) { + $dVueErreur[] = "L'adresse email est déjà utilisée."; + } + } + $nouvelUtilisateur = $userModel->inscription($prenom, $nom, $email, $hash); - // verification que l'email est valide et unique : - if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { - $dVueErreur[] = "L'adresse email n'est pas valide ou est déjà utilisée."; - } else { - $utilisateur = $userModel->getUtilisateurByEmail($email); - if ($utilisateur instanceof Alumni) { - $dVueErreur[] = "L'adresse email est déjà utilisée."; + if ($nouvelUtilisateur instanceof Alumni) { + echo $twig->render('inscription_success.html'); + exit(); } } - $nouvelUtilisateur = $userModel->inscription($prenom,$nom,$email, $hash); - - if ($nouvelUtilisateur instanceof Alumni) { - header('Location: index.php?action=inscription_success'); - exit(); - } else { - $dVueErreur[] = "L'inscription a échoué, veuillez réessayer."; + catch (Exception $e) { + $dVueErreur[] = "L'inscription a échoué, veuillez réessayer."; } } echo $twig->render('inscription.html', ['dVueErreur' => $dVueErreur]); @@ -129,76 +89,66 @@ class UtilisateurControleur global $twig; // Ajout d'un var_dump pour déboguer if (isset($_SESSION['utilisateur']) && $_SESSION['utilisateur'] instanceof Alumni) { - $prenom = $_SESSION['utilisateur']->getPrenom(); - $nom = $_SESSION['utilisateur']->getNom(); - } - else{ - $prenom = null; - $nom = null; - } + $userModel = new UtilisateurModele(); + $evenements=$userModel->getEvenement(); //aller sur la page d'accueil avec le nom et prenom de l'utilisateur - echo $twig->render('accueil.html', ['prenom' => $prenom, 'nom' => $nom]); + echo $twig->render('accueil.html', ['evenements' => $evenements]); + } else { + echo $twig->render('accueil.html'); + } } - protected function inscription_success() - { - global $twig; - echo $twig->render('inscription_success.html'); - } - protected function consulterProfilLimite() + public function consulterProfilLimite() { //TODO + echo 'not implemented yet'; } - protected function consultOffers() + public function consultOffers(?array $params) { - $offerMdl = new OffreModele(); + $userMdl = new UtilisateurModele(); global $twig; - $niveauEtudes=null; - $typeContrat=null; - $exp = null; + $niveauEtudes = NULL; + $typeContrat = NULL; + $exp = NULL; + $msg = NULL; $nbOffers = 5 ; - if(isset($_GET["niveauEtudes"]) && Validation::validateTypeStudies($_GET["niveauEtudes"])) { - $niveauEtudes = $_GET["niveauEtudes"]; + if(isset($_POST["niveauEtudes"]) && Validation::validateTypeStudies($_POST["niveauEtudes"])) { + $niveauEtudes = $_POST["niveauEtudes"]; } - if(isset($_GET["typeContrat"]) && Validation::validateTypeContract($_GET["typeContrat"])) { - $typeContrat = $_GET["typeContrat"]; + if(isset($_POST["typeContrat"]) && Validation::validateTypeContract($_POST["typeContrat"])) { + $typeContrat = $_POST["typeContrat"]; } - if(isset($_GET["experience"]) && Validation::validateExperience($_GET["experience"])) { - $exp = $_GET["experience"]; + if(isset($_POST["experience"]) && Validation::validateExperience($_POST["experience"])) { + $exp = $_POST["experience"]; } if ($niveauEtudes == null && $typeContrat == null && $exp == null) { - $totalOffers = $offerMdl->getNbOffers(); + $totalOffers = $userMdl->getNbOffers(); } else { $params = array( 'typeContrat' => $typeContrat, 'exp' => $exp, - 'niveauEtudes' => $niveauEtudes, + 'niveauEtudes' => $niveauEtudes ); - $offers = $offerMdl->getOffersWithFilters($params); - $totalOffers = count($offers); + //$offers = $userMdl->getOffersWithFilters($params); + //var_dump($offers); + //$totalOffers = count($offers); + $totalOffers = count($userMdl->getOffersWithFilters($params)); } $numberPages = ceil($totalOffers / 5); - if($numberPages == 0 ) - { - - echo $twig->render("erreur.html",['dVueErreur' => ['Aucune Offre Trouvée']]); - return; - } - if (isset($_GET["page"]) && intval($_GET["page"]) != null) { $page = intval($_GET["page"]); if ($page > $numberPages || $page < 1) { $dVueErreur[] = "Page introuvable"; - echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); + echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur ]); return; } } else { @@ -207,113 +157,39 @@ class UtilisateurControleur $start = intval(($page - 1) * 5); + $offers = []; + if ($niveauEtudes == null && $typeContrat == null && $exp == null) { - $offers = $offerMdl->getOfferLimit($start, $nbOffers); + $offers = $userMdl->getOfferLimit($start, $nbOffers); } else { $params['start'] = $start; $params['nbOffers'] = 5; - $offers = $offerMdl->getOffersWithFilters($params); - } + $offers = $userMdl->getOffersWithFilters($params); - /* echo "filtre :".$niveauEtudes."
"; - echo "filtre :".$typeContrat."
"; - echo "filtre :".$exp."
";*/ + } echo $twig->render('OffersList.html', [ + 'msg' => $msg, 'offres' => $offers, 'numberPages' => $numberPages, 'currentPage' => $page, - 'typeContrat' => (($typeContrat != null ? $typeContrat : "")), - 'experience' => (($exp != null ? $exp : "")), - 'niveauEtudes' => (($niveauEtudes != null ? $niveauEtudes : "")), - 'valContrat' => (($typeContrat != null ? "&typeContrat=".$typeContrat : "")), - 'valExp' => (($exp != null ? "&experience=".$exp : "")), - 'valEtudes' => (($niveauEtudes != null ? "&niveauEtudes=".$niveauEtudes : "")) + 'typeContrat' => (($typeContrat != null) ? $typeContrat : ""), + 'experience' => (($exp != null) ? $exp : ""), + 'niveauEtudes' => (($niveauEtudes != null) ? $niveauEtudes : ""), + 'valContrat' => (($typeContrat != null) ? "&typeContrat=".$typeContrat : ""), + 'valExp' => (($exp != null) ? "&experience=".$exp : ""), + 'valEtudes' => (($niveauEtudes != null) ? "&niveauEtudes=".$niveauEtudes : "") ]); } - protected function createOfferForm() - { - global $twig; - echo $twig->render("CreerOffre.html", []); - } - - protected function createOffer() + public function displayOffer(?array $params) { global $twig; - $taberror = []; - - $requiredFields = ['name', 'entreprise', 'description','typeContrat', 'descriptPoste', 'profilRecherche', 'choixExp', 'education', 'mail', 'num']; - - $error = false; - foreach ($requiredFields as $field) { - if (empty($_POST[$field])) { - $error = true; - $taberror[] = "Le champ {$field} est requis !"; - } - } - if($error) - { - echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]); - return; - } - - if(!Validation::verifierEmail($_POST["mail"])) - { - //echo $twig->render("CreerOffre.html", ['errMsg' => "Email non valide !" ]); - $taberror[] = "Email non valide !"; - } - - if(!Validation::validateNumber($_POST["num"])) - { - $taberror[] = "Numero non valide !"; - //echo $twig->render("CreerOffre.html", ['errMsg' => "Numero non valide !" ]); - } - - if (!Validation::validateImage("image")) + if (isset($params['id']) && intval($params['id']) != null) { - if(isset($_FILES['image']['name'])) {$taberror[] = "Image non valide !";} - else {$taberror[] = "Inserez une image !";} - } - if(!Validation::validateImage("logo")) { - if(isset($_FILES['logo']['name'])) {$taberror[] = "Logo non valide !";} - else {$taberror[] = "Inserez un logo !";} - return; - } - - if(count($taberror) > 0) - { - echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]); - - } - else{ - $saveImg1 = ImageSaver::SaveImage("image"); - $saveImg2 = ImageSaver::SaveImage("logo"); - if($saveImg1[0] && $saveImg2[0]) { - $offreMdl = new OffreModele(); - - - $offre = $offreMdl->publishOffer($saveImg1[1], $saveImg2[1]); - - echo $twig->render("OffreDetailTest.html", ['offre' => $offre]); - } - else - { - $taberror[] = "Erreur lors de l'upload des images"; - echo $twig->render("CreerOffre.html", ['tabError' => $taberror ]); - } - } - } - - public function displayOffer() - { - global $twig; - - if (isset($_GET["id"]) && intval($_GET["id"]) != null) - { - $offreMdl = new OffreModele(); - $offre = $offreMdl->getOfferFromId(intval($_GET["id"])); + $uttilsMdl = new UtilisateurModele(); + $offre = $uttilsMdl->getOfferFromId(intval($params["id"])); if($offre != NULL) { echo $twig->render("OffreDetailTest.html",['offre' => $offre]); @@ -324,7 +200,7 @@ class UtilisateurControleur echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); } - protected function listerEvenement() + public function listerEvenement() { $mdl = new UtilisateurModele(); $evenements = $mdl->getEvenement(); @@ -332,52 +208,30 @@ class UtilisateurControleur echo $twig->render('evenement.html', ['evenements' => $evenements]); } - - protected function creerEvenement() + + public function avoirDetailEvenement(?array $params) { + $mdl = new UtilisateurModele(); global $twig; - if (isset($_FILES["image"])) { - $img = ImageSaver::SaveImage('image'); + if(isset($params['id'])) + { + $evenement = $mdl->getEvenementById($params['id']); - if (!Validation::validerEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1])) { - $mdl = new UtilisateurModele(); - $mdl->ajouterEvenement($_POST["titre"], $_POST["description"], $_POST["date"], $_POST["nbPlaceMax"], $img[1]); - $this->listerEvenement(); - } else { - $dVueErreur[] ="Erreur lors de la création de l'évènement"; - echo $twig->render("erreur.html",['dVueErreur' => $dVueErreur]); - } - } else { - echo $twig->render('creerEvenement.html', []); + echo $twig->render('detailEvenement.html', ['evenement' => $evenement]); } - } - - protected function supprimerEvenement() - { - $mdl = new UtilisateurModele(); - $mdl->deleteEvenement($_GET["id"]); + else echo $twig->render('erreur.html', ['dVueErreur' => ['erreur id evenement']]); - $this->listerEvenement(); - } - - protected function avoirDetailEvenement() - { - $mdl = new UtilisateurModele(); - $evenement = $mdl->getEvenementById($_GET["id"]); - global $twig; - echo $twig->render('detailEvenement.html', ['evenement' => $evenement]); } - protected function rechercherEvenement() + public function rechercherEvenement() { $mdl = new UtilisateurModele(); $evenements = $mdl->getEvenement(); - if(isset($_POST["recherche"]) AND !empty($_POST["recherche"])) - { + if (isset($_POST["recherche"]) and !empty($_POST["recherche"])) { $recherche = Validation::nettoyerString($_POST["recherche"]); $evenements = $mdl->getEvenementByTitre($recherche); } @@ -385,4 +239,35 @@ class UtilisateurControleur global $twig; echo $twig->render('evenement.html', ['evenements' => $evenements]); } + + public function getProfilByPage(?array $params) + { + + global $twig; + $dVueErreur = []; // Tableau pour stocker les erreurs, le cas échéant + $userModel = new UtilisateurModele(); + $nbParPage = 6; + $nombreTotalPages = ceil(($userModel->getNbTotalPages())/$nbParPage); + if (isset($params['id'] ) && $params['id'] != null) { + $page = Validation::validerIntPossitif($params['id']); + try{ + $profils = $userModel->getProfilByPage($page, $nbParPage); + if (isset($profils)) { + echo $twig->render('profil.html', [ + 'profils' => $profils, + 'nombreTotalPages' => $nombreTotalPages, + 'page' => $page] + ); + } + }catch (Exception $e){ + $dVueErreur[] = "Aucun profil n'a été trouvé."; + echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); + } + } else { + $dVueErreur[] = "La page n'existe pas."; + echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]); + } + } + + } \ No newline at end of file diff --git a/php/src/gateway/AlumniGateway.php b/php/src/gateway/AlumniGateway.php index 5e19480..89153f2 100644 --- a/php/src/gateway/AlumniGateway.php +++ b/php/src/gateway/AlumniGateway.php @@ -12,11 +12,13 @@ class AlumniGateway /** * @param $con */ - public function __construct(Connection $con){ + public function __construct(Connection $con) + { $this->con = $con; } - public function insert(string $email, string $motDePasse, string $role){ + public function insert(string $email, string $motDePasse, string $role) + { $query = 'INSERT INTO Alumni (mail, mdp, role) VALUES (:mail, :mdp, :role)'; return $this->con->executeQuery($query, array( ':mail' => array($email, PDO::PARAM_STR), @@ -26,15 +28,16 @@ class AlumniGateway } - public function updateMotDePasse(int $id, string $password){ - $query='UPDATE Alumni SET motDePasse=:new WHERE id=:i'; + public function updateMotDePasse(int $id, string $password) + { + $query = 'UPDATE Alumni SET motDePasse=:new WHERE id=:i'; $this->con->executeQuery($query, array( ':i' => array($id, PDO::PARAM_INT), ':new' => array($password, PDO::PARAM_STR) )); } - public function ObtenirById(int $id) : array + public function ObtenirById(int $id): array { $query = 'SELECT * FROM Alumni WHERE id=:i'; $this->con->executeQuery($query, array( @@ -43,31 +46,24 @@ class AlumniGateway return $this->con->getResults(); } - public function findByEmail(string $email){ - $query = 'SELECT Alumni.mail, Alumni.mdp, Alumni.role, Profil.nom, Profil.prenom + public function findByEmail(string $email) + { + $query = 'SELECT Alumni.id, Alumni.mail, Alumni.mdp, Alumni.role, Profil.nom, Profil.prenom FROM Alumni LEFT JOIN Profil ON Alumni.id = Profil.alumni WHERE Alumni.mail = :e'; $this->con->executeQuery($query, array( ':e' => array($email, PDO::PARAM_STR), )); - $res = $this->con->getResults(); - if (count($res) == 0) { - return null; - } - return new Alumni($res[0]['mail'], $res[0]['mdp'], $res[0]['role'], $res[0]['nom'], $res[0]['prenom']); + return $this->con->getResults(); } - public function getAll(){ - $query='SELECT * FROM Alumni'; + public function getAll() + { + $query = 'SELECT * FROM Alumni'; $this->con->executeQuery($query); - $res=$this->con->getResults(); - $array=[]; - foreach($res as $r){ - $array[]=new Alumni($r['mail'],$r['id'],$r['mdp'],$r['role']); - } - return $array; + return $this->con->getResults(); } public function getID(string $email) @@ -79,4 +75,27 @@ class AlumniGateway $res = $this->con->getResults(); return $res[0]['id']; } -} \ No newline at end of file + + public function deleteUser(int $accountId) + { + // Supprimer les enregistrements liés dans AutreTable + $query = 'DELETE FROM Profil WHERE alumni=:i'; + $this->con->executeQuery($query, array( + ':i' => array($accountId, PDO::PARAM_INT) + )); + + $query = 'DELETE FROM Offre WHERE offreur=:i'; + $this->con->executeQuery($query, array( + ':i' => array($accountId, PDO::PARAM_INT) + )); + + // Ensuite, supprimer l'enregistrement dans Alumni + $query = 'DELETE FROM Alumni WHERE id=:i'; + $this->con->executeQuery($query, array( + ':i' => array($accountId, PDO::PARAM_INT) + )); + + return $this->con->getResults(); + } + +} diff --git a/php/src/gateway/ImageGateway.php b/php/src/gateway/ImageGateway.php deleted file mode 100644 index 64e94e0..0000000 --- a/php/src/gateway/ImageGateway.php +++ /dev/null @@ -1,74 +0,0 @@ -con = $con; - } - - - public function insertImage(Image $img) - { - $query = "INSERT INTO Image (`nom`, `taille`, `type`, `blob`) VALUES ( :n, :t, :ty, :b)"; - $this->con->executeQuery($query, array( - ':n' => array($img->getName(), PDO::PARAM_STR), - ':t' => array($img->getTaille(), PDO::PARAM_STR), - ':ty' => array($img->getType(), PDO::PARAM_STR), - ':b' => array($img->getBlob(), PDO::PARAM_STR) - )); - } - - public function delete(int $id) - { - $query = 'DELETE FROM Image WHERE id=:i'; - $this->con->executeQuery($query, array( - ':i' => array($id, PDO::PARAM_INT) - )); - } - - public function getFromId(int $id) : array - { - $query = 'SELECT * FROM Image WHERE id=:i'; - $this->con->executeQuery($query, array( - ':i' => array($id, PDO::PARAM_INT) - )); - return $this->con->getResults(); - } - - public function getNewId() : int - { - $query = 'SELECT MAX(id) FROM Image'; - $this->con->executeQuery($query); - $res = $this->con->getResults(); - if ($res[0]['MAX(id)'] === null) { - return 1; - } - return intval($res[0]['MAX(id)'])+1; - - } - - public function obtenirToutesImages() - { - $query = 'SELECT * FROM Image'; - $this->con->executeQuery($query); - $res = $this->con->getResults(); - $array = []; - foreach ($res as $r) { - $array[] = new Image($this->getNewId(),$r['nom'], $r['taille'], $r['type'], $r['blob']); - } - return $array; - } -} - -?> \ No newline at end of file diff --git a/php/src/gateway/ImageSaver.php b/php/src/gateway/ImageManager.php similarity index 67% rename from php/src/gateway/ImageSaver.php rename to php/src/gateway/ImageManager.php index a6d189d..994ea3f 100644 --- a/php/src/gateway/ImageSaver.php +++ b/php/src/gateway/ImageManager.php @@ -1,7 +1,7 @@ con->executeQuery($query, array( ':i' => array($offre->getId(), \PDO::PARAM_INT), - //':o' => array($offre->getOffreurId(), \PDO::PARAM_STR), - ':o' => array(1,\PDO::PARAM_INT), + ':o' => array($offre->getOffreurId(), \PDO::PARAM_INT), ':t' => array($offre->getNom(), \PDO::PARAM_STR), ':d' => array($offre->getDescription(), \PDO::PARAM_STR), 'img' => array($offre->getImg(), \PDO::PARAM_STR), @@ -128,6 +127,22 @@ class OffreGateway return $this->con->getResults(); } + public function getNbTotalPages() + { + $query = 'SELECT COUNT(*) FROM Profil'; + $this->con->executeQuery($query, array()); + $res = $this->con->getResults(); + return intval($res[0]['COUNT(*)']); + } + + public function deleteOffer($id) + { + $query = 'DELETE FROM OFFRE WHERE id=:i'; + $this->con->executeQuery($query,array( + ':i' => array($id,\PDO::PARAM_INT) + ) + ); + } } \ No newline at end of file diff --git a/php/src/gateway/ProfilGateway.php b/php/src/gateway/ProfilGateway.php index 3673b68..a0afb77 100644 --- a/php/src/gateway/ProfilGateway.php +++ b/php/src/gateway/ProfilGateway.php @@ -33,4 +33,16 @@ class ProfilGateway )); return $this->con->getResults(); } + + public function userByPage(int $page, int $nbParPage) + { + $start = ($page - 1) * $nbParPage; // Calcul de l'index de départ pour LIMIT + $start = max(0, $start); // Si $start est négatif, on met 0 (pas de page -1) + $query = 'SELECT * FROM Profil LIMIT :start, :nbParPage'; + $this->con->executeQuery($query, array( + ':start' => array($start, PDO::PARAM_INT), + ':nbParPage' => array($nbParPage, PDO::PARAM_INT), + )); + return $this->con->getResults(); + } } \ No newline at end of file diff --git a/php/src/metier/Alumni.php b/php/src/metier/Alumni.php index 7b61e8a..70e5aa8 100644 --- a/php/src/metier/Alumni.php +++ b/php/src/metier/Alumni.php @@ -3,7 +3,7 @@ namespace App\metier; class Alumni{ - + private int $id; /** * @var string Email */ @@ -28,12 +28,13 @@ class Alumni{ * @param Profil $profil */ - public function __construct(string $email, string $motDePasse, String $role, string $nom, string $prenom) + public function __construct(int $id,string $email, string $motDePasse, String $role, string $nom, string $prenom) { + $this->id = $id; $this->email = $email; $this->motDePasse = $motDePasse; $this->role = $role; - $this->profil = new Profil($nom, $prenom, $email, "","", "", ""); + $this->profil = new Profil($id,$nom, $prenom, $email, "","", "", "",""); } /** @@ -76,4 +77,9 @@ class Alumni{ { return $this->profil->getNom(); } + + public function getId() + { + return $this->id; + } } \ No newline at end of file diff --git a/php/src/metier/Offre.php b/php/src/metier/Offre.php index bd9b494..2264363 100755 --- a/php/src/metier/Offre.php +++ b/php/src/metier/Offre.php @@ -10,21 +10,21 @@ class TypeContrat { const Alternance = "Alternance"; const Stage = "Stage"; } - -enum ProfilRecherche : string -{ - case Junior = "Junior"; - case Senior = "Senior"; - case Indifferent = "Indifferent"; -} - -enum NiveauEtudes: string -{ - case Bac2 = "Bac+2"; - case Bac3 = "Bac+3"; - case Bac5 = "Bac+5"; - case Indifferent = "Indifferent"; -} +// +//enum ProfilRecherche : string +//{ +// case Junior = "Junior"; +// case Senior = "Senior"; +// case Indifferent = "Indifferent"; +//} +// +//enum NiveauEtudes: string +//{ +// case Bac2 = "Bac+2"; +// case Bac3 = "Bac+3"; +// case Bac5 = "Bac+5"; +// case Indifferent = "Indifferent"; +//} class Offre { diff --git a/php/src/metier/Profil.php b/php/src/metier/Profil.php index 8fef2ee..bd73ec5 100644 --- a/php/src/metier/Profil.php +++ b/php/src/metier/Profil.php @@ -28,6 +28,8 @@ class Profil /** * @var string Url linkedin */ + //image can be null + private ?string $image; private string $linkedinUrl; /** @@ -48,11 +50,12 @@ class Profil * @param string $githubUrl * @param string $portfolioUrl */ - public function __construct(string $nom, string $prenom, string $email, string $cv, string $linkedinUrl, string $githubUrl, string $portfolioUrl) + public function __construct(int $alumni,string $nom, string $prenom, string $email, ?string $image,string $cv, string $linkedinUrl, string $githubUrl, string $portfolioUrl) { - + $this->id = $alumni; $this->nom = $nom; $this->prenom = $prenom; + $this->image = $image; $this->email = $email; $this->cv = $cv; $this->linkedinUrl = $linkedinUrl; @@ -61,6 +64,14 @@ class Profil } + public function getId(): int + { + return $this->id; + } + public function getImage(): ?string + { + return $this->image ?? 'logo.png'; + } public function getCv(): string { return $this->cv; diff --git a/php/src/modele/AdminModele.php b/php/src/modele/AdminModele.php index ac33e99..9f1a305 100755 --- a/php/src/modele/AdminModele.php +++ b/php/src/modele/AdminModele.php @@ -2,7 +2,9 @@ namespace App\modele; +use App\gateway\Connection; use App\metier\Alumni; +use App\metier\Evenement; class AdminModele extends MembreModele { @@ -10,9 +12,21 @@ class AdminModele extends MembreModele * @description supprimer un compte * @param Alumni $account compte à supprimer */ - public function deleteAccount(\App\metier\Alumni $account) + public function deleteAccount(int $accountId) { - // TO DO + global $twig; + $dVueErreur = []; + $con = new Connection(DB_HOST, DB_USER, DB_PASS); + $gate = new \App\gateway\AlumniGateway($con); + $result = $gate->deleteUser($accountId); + /* try { + + var_dump($result); + } catch (\Exception $e) { + $dVueErreur[] = "Erreur lors de la suppression du compte"; + echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur]); + }*/ + } /** @@ -29,30 +43,33 @@ class AdminModele extends MembreModele * @description supprimer une offre spécifique * @param Offre $offer offre à supprimer */ - public function deleteOffer(Offre $offer) - { - // TO DO - } /** * @description créer un évènement * @return \Evenement évènement créé */ - public function createEvent() : \Evenement + public function ajouterEvenement(int $idOrganisateur, string $titre, string $description, string $date, int $nbPlaceMax, string $img) { - $event = new \Evenement("","",null); - // TO DO + $evenement = new Evenement( + $this->eventGw->getNewId(), + $idOrganisateur, + $titre, + $description, + $date, + $nbPlaceMax, + $img + ); - return $event; + $this->eventGw->insertEvenement($evenement); } /** * @description suppression d'un évènement * @param \Evenement $event évènement à supprimer */ - public function deleteEvent(\Evenement $event) + public function deleteEvenement(int $id) { - // TO DO + $this->eventGw->deleteEvenement($id); } /** diff --git a/php/src/modele/MembreModele.php b/php/src/modele/MembreModele.php index b84f102..016f6ee 100755 --- a/php/src/modele/MembreModele.php +++ b/php/src/modele/MembreModele.php @@ -2,6 +2,7 @@ namespace App\modele; +<<<<<<< HEAD use App\gateway\AlumniGateway; use App\gateway\Connection; use App\gateway\ImageGateway; @@ -9,6 +10,11 @@ use App\gateway\OffreGateway; use App\gateway\ProfilGateway; use App\metier\Alumni; use mysql_xdevapi\Exception; +======= +use App\gateway\ImageManager; +use App\metier\Alumni; +use App\metier\Offre; +>>>>>>> master class MembreModele extends UtilisateurModele { @@ -147,4 +153,60 @@ class MembreModele extends UtilisateurModele + public function publishOffer(string $img, string $logo) + { + $desc = $_POST["description"]; + $descposte = $_POST["descriptPoste"]; + $nom = $_POST["name"]; + $ville = $_POST["ville"]; + $entreprise = $_POST["entreprise"]; + $profilRecherche = $_POST["profilRecherche"]; + $mail = $_POST["mail"]; + $num = $_POST["num"]; + $site = $_POST["site"]; + $exp = $_POST["choixExp"]; + $typeContrat = $_POST["typeContrat"]; + $niveauEtudes = $_POST["education"]; + $date = new \DateTime(); + + if(isset($_POST["fullRemote"])) + { + $remote = true; + } + else $remote = false; + + // à la place de NULL passer id utilisateur créateur offre + $offre = new Offre($this->offreGw->getNewId(), + new Alumni(intval($_SESSION['id']),"test.mail@icloud.fr","",$_SESSION['role'],$_SESSION['nom'],$_SESSION['prenom']), + $nom, + $desc, + $img, + $logo, + $typeContrat, + $ville, + $entreprise, + $descposte, + $profilRecherche, + $exp, + $niveauEtudes, + $mail, + $num, + $site, + $remote, + $date); + + $this->offreGw->addOffers($offre); + + return $offre; + } + + public function deleteOffer(Offre $offre) + { + $this->offreGw->deleteOffer($offre->getId()); + ImageManager::deleteImg($offre->getImg()); + ImageManager::deleteImg($offre->getLogo()); + + } + + } \ No newline at end of file diff --git a/php/src/modele/OffreModele.php b/php/src/modele/OffreModele.php deleted file mode 100644 index d37c17a..0000000 --- a/php/src/modele/OffreModele.php +++ /dev/null @@ -1,145 +0,0 @@ -offreGw = new OffreGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); - } - - public function publishOffer(string $img, string $logo) - { - $desc = $_POST["description"]; - $descposte = $_POST["descriptPoste"]; - $nom = $_POST["name"]; - $ville = $_POST["ville"]; - $entreprise = $_POST["entreprise"]; - $profilRecherche = $_POST["profilRecherche"]; - $mail = $_POST["mail"]; - $num = $_POST["num"]; - $site = $_POST["site"]; - $exp = $_POST["choixExp"]; - $typeContrat = $_POST["typeContrat"]; - $niveauEtudes = $_POST["education"]; - $date = new \DateTime(); - - if(isset($_POST["fullRemote"])) - { - $remote = true; - } - else $remote = false; - - // à la place de NULL passer id utilisateur créateur offre - $offre = new Offre($this->offreGw->getNewId(), - new Alumni("test.mail@icloud.fr","password","admin","prenom","nom"), - $nom, - $desc, - $img, - $logo, - $typeContrat, - $ville, - $entreprise, - $descposte, - $profilRecherche, - $exp, - $niveauEtudes, - $mail, - $num, - $site, - $remote, - $date); - - $this->offreGw->addOffers($offre); - - return $offre; - - } - public function getOffers() : array - { - $res = $this->offreGw->getOffers(); - $offers = $this->CreateOffersFromGw($res); - return $offers; - } - - - public function getOfferFromId(int $id) : ?Offre - { - $res = $this->offreGw->getOfferFromId($id); - if($res != null) - return $this->CreateOffersFromGw($res)[0]; - return null; - } - - public function CreateOffersFromGw($res) : array - { - $alGw = new AlumniGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); - - $offers=[]; - foreach ($res as $row) - { - $resal = $alGw->ObtenirById($row['offreur']); - $profilGw = new ProfilGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); - $resProfl = $profilGw->getProfilById($row['offreur']); - - $alumni = new Alumni($resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role'],$resProfl[0]['nom'],$resProfl[0]["prenom"]); - - $date = \DateTime::createFromFormat('Y-m-d', $row['date']); - - $offers[]=new Offre( - $row['id'], - $alumni, - $row['titre'], - $row['description'], - $row["image"], - $row["logo"], - $row['typeContrat'], - $row['ville'], - $row["entreprise"], - $row['descriptifPoste'], - $row['profil'], - $row['experience'], - $row['niveauEtudes'], - $row['mailContact'], - $row['numero'], - $row['websiteURL'], - $row['remote'], - $date); - } - - - return $offers; - } - - public function getOfferLimit($start, $nbOffers): array - { - $res = $this->offreGw->getOfferLimit($start, $nbOffers); - return $this->CreateOffersFromGw($res); - } - - public function getNbOffers() : int - { - return $this->offreGw->getNbOffers(); - } - - - - public function getOffersWithFilters($params) : array - { - return $this->offreGw->getOffersWithFilters($params); - } - -} \ No newline at end of file diff --git a/php/src/modele/UtilisateurModele.php b/php/src/modele/UtilisateurModele.php index bdea578..93ff4e4 100755 --- a/php/src/modele/UtilisateurModele.php +++ b/php/src/modele/UtilisateurModele.php @@ -3,19 +3,27 @@ namespace App\modele; use App\gateway\Connection; use App\gateway\EvenementGateway; +use App\gateway\OffreGateway; use App\metier\Evenement; use App\metier\Alumni; use App\gateway\AlumniGateway; use App\gateway\ProfilGateway; +use App\metier\Profil; +use App\metier\Offre; class UtilisateurModele { private $con; + protected $offreGw; + protected $eventGw; + public function __construct() { $this->con = new Connection(DB_HOST,DB_USER,DB_PASS); + $this->offreGw = new OffreGateway($this->con); + $this->eventGw = new EvenementGateway($this->con); } /** @@ -25,18 +33,18 @@ class UtilisateurModele * @return Alumni */ - public function connection(string $email, string $mdp) : ? Alumni - { - $con = new Connection(DB_HOST,DB_USER,DB_PASS); - $gate = new AlumniGateway($con); - // Récupérez l'utilisateur avec l'email donné en utilisant AlumniGateway + public function connection(string $email, string $mdp): ?Alumni + { + $con = new Connection(DB_HOST, DB_USER, DB_PASS); + $gate = new AlumniGateway($con); + + // Récupation de l'utilisateur avec l'email $utilisateur = $gate->findByEmail($email); - if ($utilisateur instanceof Alumni) { - // L'utilisateur existe, vérifiez le mot de passe - if (password_verify($mdp, $utilisateur->getPassword())) { + if (isset($utilisateur[0])) { + // L'utilisateur existe, vérification du mot de passe + if (password_verify($mdp, $utilisateur[0]['mdp'])) { // Le mot de passe est correct, retournez l'utilisateur - session_start(); - return $utilisateur; + return new Alumni($utilisateur[0]['id'],$utilisateur[0]['mail'], $utilisateur[0]['mdp'], $utilisateur[0]['role'],$utilisateur[0]['nom'],$utilisateur[0]['prenom']); } else { // Le mot de passe est incorrect, renvoyez null return null; @@ -45,7 +53,7 @@ class UtilisateurModele // L'utilisateur n'existe pas, renvoyez null return null; } - } + } /** * @description s'inscrire @@ -55,41 +63,41 @@ class UtilisateurModele * @return \Alumni chargé */ - public function inscription(string $prenom, string $nom,string $email, string $hashpassword):? Alumni - { - $role = "Membre"; - $con = new Connection(DB_HOST,DB_USER,DB_PASS); - $gate = new AlumniGateway($con); - $profilGate = new ProfilGateway($con); - // Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway - if ($gate->insert($email, $hashpassword, $role)) { - $alumni = $gate->getID($email); - if($profilGate->insert($alumni,$nom, $prenom,$email)){ - // L'insertion a réussi, retournez le nouvel utilisateur - $nouvelUtilisateur = new Alumni($email, $hashpassword, $role,$nom,$prenom); - return $nouvelUtilisateur; - } - return null; - } else { - // L'insertion a échoué, renvoyez un utilisateur vide pour indiquer l'échec - return null; - } - } - - public function getUtilisateurByEmail(string $email) - { - $con = new Connection(DB_HOST,DB_USER,DB_PASS); - $gate = new AlumniGateway($con); - // Récupérez l'utilisateur avec l'email donné en utilisant AlumniGateway - $utilisateur = $gate->findByEmail($email); - if ($utilisateur instanceof Alumni) { - // L'utilisateur existe, retournez-le - return $utilisateur; - } else { - // L'utilisateur n'existe pas, renvoyez null - return null; - } - } + public function inscription(string $prenom, string $nom, string $email, string $hashpassword): ?Alumni + { + $role = "Membre"; + $con = new Connection(DB_HOST, DB_USER, DB_PASS); + $gate = new AlumniGateway($con); + $profilGate = new ProfilGateway($con); + // Insérez le nouvel utilisateur dans la base de données en utilisant AlumniGateway + if ($gate->insert($email, $hashpassword, $role)) { + $id = $gate->getID($email); + if ($profilGate->insert($id, $nom, $prenom, $email)) { + // L'insertion a réussi, retournez le nouvel utilisateur + $nouvelUtilisateur = new Alumni($id, $email, $hashpassword, $role, $nom, $prenom); + return $nouvelUtilisateur; + } + return null; + } else { + // L'insertion a échoué, renvoyez un utilisateur vide pour indiquer l'échec + return null; + } + } + + public function getUtilisateurByEmail(string $email) + { + $con = new Connection(DB_HOST, DB_USER, DB_PASS); + $gate = new AlumniGateway($con); + // Récupérez l'utilisateur avec l'email donné en utilisant AlumniGateway + $utilisateur = $gate->findByEmail($email); + if (isset($utilisateur[0])) { + // L'utilisateur existe, retournez-le + return new Alumni($utilisateur[0]['id'],$utilisateur[0]['mail'], $utilisateur[0]['mdp'], $utilisateur[0]['role'],$utilisateur[0]['nom'],$utilisateur[0]['prenom']); + } else { + // L'utilisateur n'existe pas, renvoyez null + return null; + } + } public function getEvenement() : array { @@ -99,8 +107,7 @@ class UtilisateurModele $evenement = array(); - foreach($data as $row) - { + foreach ($data as $row) { $evenement[] = new Evenement( $row['id'], $row['organisateur'], @@ -114,29 +121,6 @@ class UtilisateurModele return $evenement; } - public function ajouterEvenement(string $titre, string $description, string $date, int $nbPlaceMax, string $img) - { - $gate = new EvenementGateway($this->con); - - $evenement = new Evenement( - $gate->getNewId(), - '1', //TODO : Ajouter l'ID de l'admin connecté - $titre, - $description, - $date, - $nbPlaceMax, - $img - ); - - $gate->insertEvenement($evenement); - } - - public function deleteEvenement(int $id) - { - $gate = new EvenementGateway($this->con); - $gate->deleteEvenement($id); - } - public function getEvenementById(int $id) : Evenement { $gate = new EvenementGateway($this->con); @@ -179,4 +163,112 @@ class UtilisateurModele return $evenement; } -} \ No newline at end of file + + public function getProfilByPage(string $page, int $nbParPage) + { + $page = max(1, intval($page)); + $con = new Connection(DB_HOST, DB_USER, DB_PASS); + $gate = new ProfilGateway($con); + $data = $gate->userByPage($page, $nbParPage); + if(isset($data)){ + //Création d'une liste d'objets utilisateurs + $profils = array(); + foreach ($data as $row) { + $profils[] = new Profil( + $row['alumni'], + $row['nom'], + $row['prenom'], + $row['email'], + $row['image'] ?? null, + $row['cv'] ?? '', + $row['linkedinURL'] ?? '', + $row['githubURL'] ?? '', + $row['portfolioURL'] ?? '' + ); + } + return $profils; + } + return null; + } + + + public function getOfferFromId(int $id) : ?Offre + { + $res = $this->offreGw->getOfferFromId($id); + if($res != null) + return $this->CreateOffersFromGw($res)[0]; + return null; + } + + + + + public function CreateOffersFromGw($res) : array + { + $alGw = new AlumniGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); + + $offers=[]; + foreach ($res as $row) + { + $resal = $alGw->ObtenirById($row['offreur']); + + $profilGw = new ProfilGateway(new Connection(DB_HOST,DB_USER,DB_PASS)); + $resProfl = $profilGw->getProfilById($resal[0]['id']); + + $alumni = new Alumni(intval($resal[0]['id']),$resal[0]['mail'],$resal[0]['mdp'],$resal[0]['role'],$resProfl[0]['nom'],$resProfl[0]["prenom"]); + + $date = \DateTime::createFromFormat('Y-m-d', $row['date']); + + $offers[]=new Offre( + $row['id'], + $alumni, + $row['titre'], + $row['description'], + $row["image"], + $row["logo"], + $row['typeContrat'], + $row['ville'], + $row["entreprise"], + $row['descriptifPoste'], + $row['profil'], + $row['experience'], + $row['niveauEtudes'], + $row['mailContact'], + $row['numero'], + $row['websiteURL'], + $row['remote'], + $date); + } + + + return $offers; + } + + public function getOfferLimit($start, $nbOffers): array + { + $res = $this->offreGw->getOfferLimit($start, $nbOffers); + return $this->CreateOffersFromGw($res); + } + + public function getNbOffers() : int + { + return $this->offreGw->getNbOffers(); + } + + public function getOffersWithFilters($params) : array + { + return $this->CreateOffersFromGw($this->offreGw->getOffersWithFilters($params)); + } + + public function getOffers() : array + { + $res = $this->offreGw->getOffers(); + $offers = $this->CreateOffersFromGw($res); + return $offers; + } + + public function getNbTotalPages() + { + return $this->offreGw->getNbTotalPages(); + } +} diff --git a/php/src/router/AltoRouter.php b/php/src/router/AltoRouter.php new file mode 100644 index 0000000..3f7c952 --- /dev/null +++ b/php/src/router/AltoRouter.php @@ -0,0 +1,304 @@ + + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +*/ + +class AltoRouter +{ + + /** + * @var array Array of all routes (incl. named routes). + */ + protected $routes = []; + + /** + * @var array Array of all named routes. + */ + protected $namedRoutes = []; + + /** + * @var string Can be used to ignore leading part of the Request URL (if main file lives in subdirectory of host) + */ + protected $basePath = ''; + + /** + * @var array Array of default match types (regex helpers) + */ + protected $matchTypes = [ + 'i' => '[0-9]++', + 'a' => '[0-9A-Za-z]++', + 'h' => '[0-9A-Fa-f]++', + '*' => '.+?', + '**' => '.++', + '' => '[^/\.]++' + ]; + + /** + * Create router in one call from config. + * + * @param array $routes + * @param string $basePath + * @param array $matchTypes + * @throws Exception + */ + public function __construct(array $routes = [], $basePath = '', array $matchTypes = []) + { + $this->addRoutes($routes); + $this->setBasePath($basePath); + $this->addMatchTypes($matchTypes); + } + + /** + * Retrieves all routes. + * Useful if you want to process or display routes. + * @return array All routes. + */ + public function getRoutes() + { + return $this->routes; + } + + /** + * Add multiple routes at once from array in the following format: + * + * $routes = [ + * [$method, $route, $target, $name] + * ]; + * + * @param array $routes + * @return void + * @author Koen Punt + * @throws Exception + */ + public function addRoutes($routes) + { + if (!is_array($routes) && !$routes instanceof Traversable) { + throw new RuntimeException('Routes should be an array or an instance of Traversable'); + } + foreach ($routes as $route) { + call_user_func_array([$this, 'map'], $route); + } + } + + /** + * Set the base path. + * Useful if you are running your application from a subdirectory. + * @param string $basePath + */ + public function setBasePath($basePath) + { + $this->basePath = $basePath; + } + + /** + * Add named match types. It uses array_merge so keys can be overwritten. + * + * @param array $matchTypes The key is the name and the value is the regex. + */ + public function addMatchTypes(array $matchTypes) + { + $this->matchTypes = array_merge($this->matchTypes, $matchTypes); + } + + /** + * Map a route to a target + * + * @param string $method One of 5 HTTP Methods, or a pipe-separated list of multiple HTTP Methods (GET|POST|PATCH|PUT|DELETE) + * @param string $route The route regex, custom regex must start with an @. You can use multiple pre-set regex filters, like [i:id] + * @param mixed $target The target where this route should point to. Can be anything. + * @param string $name Optional name of this route. Supply if you want to reverse route this url in your application. + * @throws Exception + */ + public function map($method, $route, $target, $name = null) + { + + $this->routes[] = [$method, $route, $target, $name]; + + if ($name) { + if (isset($this->namedRoutes[$name])) { + throw new RuntimeException("Can not redeclare route '{$name}'"); + } + $this->namedRoutes[$name] = $route; + } + + return; + } + + /** + * Reversed routing + * + * Generate the URL for a named route. Replace regexes with supplied parameters + * + * @param string $routeName The name of the route. + * @param array @params Associative array of parameters to replace placeholders with. + * @return string The URL of the route with named parameters in place. + * @throws Exception + */ + public function generate($routeName, array $params = []) + { + + // Check if named route exists + if (!isset($this->namedRoutes[$routeName])) { + throw new RuntimeException("Route '{$routeName}' does not exist."); + } + + // Replace named parameters + $route = $this->namedRoutes[$routeName]; + + // prepend base path to route url again + $url = $this->basePath . $route; + + if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { + foreach ($matches as $index => $match) { + list($block, $pre, $type, $param, $optional) = $match; + + if ($pre) { + $block = substr($block, 1); + } + + if (isset($params[$param])) { + // Part is found, replace for param value + $url = str_replace($block, $params[$param], $url); + } elseif ($optional && $index !== 0) { + // Only strip preceding slash if it's not at the base + $url = str_replace($pre . $block, '', $url); + } else { + // Strip match block + $url = str_replace($block, '', $url); + } + } + } + + return $url; + } + + /** + * Match a given Request Url against stored routes + * @param string $requestUrl + * @param string $requestMethod + * @return array|boolean Array with route information on success, false on failure (no match). + */ + public function match($requestUrl = null, $requestMethod = null) + { + + $params = []; + + // set Request Url if it isn't passed as parameter + if ($requestUrl === null) { + $requestUrl = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '/'; + } + + // strip base path from request url + $requestUrl = substr($requestUrl, strlen($this->basePath)); + + // Strip query string (?a=b) from Request Url + if (($strpos = strpos($requestUrl, '?')) !== false) { + $requestUrl = substr($requestUrl, 0, $strpos); + } + + $lastRequestUrlChar = $requestUrl ? $requestUrl[strlen($requestUrl)-1] : ''; + + // set Request Method if it isn't passed as a parameter + if ($requestMethod === null) { + $requestMethod = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : 'GET'; + } + + foreach ($this->routes as $handler) { + list($methods, $route, $target, $name) = $handler; + + $method_match = (stripos($methods, $requestMethod) !== false); + + // Method did not match, continue to next route. + if (!$method_match) { + continue; + } + + if ($route === '*') { + // * wildcard (matches all) + $match = true; + } elseif (isset($route[0]) && $route[0] === '@') { + // @ regex delimiter + $pattern = '`' . substr($route, 1) . '`u'; + $match = preg_match($pattern, $requestUrl, $params) === 1; + } elseif (($position = strpos($route, '[')) === false) { + // No params in url, do string comparison + $match = strcmp($requestUrl, $route) === 0; + } else { + // Compare longest non-param string with url before moving on to regex + // Check if last character before param is a slash, because it could be optional if param is optional too (see https://github.com/dannyvankooten/AltoRouter/issues/241) + if (strncmp($requestUrl, $route, $position) !== 0 && ($lastRequestUrlChar === '/' || $route[$position-1] !== '/')) { + continue; + } + + $regex = $this->compileRoute($route); + $match = preg_match($regex, $requestUrl, $params) === 1; + } + + if ($match) { + if ($params) { + foreach ($params as $key => $value) { + if (is_numeric($key)) { + unset($params[$key]); + } + } + } + + return [ + 'target' => $target, + 'params' => $params, + 'name' => $name + ]; + } + } + + return false; + } + + /** + * Compile the regex for a given route (EXPENSIVE) + * @param $route + * @return string + */ + protected function compileRoute($route) + { + if (preg_match_all('`(/|\.|)\[([^:\]]*+)(?::([^:\]]*+))?\](\?|)`', $route, $matches, PREG_SET_ORDER)) { + $matchTypes = $this->matchTypes; + foreach ($matches as $match) { + list($block, $pre, $type, $param, $optional) = $match; + + if (isset($matchTypes[$type])) { + $type = $matchTypes[$type]; + } + if ($pre === '.') { + $pre = '\.'; + } + + $optional = $optional !== '' ? '?' : null; + + //Older versions of PCRE require the 'P' in (?P) + $pattern = '(?:' + . ($pre !== '' ? $pre : null) + . '(' + . ($param !== '' ? "?P<$param>" : null) + . $type + . ')' + . $optional + . ')' + . $optional; + + $route = str_replace($block, $pattern, $route); + } + } + return "`^$route$`u"; + } +} diff --git a/php/templates/OffersList.html b/php/templates/OffersList.html index c86f465..b5481c0 100644 --- a/php/templates/OffersList.html +++ b/php/templates/OffersList.html @@ -5,7 +5,7 @@ Alica - Offres - +
@@ -14,13 +14,15 @@
- Publier une offre + {% if role == 'Membre' or role == 'Admin' %} + Publier une offre + {% endif %}
-
+

Filtrer les offres

@@ -43,8 +45,6 @@
- -
@@ -79,7 +79,7 @@
@@ -87,47 +87,60 @@

Offres d'emploi

+{% if msg %} +

{{ msg }}

+{% endif %}
- {% for offre in offres %} -
-
- logo -

{{ offre.getNom() }}

-
-
-

Julien Martin | {{ offre.getDateStringFr()}}

-

{{ offre.getDescription() }}

-
-
- location -

{{offre.getVille()}}

-
- -
+ {% if offres %} + {% for offre in offres %} +
+
+ logo +

{{ offre.getNom() }}

+
+
+

{{offre.getOffreur().Prenom()}}, {{offre.getOffreur().getNom() }} | {{ offre.getDateStringFr()}}

+

{{ offre.getDescription() }}

+
- {% endfor %} +
+ location +

{{offre.getVille()}}

+
+
+ + {% if role == 'Admin' or id == offre.getOffreur().getId() %} + + {% endif %} +
+
+ {% endfor %} + {% else %} +
  • Aucune offre trouvée.
  • + {% endif %} @@ -136,8 +149,6 @@ - - diff --git a/php/templates/Offre.html b/php/templates/Offre.html deleted file mode 100644 index 7211ce4..0000000 --- a/php/templates/Offre.html +++ /dev/null @@ -1,10 +0,0 @@ - - - - - Offre {{ offre.getNom() }} - - - - - \ No newline at end of file diff --git a/php/templates/OffreDetailTest.html b/php/templates/OffreDetailTest.html index e404b79..ee55360 100644 --- a/php/templates/OffreDetailTest.html +++ b/php/templates/OffreDetailTest.html @@ -9,23 +9,28 @@
    - {% include "menu.html" %}

    Détails de l'Offre

    +
      - -
    • Logo -
    • Offer Image
    • + + + {% if role == 'Admin' or id == offre.getOffreur().getId() %} + + {% endif %} + Logo +
    • Offer Image
    • -
    • Offreur: {{ offre.getOffreur().getNom() }}
    • +
    • Offreur: {{offre.getOffreur().Prenom()}} {{offre.getOffreur().getNom() }}
    • Nom de l'offre: {{ offre.getNom() }}
    • Entreprise : {{ offre.getEntreprise() }}
    • Description: {{ offre.getDescription() }}
    • Type de contrat: {{ offre.getTypeContrat() }}
    • Niveau d'études : {{ offre.getNiveauEtudes() }}
    • +
    • Experience Recherchée : {{ offre.getExperience() }}
    • Ville: {{ offre.getVille() }}
    • Date de publication: {{ offre.getDateStringFr() }}
    • Descriptif Poste : {{ offre.getDescriptifPoste() }}
    • @@ -33,7 +38,6 @@
    • Site de L'annonce : {{ offre.getSiteUrl() }}
    • Mail de Contact : : {{ offre.getMailContact() }}
    • Numéro de Contact : {{ offre.getNumero() }}
    • -
    • Full Remote : {% if offre.isRemote() %} diff --git a/php/templates/accueil.html b/php/templates/accueil.html index b6118c7..3f66900 100755 --- a/php/templates/accueil.html +++ b/php/templates/accueil.html @@ -1,40 +1,108 @@ - - - - - Alica - Accueil - - - - -
      - {% include 'menu.html' %} -
      -

      Accueil

      - -

      {% if prenom and nom %} - Bienvenue, {{ prenom }} {{ nom }}! - {% else %} - Bienvenue, invité! - {% endif %}

      -

      Vous êtes sur la page d'accueil

      + + + + + + Alica - Accueil + + +
      + {% include 'menu.html' %} +
      + +
      +

      Accueil

      +

      + {% if prenom and nom %} + Bienvenue, {{ prenom }} {{ nom }} {{id}} {{role}}! + {% else %} + Bienvenue, invité! + {% endif %} +

      + {% if dVueErreur is not empty %} -
      -
      -
      -
        - {% for erreur in dVueErreur %} -
      • {{ erreur }}
      • - {% endfor %} -
      +
      +
        + {% for erreur in dVueErreur %} +
      • {{ erreur }}
      • + {% endfor %} +
      +
      + {% endif %} + +
      +
      +
      - {% endif %} + + + {% include 'footer.html' %} + + + + + + + + + diff --git a/php/templates/connection.html b/php/templates/connection.html index c199201..577551e 100755 --- a/php/templates/connection.html +++ b/php/templates/connection.html @@ -4,11 +4,16 @@ Alica - Connexion - + + +{% if msg %} +

      {{msg}}

      +{% endif %} +
      - +

      Connexion

      Identifiant @@ -37,9 +42,7 @@
      -
      - -
      + S'inscrire
      {% if dVueErreur is not empty %} diff --git a/php/templates/CreerOffre.html b/php/templates/createOffer.html similarity index 98% rename from php/templates/CreerOffre.html rename to php/templates/createOffer.html index 8a1e867..3f49216 100644 --- a/php/templates/CreerOffre.html +++ b/php/templates/createOffer.html @@ -15,7 +15,7 @@

      Publier Une Offre

      -
      + {% if tabError is defined %} {% for error in tabError %} diff --git a/php/templates/creerEvenement.html b/php/templates/creerEvenement.html index 7b7b28d..e64dc2c 100644 --- a/php/templates/creerEvenement.html +++ b/php/templates/creerEvenement.html @@ -9,7 +9,7 @@

      Créer un Événement

      - +
      @@ -33,6 +33,7 @@
      +

      Les images doivent être de type png, jpg, jpeg, bmp, webp & inférieures à 10MB

      diff --git a/php/templates/creerOffre.html b/php/templates/creerOffre.html deleted file mode 100644 index 8a1e867..0000000 --- a/php/templates/creerOffre.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - Publier une Offre - - - - - -
      - {% include "menu.html" %} -
      - -
      -

      Publier Une Offre

      - - - - {% if tabError is defined %} - {% for error in tabError %} -

      {{ error }}

      - {% endfor %} - {% endif %} - - -

      Les champs contenant des astrérisques * sont obligatoires.

      -
      - - -
      - -
      - - -
      - - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - -
      - - -
      - - - - - - -

      Les images doivent être de type png, jpg, jpeg, bmp, webp & inférieures à 10MB

      - - -
      - - - - - - - - - diff --git a/php/templates/detailEvenement.html b/php/templates/detailEvenement.html index fd9e78d..5e1924c 100644 --- a/php/templates/detailEvenement.html +++ b/php/templates/detailEvenement.html @@ -22,9 +22,9 @@

      Organisateur: {{ evenement.organisateurId }}

      Date: {{ evenement.date }}

      Description: {{ evenement.description }}

      - Event Image + Event Image

      Places disponibles: {{ evenement.nbPlaceMax }}

      - Retour + Retour
      {% else %}

      L'événement n'existe pas ou n'est pas disponible.

      diff --git a/php/templates/erreur.html b/php/templates/erreur.html index ea207e5..d8fd4c1 100755 --- a/php/templates/erreur.html +++ b/php/templates/erreur.html @@ -3,25 +3,23 @@ - + Alica - Erreur - - {% include "menu.html" %} +
      + {% include "menu.html" %} +
      +

      Erreur

      {% if dVueErreur is defined %} {% for value in dVueErreur %}

      {{value}}

      {% endfor %} {% endif %} -
      +
      diff --git a/php/templates/evenement.html b/php/templates/evenement.html index 8d45c2e..cc9199e 100644 --- a/php/templates/evenement.html +++ b/php/templates/evenement.html @@ -5,7 +5,7 @@ Liste des Événements - + @@ -15,14 +15,19 @@
      -
      +

      Liste des Événements

      - Publier événement + {% if role == 'Admin' %} + Publier événement + {% else %} +
      +
      + {% endif %}
        @@ -34,15 +39,20 @@

        Organisateur: {{ evenement.getNomOrganisateur() }}

        Date: {{ evenement.date }}

        Description: {{ evenement.description }}

        - {{ evenement.titre }} + {{ evenement.titre }}

        Places disponibles: {{ evenement.nbPlaceMax }}

        - Détails + Détails
      -
      - -
      + {% if role == 'Admin' %} +
      + +
      + {% else %} +
      +
      + {% endif %}
    • {% endfor %} {% else %} diff --git a/php/templates/inscription.html b/php/templates/inscription.html index a22ee4b..b23c9e4 100755 --- a/php/templates/inscription.html +++ b/php/templates/inscription.html @@ -4,11 +4,11 @@ Alica - Inscription - +
      -
      +

      S'inscrire

      Prénom : @@ -18,27 +18,23 @@
      -
      -
    -
    - Nom : -
    -
    -
    -
    -
    -
    - Email -
    -
    - +
    + Nom : +
    +
    + +
    +
    -
    +
    + Email +
    +
    + +
    @@ -62,9 +58,7 @@
    -
    - -
    + Se Connecter
    {% if dVueErreur is not empty %} diff --git a/php/templates/inscription_success.html b/php/templates/inscription_success.html index 3e1f2b3..d3db6a7 100644 --- a/php/templates/inscription_success.html +++ b/php/templates/inscription_success.html @@ -3,7 +3,7 @@ Success - +

    Inscription effectuée avec succès, vous pouvez désormais vous connecter

    @@ -15,7 +15,7 @@
    diff --git a/php/templates/menu.html b/php/templates/menu.html index 3e29b53..95c4c8e 100644 --- a/php/templates/menu.html +++ b/php/templates/menu.html @@ -1,13 +1,13 @@ - +
    diff --git a/php/templates/profil.html b/php/templates/profil.html new file mode 100644 index 0000000..77d41b0 --- /dev/null +++ b/php/templates/profil.html @@ -0,0 +1,74 @@ + + + + + + Profils des Alumnis + + + + +
    + {% include "menu.html" %} +
    +

    Les Alumnis :

    +
    +
    +
    +
    + {% for profil in profils %} +
    +
    + Image de profil +
    +
    +

    {{ profil.prenom }} {{ profil.nom }}

    + {% if profil.experience is defined %} +

    {{ profil.experience }}

    + {% else %} +

    Cet utilisateur n'a pas renseigné son poste

    + {% endif %} + Voir le détail du profil + {% if role == 'Admin' %} + + {% endif %} +
    +
    + {% else %} +

    Aucun profil trouvé.

    + {% endfor %} +
    +
    +
    +
    + + + + + + + + +