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'])) {
    //les sources
    $idProjet = 0;
    $projetManager = new ProjetManager($pdo);
    $contratEmployeManager = new ContratEmployeManager($pdo);
    $contratDetaislManager = new ContratDetailsManager($pdo);
    $employesManager = new EmployeManager($pdo);
    if (isset($_GET['idProjet']) and $_GET['idProjet'] > 0 and $_GET['idProjet'] <= $projetManager->getLastId()) {
        $idProjet = $_GET['idProjet'];
        $projet = $projetManager->getProjetById($idProjet);
        $contratEmployes = $contratEmployeManager->getContratEmployesByIdProjet($idProjet);
        $employes = $employesManager->getEmployes();
        //}
        ?>
<!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]-->
<!-- BEGIN HEAD -->
<head>
    <meta charset="utf-8" />
}
spl_autoload_register("classLoad");
include '../config.php';
include '../lib/image-processing.php';
//classes loading end
session_start();
//post input processing
$action = htmlentities($_POST['action']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
$idContratEmploye = htmlentities($_POST['idContratEmploye']);
$idProjet = htmlentities($_POST['idProjet']);
$idSociete = htmlentities($_POST['idSociete']);
//Component Class Manager
$contratDetailsManager = new ContratDetailsManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['montant'])) {
        $dateOperation = htmlentities($_POST['dateOperation']);
        $montant = htmlentities($_POST['montant']);
        $numeroCheque = htmlentities($_POST['numeroCheque']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $contratDetails = new ContratDetails(array('dateOperation' => $dateOperation, 'montant' => $montant, 'numeroCheque' => $numeroCheque, 'idContratEmploye' => $idContratEmploye, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $contratDetailsManager->add($contratDetails);
        $actionMessage = "Opération Valide : ContratDetails Ajouté(e) avec succès.";
        $typeMessage = "success";
        //add history data to db
    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();
if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") {
    //classes managers
    $idProjet = 0;
    $projetManager = new ProjetManager($pdo);
    $contratEmployeManager = new ContratEmployeManager($pdo);
    $contratDetaislManager = new ContratDetailsManager($pdo);
    $employesManager = new EmployeManager($pdo);
    if (isset($_GET['idContratEmploye']) and $_GET['idContratEmploye'] > 0 and $_GET['idContratEmploye'] <= $contratEmployeManager->getLastId()) {
        $idProjet = $_GET['idProjet'];
        $idContratEmploye = $_GET['idContratEmploye'];
        $projet = $projetManager->getProjetById($idProjet);
        $contratEmploye = $contratEmployeManager->getContratEmployeById($idContratEmploye);
        $contratDetails = $contratDetaislManager->getContratDetailsByIdContratEmploye($idContratEmploye);
        $totalPaye = $contratDetaislManager->getContratDetailsTotalByIdContratEmploye($idContratEmploye);
    }
    ob_start();
    ?>
<style type="text/css">
    p, h1, h3{
        text-align: center;
        text-decoration: underline;
    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();
if (isset($_SESSION['userMerlaTrav'])) {
    //classes managers
    $idProjet = 0;
    $projetManager = new ProjetManager($pdo);
    $contratEmployeManager = new ContratEmployeManager($pdo);
    $contratDetaislManager = new ContratDetailsManager($pdo);
    $employesManager = new EmployeManager($pdo);
    $contratDetails = "";
    if (isset($_GET['idContratDetail']) and $_GET['idContratDetail'] > 0 and $_GET['idContratDetail'] <= $contratDetaislManager->getLastId()) {
        $idProjet = $_GET['idProjet'];
        $idContratDetail = $_GET['idContratDetail'];
        $projet = $projetManager->getProjetById($idProjet);
        //$contratEmploye = $contratEmployeManager->getContratEmployeById($idContratEmploye);
        //$contratDetails = $contratDetaislManager->getContratDetailsByIdContratEmploye($idContratEmploye);
        $contratDetails = $contratDetaislManager->getContratDetailsById($idContratDetail);
        $contrat = $contratEmployeManager->getContratEmployeById($contratDetails->idContratEmploye());
        $employe = $employesManager->getEmployeById($contrat->employe());
        //$totalPaye = $contratDetaislManager->getContratDetailsTotalByIdContratEmploye($idContratEmploye);
    }
    ob_start();
    ?>