Candidatures dans offres_stages.php
This commit is contained in:
parent
4291b4d425
commit
a0f2225c99
@ -131,7 +131,7 @@
|
||||
|
||||
.flex-row
|
||||
{
|
||||
width: calc(100% / 2);
|
||||
width: calc(100% / 4);
|
||||
text-align: center;
|
||||
padding: 0.2em 0.2em;
|
||||
}
|
||||
@ -227,6 +227,13 @@
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.flex-row-modal
|
||||
{
|
||||
width: calc(100% / 2);
|
||||
text-align: center;
|
||||
padding: 0.2em 0.2em;
|
||||
}
|
||||
|
||||
.close
|
||||
{
|
||||
color: #aaa;
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
var ID_internship=0;
|
||||
|
||||
$(document).ready(function(){
|
||||
$("#li_stages").delay(2000).addClass("hover");
|
||||
|
||||
@ -27,8 +29,10 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
$(".button_postuler").click(function() {
|
||||
$(".modal").show();
|
||||
window.ID_internship = $(this).attr("id_internship");
|
||||
$(".title_modal").html("Postuler pour " + $(this).attr("name_internship"));
|
||||
$(".info_message").hide();
|
||||
$(".modal").show();
|
||||
});
|
||||
|
||||
window.onclick = function(event) {
|
||||
@ -37,6 +41,13 @@ $(document).ready(function(){
|
||||
}
|
||||
}
|
||||
|
||||
$('.form_postuler').on('submit',(function(){
|
||||
check = true;
|
||||
if ($('#cv').get(0).files.length === 0 || $('#lm').get(0).files.length === 0) { check = false; }
|
||||
if (check) {$(".form_postuler").append('<input type="hidden" name="ID_internship" value="'+ window.ID_internship +'">');}
|
||||
return check;
|
||||
|
||||
}));
|
||||
|
||||
|
||||
});
|
||||
@ -25,8 +25,6 @@ if (isset($_SESSION["username"])){
|
||||
$query_candidatures = $bdd->prepare($sql);
|
||||
$query_candidatures->execute(['user' => $_SESSION["username"]]);
|
||||
$results_candidatures = $query_candidatures->fetchALL(PDO::FETCH_OBJ);
|
||||
|
||||
|
||||
?>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@ -60,22 +58,41 @@ if (isset($_SESSION["username"])){
|
||||
<div class="divRight">
|
||||
<table>
|
||||
<div class="table_title">Fichiers en lien avec la candidature:</div>
|
||||
|
||||
<tr>
|
||||
<td>Curriculum Vitae :</td>
|
||||
<td><?= $result->cv_file_path_candidature; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($result->cv_file_path_candidature != "") {echo 'Déposé <i style="color:green;" class="fas fa-check"></i>';}
|
||||
else {echo 'Non disponible <i style="color:red;" class="fas fa-times"></i>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lettre de motivation :</td>
|
||||
<td><?= $result->lm_file_path_candidature; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($result->lm_file_path_candidature != "") {echo 'Déposé <i style="color:green;" class="fas fa-check"></i>';}
|
||||
else {echo 'Non disponible <i style="color:red;" class="fas fa-times"></i>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Fiche de validation :</td>
|
||||
<td><?= $result->validation_form_file_path_candidature; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($result->validation_form_file_path_candidature != "") {echo 'Déposé <i style="color:green;" class="fas fa-check"></i>';}
|
||||
else {echo 'Non disponible <i style="color:red;" class="fas fa-times"></i>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Convention de stage :</td>
|
||||
<td><?= $result->internship_agreement_file_path_candidature; ?></td>
|
||||
<td>
|
||||
<?php
|
||||
if($result->internship_agreement_file_path_candidature != "") {echo 'Déposé <i style="color:green;" class="fas fa-check"></i>';}
|
||||
else {echo 'Non disponible <i style="color:red;" class="fas fa-times"></i>';}
|
||||
?>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
@ -88,7 +105,7 @@ if (isset($_SESSION["username"])){
|
||||
<div class="bubble">
|
||||
<div class="title_bubble">Tout est vide...</div>
|
||||
<div class="text_content">
|
||||
Il n'y a aucun favori dans les parages <i class="fas fa-wind"></i>
|
||||
Vous n'avez aucune candidature en cours <i class="fas fa-wind"></i>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
BIN
controller/0
Normal file
BIN
controller/0
Normal file
Binary file not shown.
50
controller/Postuler.php
Normal file
50
controller/Postuler.php
Normal file
@ -0,0 +1,50 @@
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION["username"])){
|
||||
include "../controller/ConnexionBDD.php";
|
||||
if (!$error) {
|
||||
if (is_uploaded_file($_FILES['cv']['tmp_name']) && is_uploaded_file($_FILES['lm']['tmp_name']) && isset($_POST["ID_internship"])) {
|
||||
$query_ID_user = $bdd->prepare('SELECT ID_user FROM users WHERE username=:user;');
|
||||
$query_ID_user->execute(['user' => $_SESSION["username"]]);
|
||||
$ID_user = $query_ID_user->fetchALL(PDO::FETCH_OBJ)[0]->ID_user;
|
||||
|
||||
$location_cv = "/documents/users/".$ID_user."/candidatures/".$_POST["ID_internship"]."/".$_FILES['cv']['name'];
|
||||
$location_lm = "/documents/users/".$ID_user."/candidatures/".$_POST["ID_internship"]."/".$_FILES['lm']['name'];
|
||||
|
||||
echo $location_cv;
|
||||
echo "<br>";
|
||||
echo $location_lm;
|
||||
|
||||
try {
|
||||
if (!is_dir('../documents/')){
|
||||
mkdir("../documents/", 0700);
|
||||
}
|
||||
if (!is_dir('../documents/users')){
|
||||
mkdir("../documents/users", 0700);
|
||||
}
|
||||
if (!is_dir("../documents/users/".$ID_user."/")){
|
||||
mkdir("../documents/users/".$ID_user."/", 0700);
|
||||
}
|
||||
if (!is_dir("../documents/users/".$ID_user."/"."candidatures/")){
|
||||
mkdir("../documents/users/".$ID_user."/"."candidatures/", 0700);
|
||||
}
|
||||
if (!is_dir("../documents/users/".$ID_user."/"."candidatures/".$_POST["ID_internship"])){
|
||||
mkdir("../documents/users/".$ID_user."/"."candidatures/".$_POST["ID_internship"], 0700);
|
||||
}
|
||||
|
||||
move_uploaded_file($_FILES['cv']['tmp_name'], "..".$location_cv);
|
||||
move_uploaded_file($_FILES['lm']['tmp_name'], "..".$location_lm);
|
||||
|
||||
$query_ID_user = $bdd->prepare('INSERT INTO candidatures VALUES (NULL, "1", :location_cv, :location_lm, NULL, NULL, :ID_user, :ID_internship);');
|
||||
$query_ID_user->execute(['location_cv' => $location_cv, 'location_lm' => $location_lm, 'ID_user' => $ID_user, 'ID_internship' => $_POST["ID_internship"]]);
|
||||
|
||||
echo "<script>location.href='/offres_stages.php';</script>";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo "zut une erreur";
|
||||
}
|
||||
} else {echo "POST file incomplet";}
|
||||
}
|
||||
}
|
||||
?>
|
||||
BIN
documents/users/1/candidatures/2/CV.pdf
Normal file
BIN
documents/users/1/candidatures/2/CV.pdf
Normal file
Binary file not shown.
BIN
documents/users/1/candidatures/2/LM.pdf
Normal file
BIN
documents/users/1/candidatures/2/LM.pdf
Normal file
Binary file not shown.
@ -4,7 +4,7 @@
|
||||
session_start();
|
||||
|
||||
if (isset($_SESSION["username"])){
|
||||
$sql = 'SELECT ID_internship ,name_internship, description_internship, duration_internship, remuneration_internship, offer_date_internship, place_number_internship, competences_internship, city_localisation, postal_code_localisation, GROUP_CONCAT(name_promotion SEPARATOR ", ") AS "name_promotion", name_company, note FROM internships NATURAL JOIN localisations NATURAL JOIN companies NATURAL JOIN internship_for_promo NATURAL JOIN promotions NATURAL JOIN evaluate INNER JOIN users ON evaluate.ID_user=users.ID_user NATURAL JOIN roles WHERE name_role="Pilote" AND visibility_company="O"';
|
||||
$sql = 'SELECT ID_internship ,name_internship, description_internship, duration_internship, remuneration_internship, offer_date_internship, place_number_internship, competences_internship, city_localisation, postal_code_localisation, GROUP_CONCAT(name_promotion SEPARATOR ", ") AS "name_promotion", name_company, email_company, email_company, note FROM internships NATURAL JOIN localisations NATURAL JOIN companies NATURAL JOIN internship_for_promo NATURAL JOIN promotions NATURAL JOIN evaluate INNER JOIN users ON evaluate.ID_user=users.ID_user NATURAL JOIN roles WHERE name_role="Pilote" AND visibility_company="O"';
|
||||
$params = [];
|
||||
$selected = [];
|
||||
if (isset($_GET["localisation"]) && isset($_GET["competences"]) && isset($_GET["confiance"]) && isset($_GET["dateoffre"]) && isset($_GET["duree"]) && isset($_GET["promotion"])){
|
||||
@ -85,6 +85,14 @@ if (isset($_SESSION["username"])){
|
||||
foreach ($results_wishlist as $result) {
|
||||
array_push($wishlist, $result->ID_internship);
|
||||
}
|
||||
|
||||
$query_candidatures = $bdd->prepare('SELECT candidatures.ID_internship FROM candidatures NATURAL JOIN users INNER JOIN internships ON candidatures.ID_internship=internships.ID_internship WHERE username=:user;');
|
||||
$query_candidatures->execute(['user' => $_SESSION["username"]]);
|
||||
$results_candidatures = $query_candidatures->fetchALL(PDO::FETCH_OBJ);
|
||||
$candidatures = [];
|
||||
foreach ($results_candidatures as $result) {
|
||||
array_push($candidatures, $result->ID_internship);
|
||||
}
|
||||
?>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@ -96,17 +104,17 @@ if (isset($_SESSION["username"])){
|
||||
<div id="modal_postuler" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<div class="title_modal">Postuler pour </div>
|
||||
<form class="form_postuler" method="post" enctype="multipart/form-data">
|
||||
<div class="title_modal"></div>
|
||||
<form class="form_postuler" action="controller/Postuler.php" method="post" enctype="multipart/form-data">
|
||||
<div class="table-container">
|
||||
<div class="info_message"></div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Curriculum Vitae</div>
|
||||
<div class="flex-row value"><input id="cv" type="file" name="cv" require></div>
|
||||
<div class="flex-row-modal name">Curriculum Vitae</div>
|
||||
<div class="flex-row-modal value"><input id="cv" type="file" name="cv" require></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Lettre de motivation</div>
|
||||
<div class="flex-row value"><input id="lm" type="file" name="lm" require></div>
|
||||
<div class="flex-row-modal name">Lettre de motivation</div>
|
||||
<div class="flex-row-modal value"><input id="lm" type="file" name="lm" require></div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit">Envoyer</button>
|
||||
@ -230,7 +238,7 @@ if (isset($_SESSION["username"])){
|
||||
<div class="name_company">
|
||||
<?= $result->name_company; ?>
|
||||
</div>
|
||||
<?= $result->city_localisation; ?> <?= $result->postal_code_localisation; ?>
|
||||
<?= $result->city_localisation; ?> <?= $result->postal_code_localisation; ?> - <?= $result->email_company; ?>
|
||||
<div class="description">
|
||||
<?= $result->description_internship; ?>
|
||||
</div>
|
||||
@ -274,8 +282,14 @@ if (isset($_SESSION["username"])){
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div class="button">
|
||||
<button id="button_postuler<?=$result->ID_internship?>" class="button_postuler">Postuler</button>
|
||||
<?php
|
||||
if (!in_array($result->ID_internship, $candidatures)) { ?>
|
||||
<button class="button_postuler" name_internship="<?=$result->name_internship;?>" id_internship="<?=$result->ID_internship?>">Postuler</button>
|
||||
<?php } else { ?>
|
||||
<button class="button_postuler" disabled>Déjà postulé</button>
|
||||
<?php } ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
43
test2.php
43
test2.php
@ -1,20 +1,35 @@
|
||||
<html>
|
||||
<body>
|
||||
<?php
|
||||
session_start();
|
||||
|
||||
/* Get the name of the file uploaded to Apache */
|
||||
$filename = $_FILES['file']['name'];
|
||||
if (isset($_SESSION["username"])){
|
||||
include "controller/ConnexionBDD.php";
|
||||
if (!$error) {
|
||||
$query_ID_user = $bdd->prepare('SELECT ID_user FROM users WHERE username=:user;');
|
||||
$query_ID_user->execute(['user' => $_SESSION["username"]]);
|
||||
$ID_user = $query_ID_user->fetchALL(PDO::FETCH_OBJ)[0]->ID_user;
|
||||
|
||||
/* Prepare to save the file upload to the upload folder */
|
||||
$location = "upload/".$filename;
|
||||
$location_cv = "./documents/users/".$ID_user."/".$_FILES['cv']['name'];
|
||||
$location_lm = "./documents/users/".$ID_user."/".$_FILES['lm']['name'];
|
||||
|
||||
/* Permanently save the file upload to the upload folder */
|
||||
if ( move_uploaded_file($_FILES['file']['tmp_name'], $location) ) {
|
||||
echo '<p>The HTML5 and php file upload was a success!</p>';
|
||||
} else {
|
||||
echo '<p>The php and HTML5 file upload failed.</p>';
|
||||
if (!is_dir('./documents/')){
|
||||
mkdir("./documents/", 0700);
|
||||
}
|
||||
if (!is_dir('./documents/users')){
|
||||
mkdir("./documents/users", 0700);
|
||||
}
|
||||
if (!is_dir("./documents/users/".$ID_user)){
|
||||
mkdir("./documents/users/".$ID_user, 0700);
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
move_uploaded_file($_FILES['cv']['tmp_name'], $location_cv);
|
||||
move_uploaded_file($_FILES['lm']['tmp_name'], $location_lm);
|
||||
echo "tout est ok";
|
||||
}
|
||||
catch (Exception $e) {
|
||||
echo "zut une erreur";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user