Compare commits

...

5 Commits

BIN
.DS_Store vendored

Binary file not shown.

2
.gitignore vendored

@ -438,4 +438,4 @@ php/composer.lock
php/.idea/
##### Images :
php/public/uploads/
###php/public/uploads/

Binary file not shown.

After

Width:  |  Height:  |  Size: 100 KiB

BIN
php/.DS_Store vendored

Binary file not shown.

@ -12,8 +12,8 @@
}
.custom-button {
background-color: #00DBFF;
border-color: #00DBFF;
background-color: #7fb4bd;
border-color: #7fb4bd;
color: #fff;
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 80 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 124 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 164 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 45 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

@ -38,9 +38,10 @@ class FrontControleur
$router->map('POST','/[a:action]?','UtilisateurControleur');
$router->map('GET','/[a:action]/[i:id]?','UtilisateurControleur');
$router->map('GET|POST','/[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');
@ -59,8 +60,6 @@ class FrontControleur
$id = array();
try{
$twig->render("accueil.html",[]);
if (!$match) {
$dVueErreur[] = "Error 404 Page not found";

@ -78,7 +78,7 @@ class MembreControleur extends UtilisateurControleur
$offre = $mbrModel->publishOffer($saveImg1[1], $saveImg2[1]);
echo $twig->render("OffreDetailTest.html", ['offre' => $offre]);
echo $twig->render("OffreDetail.html", ['offre' => $offre]);
}
else
{
@ -101,17 +101,7 @@ class MembreControleur extends UtilisateurControleur
$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();
}*/
$this->consultOffers(NULL);
}

@ -84,7 +84,7 @@ class UtilisateurControleur
echo $twig->render('inscription.html', ['dVueErreur' => $dVueErreur]);
}
protected function accueil()
public function accueil()
{
global $twig;
// Ajout d'un var_dump pour déboguer
@ -104,6 +104,23 @@ class UtilisateurControleur
echo 'not implemented yet';
}
/**
* @return void
* @description afficher la liste des offres
*/
public function resetFilters()
{
unset($_SESSION["niveauEtudes"]);
unset($_SESSION["typeContrat"]);
unset($_SESSION["experience"]);
$this->consultOffers(null);
}
/**
* @param array|null $params paramètres / filtres de la rehcerhce
* @return void
* @description afficher la liste des offres
*/
public function consultOffers(?array $params)
{
$userMdl = new UtilisateurModele();
@ -117,16 +134,29 @@ class UtilisateurControleur
$nbOffers = 5 ;
if(isset($_POST["niveauEtudes"]) && Validation::validateTypeStudies($_POST["niveauEtudes"])) {
$niveauEtudes = $_POST["niveauEtudes"];
//$niveauEtudes = $_POST["niveauEtudes"];
$_SESSION["niveauEtudes"] = $_POST["niveauEtudes"];
$niveauEtudes = $_SESSION["niveauEtudes"];
}
else if(isset($_SESSION["niveauEtudes"]))
{$niveauEtudes = $_SESSION["niveauEtudes"];}
if(isset($_POST["typeContrat"]) && Validation::validateTypeContract($_POST["typeContrat"])) {
$typeContrat = $_POST["typeContrat"];
//$typeContrat = $_POST["typeContrat"];
$_SESSION["typeContrat"] = $_POST["typeContrat"];
$typeContrat = $_SESSION["typeContrat"];
}
else if(isset($_SESSION["typeContrat"]))
{$typeContrat = $_SESSION["typeContrat"];}
if(isset($_POST["experience"]) && Validation::validateExperience($_POST["experience"])) {
$exp = $_POST["experience"];
//$exp = $_POST["experience"];
$_SESSION["experience"] = $_POST["experience"];
$exp = $_SESSION["experience"];
}
else if(isset($_SESSION["experience"]))
{$exp = $_SESSION["experience"];}
if ($niveauEtudes == null && $typeContrat == null && $exp == null) {
$totalOffers = $userMdl->getNbOffers();
@ -144,8 +174,14 @@ class UtilisateurControleur
$numberPages = ceil($totalOffers / 5);
if (isset($_GET["page"]) && intval($_GET["page"]) != null) {
$page = intval($_GET["page"]);
//var_dump($params);
//echo "page : ".$params["id"];
/*if (isset($params["id"]) && intval($params["id"]) != null)*/
if(isset($_GET['id']) && intval($_GET['id']) != null)
{
$page = intval($_GET['id']);
//echo "page : ".$page;
if ($page > $numberPages || $page < 1) {
$dVueErreur[] = "Page introuvable";
echo $twig->render("erreur.html", ['dVueErreur' => $dVueErreur ]);
@ -182,6 +218,11 @@ class UtilisateurControleur
]);
}
/**
* @param array|null $params paramètres
* @return void
* @description afficher le détail d'une offre
*/
public function displayOffer(?array $params)
{
global $twig;
@ -192,7 +233,7 @@ class UtilisateurControleur
$offre = $uttilsMdl->getOfferFromId(intval($params["id"]));
if($offre != NULL)
{
echo $twig->render("OffreDetailTest.html",['offre' => $offre]);
echo $twig->render("OffreDetail.html",['offre' => $offre]);
return;
}
}
@ -268,6 +309,4 @@ class UtilisateurControleur
echo $twig->render('erreur.html', ['dVueErreur' => $dVueErreur]);
}
}
}

@ -4,18 +4,34 @@ namespace App\gateway;
class ImageManager
{
/**
* @return int id aléatoire
* @description générer un id aléatoire
*/
public static function getId() : int
{
return rand(10000,19999);
}
/**
* @description sauvegarder une image
* @param string $filename
* @return array [bool,string] tableau de retour avec le booléen et le nom de l'image
*/
public static function SaveImage(string $filename) : array
{
try {
$return=[];
$name = substr($_FILES[$filename]["name"], 0, 45);
$name = self::getId().$name;
$name = $_FILES[$filename]["name"];
$path = "public/uploads/".$name;
while(file_exists($path))
{
$name = substr($_FILES[$filename]["name"], 0, 45);
$name = self::getId().$name;
$path = "public/uploads/".$name;
}
move_uploaded_file($_FILES[$filename]['tmp_name'], "public/uploads/$name");
$return[]=true;
@ -28,6 +44,11 @@ class ImageManager
}
}
/**
* @param string $img
* @return bool true si l'image a été supprimée, false sinon
* @description supprimer une image
*/
public static function deleteImg(string $img) : bool
{
$path = "public/uploads/$img";

@ -67,8 +67,11 @@ class MembreModele extends UtilisateurModele
return false;
}
/**
* @param string $img url de l'image
* @param string $logo url du logo
* @description publier une offre
*/
public function publishOffer(string $img, string $logo)
{
$desc = $_POST["description"];
@ -116,6 +119,11 @@ class MembreModele extends UtilisateurModele
return $offre;
}
/**
* @param Offre $offre offre à supprimer
* @description supprimer une offre
* @return void
*/
public function deleteOffer(Offre $offre)
{
$this->offreGw->deleteOffer($offre->getId());

@ -192,6 +192,11 @@ class UtilisateurModele
}
/**
* @param int $id identifiant d'offre
* @return Offre|null offre trouvée
* @description récupérer une offre depuis son id
*/
public function getOfferFromId(int $id) : ?Offre
{
$res = $this->offreGw->getOfferFromId($id);
@ -203,6 +208,11 @@ class UtilisateurModele
/**
* @description créer une offre depuis un tableau de retour de Gw
* @param array $res tableau de retour de Gw
* @return array tableau d'offres
*/
public function CreateOffersFromGw($res) : array
{
$alGw = new AlumniGateway(new Connection(DB_HOST,DB_USER,DB_PASS));
@ -244,22 +254,37 @@ class UtilisateurModele
return $offers;
}
/**
* @param $start int de départ pour la reqûete sql
* @param $nbOffers nombre d'offres à récupérer
* @return array tableau d'offres
*/
public function getOfferLimit($start, $nbOffers): array
{
$res = $this->offreGw->getOfferLimit($start, $nbOffers);
return $this->CreateOffersFromGw($res);
}
/**
* @return int nombre d'offres
*/
public function getNbOffers() : int
{
return $this->offreGw->getNbOffers();
}
/**
* @param $params array filtres de la recherche
* @return array tableau d'offres
*/
public function getOffersWithFilters($params) : array
{
return $this->CreateOffersFromGw($this->offreGw->getOffersWithFilters($params));
}
/**
* @return array tableau de toutes les offres
*/
public function getOffers() : array
{
$res = $this->offreGw->getOffers();

@ -16,6 +16,9 @@
<div>
{% if role == 'Membre' or role == 'Admin' %}
<a href="{{dir}}/user/{{id}}/createOfferForm" type="button" class="btn btn-outline-success mb-4">Publier une offre</a>
{% else %}
<a type="button" class="btn btn-outline-light mb-4">Publier une offre</a>
<p><i>Connectez vous pour publier une offre</i></p>
{% endif %}
</div>
@ -79,7 +82,7 @@
</div>
<div>
<a href="{{dir}}/consultOffers" class="btn btn-info">Réinitialiser les filtres</a>
<a href="{{dir}}/resetFilters" class="btn btn-info">Réinitialiser les filtres</a>
</div>
</div>
@ -107,7 +110,7 @@
</div>
<div class="row3">
<img src="public/assets/location.png" alt="location">
<img src="{{dir}}/public/assets/location.png" alt="location">
<p>{{offre.getVille()}}</p>
</div>
<div class="d-flex justify-content-around">
@ -123,32 +126,28 @@
{% else %}
<li class="list-group-item">Aucune offre trouvée.</li>
{% endif %}
<nav style="text-align: center;">
<nav style="text-align: center;">
{% if numberPages is defined %}
{% if numberPages > 1 %}
{% if currentPage is defined %}
{% for i in 1..numberPages %}
{% if i == currentPage %}
<!--
index.php?action=consultOffers&page={{ i }}&typeContrat={{ typeContrat }}&experience={{ experience }}&niveauEtudes={{ niveauEtudes }}
-->
<a href="{{dir}}/consultOffers?page={{i}}{{valContrat}}{{valExp}}{{ValEtudes}}" class="current">{{ i }}</a>
{% else %}
<a href="{{dir}}/consultOffers?page={{i}}{{valContrat}}{{valExp}}{{ValEtudes}}">{{ i }}</a>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
</nav>
<nav class="pagination justify-content-center">
{% if numberPages is defined %}
{% if numberPages > 1 %}
{% if currentPage is defined %}
{% for i in 1..numberPages %}
{% if i == currentPage %}
<a href="{{ dir }}/consultOffers?id={{ i }}" class="page-item page-link current">{{ i }}</a>
{% else %}
<a href="{{ dir }}/consultOffers?id={{ i }}" class="page-item page-link">{{ i }}</a>
{% endif %}
{% endfor %}
{% endif %}
{% endif %}
{% endif %}
</nav>
</div>
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>

@ -14,6 +14,7 @@
<div class="container mt-5">
<h1 class="display-4">Détails de l'Offre</h1>
<a href="{{dir}}/ConsultOffers" class="btn btn-primary mb-4">Retour</a>
<ul class="list-group">
@ -23,7 +24,6 @@
{% endif %}
<img src="{{dir}}/public/uploads/{{offre.getLogo()}}" alt="Logo" class="img-thumbnail" style="max-height: 50px; max-width: 50px;"></li>
<li class="list-group-item"><img src="{{dir}}/public/uploads/{{offre.getImg()}}" alt="Offer Image" class="img-fluid"></li>
<!--<li class="list-group-item"><strong>ID:</strong> {{ offre.getId() }}</li> -->
<li class="list-group-item"><strong>Offreur:</strong> {{offre.getOffreur().Prenom()}} {{offre.getOffreur().getNom() }}</li>
<li class="list-group-item"><strong>Nom de l'offre:</strong> {{ offre.getNom() }}</li>
<li class="list-group-item"><strong>Entreprise :</strong> {{ offre.getEntreprise() }}</li>
@ -35,7 +35,7 @@
<li class="list-group-item"><strong>Date de publication:</strong> {{ offre.getDateStringFr() }}</li>
<li class="list-group-item"><strong>Descriptif Poste :</strong> {{ offre.getDescriptifPoste() }}</li>
<li class="list-group-item"><strong>Profil recherché :</strong> {{ offre.getProfilSearched() }}</li>
<li class="list-group-item"><strong>Site de L'annonce :</strong> {{ offre.getSiteUrl() }}</li>
<li class="list-group-item"><strong>Site de L'annonce :</strong><a href="{{offre.getSiteUrl()}}" target="_blank">{{ offre.getSiteUrl() }}</a></li>
<li class="list-group-item"><strong>Mail de Contact : :</strong> {{ offre.getMailContact() }}</li>
<li class="list-group-item"><strong>Numéro de Contact :</strong> {{ offre.getNumero() }}</li>
<li class="list-group-item">
Loading…
Cancel
Save