$param = $_GET['param']; $idEmploye = htmlentities($_POST['idEmploye']); if (!empty($_POST['nom'])) { $nom = htmlentities($_POST['nom']); $cin = htmlentities($_POST['cin']); $email = htmlentities($_POST['email']); $telephone = htmlentities($_POST['telephone']); $etatCivile = htmlentities($_POST['etatCivile']); $dateDebut = htmlentities($_POST['dateDebut']); $dateSortie = htmlentities($_POST['dateSortie']); $photo = htmlentities($_POST['photo']); if (!empty($_FILES['newPhoto']) and $_FILES['newPhoto']['error'] == 0) { $photo = imageProcessing($_FILES['newPhoto'], '/photo_employes_societe/'); } $employe = new EmployeSociete(array('id' => $idEmploye, 'nom' => $nom, 'cin' => $cin, 'etatCivile' => $etatCivile, 'telephone' => $telephone, 'photo' => $photo, 'email' => $email, 'dateDebut' => $dateDebut, 'dateSortie' => $dateSortie)); $employeManager = new EmployeSocieteManager($pdo); $employeManager->update($employe); $_SESSION['employe-update-success'] = "<strong>Opération valide : </strong>Les informations de l'employé '" . $nom . "' sont modifiées avec succès."; $location = "employes-societe.php"; if ($param == 2) { $location = "employe-societe-profile.php?idEmploye=" . $idEmploye; } header('Location:../' . $location); } else { $_SESSION['employe-update-error'] = "<strong>Erreur Modification Employé : </strong>Vous devez remplir au moins le champ 'Nom'."; $location = "employes-societe.php"; if ($param == 2) { $location = "employe-societe-profile.php?idEmploye=" . $idEmploye; } header('Location:../' . $location); exit;
function classLoad($myClass) { if (file_exists('model/' . $myClass . '.php')) { include 'model/' . $myClass . '.php'; } elseif (file_exists('controller/' . $myClass . '.php')) { include 'controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include 'config.php'; include 'lib/pagination.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") { //les sources $employeManager = new EmployeSocieteManager($pdo); $employes = ""; //test the employeSociete object number: if exists get terrain else do nothing $employeNumber = $employeManager->getEmployeSocieteNumber(); if ($employeNumber != 0) { $employeSocietePerPage = 10; $pageNumber = ceil($employeNumber / $employeSocietePerPage); $p = 1; if (isset($_GET['p']) and ($_GET['p'] > 0 and $_GET['p'] <= $pageNumber)) { $p = $_GET['p']; } else { $p = 1; } $begin = ($p - 1) * $employeSocietePerPage; $pagination = paginate('employes-societe.php', '?p=', $pageNumber, $p); $employesSociete = $employeManager->getEmployesSocieteByLimits($begin, $employeSocietePerPage);
function classLoad($myClass) { if (file_exists('model/' . $myClass . '.php')) { include 'model/' . $myClass . '.php'; } elseif (file_exists('controller/' . $myClass . '.php')) { include 'controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include 'config.php'; include 'lib/pagination.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") { //les sources $employeManager = new EmployeSocieteManager($pdo); $employe = ""; $idEmploye = 0; if (isset($_GET['idEmploye']) and ($_GET['idEmploye'] > 0 and $_GET['idEmploye'] <= $employeManager->getLastId())) { $idEmploye = htmlentities($_GET['idEmploye']); $employe = $employeManager->getEmployesSocieteById($idEmploye); $salairesManager = new EmployeSocieteSalaireManager($pdo); $salaires = $salairesManager->getSalairesByIdEmploye($idEmploye); $congesManager = new EmployeSocieteCongeManager($pdo); $conges = $congesManager->getCongesByIdEmploye($idEmploye); } ?> <!DOCTYPE html> <!--[if IE 8]> <html lang="en" class="ie8"> <![endif]--> <!--[if IE 9]> <html lang="en" class="ie9"> <![endif]--> <!--[if !IE]><!--> <html lang="en"> <!--<![endif]-->
function classLoad($myClass) { if (file_exists('../model/' . $myClass . '.php')) { include '../model/' . $myClass . '.php'; } elseif (file_exists('../controller/' . $myClass . '.php')) { include '../controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include '../config.php'; include '../lib/image-processing.php'; //classes loading end session_start(); //post input processing if (!empty($_POST['nom'])) { $employeManager = new EmployeSocieteManager($pdo); $nom = htmlentities($_POST['nom']); if ($employeManager->exists($nom)) { $_SESSION['employe-add-error'] = "<strong>Erreur Ajout Employé : </strong>Un employé existe déjà avec ce nom : " . $nom . "."; header('Location:../employes-societe.php'); exit; } else { $cin = htmlentities($_POST['cin']); $email = htmlentities($_POST['email']); $telephone = htmlentities($_POST['telephone']); $etatCivile = htmlentities($_POST['etatCivile']); $email = htmlentities($_POST['email']); $dateDebut = htmlentities($_POST['dateDebut']); $dateSortie = htmlentities($_POST['dateSortie']); $photo = imageProcessing($_FILES['photo'], '/photo_employes_societe/'); $employe = new EmployeSociete(array('nom' => $nom, 'cin' => $cin, 'etatCivile' => $etatCivile, 'telephone' => $telephone, 'photo' => $photo, 'email' => $email, 'dateDebut' => $dateDebut, 'dateSortie' => $dateSortie));
<?php //classes loading begin function classLoad($myClass) { if (file_exists('../model/' . $myClass . '.php')) { include '../model/' . $myClass . '.php'; } elseif (file_exists('../controller/' . $myClass . '.php')) { include '../controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include '../config.php'; //classes loading end session_start(); //post input processing $idEmploye = $_POST['idEmploye']; $employeManager = new EmployeSocieteManager($pdo); $employeManager->delete($idEmploye); $_SESSION['employe-delete-success'] = "<strong>Opération valide : </strong>Employé supprimé avec succès."; header('Location:../employes-societe.php');