Compare commits
31 Commits
AffichageP
...
master
Author | SHA1 | Date |
---|---|---|
Thomas MUZARD | c60f579a25 | 1 year ago |
Clément Verdoire | 776993ce23 | 1 year ago |
Baptiste D | 4c3e3571a9 | 1 year ago |
Baptiste D | 1d3486d9ba | 1 year ago |
Baptiste D | 02048befd8 | 1 year ago |
thomas muzard | 13eb6be744 | 1 year ago |
Baptiste D | e6f5518ebc | 1 year ago |
Baptiste D | 03371c34ad | 1 year ago |
Clément Verdoire | 941296e44c | 1 year ago |
Clément Verdoire | 60dff089bb | 1 year ago |
Baptiste D | ef2ff36190 | 1 year ago |
Baptiste D | 132d41e1db | 1 year ago |
Clément Verdoire | 9176e6cb03 | 1 year ago |
Clément Verdoire | 14479cf2a3 | 1 year ago |
Clément Verdoire | 39bae853c9 | 1 year ago |
Baptiste D | 9271f53d47 | 1 year ago |
Clément Verdoire | 4031f71acb | 1 year ago |
Baptiste D | 406cde7784 | 1 year ago |
Baptiste D | cebb1aac3a | 1 year ago |
Baptiste D | 6aa6dabb26 | 1 year ago |
Leo TUAILLON | 3d0267bb61 | 1 year ago |
Leo TUAILLON | 849663f143 | 1 year ago |
Clément Verdoire | 1e4aaf41b8 | 1 year ago |
Leo TUAILLON | a2f805cba2 | 1 year ago |
Leo TUAILLON | ce5fb022b9 | 1 year ago |
Leo TUAILLON | b5d91b5ac3 | 1 year ago |
Baptiste D | a32a224099 | 1 year ago |
Baptiste D | 090bb42cbd | 1 year ago |
Clément Verdoire | 7f85096c7b | 1 year ago |
Baptiste D | 43729cfd59 | 1 year ago |
Leo TUAILLON | ed00c99894 | 1 year ago |
After Width: | Height: | Size: 100 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 45 KiB |
Before Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 80 KiB |
Before Width: | Height: | Size: 15 KiB |
After Width: | Height: | Size: 74 KiB |
After Width: | Height: | Size: 2.7 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 9.7 KiB |
After Width: | Height: | Size: 70 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 4.6 KiB |
After Width: | Height: | Size: 8.0 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 162 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 3.9 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 22 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 124 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 164 KiB |
After Width: | Height: | Size: 8.8 KiB |
After Width: | Height: | Size: 45 KiB |
After Width: | Height: | Size: 20 KiB |
After Width: | Height: | Size: 3.1 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 149 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 2.5 MiB |
Before Width: | Height: | Size: 467 KiB |
After Width: | Height: | Size: 2.5 MiB |
After Width: | Height: | Size: 34 KiB |
@ -1,36 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace App\controleur;
|
||||
use App\config\Validation;
|
||||
use App\gateway\ImageManager;
|
||||
use App\modele\MembreModele;
|
||||
|
||||
class MembreControleur extends UtilisateurControleur
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
{}
|
||||
|
||||
protected function deconnexion()
|
||||
public function deconnexion()
|
||||
{
|
||||
global $twig;
|
||||
session_unset();
|
||||
session_destroy();
|
||||
echo "on est passes ici";
|
||||
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("OffreDetail.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(NULL);
|
||||
|
||||
}
|
||||
|
||||
protected function modifierProfil()
|
||||
public function proposerOffre()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
||||
protected function signaler()
|
||||
public function consulterProfil()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function modifierProfil()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
public function signaler()
|
||||
{
|
||||
//TODO
|
||||
}
|
||||
|
@ -1,74 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\gateway;
|
||||
|
||||
use App\metier\Image;
|
||||
use PDO;
|
||||
|
||||
class ImageGateway
|
||||
{
|
||||
private Connection $con;
|
||||
|
||||
/**
|
||||
* @param $con
|
||||
*/
|
||||
public function __construct(Connection $con)
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
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 = $_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;
|
||||
$return[]=$name;
|
||||
return $return;
|
||||
} catch (\Exception $e) {
|
||||
$return[] = false;
|
||||
$return[] = "";
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @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";
|
||||
if (file_exists($path)) {
|
||||
unlink($path);
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,30 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\gateway;
|
||||
class ImageSaver
|
||||
{
|
||||
|
||||
public static function getId() : int
|
||||
{
|
||||
return rand(10000,19999);
|
||||
}
|
||||
|
||||
public static function SaveImage(string $filename) : array
|
||||
{
|
||||
try {
|
||||
$return=[];
|
||||
|
||||
$name = substr($_FILES[$filename]["name"], 0, 45);
|
||||
$name = self::getId().$name;
|
||||
|
||||
move_uploaded_file($_FILES[$filename]['tmp_name'], "public/uploads/$name");
|
||||
$return[]=true;
|
||||
$return[]=$name;
|
||||
return $return;
|
||||
} catch (\Exception $e) {
|
||||
$return[] = false;
|
||||
$return[] = "";
|
||||
return $return;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,125 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Publier une Offre</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
{% include "menu.html" %}
|
||||
</header>
|
||||
|
||||
<main class="container mt-4">
|
||||
<h1>Publier Une Offre</h1>
|
||||
|
||||
<form style="background-color: #00DBFF" class="p-4" enctype="multipart/form-data" action="createOffer" method="post">
|
||||
|
||||
{% if tabError is defined %}
|
||||
{% for error in tabError %}
|
||||
<p style="color: red">{{ error }}</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
|
||||
|
||||
<p>Les champs contenant des astrérisques * sont obligatoires.</p>
|
||||
<div class="form-group">
|
||||
<label for="name">Intitulé de l'offre*</label>
|
||||
<input type="text" class="form-control" id="name" name="name" placeholder="Intitulé" maxlength="128" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="entreprise">Nom de l'entreprise :*</label>
|
||||
<input type="text" class="form-control" id="entreprise" name="entreprise" placeholder="Entreprise" maxlength="64" required>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label for="description">Amorce :*</label>
|
||||
<textarea class="form-control" id="description" name="description" placeholder="Description rapide" maxlength="200" required></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-check">
|
||||
<input type="checkbox" class="form-check-input" id="fullRemote" name="fullRemote" >
|
||||
<label class="form-check-label" for="fullRemote">Full Remote</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="ville">Ville</label>
|
||||
<input type="text" class="form-control" id="ville" name="ville" placeholder="Ville" required maxlength="100">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="choixContrat">Choisissez un type de contrat :*</label>
|
||||
<select class="form-control" id="choixContrat" name="typeContrat">
|
||||
<option value="CDI" selected>CDI</option>
|
||||
<option value="CDD">CDD</option>
|
||||
<option value="Alternance">Alternance</option>
|
||||
<option value="Stage">Stage</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="descriptPoste">Descriptif du Poste :*</label>
|
||||
<textarea class="form-control" id="descriptPoste" name="descriptPoste" placeholder="Description du Poste" required maxlength="2028"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="profilRecherche">Profil Recherché :*</label>
|
||||
<textarea class="form-control" id="profilRecherche" name="profilRecherche" placeholder="Profil recherché" required maxlength="2028"></textarea>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="choixExp">Experience Recherchée :*</label>
|
||||
<select class="form-control" id="choixExp" name="choixExp" required>
|
||||
<option value="Indifférent" selected>Indifferent</option>
|
||||
<option value="Junior">Junior</option>
|
||||
<option value="Senior">Senior</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="nivEtudes">Niveau d'études :*</label>
|
||||
<select class="form-control" id="nivEtudes" name="education" required>
|
||||
<option value="Indifférent" selected>Indifferent</option>
|
||||
<option value="Bac+2">Bac+2</option>
|
||||
<option value="Bac+3">Bac+3</option>
|
||||
<option value="Bac+5">Bac+5</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="mail">Email de contact :*</label>
|
||||
<input type="text" class="form-control" id="mail" name="mail" placeholder="Adresse de contact" maxlength="30" required>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="num">Numero de contact :*</label>
|
||||
<input type="text" class="form-control" id="num" name="num" placeholder="Numéro de contact" required maxlength="10">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label for="site">Site web de l'annonce ou entreprise :</label>
|
||||
<input type="text" class="form-control" id="site" name="site" placeholder="Adresse web" maxlength="40" required>
|
||||
</div>
|
||||
|
||||
<label for="image">Image*</label>
|
||||
<input type="file" name="image" id="image" required>
|
||||
<label for="logo">Logo d'entreprise*</label>
|
||||
<input type="file" name="logo" id="logo" required>
|
||||
<input type="submit" value="Publier L'annonce" name="submit" id="submit">
|
||||
<p><i>Les images doivent être de type png, jpg, jpeg, bmp, webp & inférieures à 10MB</i></p>
|
||||
</form>
|
||||
|
||||
</main>
|
||||
|
||||
<!-- scripts : -->
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.5.3/dist/umd/popper.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|