$typeMessage = "";
//Component Class Manager
$collaborationManager = new CollaborationManager($pdo);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['titre'])) {
        $titre = htmlentities($_POST['titre']);
        $description = htmlentities($_POST['description']);
        $status = htmlentities($_POST['status']);
        $duree = htmlentities($_POST['duree']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $collaboration = new Collaboration(array('titre' => $titre, 'description' => $description, 'status' => $status, 'duree' => $duree, 'created' => $created, 'createdBy' => $createdBy));
        //add it to db
        $collaborationManager->add($collaboration);
        $actionMessage = "Opération Valide : Collaboration Ajouté(e) avec succès.";
        $typeMessage = "success";
    } else {
        $actionMessage = "Erreur Ajout collaboration : Vous devez remplir le champ 'titre'.";
        $typeMessage = "error";
    }
} else {
    if ($action == "update") {
        $idCollaboration = htmlentities($_POST['idCollaboration']);
        if (!empty($_POST['titre'])) {
            $titre = htmlentities($_POST['titre']);
            $description = htmlentities($_POST['description']);
            $status = htmlentities($_POST['status']);
            $duree = htmlentities($_POST['duree']);
            $updatedBy = $_SESSION['userMerlaTrav']->login();