Pastebin
Retrouvez, créez et partagez vos snippets en temps réel.
Rechercher un Pastebin
Aucun paste trouvé.
Créer un paste
Pastebin
Blog
fhal
<?php // emploi.php - Gestion de la table EMPLOI (Recherche, Ajout, Modification, Suppression) include 'menu.php'; include 'ctrl_acces.php'; include 'ctrl_permissions.php'; include 'db_connect.php'; $action = $_GET['action'] ?? 'list'; $message = ''; $type_message = ''; $sort = $_GET['sort'] ?? 'CODE'; $order = $_GET['order'] ?? 'ASC'; // Vérifier les permissions $permissions = check_permissions(); // Traitement des actions POST if ($_SERVER['REQUEST_METHOD'] == 'POST') { $code = trim($_POST['code'] ?? ''); $categoriemax = trim($_POST['categoriemax'] ?? ''); $categoriemin = trim($_POST['categoriemin'] ?? ''); $code_college = trim($_POST['code_college'] ?? ''); $code_corps_activite = trim($_POST['code_corps_activite'] ?? ''); $code_filiere = trim($_POST['code_filiere'] ?? ''); $libellefr = trim($_POST['libellefr'] ?? ''); $libellear = trim($_POST['libellear'] ?? ''); $codeancien = trim($_POST['codeancien'] ?? null); $regimehorraire = trim($_POST['regimehorraire'] ?? null); $emploihabillement = trim($_POST['emploihabillement'] ?? null); $transpositioncreation = trim($_POST['transpositioncreation'] ?? null); $transpositionextinction = trim($_POST['transpositionextinction'] ?? null); $creetransposition = trim($_POST['creetransposition'] ?? null); $extinctiontransposition = trim($_POST['extinctiontransposition'] ?? null); $datetranspositioncreation = trim($_POST['datetranspositioncreation'] ?? null); if (!empty($datetranspositioncreation)) { $date = DateTime::createFromFormat('d/m/Y', $datetranspositioncreation); if ($date) { $datetranspositioncreation = $date->format('Y-m-d'); } } $datetranspositionextinction = trim($_POST['datetranspositionextinction'] ?? null); if (!empty($datetranspositionextinction)) { $date = DateTime::createFromFormat('d/m/Y', $datetranspositionextinction); if ($date) { $datetranspositionextinction = $date->format('Y-m-d'); } } if ($action == 'add') { if (empty($code) || empty($categoriemax) || empty($categoriemin) || empty($code_college) || empty($code_corps_activite) || empty($code_filiere) || empty($libellefr) || empty($libellear)) { $message = 'Les champs marqués d\'un * sont obligatoires'; $type_message = 'error'; } else { $sql = "INSERT INTO EMPLOI (CODE, CATEGORIEMAX, CATEGORIEMIN, CODE_COLLEGE, CODE_CORPS_ACTIVITE, CODE_FILIERE, LIBELLEFR, LIBELLEAR, CODEANCIEN, REGIMEHORRAIRE, EMPLOIHABILLEMENT, TRANSPOSITIONCREATION, TRANSPOSITIONEXTINCTION, CREETRANSPOSITION, EXTINCTIONTRANSPOSITION, DATETRANSPOSITIONCREATION, DATETRANSPOSITIONEXTINCTION) VALUES (:code, :categoriemax, :categoriemin, :code_college, :code_corps_activite, :code_filiere, :libellefr, :libellear, :codeancien, :regimehorraire, :emploihabillement, :transpositioncreation, :transpositionextinction, :creetransposition, :extinctiontransposition, TO_DATE(:datetranspositioncreation, 'YYYY-MM-DD'), TO_DATE(:datetranspositionextinction, 'YYYY-MM-DD'))"; $stmt = oci_parse($connection, $sql); oci_bind_by_name($stmt, ':code', $code); oci_bind_by_name($stmt, ':categoriemax', $categoriemax); oci_bind_by_name($stmt, ':categoriemin', $categoriemin); oci_bind_by_name($stmt, ':code_college', $code_college); oci_bind_by_name($stmt, ':code_corps_activite', $code_corps_activite); oci_bind_by_name($stmt, ':code_filiere', $code_filiere); oci_bind_by_name($stmt, ':libellefr', $libellefr); oci_bind_by_name($stmt, ':libellear', $libellear); oci_bind_by_name($stmt, ':codeancien', $codeancien); oci_bind_by_name($stmt, ':regimehorraire', $regimehorraire); oci_bind_by_name($stmt, ':emploihabillement', $emploihabillement); oci_bind_by_name($stmt, ':transpositioncreation', $transpositioncreation); oci_bind_by_name($stmt, ':transpositionextinction', $transpositionextinction); oci_bind_by_name($stmt, ':creetransposition', $creetransposition); oci_bind_by_name($stmt, ':extinctiontransposition', $extinctiontransposition); oci_bind_by_name($stmt, ':datetranspositioncreation', $datetranspositioncreation); oci_bind_by_name($stmt, ':datetranspositionextinction', $datetranspositionextinction); if (oci_execute($stmt)) { $message = 'Emploi ajouté avec succès'; $type_message = 'success'; $action = 'list'; } else { $e = oci_error($stmt); $message = 'Erreur lors de l\'ajout : ' . $e['message']; $type_message = 'error'; } oci_free_statement($stmt); } } elseif ($action == 'edit') { if (empty($categoriemax) || empty($categoriemin) || empty($code_college) || empty($code_corps_activite) || empty($code_filiere) || empty($libellefr) || empty($libellear)) { $message = 'Les champs marqués d\'un * sont obligatoires'; $type_message = 'error'; } else { $sql = "UPDATE EMPLOI SET CATEGORIEMAX = :categoriemax, CATEGORIEMIN = :categoriemin, CODE_COLLEGE = :code_college, CODE_CORPS_ACTIVITE = :code_corps_activite, CODE_FILIERE = :code_filiere, LIBELLEFR = :libellefr, LIBELLEAR = :libellear, CODEANCIEN = :codeancien, REGIMEHORRAIRE = :regimehorraire, EMPLOIHABILLEMENT = :emploihabillement, TRANSPOSITIONCREATION = :transpositioncreation, TRANSPOSITIONEXTINCTION = :transpositionextinction, CREETRANSPOSITION = :creetransposition, EXTINCTIONTRANSPOSITION = :extinctiontransposition, DATETRANSPOSITIONCREATION = TO_DATE(:datetranspositioncreation, 'YYYY-MM-DD'), DATETRANSPOSITIONEXTINCTION = TO_DATE(:datetranspositionextinction, 'YYYY-MM-DD') WHERE CODE = :code"; $stmt = oci_parse($connection, $sql); oci_bind_by_name($stmt, ':categoriemax', $categoriemax); oci_bind_by_name($stmt, ':categoriemin', $categoriemin); oci_bind_by_name($stmt, ':code_college', $code_college); oci_bind_by_name($stmt, ':code_corps_activite', $code_corps_activite); oci_bind_by_name($stmt, ':code_filiere', $code_filiere); oci_bind_by_name($stmt, ':libellefr', $libellefr); oci_bind_by_name($stmt, ':libellear', $libellear); oci_bind_by_name($stmt, ':codeancien', $codeancien); oci_bind_by_name($stmt, ':regimehorraire', $regimehorraire); oci_bind_by_name($stmt, ':emploihabillement', $emploihabillement); oci_bind_by_name($stmt, ':transpositioncreation', $transpositioncreation); oci_bind_by_name($stmt, ':transpositionextinction', $transpositionextinction); oci_bind_by_name($stmt, ':creetransposition', $creetransposition); oci_bind_by_name($stmt, ':extinctiontransposition', $extinctiontransposition); oci_bind_by_name($stmt, ':datetranspositioncreation', $datetranspositioncreation); oci_bind_by_name($stmt, ':datetranspositionextinction', $datetranspositionextinction); oci_bind_by_name($stmt, ':code', $code); if (oci_execute($stmt)) { $message = 'Emploi modifié avec succès'; $type_message = 'success'; $action = 'list'; } else { $e = oci_error($stmt); $message = 'Erreur lors de la modification : ' . $e['message']; $type_message = 'error'; } oci_free_statement($stmt); } } } // Suppression if (isset($_GET['delete'])) { $code = $_GET['delete']; $sql = "DELETE FROM EMPLOI WHERE CODE = :code"; $stmt = oci_parse($connection, $sql); oci_bind_by_name($stmt, ':code', $code); if (oci_execute($stmt)) { $message = 'Emploi supprimé avec succès'; $type_message = 'success'; } else { $e = oci_error($stmt); $message = 'Erreur lors de la suppression : ' . $e['message']; $type_message = 'error'; } oci_free_statement($stmt); $action = 'list'; } // Récupération des données pour modification $emploi_data = null; if ($action == 'edit' && isset($_GET['code'])) { $sql = "SELECT * FROM EMPLOI WHERE CODE = :code"; $stmt = oci_parse($connection, $sql); oci_bind_by_name($stmt, ':code', $_GET['code']); oci_execute($stmt); $emploi_data = oci_fetch_assoc($stmt); oci_free_statement($stmt); } // Récupération des listes pour les clés étrangères $categories = []; $colleges = []; $corps_activites = []; $filieres = []; $sql_categories = "SELECT LIBELLE_CATEGORIE_FR, CODE_categorie FROM categorie ORDER BY CODE_categorie"; $stmt_categories = oci_parse($connection, $sql_categories); oci_execute($stmt_categories); while ($row = oci_fetch_assoc($stmt_categories)) { $categories[] = $row; } oci_free_statement($stmt_categories); $sql_colleges = "SELECT CODE_COLLEGE, LIBELLE_COLLEGE_FR FROM COLLEGE ORDER BY LIBELLE_COLLEGE_FR"; $stmt_colleges = oci_parse($connection, $sql_colleges); oci_execute($stmt_colleges); while ($row = oci_fetch_assoc($stmt_colleges)) { $colleges[] = $row; } oci_free_statement($stmt_colleges); $sql_corps_activites = "SELECT CODE_CORPS_ACTIVITE, LIBELLE_CORPS_ACTIVITE_FR FROM CORPS_ACTIVITE ORDER BY LIBELLE_CORPS_ACTIVITE_FR"; $stmt_corps_activites = oci_parse($connection, $sql_corps_activites); oci_execute($stmt_corps_activites); while ($row = oci_fetch_assoc($stmt_corps_activites)) { $corps_activites[] = $row; } oci_free_statement($stmt_corps_activites); $sql_filieres = "SELECT CODE_FILIERE, LIBELLE_FILIERE_FR FROM FILIERES ORDER BY LIBELLE_FILIERE_FR"; $stmt_filieres = oci_parse($connection, $sql_filieres); oci_execute($stmt_filieres); while ($row = oci_fetch_assoc($stmt_filieres)) { $filieres[] = $row; } oci_free_statement($stmt_filieres); // Récupération de la liste des emplois (recherche et tri) $search = trim($_GET['search'] ?? ''); $search_college = trim($_GET['search_college'] ?? ''); $search_corps = trim($_GET['search_corps'] ?? ''); $search_filiere = trim($_GET['search_filiere'] ?? ''); $emplois = []; if ($action == 'list') { $sql = "SELECT e.CODE, e.CATEGORIEMAX, e.CATEGORIEMIN, e.CODE_COLLEGE, e.CODE_CORPS_ACTIVITE, e.CODE_FILIERE, e.LIBELLEFR, e.LIBELLEAR, e.CODEANCIEN, e.REGIMEHORRAIRE, e.EMPLOIHABILLEMENT, e.TRANSPOSITIONCREATION, e.TRANSPOSITIONEXTINCTION, e.CREETRANSPOSITION, e.EXTINCTIONTRANSPOSITION, e.DATETRANSPOSITIONCREATION, e.DATETRANSPOSITIONEXTINCTION, c.LIBELLE_COLLEGE_FR, ca.LIBELLE_CORPS_ACTIVITE_FR, f.LIBELLE_FILIERE_FR, cp_max.code_categorie AS CATEGORIEMAX_CODE, cp_min.code_categorie AS CATEGORIEMIN_CODE FROM EMPLOI e LEFT JOIN COLLEGE c ON UPPER(REGEXP_REPLACE(e.CODE_COLLEGE, '[[:space:]]', '')) = UPPER(REGEXP_REPLACE(c.CODE_COLLEGE, '[[:space:]]', '')) LEFT JOIN CORPS_ACTIVITE ca ON UPPER(REGEXP_REPLACE(e.CODE_CORPS_ACTIVITE, '[[:space:]]', '')) = UPPER(REGEXP_REPLACE(ca.CODE_CORPS_ACTIVITE, '[[:space:]]', '')) LEFT JOIN FILIERES f ON UPPER(REGEXP_REPLACE(e.CODE_FILIERE, '[[:space:]]', '')) = UPPER(REGEXP_REPLACE(f.CODE_FILIERE, '[[:space:]]', '')) LEFT JOIN categorie cp_max ON UPPER(REGEXP_REPLACE(e.CATEGORIEMAX, '[[:space:]]', '')) = UPPER(REGEXP_REPLACE(cp_max.code_categorie, '[[:space:]]', '')) LEFT JOIN categorie cp_min ON UPPER(REGEXP_REPLACE(e.CATEGORIEMIN, '[[:space:]]', '')) = UPPER(REGEXP_REPLACE(cp_min.code_categorie, '[[:space:]]', ''))"; $conditions = []; $params = []; if ($search !== '') { $conditions[] = "(UPPER(e.CODE) LIKE :search OR UPPER(e.LIBELLEFR) LIKE :search OR UPPER(e.LIBELLEAR) LIKE :search)"; $params[':search'] = '%' . strtoupper($search) . '%'; } if ($search_college !== '') { $conditions[] = "UPPER(REGEXP_REPLACE(e.CODE_COLLEGE, '[[:space:]]', '')) = :search_college"; $params[':search_college'] = strtoupper(preg_replace('/\s+/', '', $search_college)); } if ($search_corps !== '') { $conditions[] = "UPPER(REGEXP_REPLACE(e.CODE_CORPS_ACTIVITE, '[[:space:]]', '')) = :search_corps"; $params[':search_corps'] = strtoupper(preg_replace('/\s+/', '', $search_corps)); } if ($search_filiere !== '') { $conditions[] = "UPPER(REGEXP_REPLACE(e.CODE_FILIERE, '[[:space:]]', '')) = :search_filiere"; $params[':search_filiere'] = strtoupper(preg_replace('/\s+/', '', $search_filiere)); } if (!empty($conditions)) { $sql .= " WHERE " . implode(" AND ", $conditions); } if (!empty($sort)) { $sql .= " ORDER BY " . $sort . " " . $order; } $stmt = oci_parse($connection, $sql); foreach ($params as $key => $value) { oci_bind_by_name($stmt, $key, $value); } if (oci_execute($stmt)) { while ($row = oci_fetch_assoc($stmt)) { $emplois[] = $row; } } else { $e = oci_error($stmt); $message = "Erreur de recherche : " . $e['message']; $type_message = "error"; } oci_free_statement($stmt); } ?> <!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Gestion des Emplois</title> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet"> <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script> <style> .message { padding: 10px; margin-bottom: 20px; border-radius: 5px; } .success { background-color: #d4edda; color: #155724; border: 1px solid #c3e6cb; } .error { background-color: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; } img { cursor: pointer; } label span { color: red; } </style> </head> <body> <div class="container mt-5"> <h1 class="mb-4">Gestion des Emplois</h1> <?php if (!empty($message)): ?> <div class="alert alert-<?php echo $type_message == 'success' ? 'success' : 'danger'; ?> alert-dismissible fade show" role="alert"> <?php echo htmlspecialchars($message); ?> <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button> </div> <?php endif; ?> <?php if ($action == 'list'): ?> <div class="mb-3"> <form method="GET" class="row g-3"> <input type="hidden" name="action" value="list"> <input type="hidden" name="list_submitted" value="1"> <div class="col-md-3"> <input type="text" name="search" class="form-control" placeholder="Rechercher par code ou libellé..." value="<?php echo htmlspecialchars($search); ?>"> </div> <div class="col-md-3"> <select name="search_college" class="form-select"> <option value="">Tous les collèges</option> <?php foreach ($colleges as $college): ?> <option value="<?php echo htmlspecialchars($college['CODE_COLLEGE']); ?>" <?php echo (strtoupper(preg_replace('/\s+/', '', $search_college)) == strtoupper(preg_replace('/\s+/', '', $college['CODE_COLLEGE']))) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($college['LIBELLE_COLLEGE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-3"> <select name="search_corps" class="form-select"> <option value="">Tous les corps activité</option> <?php foreach ($corps_activites as $corps): ?> <option value="<?php echo htmlspecialchars($corps['CODE_CORPS_ACTIVITE']); ?>" <?php echo (strtoupper(preg_replace('/\s+/', '', $search_corps)) == strtoupper(preg_replace('/\s+/', '', $corps['CODE_CORPS_ACTIVITE']))) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($corps['LIBELLE_CORPS_ACTIVITE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-3"> <select name="search_filiere" class="form-select"> <option value="">Toutes les filières</option> <?php foreach ($filieres as $filiere): ?> <option value="<?php echo htmlspecialchars($filiere['CODE_FILIERE']); ?>" <?php echo (strtoupper(preg_replace('/\s+/', '', $search_filiere)) == strtoupper(preg_replace('/\s+/', '', $filiere['CODE_FILIERE']))) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($filiere['LIBELLE_FILIERE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-12"> <button type="submit" class="btn btn-primary">Rechercher</button> </div> </form> <?php if ($permissions['ajout']): ?> <a href="?action=add" class="btn btn-success mt-2">+ Ajouter un emploi</a> <?php endif; ?> </div> <div class="table-responsive"> <table class="table table-striped"> <thead> <tr> <th><a href="?action=list&sort=CODE&order=<?php echo ($sort === 'CODE' && $order === 'ASC') ? 'DESC' : 'ASC'; ?>&search=<?php echo urlencode($search); ?>&search_college=<?php echo urlencode($search_college); ?>&search_corps=<?php echo urlencode($search_corps); ?>&search_filiere=<?php echo urlencode($search_filiere); ?>&list_submitted=1">Code <?php echo ($sort === 'CODE') ? ($order === 'ASC' ? '▲' : '▼') : ''; ?></a></th> <th><a href="?action=list&sort=LIBELLEFR&order=<?php echo ($sort === 'LIBELLEFR' && $order === 'ASC') ? 'DESC' : 'ASC'; ?>&search=<?php echo urlencode($search); ?>&search_college=<?php echo urlencode($search_college); ?>&search_corps=<?php echo urlencode($search_corps); ?>&search_filiere=<?php echo urlencode($search_filiere); ?>&list_submitted=1">Libellé (FR) <?php echo ($sort === 'LIBELLEFR') ? ($order === 'ASC' ? '▲' : '▼') : ''; ?></a></th> <th>Catégorie Min</th> <th>Catégorie Max</th> <th>Collège</th> <th>Corps Activité</th> <th>Filière</th> <th>Actions</th> </tr> </thead> <tbody> <?php foreach ($emplois as $emploi): ?> <tr> <td><?php echo htmlspecialchars($emploi['CODE']); ?></td> <td><?php echo htmlspecialchars($emploi['LIBELLEFR']); ?></td> <td><?php echo htmlspecialchars($emploi['CATEGORIEMIN_CODE']); ?></td> <td><?php echo htmlspecialchars($emploi['CATEGORIEMAX_CODE']); ?></td> <td><?php echo htmlspecialchars($emploi['LIBELLE_COLLEGE_FR']); ?></td> <td><?php echo htmlspecialchars($emploi['LIBELLE_CORPS_ACTIVITE_FR']); ?></td> <td><?php echo htmlspecialchars($emploi['LIBELLE_FILIERE_FR']); ?></td> <td> <?php if ($permissions['modif']): ?> <a href="?action=edit&code=<?php echo urlencode($emploi['CODE']); ?>"><img src="image/update.png" alt="Modifier"></a> <?php endif; ?> <?php if ($permissions['supp']): ?> <a href="?action=list&delete=<?php echo urlencode($emploi['CODE']); ?>" onclick="return confirm('Êtes-vous sûr de vouloir supprimer cet emploi ?');"><img src="image/supp.jpg" alt="Supprimer"></a> <?php endif; ?> </td> </tr> <?php endforeach; ?> </tbody> </table> </div> <?php elseif ($action == 'add' || ($action == 'edit' && $emploi_data)): ?> <h2><?php echo $action == 'add' ? 'Ajouter un emploi' : 'Modifier un emploi'; ?></h2> <form method="POST"> <ul class="nav nav-tabs" id="emploiTabs" role="tablist"> <li class="nav-item" role="presentation"> <button class="nav-link active" id="main-tab" data-bs-toggle="tab" data-bs-target="#main" type="button" role="tab" aria-controls="main" aria-selected="true">Informations Principales</button> </li> <li class="nav-item" role="presentation"> <button class="nav-link" id="additional-tab" data-bs-toggle="tab" data-bs-target="#additional" type="button" role="tab" aria-controls="additional" aria-selected="false">Informations Supplémentaires</button> </li> </ul> <div class="tab-content" id="emploiTabsContent"> <div class="tab-pane fade show active" id="main" role="tabpanel" aria-labelledby="main-tab"> <div class="row g-3 mt-3"> <div class="col-md-6"> <label for="code" class="form-label">Code: <span>*</span></label> <input type="text" class="form-control" id="code" name="code" value="<?php echo htmlspecialchars($emploi_data['CODE'] ?? ''); ?>" <?php echo $action == 'edit' ? 'readonly' : 'required'; ?>> </div> <div class="col-md-6"> <label for="categoriemax" class="form-label">Catégorie Max: <span>*</span></label> <select class="form-select" id="categoriemax" name="categoriemax" required> <option value="">-- Choisir une catégorie --</option> <?php foreach ($categories as $categorie): ?> <option value="<?php echo htmlspecialchars($categorie['CODE_CATEGORIE']); ?>" <?php echo (isset($emploi_data) && $emploi_data['CATEGORIEMAX'] == $categorie['CODE_CATEGORIE']) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($categorie['CODE_CATEGORIE']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label for="categoriemin" class="form-label">Catégorie Min: <span>*</span></label> <select class="form-select" id="categoriemin" name="categoriemin" required> <option value="">-- Choisir une catégorie --</option> <?php foreach ($categories as $categorie): ?> <option value="<?php echo htmlspecialchars($categorie['CODE_CATEGORIE']); ?>" <?php echo (isset($emploi_data) && $emploi_data['CATEGORIEMIN'] == $categorie['CODE_CATEGORIE']) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($categorie['CODE_CATEGORIE']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label for="code_college" class="form-label">Collège: <span>*</span></label> <select class="form-select" id="code_college" name="code_college" required> <option value="">-- Choisir un collège --</option> <?php foreach ($colleges as $college): ?> <option value="<?php echo htmlspecialchars(trim($college['CODE_COLLEGE'])); ?>" <?php echo (isset($emploi_data) && trim($emploi_data['CODE_COLLEGE']) == trim($college['CODE_COLLEGE'])) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($college['LIBELLE_COLLEGE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label for="code_corps_activite" class="form-label">Corps Activité: <span>*</span></label> <select class="form-select" id="code_corps_activite" name="code_corps_activite" required> <option value="">-- Choisir un corps activité --</option> <?php foreach ($corps_activites as $corps): ?> <option value="<?php echo htmlspecialchars($corps['CODE_CORPS_ACTIVITE']); ?>" <?php echo (isset($emploi_data) && $emploi_data['CODE_CORPS_ACTIVITE'] == $corps['CODE_CORPS_ACTIVITE']) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($corps['LIBELLE_CORPS_ACTIVITE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label for="code_filiere" class="form-label">Filière: <span>*</span></label> <select class="form-select" id="code_filiere" name="code_filiere" required> <option value="">-- Choisir une filière --</option> <?php foreach ($filieres as $filiere): ?> <option value="<?php echo htmlspecialchars($filiere['CODE_FILIERE']); ?>" <?php echo (isset($emploi_data) && $emploi_data['CODE_FILIERE'] == $filiere['CODE_FILIERE']) ? 'selected' : ''; ?>> <?php echo htmlspecialchars($filiere['LIBELLE_FILIERE_FR']); ?> </option> <?php endforeach; ?> </select> </div> <div class="col-md-6"> <label for="libellefr" class="form-label">Libellé (FR): <span>*</span></label> <input type="text" class="form-control" id="libellefr" name="libellefr" value="<?php echo htmlspecialchars($emploi_data['LIBELLEFR'] ?? ''); ?>" required> </div> <div class="col-md-6"> <label for="libellear" class="form-label">Libellé (AR): <span>*</span></label> <input type="text" class="form-control" id="libellear" name="libellear" value="<?php echo htmlspecialchars($emploi_data['LIBELLEAR'] ?? ''); ?>" required> </div> </div> </div> <div class="tab-pane fade" id="additional" role="tabpanel" aria-labelledby="additional-tab"> <div class="row g-3 mt-3"> <div class="col-md-6"> <label for="codeancien" class="form-label">Code Ancien:</label> <input type="text" class="form-control" id="codeancien" name="codeancien" value="<?php echo htmlspecialchars($emploi_data['CODEANCIEN'] ?? ''); ?>"> </div> <div class="col-md-6"> <label for="regimehorraire" class="form-label">Régime Horaire:</label> <input type="text" class="form-control" id="regimehorraire" name="regimehorraire" value="<?php echo htmlspecialchars($emploi_data['REGIMEHORRAIRE'] ?? ''); ?>"> </div> <div class="col-md-6"> <label for="emploihabillement" class="form-label">Emploi Habillement:</label> <input type="text" class="form-control" id="emploihabillement" name="emploihabillement" value="<?php echo htmlspecialchars($emploi_data['EMPLOIHABILLEMENT'] ?? ''); ?>"> </div> <div class="col-md-6"> <label for="transpositioncreation" class="form-label">Transposition Création:</label> <input type="text" class="form-control" id="transpositioncreation" name="transpositioncreation" value="<?php $value = ''; if (!empty($emploi_data['TRANSPOSITIONCREATION'])) { $date_str = $emploi_data['TRANSPOSITIONCREATION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } else { $value = $date_str; // If not a date, display as is } } echo htmlspecialchars($value); ?>"> </div> <div class="col-md-6"> <label for="transpositionextinction" class="form-label">Transposition Extinction:</label> <input type="text" class="form-control" id="transpositionextinction" name="transpositionextinction" value="<?php $value = ''; if (!empty($emploi_data['TRANSPOSITIONEXTINCTION'])) { $date_str = $emploi_data['TRANSPOSITIONEXTINCTION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } else { $value = $date_str; // If not a date, display as is } } echo htmlspecialchars($value); ?>"> </div> <div class="col-md-6"> <label for="creetransposition" class="form-label">Créé Transposition:</label> <input type="text" class="form-control" id="creetransposition" name="creetransposition" value="<?php $value = ''; if (!empty($emploi_data['CREETRANSPOSITION'])) { $date_str = $emploi_data['CREETRANSPOSITION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } else { $value = $date_str; // If not a date, display as is } } echo htmlspecialchars($value); ?>"> </div> <div class="col-md-6"> <label for="extinctiontransposition" class="form-label">Extinction Transposition:</label> <input type="text" class="form-control" id="extinctiontransposition" name="extinctiontransposition" value="<?php $value = ''; if (!empty($emploi_data['EXTINCTIONTRANSPOSITION'])) { $date_str = $emploi_data['EXTINCTIONTRANSPOSITION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } else { $value = $date_str; // If not a date, display as is } } echo htmlspecialchars($value); ?>"> </div> <div class="col-md-6"> <label for="datetranspositioncreation" class="form-label">Date Transposition Création:</label> <input type="text" class="form-control" id="datetranspositioncreation" name="datetranspositioncreation" placeholder="jj/mm/aaaa" value="<?php $value = ''; if (!empty($emploi_data['DATETRANSPOSITIONCREATION'])) { $date_str = $emploi_data['DATETRANSPOSITIONCREATION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } } echo htmlspecialchars($value); ?>"> </div> <div class="col-md-6"> <label for="datetranspositionextinction" class="form-label">Date Transposition Extinction:</label> <input type="text" class="form-control" id="datetranspositionextinction" name="datetranspositionextinction" placeholder="jj/mm/aaaa" value="<?php $value = ''; if (!empty($emploi_data['DATETRANSPOSITIONEXTINCTION'])) { $date_str = $emploi_data['DATETRANSPOSITIONEXTINCTION']; $date = DateTime::createFromFormat('Y-m-d', $date_str); if (!$date) { $date = DateTime::createFromFormat('d-M-y', strtoupper($date_str)); } if (!$date) { $date = DateTime::createFromFormat('Y-m-d H:i:s', $date_str); } if ($date) { $value = $date->format('d/m/Y'); } } echo htmlspecialchars($value); ?>"> </div> </div> </div> </div> <div class="mt-3"> <button type="submit" class="btn <?php echo $action == 'add' ? 'btn-success' : 'btn-primary'; ?>"><?php echo $action == 'add' ? 'Ajouter' : 'Modifier'; ?></button> <a href="?action=list" class="btn btn-secondary">Retour à la liste</a> </div> </form> <?php endif; ?> </div> </body> </html> <?php if ($connection) { oci_close($connection); } ?>
Créé il y a 1 semaine.