début stage gestion
This commit is contained in:
parent
f63aa81961
commit
4f4c2c9bec
@ -77,7 +77,8 @@ table td {
|
||||
background-color: rgba(0,0,0,0.7);
|
||||
}
|
||||
|
||||
.title_modal
|
||||
.title_modal,
|
||||
.title_modal2
|
||||
{
|
||||
border-radius: 10px 10px 0 0;
|
||||
padding: 10px;
|
||||
|
||||
@ -3,8 +3,187 @@
|
||||
|
||||
.content_title
|
||||
{
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
font-size:calc(30px + 1vw);
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
margin: 10px;
|
||||
font-size:calc(30px + 1vw);
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.info_message
|
||||
{
|
||||
display: none;
|
||||
width: 80%;
|
||||
margin: 10px auto 20px auto;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.logo_plus i,
|
||||
.actions i
|
||||
{
|
||||
margin: 0 10px;
|
||||
cursor: pointer;
|
||||
color: black;
|
||||
}
|
||||
|
||||
.logo_plus
|
||||
{
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
}
|
||||
|
||||
.table {
|
||||
margin: 0 auto 0 auto;
|
||||
padding: 10px;
|
||||
text-align: center;
|
||||
overflow: auto;
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
.table tr:first-child td {
|
||||
background-color: #a79c9c;
|
||||
}
|
||||
|
||||
|
||||
table td {
|
||||
min-width: 100px;
|
||||
width: calc(100% / 8);
|
||||
padding: 5px;
|
||||
border: solid 1px black;
|
||||
}
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////
|
||||
[ Modal ] */
|
||||
|
||||
.modal
|
||||
{
|
||||
display: none;
|
||||
position: fixed;
|
||||
z-index: 1;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
background-color: rgb(0,0,0);
|
||||
background-color: rgba(0,0,0,0.7);
|
||||
}
|
||||
|
||||
.title_modal
|
||||
{
|
||||
border-radius: 10px 10px 0 0;
|
||||
padding: 10px;
|
||||
font-weight: bold;
|
||||
font-size: 2em;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.modal-content
|
||||
{
|
||||
background-color: #ffffff;
|
||||
margin: 15% auto;
|
||||
width: 80%;
|
||||
border-radius: 10px;
|
||||
text-align: center;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.info_message
|
||||
{
|
||||
display: none;
|
||||
width: 80%;
|
||||
margin: 10px auto 20px auto;
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
}
|
||||
|
||||
.form_add_edit .input
|
||||
{
|
||||
width: 80%;
|
||||
height: 25px;
|
||||
margin-left: 10px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.form_add_edit button, .form_add_edit input[type="button"]
|
||||
{
|
||||
margin: 10px;
|
||||
width: 120px;
|
||||
height: 40px;
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.close
|
||||
{
|
||||
color: #aaa;
|
||||
float: right;
|
||||
font-size: 40px;
|
||||
font-weight: bold;
|
||||
right: -20px;
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.close:hover, .close:focus
|
||||
{
|
||||
color: black;
|
||||
text-decoration: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.table-container {
|
||||
display: block;
|
||||
width: 90%;
|
||||
max-width: 900px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
|
||||
.flex-table {
|
||||
display: flex;
|
||||
flex-flow: row wrap;
|
||||
}
|
||||
|
||||
.flex-row {
|
||||
width: calc(100% / 2);
|
||||
text-align: center;
|
||||
padding: 0.2em 0.2em;
|
||||
}
|
||||
|
||||
.flex-table .name
|
||||
{
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.flex-table .value
|
||||
{
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
|
||||
/*//////////////////////////////////////////////////////////////////
|
||||
[ Responsive ]*/
|
||||
|
||||
@media screen and (max-width: 900px)
|
||||
{
|
||||
.modal-content
|
||||
{
|
||||
width: 90%;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 500px) {
|
||||
.flex-row {
|
||||
width: 100%;
|
||||
}
|
||||
.flex-table .name
|
||||
{
|
||||
text-align: left;
|
||||
font-weight: bold ;
|
||||
}
|
||||
.flex-table .value
|
||||
{
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@ -1,3 +1,72 @@
|
||||
$(document).ready(function(){
|
||||
$("#li_gestion_stages").delay(2000).addClass("hover");
|
||||
|
||||
$(".logo_add").click(function() {
|
||||
$(".modal").show();
|
||||
$(".title_modal").html("Ajout d'un stage");
|
||||
$("input[type='hidden']").attr("value","edit");
|
||||
$("input[name='name_internship']").attr("value",$(this).attr("name_internship"));
|
||||
$("input[name='description_internship']").attr("value",$(this).attr("description_internship"));
|
||||
$("input[name='duration_internship']").attr("value",$(this).attr("duration_internship"));
|
||||
$("input[name='remuneration_internship']").attr("value",$(this).attr("remuneration_internship"));
|
||||
$("input[name='offer_date_internship']").attr("value",$(this).attr("offer_date_internship"));
|
||||
$("input[name='place_number_internship']").attr("value",$(this).attr("place_number_internship"));
|
||||
$("input[name='competences_internship']").attr("value",$(this).attr("competences_internship"));
|
||||
$("select[name='name_promotion'] option[value="+$(this).attr("name_promotion")+"]").prop('selected', true);
|
||||
$("select[name='localisation'] option[value="+$(this).attr("localisation")+"]").prop('selected', true);
|
||||
$("select[name='company'] option[value="+$(this).attr("company")+"]").prop('selected', true);
|
||||
$(".info_message").css("display", "none");
|
||||
});
|
||||
|
||||
$(".close:eq(0)").click(function() {
|
||||
$(".modal").hide();
|
||||
});
|
||||
|
||||
window.onclick = function(event) {
|
||||
if (event.target == document.getElementById("modal_add_edit")) {
|
||||
$(".modal").hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('.form_add_edit').on('submit',(function(){
|
||||
$(".form_add_edit").append('<input type="hidden" name="ID_internship" value="'+ window.ID_internship +'">');
|
||||
return true;
|
||||
}));
|
||||
|
||||
|
||||
$(".logo_edit").click(function() {
|
||||
$("#modal_add_edit").show();
|
||||
window.ID_internship = $(this).attr("ID_internship");
|
||||
$(".title_modal").html("Modification d'un stage");
|
||||
$("input[type='hidden']").attr("value","edit");
|
||||
$("input[name='name_internship']").attr("value",$(this).attr("name_internship"));
|
||||
$("input[name='description_internship']").attr("value",$(this).attr("description_internship"));
|
||||
$("input[name='duration_internship']").attr("value",$(this).attr("duration_internship"));
|
||||
$("input[name='remuneration_internship']").attr("value",$(this).attr("remuneration_internship"));
|
||||
$("input[name='offer_date_internship']").attr("value",$(this).attr("offer_date_internship"));
|
||||
$("input[name='place_number_internship']").attr("value",$(this).attr("place_number_internship"));
|
||||
$("input[name='competences_internship']").attr("value",$(this).attr("competences_internship"));
|
||||
$("select[name='name_promotion'] option[value="+$(this).attr("name_promotion")+"]").prop('selected', true);
|
||||
$("select[name='localisation'] option[value="+$(this).attr("localisation")+"]").prop('selected', true);
|
||||
$("select[name='company'] option[value="+$(this).attr("company")+"]").prop('selected', true);
|
||||
$(".info_message").css("display", "none");
|
||||
});
|
||||
|
||||
$(".logo_delete").click(function() {
|
||||
console.log($(this).attr("ID_internship"));
|
||||
$.post(
|
||||
'controller/Manage_internships.php',
|
||||
{
|
||||
ID_internship: $(this).attr("ID_internship"),
|
||||
action: "delete"},
|
||||
function(data, status, jqXHR) {
|
||||
if (data.trim() == "false"){
|
||||
$(".info_message").html("Ce stage ne peut pas être supprimé car il existe des candidatures en lien avec lui.");
|
||||
$(".info_message").css("background-color", "#df8787");
|
||||
$(".info_message").css("display", "block");
|
||||
} else if (data.trim() == "true")
|
||||
location.reload();
|
||||
}
|
||||
);
|
||||
});
|
||||
});
|
||||
@ -1,49 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<title>Static - CTS</title>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="icon" type="image/png" href="assets/images/logo_petit.png">
|
||||
<link rel="stylesheet" type="text/css" href="assets/css/index.css">
|
||||
<meta name="description" content="Page d'accueil de CTS">
|
||||
<link rel="manifest" href="./manifest/manifest.json" />
|
||||
<meta name="theme-color" content="#3f51b5"/>
|
||||
<link rel="apple-touch-icon" href="assets/images/logo512.png">
|
||||
</head>
|
||||
<body>
|
||||
<div class="limiter">
|
||||
<div class="boite-login">
|
||||
<div id="zone-login" class="zone-login hidden">
|
||||
<form method="post" class="form-login validate">
|
||||
<div class="info_message">Erreur de connexion Internet, veuillez vous connecter</div>
|
||||
|
||||
<span class="form-title"><img src="assets/images/logo.png" alt="Cesi Ton Stage"></span>
|
||||
|
||||
<div class="zone-input validate-input" data-validate="Saisissez un identifiant" style="margin-bottom: 16px;">
|
||||
<input class="input-forms" type="text" name="user" placeholder="Identifiant" autocapitalize="off" autocomplete="off">
|
||||
<span class="focus-input"></span>
|
||||
</div>
|
||||
|
||||
<div class="zone-input validate-input" data-validate = "Saisissez un mot de passe">
|
||||
<input class="input-forms" id="passwd" type="password" name="pass" placeholder="Mot de passe">
|
||||
<span class="focus-input"></span>
|
||||
</div>
|
||||
|
||||
<div style="text-align:right!important;padding-top: 13px;padding-bottom: 23px;">
|
||||
<a href="#" class="txt2">Identifiant / Mot de passe</a>
|
||||
<span class="txt1"> perdu ?</span>
|
||||
</div>
|
||||
|
||||
<div class="boite-form-btn">
|
||||
<button class="form-btn">CONNEXION</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php require "controller/Script.php" ?>
|
||||
<script src="assets/js/index.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
8
website/.htaccess
Normal file
8
website/.htaccess
Normal file
@ -0,0 +1,8 @@
|
||||
Options +Indexes
|
||||
AuthType Basic
|
||||
AuthName "Page protégée"
|
||||
|
||||
AuthBasicProvider file
|
||||
AuthUserFile "D:\OneDrive\OneDrive - Association Cesi Viacesi mail\01 Pro\Semestre 1\Projet_4 - Développement Web\Livrable 3\a2_projet_web\website\.users_auth
|
||||
|
||||
Require valid-user
|
||||
63
website/controller/Manage_internships.php
Normal file
63
website/controller/Manage_internships.php
Normal file
@ -0,0 +1,63 @@
|
||||
<?php
|
||||
|
||||
if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
require "ConnexionBDD.php";
|
||||
if (!$error) {
|
||||
$query_check_cookie = $bdd->prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
|
||||
$query_check_cookie->execute(['user' => $_COOKIE['username'], 'password_user' => $_COOKIE['pass']]);
|
||||
if ($query_check_cookie->rowCount() == 1){
|
||||
if (isset($_POST["ID_internship"]) && isset($_POST["action"])){
|
||||
$ID_internship = $_POST["ID_internship"];
|
||||
|
||||
if ($_POST["action"] == "delete"){
|
||||
try {
|
||||
$query_delete_internship = $bdd->prepare('SET @ID_internship=:ID_internship;
|
||||
DELETE FROM internship_for_promo WHERE ID_internship=@ID_internship AND 0=(SELECT EXISTS (SELECT * FROM candidatures WHERE ID_internship=@ID_internship));
|
||||
DELETE FROM wishlist WHERE ID_internship=@ID_internship AND 0=(SELECT EXISTS (SELECT * FROM candidatures WHERE ID_internship=@ID_internship));
|
||||
DELETE FROM internships WHERE ID_internship=@ID_internship AND 0=(SELECT EXISTS (SELECT * FROM candidatures WHERE ID_internship=@ID_internship));');
|
||||
$query_delete_internship->execute(['ID_internship' => $ID_internship]);
|
||||
echo "true";
|
||||
} catch (Exception $e) {
|
||||
echo "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_POST["action"]) && isset($_POST["name_internship"]) && isset($_POST["description_internship"]) && isset($_POST["duration_internship"]) && isset($_POST["remuneration_internship"]) && isset($_POST["offer_date_internship"]) && isset($_POST["place_number_internship"]) && isset($_POST["competences_internship"]) && isset($_POST["name_promotion"]) && isset($_POST["localisation"]) && isset($_POST["company"])) {
|
||||
if ($_POST["action"] == "add"){
|
||||
echo "bonjour";
|
||||
try {
|
||||
$query_add_internship = $bdd->prepare('INSERT INTO internships VALUES (NULL, :name_internship, :description_internship, :duration_internship, :remuneration_internship, :offer_date_internship, :place_number_internship, :competences_internship, :ID_company, :ID_localisation);');
|
||||
$query_add_internship->execute(['name_internship' => $_POST["name_internship"], 'description_internship' => $_POST["description_internship"], 'duration_internship' => $_POST["duration_internship"], 'remuneration_internship' => $_POST["remuneration_internship"], 'offer_date_internship' => $_POST["offer_date_internship"], 'place_number_internship' => $_POST["place_number_internship"], 'competences_internship' => $_POST["competences_internship"], 'localisation' => $_POST["localisation"], 'company' => $_POST["company"]]);
|
||||
$query_add_internship = $bdd->prepare('SELECT LAST_INSERT_ID() as "ID_internship";');
|
||||
$query_add_internship->execute();
|
||||
$ID_add_internship = $query_add_internship->fetchALL(PDO::FETCH_OBJ)[0]->ID_internship;
|
||||
$query_add_internship = $bdd->prepare('INSERT INTO internship_for_promo VALUES (:ID_internship, (SELECT ID_promotion FROM promotions WHERE name_promotion = :name_promotion);');
|
||||
$query_add_internship->execute(['ID_internship' => $ID_add_internship, 'name_promotion' => $_POST['name_promotion']]);
|
||||
|
||||
echo "<script>location.href='/gestion_stages.php';</script>";
|
||||
} catch (Exception $e) {
|
||||
echo "false";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isset($_POST["action"]) && isset($_POST["name_internship"]) && isset($_POST["description_internship"]) && isset($_POST["duration_internship"]) && isset($_POST["remuneration_internship"]) && isset($_POST["offer_date_internship"]) && isset($_POST["place_number_internship"]) && isset($_POST["competences_internship"]) && isset($_POST["name_promotion"]) && isset($_POST["localisation"]) && isset($_POST["company"])) {
|
||||
if ($_POST["action"] == "edit"){
|
||||
try {
|
||||
$ID_internship = $_POST["ID_internship"];
|
||||
$query_edit_internship = $bdd->prepare('UPDATE internship_for_promo SET ID_internship = :ID_internship WHERE ID_promotion = :name_promotion;');
|
||||
$query_edit_internship->execute(['name_promotion' => $_POST['name_promotion'], 'ID_internship' => $ID_internship]);
|
||||
|
||||
$query_edit_internship = $bdd->prepare('UPDATE internships SET name_internship = :name_internship, description_internship = :description_internship, duration_internship = :duration_internship, remuneration_internship = :remuneration_internship, offer_date_internship = :offer_date_internship, place_number_internship = :place_number_internship, competences_internship = :competences_internship, name_promotion = :name_promotion, localisation = :localisation, company = :company WHERE ID_internship=:ID_internship;');
|
||||
$query_edit_internship->execute(['name_internship' => $_POST["name_internship"], 'description_internship' => $_POST["description_internship"], 'duration_internship' => $_POST["duration_internship"], 'remuneration_internship' => $_POST["remuneration_internship"], 'offer_date_internship' => $_POST["offer_date_internship"], 'place_number_internship' => $_POST["place_number_internship"], 'competences_internship' => $_POST["competences_internship"], 'name_promotion' => $_POST["name_promotion"], 'localisation' => $_POST["localisation"], 'company' => $_POST["company"]]);
|
||||
|
||||
echo "<script>location.href='/gestion_stages.php';</script>";
|
||||
} catch (Exception $e) {
|
||||
echo $e;
|
||||
}
|
||||
} else {
|
||||
echo "error";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -9,9 +9,31 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
if ($query_check_cookie->rowCount() == 1){
|
||||
$sql = 'SELECT companies.ID_company, name_company, activity_sector_company, nb_intern_cesi_company, email_company, visibility_company, companies_located.ID_localisation, note FROM companies LEFT JOIN companies_located ON companies.ID_company=companies_located.ID_company LEFT JOIN localisations ON companies_located.ID_localisation=localisations.ID_localisation INNER JOIN evaluate ON companies.ID_company = evaluate.ID_company;';
|
||||
|
||||
$query_perm = $bdd->prepare('SELECT username, code_permission FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission=:perm AND username=:user;');
|
||||
$query_perm->execute(['user' => $_COOKIE["username"], 'perm' => "SFx2"]);
|
||||
if ($query_perm->rowCount() == 1) {
|
||||
$query_perm_nav = $bdd->prepare('SELECT username, code_permission FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE username = :user;');
|
||||
$query_perm_nav->execute(['user' => $_COOKIE["username"]]);
|
||||
$results_nav = $query_perm_nav->fetchALL(PDO::FETCH_OBJ);
|
||||
if ($query_perm_nav->rowCount() >= 1) {
|
||||
$gestion_Enterprises_create = false;
|
||||
$gestion_Enterprises_edit = false;
|
||||
$gestion_Enterprises_delete = false;
|
||||
$gestion_Enterprises_stat = false;
|
||||
|
||||
foreach($results_nav as $result){
|
||||
if ($result->code_permission == "SFx3"){
|
||||
$gestion_Enterprises_create = true;
|
||||
}
|
||||
if ($result->code_permission == "SFx4"){
|
||||
$gestion_Enterprises_edit = true;
|
||||
}
|
||||
if ($result->code_permission == "SFx6"){
|
||||
$gestion_Enterprises_delete = true;
|
||||
}
|
||||
if ($result->code_permission == "SFx7"){
|
||||
$gestion_Enterprises_stat = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($gestion_Enterprises_create || $gestion_Enterprises_edit || $gestion_Enterprises_delete || $gestion_Enterprises_stat) {
|
||||
$query_companies = $bdd->prepare($sql);
|
||||
$query_companies->execute();
|
||||
$results_companies = $query_companies->fetchALL(PDO::FETCH_OBJ);
|
||||
@ -105,7 +127,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<div id="modal_stat" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close" id="close_stat">×</span>
|
||||
<div class="title_modal">Top des entreprises ayant le plus de stages</div>
|
||||
<div class="title_modal2">Top des entreprises ayant le plus de stages</div>
|
||||
<div class="modal_stat_table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
@ -123,7 +145,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="title_modal">Top des entreprises ayant le plus d'étudiants CESI</div>
|
||||
<div class="title_modal2">Top des entreprises ayant le plus d'étudiants CESI</div>
|
||||
<div class="modal_stat_table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
@ -140,7 +162,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
<div class="title_modal">Top des entreprises ayant les meilleures notes</div>
|
||||
<div class="title_modal2">Top des entreprises ayant les meilleures notes</div>
|
||||
<div class="modal_stat_table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
@ -171,7 +193,12 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<div class="content">
|
||||
<div class="content_title">Gestion des entreprises</div>
|
||||
<div class="info_message">L'entreprise a été supprimé !</div>
|
||||
<div class="logo_plus"><i class="fas fa-plus-square logo_add"></i> <i class="fas fa-chart-bar logo_stat"></i></div>
|
||||
<div class="logo_plus">
|
||||
<?php
|
||||
if ($gestion_Enterprises_create) { echo '<i class="fas fa-plus-square logo_add"></i>'; }
|
||||
if ($gestion_Enterprises_stat) { echo '<i class="fas fa-chart-bar logo_stat"></i>'; }
|
||||
?>
|
||||
</div>
|
||||
<div class="table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
@ -181,7 +208,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<td>Nb stagiaires CESI</td>
|
||||
<td>Email</td>
|
||||
<td>Visibilité</td>
|
||||
<td>Actions</td>
|
||||
<?php if ($gestion_Enterprises_edit || $gestion_Enterprises_delete) { echo '<td>Actions</td>';} ?>
|
||||
</tr>
|
||||
<?php foreach ($results_companies as $result) { ?>
|
||||
<tr>
|
||||
@ -191,12 +218,16 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<td><?= $result->nb_intern_cesi_company ?></td>
|
||||
<td><?= $result->email_company ?></td>
|
||||
<td><?= $result->visibility_company ?></td>
|
||||
<?php if ($gestion_Enterprises_edit || $gestion_Enterprises_delete) { ?>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<i ID_company="<?= $result->ID_company ?>" name="<?= $result->name_company ?>" activity_sector="<?= $result->activity_sector_company ?>" nb_intern="<?= $result->nb_intern_cesi_company ?>" email="<?= $result->email_company ?>" localisation="<?= $result->ID_localisation ?>" note="<?= $result->note ?>" visibility="<?= $result->visibility_company ?>" class="fas fa-pen logo_edit"></i>
|
||||
<i ID_company="<?= $result->ID_company ?>" class="fas fa-trash-alt logo_delete"></i>
|
||||
<?php
|
||||
if ($gestion_Enterprises_edit) { echo "<i ID_company='$result->ID_company' name='$result->name_company' activity_sector='$result->activity_sector_company' nb_intern='$result->nb_intern_cesi_company' email='$result->email_company' localisation='$result->ID_localisation' note='$result->note' visibility='$result->visibility_company' class='fas fa-pen logo_edit'></i>";}
|
||||
if ($gestion_Enterprises_delete) { echo "<i ID_company='$result->ID_company' class='fas fa-trash-alt logo_delete'></i>";}
|
||||
?>
|
||||
</div>
|
||||
</td>
|
||||
<?php } ?>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
|
||||
@ -1,12 +1,35 @@
|
||||
<!DOCTYPE html>
|
||||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<?php
|
||||
if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
require "controller/ConnexionBDD.php";
|
||||
if (!$error) {
|
||||
$query_check_cookie = $bdd->prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
|
||||
$query_check_cookie->execute(['user' => $_COOKIE['username'], 'password_user' => $_COOKIE['pass']]);
|
||||
if ($query_check_cookie->rowCount() == 1){
|
||||
require "controller/ConnexionBDD.php";
|
||||
if (!$error) {
|
||||
$query_check_cookie = $bdd->prepare('SELECT * FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission="SFx1" AND username=:user AND password_user=:password_user;');
|
||||
$query_check_cookie->execute(['user' => $_COOKIE['username'], 'password_user' => $_COOKIE['pass']]);
|
||||
if ($query_check_cookie->rowCount() == 1){
|
||||
$sql = 'SELECT internships.ID_internship, name_internship, duration_internship, remuneration_internship, offer_date_internship, place_number_internship, competences_internship, promotions.name_promotion FROM internships LEFT JOIN internship_for_promo ON internships.ID_internship = internship_for_promo.ID_internship LEFT JOIN promotions ON internship_for_promo.ID_promotion = promotions.ID_promotion;';
|
||||
|
||||
$query_perm = $bdd->prepare('SELECT username, code_permission FROM users NATURAL JOIN roles NATURAL JOIN roles_has_permissions NATURAL JOIN permissions WHERE code_permission=:perm AND username=:user;');
|
||||
$query_perm->execute(['user' => $_COOKIE["username"], 'perm' => "SFx2"]);
|
||||
if ($query_perm->rowCount() == 1) {
|
||||
$query_internships = $bdd->prepare($sql);
|
||||
$query_internships->execute();
|
||||
$results_internships = $query_internships->fetchALL(PDO::FETCH_OBJ);
|
||||
|
||||
$query_promotions = $bdd->prepare('SELECT ID_promotion, name_promotion FROM promotions GROUP BY name_promotion ORDER BY name_promotion ASC;');
|
||||
$query_promotions->execute();
|
||||
$results_promotions = $query_promotions->fetchALL(PDO::FETCH_OBJ);
|
||||
|
||||
$query_localisations = $bdd->prepare('SELECT ID_localisation, city_localisation FROM localisations GROUP BY city_localisation ORDER BY city_localisation ASC;');
|
||||
$query_localisations->execute();
|
||||
$results_localisations = $query_localisations->fetchALL(PDO::FETCH_OBJ);
|
||||
|
||||
$query_company = $bdd->prepare('SELECT ID_company, name_company FROM companies GROUP BY name_company ORDER BY name_company ASC;');
|
||||
$query_company->execute();
|
||||
$results_company = $query_company->fetchALL(PDO::FETCH_OBJ);
|
||||
|
||||
?>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
@ -15,12 +38,122 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
<link rel="stylesheet" type="text/css" href="http://ctsstatic.fr/assets/css/gestion_stages.css">
|
||||
</head>
|
||||
<body>
|
||||
<div id="modal_add_edit" class="modal">
|
||||
<div class="modal-content">
|
||||
<span class="close">×</span>
|
||||
<div class="title_modal">Ajout d'un stage</div>
|
||||
<form class="form_add_edit" method="POST" action="/controller/Manage_internships.php">
|
||||
<input type="hidden" name="action" value="add">
|
||||
<div class="table-container">
|
||||
<div class="info_message"></div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Nom :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="name_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Description du stage :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="description_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Durée du stage :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="duration_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Rémunération :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="remuneration_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Date de l'offre :</div>
|
||||
<div class="flex-row value"><input class="input" type="date" name="offer_date_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Nombre de place :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="place_number_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Compétences :</div>
|
||||
<div class="flex-row value"><input class="input" type="text" name="competences_internship" required></div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Promotion :</div>
|
||||
<div class="flex-row value">
|
||||
<select class="input" name="name_promotion" id="select_name_promotion" required>
|
||||
<option value="" selected>--Choisir une promotion--</option>
|
||||
<?php foreach ($results_promotions as $result) { ?>
|
||||
<option value="<?= $result->ID_promotion ?>"><?= $result->name_promotion ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Localisation :</div>
|
||||
<div class="flex-row value">
|
||||
<select class="input" name="localisation" id="select_localisation" required>
|
||||
<option value="">--Choisir une ville--</option>
|
||||
<?php foreach ($results_localisations as $result) { ?>
|
||||
<option value="<?= $result->ID_localisation ?>"><?= $result->city_localisation ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex-table">
|
||||
<div class="flex-row name">Entreprise :</div>
|
||||
<div class="flex-row value">
|
||||
<select class="input" name="company" id="select_company" required>
|
||||
<option value="">--Choisir une entrprise--</option>
|
||||
<?php foreach ($results_company as $result) { ?>
|
||||
<option value="<?= $result->ID_company ?>"><?= $result->name_company ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<button type="submit">Ajouter</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
<?php require "controller/Nav_bar.php"?>
|
||||
<?php require "controller/Nav_bar.php" ?>
|
||||
<div class="main">
|
||||
<?php require "controller/Top_bar.php" ?>
|
||||
<div class="content">
|
||||
<div class="content_title">Gestion des stages</div>
|
||||
<div class="info_message">Le stage a été supprimé !</div>
|
||||
<div class="logo_plus"><i class="fas fa-plus-square logo_add"></i> <i class="fas fa-chart-bar logo_stat"></i></div>
|
||||
<div class="table">
|
||||
<table class="table">
|
||||
<tr>
|
||||
<td>ID</td>
|
||||
<td>Nom</td>
|
||||
<td>Durée du stage</td>
|
||||
<td>Rémunération</td>
|
||||
<td>Date de l'offre</td>
|
||||
<td>Nombre de place</td>
|
||||
<td>Compétences</td>
|
||||
<td>Promotions</td>
|
||||
<td>Actions</td>
|
||||
</tr>
|
||||
<?php foreach ($results_internships as $result) { ?>
|
||||
<tr>
|
||||
<td><?= $result->ID_internship ?></td>
|
||||
<td><?= $result->name_internship ?></td>
|
||||
<td><?= $result->duration_internship ?></td>
|
||||
<td><?= $result->remuneration_internship ?></td>
|
||||
<td><?= $result->offer_date_internship ?></td>
|
||||
<td><?= $result->place_number_internship ?></td>
|
||||
<td><?= $result->competences_internship ?></td>
|
||||
<td><?= $result->name_promotion ?></td>
|
||||
<td>
|
||||
<div class="actions">
|
||||
<i ID_internship="<?= $result->ID_internship ?>" name="<?= $result->name_internship ?>" activity_sector="<?= $result->activity_sector_company ?>" nb_intern="<?= $result->nb_intern_cesi_company ?>" email="<?= $result->email_company ?>" localisation="<?= $result->ID_localisation ?>" note="<?= $result->note ?>" visibility="<?= $result->visibility_company ?>" class="fas fa-pen logo_edit"></i>
|
||||
<i ID_internship="<?= $result->ID_internship ?>" class="fas fa-trash-alt logo_delete"></i>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -38,4 +171,4 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
|
||||
} else {
|
||||
echo "<script>location.href='/';</script>";
|
||||
}
|
||||
?>
|
||||
}?>
|
||||
Loading…
x
Reference in New Issue
Block a user