include '../controller/' . $myClass . '.php';
    }
}
spl_autoload_register("classLoad");
include '../config.php';
include '../lib/image-processing.php';
//classes loading end
session_start();
//post input processing
$action = htmlentities($_POST['action']);
$idProjet = htmlentities($_POST['idProjet']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
//Comonent Manager
$contratEmployeManager = new ContratEmployeManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['employe'])) {
        $dateContrat = htmlentities($_POST['dateContrat']);
        $dateFinContrat = htmlentities($_POST['dateFinContrat']);
        $nombreUnites = htmlentities($_POST['nombreUnites']);
        $prixUnitaire = htmlentities($_POST['prixUnitaire']);
        $unite = htmlentities($_POST['unite']);
        $nomUnite = htmlentities($_POST['nomUnite']);
        $traveaux = htmlentities($_POST['traveaux']);
        $traveauxArabe = htmlentities($_POST['traveauxArabe']);
        $total = htmlentities($_POST['total']);
        $employe = htmlentities($_POST['employe']);
        $idProjet = htmlentities($_POST['idProjet']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
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';
require_once '../lib/tcpdf/tcpdf.php';
//classes loading end
session_start();
//classes managers
$contratEmployeManager = new ContratEmployeManager($pdo);
$companyManager = new CompanyManager($pdo);
$clientManager = new ClientManager($pdo);
$projetManager = new ProjetManager($pdo);
$employeManager = new EmployeManager($pdo);
//classes
$idContrat = $_GET['idContratEmploye'];
$contrat = $contratEmployeManager->getContratEmployeById($idContrat);
$projet = $projetManager->getProjetById($contrat->idProjet());
$employe = $employeManager->getEmployeById($contrat->employe());
//choix unité en arabe selon la valeur de l'unité
$unite = "";
if ($contrat->unite() == "m²") {
    $unite = "المتر المربع";
} else {
    if ($contrat->unite() == "m lineaire") {
    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'])) {
    //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>
{
    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;
    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" or $_SESSION['userMerlaTrav']->profil() == "consultant")) {
    //les sources
    $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);
        ?>
<!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 -->
    }
}
spl_autoload_register("classLoad");
include '../config.php';
include '../lib/image-processing.php';
//classes loading end
session_start();
//post input processing
$action = htmlentities($_POST['action']);
$idProjet = htmlentities($_POST['idProjet']);
$idSociete = htmlentities($_POST['idSociete']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
//Comonent Manager
$contratEmployeManager = new ContratEmployeManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['employe'])) {
        $dateContrat = htmlentities($_POST['dateContrat']);
        $nombreUnites = htmlentities($_POST['nombreUnites']);
        $prixUnitaire = htmlentities($_POST['prixUnitaire']);
        $total = htmlentities($_POST['total']);
        $employe = htmlentities($_POST['employe']);
        $idProjet = htmlentities($_POST['idProjet']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $contratEmploye = new ContratEmploye(array('dateContrat' => $dateContrat, 'nombreUnites' => $nombreUnites, 'prixUnitaire' => $prixUnitaire, 'total' => $total, 'employe' => $employe, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $contratEmployeManager->add($contratEmploye);
{
    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();