Skip to content
Snippets Groups Projects
Commit de3ece98 authored by nicrausaz's avatar nicrausaz
Browse files

check post, filiere info ok

parent 7ec6f32e
No related branches found
No related tags found
No related merge requests found
...@@ -21,12 +21,14 @@ ...@@ -21,12 +21,14 @@
<body> <body>
<?php <?php
include('templates/header.php'); include('templates/header.php');
require_once("helpers.php");
if (isset($_GET['edit'])) { if (isset($_GET['edit'])) {
// checker si y a pas de postulation selectionnée (session) // Check si une postulation a été selectionnée
require_once("helpers.php"); if (!isset($_SESSION['current_post']['applicant_id'])) {
echo "editing applicant" . $_SESSION['current_post']['applicant_id']; header('Location: index.php');
$current_post = $_SESSION['current_post']; } else {
echo $current_post['applicant_guest_sciper']; $current_post = $_SESSION['current_post'];
}
} }
?> ?>
<main id="main" role="main" class="content container-grid"> <main id="main" role="main" class="content container-grid">
......
...@@ -316,11 +316,9 @@ function deletePostulation ($pdo, $id, $sciper, $rep1, $rep2) { ...@@ -316,11 +316,9 @@ function deletePostulation ($pdo, $id, $sciper, $rep1, $rep2) {
header('Location: viewpostulation.php'); header('Location: viewpostulation.php');
} }
function updatePostulation ($pdo, $posted_data, $posted_files) { function updatePostulation ($pdo, $posted_data) {
// echo "<pre>";
// print_r($posted_data);
$posted_files = $posted_data->fichiers;
// update applicant infos // update applicant infos
$sqlreq = "UPDATE applicant $sqlreq = "UPDATE applicant
...@@ -460,25 +458,29 @@ foreach ($posted_data->stages as $training) { ...@@ -460,25 +458,29 @@ foreach ($posted_data->stages as $training) {
$query->execute(); $query->execute();
} }
die; echo "<pre>";
// TODO: files // TODO: files
print_r($posted_files);
$i = 1; foreach ($posted_files as $key => $file) {
while (isset($posted_data['file_id'.$i])) { if ($file['name'] != '') {
// remplace le fichier sur le serveur print_r($file);
if ($_FILES['file'.$i]['name']) {
$file_data = getOneFile($pdo, $posted_data['file_id'.$i], $id);
if (move_uploaded_file($_FILES['file'.$i]['tmp_name'], $file_data['file_path'])) {
} else {
// Le fichier est ouvert
$_SESSION['edit_error']['files'] = "Erreur lors du remplacement du fichier" . $_FILES['file'.$i]['name'] . ", réessayez plus tard.";
}
}
$i++;
} }
// header('Location: viewpostulation.php'); }
// $i = 1;
// while (isset($posted_data['file_id'.$i])) {
// // remplace le fichier sur le serveur
// if ($_FILES['file'.$i]['name']) {
// $file_data = getOneFile($pdo, $posted_data['file_id'.$i], $id);
// if (move_uploaded_file($_FILES['file'.$i]['tmp_name'], $file_data['file_path'])) {
// } else {
// // Le fichier est ouvert
// $_SESSION['edit_error']['files'] = "Erreur lors du remplacement du fichier" . $_FILES['file'.$i]['name'] . ", réessayez plus tard.";
// }
// }
// $i++;
// }
// header('Location: viewpostulation.php');
} }
#endregion #endregion
?> ?>
\ No newline at end of file
...@@ -9,6 +9,19 @@ ...@@ -9,6 +9,19 @@
<small>Formats autorisés: <b>PDF, JPG, JPEG, PNG</b></small> <small>Formats autorisés: <b>PDF, JPG, JPEG, PNG</b></small>
<!-- Annexes obligatoires --> <!-- Annexes obligatoires -->
<div class="form-group mt-3" id="files"> <div class="form-group mt-3" id="files">
<!-- <?php foreach ($files as $key => $file) { ?>
<div class="form-group">
<label for="photo"></label>
<input type="file" name="photo" class="upload-input" id="photo" onchange="changeTitleFile(this)"/>
<br>
<label for="photo" class="btn btn-secondary btn-sm icon-right">
Remplacer: <?= $file['file_name'] ?>
</label>
<br>
<small class="error" class="form-text text-muted"></small>
</div>
<?php } ?> -->
<div class="form-group"> <div class="form-group">
<label for="photo">Photo passeport <strong>couleur: *</strong></label> <label for="photo">Photo passeport <strong>couleur: *</strong></label>
<input type="file" name="photo" class="upload-input" id="photo" onchange="changeTitleFile(this)"/> <input type="file" name="photo" class="upload-input" id="photo" onchange="changeTitleFile(this)"/>
......
<div class="form-group">
<label>Filières informatiques:*</label>
<div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill1" class="custom-control-input" value="developpementApplications" <?php echo ($current_post['applicant_it_section'] == "developpementApplications") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill1">Développement d'application</label>
</div>
<div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill2" class="custom-control-input" value="entreprise" <?php echo ($current_post['applicant_it_section'] == "entreprise") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill2">Informatique d'entreprise</label>
</div>
<div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill3" class="custom-control-input" value="techniqueSysteme" <?php echo ($current_post['applicant_it_section'] == "techniqueSysteme") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill3">Technique des systèmes</label>
</div>
<div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill4" class="custom-control-input" value="neSaisPas" <?php echo ($current_post['applicant_it_section'] == '' || $current_post['applicant_it_section'] == "neSaisPas") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill4">Je ne sais pas</label>
</div>
</div>
<button type="button" class="btn btn-primary btn-sm mb-3" id="infoFilieres">Infos sur les filières</button>
\ No newline at end of file
<div id="infoOnly"> <div id="infoOnly">
<?php include('templates/filieresinfos.php') ?> <?php include('filieresinfos.php') ?>
</div> </div>
<label>Je désire m'inscire en maturité professionnelle intégrée:</label> <label>Je désire m'inscire en maturité professionnelle intégrée:</label>
...@@ -10,4 +10,5 @@ ...@@ -10,4 +10,5 @@
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" name="mpt" id="mpt2" class="custom-control-input" value="true" <?php echo ($current_post['applicant_maturity'] == 1) ? "checked=\"checked\"" : ''; ?>> <input type="radio" name="mpt" id="mpt2" class="custom-control-input" value="true" <?php echo ($current_post['applicant_maturity'] == 1) ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="mpt2">Oui</label> <label class="custom-control-label" for="mpt2">Oui</label>
</div> </div>
\ No newline at end of file <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="infoMpt">Infos sur la maturité professionnelle</button>
\ No newline at end of file
...@@ -5,15 +5,15 @@ ...@@ -5,15 +5,15 @@
<label class="custom-control-label" for="fill1">Développement d'application</label> <label class="custom-control-label" for="fill1">Développement d'application</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill2" class="custom-control-input" value="entreprise" <?php echo ($_SESSION['postedForm']['filInfo'] == "entreprise") ? "checked=\"checked\"" : ''; ?>> <input type="radio" name="filInfo" id="fill2" class="custom-control-input" value="entreprise" <?php echo ($_SESSION['postedForm']['filInfo'] == "entreprise") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill2">Informatique d'entreprise</label> <label class="custom-control-label" for="fill2">Informatique d'entreprise</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill3" class="custom-control-input" value="techniqueSysteme" <?php echo ($_SESSION['postedForm']['filInfo'] == "techniqueSysteme") ? "checked=\"checked\"" : ''; ?>> <input type="radio" name="filInfo" id="fill3" class="custom-control-input" value="techniqueSysteme" <?php echo ($_SESSION['postedForm']['filInfo'] == "techniqueSysteme") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill3">Technique des systèmes</label> <label class="custom-control-label" for="fill3">Technique des systèmes</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" name="filInfo" id="fill4" class="custom-control-input" value="neSaisPas" <?php echo (!isset($_SESSION['postedForm']['filInfo']) || $_SESSION['postedForm']['mpt'] == "neSaisPas") ? "checked=\"checked\"" : ''; ?>> <input type="radio" name="filInfo" id="fill4" class="custom-control-input" value="neSaisPas" <?php echo (!isset($_SESSION['postedForm']['filInfo']) || $_SESSION['postedForm']['mpt'] == "neSaisPas") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="fill4">Je ne sais pas</label> <label class="custom-control-label" for="fill4">Je ne sais pas</label>
</div> </div>
</div> </div>
......
<div id="infoOnly"> <div id="infoOnly">
<?php include('templates/filieresinfos.php') ?> <?php include('filieresinfos.php') ?>
</div> </div>
<label>Je désire m'inscire en maturité professionnelle intégrée*:</label> <label>Je désire m'inscire en maturité professionnelle intégrée*:</label>
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
<label class="custom-control-label" for="mpt1">Non</label> <label class="custom-control-label" for="mpt1">Non</label>
</div> </div>
<div class="custom-control custom-radio"> <div class="custom-control custom-radio">
<input type="radio" name="mpt" id="mpt2" class="custom-control-input" value="true" <?php echo ($_SESSION['postedForm']['mpt'] == "true") ? "checked=\"checked\"" : ''; ?>> <input type="radio" name="mpt" id="mpt2" class="custom-control-input" value="true" <?php echo ($_SESSION['postedForm']['mpt'] == "true") ? "checked=\"checked\"" : ''; ?>>
<label class="custom-control-label" for="mpt2">Oui</label> <label class="custom-control-label" for="mpt2">Oui</label>
</div> </div>
<button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="infoMpt">Infos sur la maturité professionnelle</button> <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="infoMpt">Infos sur la maturité professionnelle</button>
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment