diff --git a/.users_auth b/.users_auth
new file mode 100644
index 0000000..a7a3cd4
--- /dev/null
+++ b/.users_auth
@@ -0,0 +1 @@
+root:$apr1$FXQX1PU2$iXKK3c5z.Vsi63Ve5uu7Z1
diff --git a/assets/css/gestion_entreprises.css b/assets/css/gestion_entreprises.css
index e8b7b12..970444f 100644
--- a/assets/css/gestion_entreprises.css
+++ b/assets/css/gestion_entreprises.css
@@ -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: block;
+ 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;
+ }
}
\ No newline at end of file
diff --git a/assets/js/gestion_entreprises.js b/assets/js/gestion_entreprises.js
index 4c2325e..e9e5389 100644
--- a/assets/js/gestion_entreprises.js
+++ b/assets/js/gestion_entreprises.js
@@ -1,3 +1,43 @@
$(document).ready(function(){
$("#li_gestion_entreprises").delay(2000).addClass("hover");
+
+
+ $(".logo_add").click(function() {
+ $(".modal").show();
+ $(".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_postuler").append('');
+ return true;
+ }));
+
+
+ $(".logo_delete").click(function() {
+ console.log($(this).attr("ID_company"));
+ $.post(
+ 'controller/Manage_companies.php',
+ {
+ ID_company: $(this).attr("ID_company"),
+ action: "delete"},
+ function(data, status, jqXHR) {
+ if (data.trim() == "false"){
+ $(".info_message").html("Cette entreprise ne peut pas supprimer car il existe des stages en lien avec elle.");
+ $(".info_message").css("background-color", "#df8787");
+ $(".info_message").css("display", "block");
+ } else if (data.trim() == "true")
+ location.reload();
+ }
+ );
+ });
});
\ No newline at end of file
diff --git a/controller/Manage_companies.php b/controller/Manage_companies.php
new file mode 100644
index 0000000..1f285bd
--- /dev/null
+++ b/controller/Manage_companies.php
@@ -0,0 +1,37 @@
+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_company"]) && isset($_POST["action"])){
+ $ID_company = $_POST["ID_company"];
+ $action = $_POST["action"];
+
+ if ($action == "delete"){
+ try {
+ $query_delete_company = $bdd->prepare('SET @ID_company=:ID_company;DELETE FROM companies_located WHERE ID_company=@ID_company AND 0=(SELECT EXISTS (SELECT * FROM internships WHERE ID_company=@ID_company));DELETE FROM evaluate WHERE ID_company=@ID_company AND 0=(SELECT EXISTS (SELECT * FROM internships WHERE ID_company=@ID_company));DELETE FROM manage_company WHERE ID_company=@ID_company AND 0=(SELECT EXISTS (SELECT * FROM internships WHERE ID_company=@ID_company));DELETE FROM companies WHERE ID_company=@ID_company AND 0=(SELECT EXISTS (SELECT * FROM internships WHERE ID_company=@ID_company));');
+ $query_delete_company->execute(['ID_company' => $ID_company]);
+ echo "true";
+ } catch (Exception $e) {
+ echo "false";
+ }
+ } else if ($action == "add"){
+ echo "bonour";
+ if (isset($_POST["name"]) && isset($_POST["activity_sector"]) && isset($_POST["nb_intern_cesi"]) && isset($_POST["note"]) && isset($_POST["email"])) {
+ echo "oui";
+ }
+ /*try {
+ $query_add_company = $bdd->prepare('INSERT INTO companies VALUES (NULL, :name, :activity_sector, :nb_intern_CESI, :visibility, :email);');
+ $query_add_company->execute();
+ echo "true";
+ } catch (Exception $e) {
+ echo "false";
+ }*/
+ }
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/documents/.htaccess b/documents/.htaccess
new file mode 100644
index 0000000..9f44f44
--- /dev/null
+++ b/documents/.htaccess
@@ -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\documents\.users_auth
+
+Require valid-user
\ No newline at end of file
diff --git a/documents/.users_auth b/documents/.users_auth
new file mode 100644
index 0000000..7c6a5bc
--- /dev/null
+++ b/documents/.users_auth
@@ -0,0 +1 @@
+root:$apr1$JlIdU6VT$U8fZ/np1mDuIpj5GXZ524.
diff --git a/gestion_entreprises.php b/gestion_entreprises.php
index d581e20..d64bbe3 100644
--- a/gestion_entreprises.php
+++ b/gestion_entreprises.php
@@ -7,6 +7,42 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
$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 * FROM companies ;';
+
+ $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_companies = $bdd->prepare($sql);
+ $query_companies->execute();
+ $results_companies = $query_companies->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_localisations = $bdd->prepare('SELECT city_localisation FROM companies NATURAL JOIN companies_located NATURAL JOIN localisations GROUP BY city_localisation ORDER BY city_localisation ASC;');
+ $query_localisations->execute();
+ $results_localisations = $query_localisations->fetchALL(PDO::FETCH_OBJ);
+
+ $query_activity_sector = $bdd->prepare('SELECT activity_sector_company FROM companies WHERE visibility_company="O" GROUP BY activity_sector_company;');
+ $query_activity_sector->execute();
+ $results_activity_sector = $query_activity_sector->fetchALL(PDO::FETCH_OBJ);
+ $liste_activity_sector = [];
+ foreach ($results_activity_sector as $result_activity_sector) {
+ foreach (explode(", ", $result_activity_sector->activity_sector_company) as $result) {
+ if (!in_array($result, $liste_activity_sector)) {
+ array_push($liste_activity_sector, $result);
+ }
+ }
+ }*/
+
+ /*$query_notes = $bdd->prepare('SELECT note FROM companies NATURAL JOIN evaluate INNER JOIN users ON evaluate.ID_user=users.ID_user NATURAL JOIN roles WHERE name_role="Pilote" GROUP BY note ORDER BY note ASC;');
+ $query_notes->execute();
+ $results_notes = $query_notes->fetchALL(PDO::FETCH_OBJ);
+
+ $query_nb_stages = $bdd->prepare('SELECT * FROM (SELECT COUNT(internships.ID_company) AS "number_of_internships" FROM companies LEFT JOIN internships ON companies.ID_company=internships.ID_company GROUP BY internships.ID_company) AS T GROUP BY number_of_internships ORDER BY number_of_internships ASC;');
+ $query_nb_stages->execute();
+ $results_nb_stages = $query_nb_stages->fetchALL(PDO::FETCH_OBJ);*/
?>
@@ -15,12 +51,111 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
+
+
+
×
+
Ajout d'une entreprise
+
+
+
+
+
+
+
+
+
Gestion des entreprises
+
L'entreprise a été supprimé !
+
+
+
+
+ | ID |
+ Nom |
+ Secteur d'activité |
+ Nb stagiaires CESI |
+ Email |
+ Visibilité |
+ Actions |
+
+
+
+ | = $result->ID_company ?> |
+ = $result->name_company ?> |
+ = $result->activity_sector_company ?> |
+ = $result->nb_intern_cesi_company ?> |
+ = $result->email_company ?> |
+ = $result->visibility_company ?> |
+
+
+
+
+
+ |
+
+
+
+
@@ -29,6 +164,8 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
location.href='/';";
}
diff --git a/offres_stages.php b/offres_stages.php
index 16c8282..3eccc80 100644
--- a/offres_stages.php
+++ b/offres_stages.php
@@ -138,11 +138,7 @@ if (isset($_COOKIE['username']) && isset($_COOKIE['pass'])) {
Filtres de recherche :