Example #1
0
        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'])) {
    //classManagers
    $projetManager = new ProjetManager($pdo);
    $societeManager = new SocieteManager($pdo);
    $appartementManager = new AppartementManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    $maisonManager = new MaisonManager($pdo);
    $terrainManager = new TerrainManager($pdo);
    $contratManager = new ContratManager($pdo);
    //
    $type = "";
    if (isset($_GET['idProjet']) and ($_GET['idProjet'] >= 1 and $_GET['idProjet'] <= $projetManager->getLastId())) {
        $idProjet = $_GET['idProjet'];
        $idSociete = $_GET['idSociete'];
        $societe = $societeManager->getSocieteById($idSociete);
        $appartements = $appartementManager->getAppartementsByIdProjet($idProjet);
        $locaux = $locauxManager->getLocauxByIdProjet($idProjet);
        $maisons = $maisonManager->getMaisonsByIdProjet($idProjet);
        $terrains = $terrainManager->getTerrainsByIdProjet($idProjet);
        //Get Biens Number
        $appartementNumber = $appartementManager->getNumberBienByIdProjet($idProjet);
$idProjet = $_POST['idProjet'];
$idSociete = $_POST['idSociete'];
$idContrat = $_POST['idContrat'];
$status = $_POST['status'];
$typeBien = $_POST['typeBien'];
$idBien = $_POST['idBien'];
//create classes managers
$contratManager = new ContratManager($pdo);
//create classes
$redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete;
if ($typeBien == "appartement") {
    $appartementManager = new AppartementManager($pdo);
    $appartementManager->updateStatus($status, $idBien);
} else {
    if ($typeBien == "localCommercial") {
        $locauxManager = new LocauxManager($pdo);
        $locauxManager->updateStatus($status, $idBien);
    } else {
        if ($typeBien == "maison") {
            $maisonManager = new MaisonManager($pdo);
            $maisonManager->updateStatus($status, $idBien);
        } else {
            if ($typeBien == "terrain") {
                $terrainManager = new TerrainManager($pdo);
                $terrainManager->updateStatus($status, $idBien);
            }
        }
    }
}
$_SESSION['bien-change-status-success'] = "<strong>Opération valide : </strong>Le status du bien est changé avec succès.";
header($redirectLink);
Example #3
0
 }
 //special treatment for bien of contrat object
 $idBien = $contrat->idBien();
 $typeBien = $contrat->typeBien();
 if (isset($_POST['typeBien'])) {
     //get bien form elements
     $idBien = htmlentities($_POST['bien']);
     $typeBien = htmlentities($_POST['typeBien']);
     //bien treatment
     if ($typeBien == "appartement") {
         $appartementManager = new AppartementManager($pdo);
         $appartementManager->updateStatus("Vendu", $idBien);
         $appartementManager->updateStatus("Disponible", $contrat->idBien());
     } else {
         if ($typeBien == "localCommercial") {
             $locauxManager = new LocauxManager($pdo);
             $locauxManager->updateStatus("Vendu", $idBien);
             $locauxManager->updateStatus("Disponible", $contrat->idBien());
         } else {
             if ($typeBien == "maison") {
                 $maisonManager = new MaisonManager($pdo);
                 $maisonManager->updateStatus("Vendu", $idBien);
                 $maisonManager->updateStatus("Disponible", $contrat->idBien());
             } else {
                 if ($typeBien == "terrain") {
                     $terrainManager = new TerrainManager($pdo);
                     $terrainManager->updateStatus("Vendu", $idBien);
                     $terrainManager->updateStatus("Disponible", $contrat->idBien());
                 }
             }
         }
Example #4
0
        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") {
    $contratManager = new ContratManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $appartementManager = new AppartementManager($pdo);
    $terrainManager = new TerrainManager($pdo);
    $maisonManager = new MaisonManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    $biens = "";
    $idContrat = 0;
    if (isset($_GET['idContrat']) and ($_GET['idContrat'] > 0 and $_GET['idContrat'] <= $contratManager->getLastId())) {
        $idContrat = $_GET['idContrat'];
    } else {
        header('Location:../dashboard.php');
        exit;
    }
    $contrat = $contratManager->getContratById($idContrat);
    $projet = $projetManager->getProjetById($contrat->idProjet());
    $typeBien = "";
    if ($contrat->typeBien() == "appartement") {
        $biens = $appartementManager->getAppartementById($contrat->idBien());
        $typeBien = "Appartement";
    } else {
    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
$idProjet = $_POST['idProjet'];
$idContrat = $_POST['idContrat'];
$contratManager = new ContratManager($pdo);
$contrat = $contratManager->getContratById($idContrat);
$contratManager->delete($idContrat);
if ($contrat->typeBien() == "appartement") {
    $appartementManager = new AppartementManager($pdo);
    $appartementManager->changeStatus($contrat->idBien(), "Non");
} else {
    if ($contrat->typeBien() == "localCommercial") {
        $locauxManager = new LocauxManager($pdo);
        $locauxManager->changeStatus($contrat->idBien(), "Non");
    }
}
$_SESSION['contrat-delete-success'] = "<strong>Opération valide : </strong>Contrat supprimé avec succès.";
$redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet;
if (isset($_GET['p']) and $_GET['p'] == 99) {
    $redirectLink = 'Location:../clients-search.php';
}
header($redirectLink);
        $codeContrat = uniqid() . date('YmdHis');
        $created = date('Y-m-d h:i:s');
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $numeroCheque = '0';
        if (isset($_POST['numeroCheque'])) {
            $numeroCheque = htmlentities($_POST['numeroCheque']);
        }
        $contratManager = new ContratManager($pdo);
        $contrat = new Contrat(array('numero' => $numero, 'dateCreation' => $dateCreation, 'prixVente' => $prixNegocie, 'avance' => $avance, 'modePaiement' => $modePaiement, 'dureePaiement' => $dureePaiement, 'nombreMois' => $nombreMois, 'echeance' => $echeance, 'note' => $note, 'idClient' => $idClient, 'idProjet' => $idProjet, 'idBien' => $idBien, 'typeBien' => $typeBien, 'code' => $codeContrat, 'numeroCheque' => $numeroCheque, 'created' => $created, 'createdBy' => $createdBy));
        $contratManager->add($contrat);
        if ($typeBien == "appartement") {
            $appartementManager = new AppartementManager($pdo);
            $appartementManager->changeStatus($idBien, "Vendu");
        } else {
            if ($typeBien == "localCommercial") {
                $locauxManager = new LocauxManager($pdo);
                $locauxManager->changeStatus($idBien, "Vendu");
            }
        }
        //add note client into db and show it in the dashboard
        $notesClientManager = new NotesClientManager($pdo);
        $notesClient = new NotesClient(array('note' => $note, 'created' => date('Y-m-d'), 'idProjet' => $idProjet, 'codeContrat' => $codeContrat));
        $notesClientManager->add($notesClient);
        header('Location:../contrat.php?codeContrat=' . $codeContrat);
    } else {
        $_SESSION['contrat-add-error'] = "<strong>Erreur Création Contrat : </strong>Vous devez choisir un 'Type de bien'.";
        header('Location:../contrats-add.php?idProjet=' . $idProjet . '&codeClient=' . $codeClient);
        exit;
    }
} else {
    $_SESSION['contrat-add-error'] = "<strong>Erreur Création Contrat : </strong>Vous devez remplir le champ <strong>Nom</strong>.";
Example #7
0
 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();
 if(isset($_SESSION['userMerlaTrav']) ){
     //classes managers
     $appartementManager = new AppartementManager($pdo);
     $locauxManager = new LocauxManager($pdo);
     $usersManager = new UserManager($pdo);
     $projetManager = new ProjetManager($pdo);
     $contratManager = new ContratManager($pdo);
     $clientManager = new ClientManager($pdo);
     $chargeManager = new ChargeManager($pdo);
     $chargeCommunManager = new ChargeCommunManager($pdo);
     $livraisonsManager = new LivraisonManager($pdo);
     $livraisonDetailManager = new LivraisonDetailManager($pdo);
     $fournisseursManager = new FournisseurManager($pdo);
     $reglementsFournisseurManager = new ReglementFournisseurManager($pdo);
     $caisseEntreesManager = new CaisseEntreesManager($pdo);
     $caisseSortiesManager = new CaisseSortiesManager($pdo);
     $operationsManager = new OperationManager($pdo);
     //classes and vars
     //$idProjet = $_GET['idProjet'];
Example #8
0
//classes loading end
session_start();
$historyManager = new HistoryManager($pdo);
$projetManager = new ProjetManager($pdo);
//post input processing
$idProjet = htmlentities($_POST['idProjet']);
$idSociete = htmlentities($_POST['idSociete']);
$type = htmlentities($_POST['type']);
if (!empty($_POST['idProjet'])) {
    $id = htmlentities($_POST['id']);
    if (htmlentities($_POST['typeImmobiliere']) == "appartement") {
        $appartementManager = new AppartementManager($pdo);
        $appartementManager->delete($id);
    } else {
        if (htmlentities($_POST['typeImmobiliere']) == "local") {
            $locauxManager = new LocauxManager($pdo);
            $locauxManager->delete($id);
        } else {
            if (htmlentities($_POST['typeImmobiliere']) == "maison") {
                $maisonManager = new MaisonManager($pdo);
                $maisonManager->delete($id);
            } else {
                if (htmlentities($_POST['typeImmobiliere']) == "terrain") {
                    $terrainManager = new TerrainManager($pdo);
                    $terrainManager->delete($id);
                }
            }
        }
    }
    //add history data to db
    $createdBy = $_SESSION['userMerlaTrav']->login();
{
    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
$idProjet = $_POST['idProjet'];
$idContrat = $_POST['idContrat'];
//create classes managers
$locauxManager = new LocauxManager($pdo);
$contratManager = new ContratManager($pdo);
$appartementManager = new AppartementManager($pdo);
//create classes
$contrat = $contratManager->getContratById($idContrat);
//change status of the old contrat Bien from reservé to non reservé
if ($contrat->typeBien() == "appartement") {
    $appartementManager->changeStatus($contrat->idBien(), "Disponible");
} else {
    if ($contrat->typeBien() == "localCommercial") {
        $locauxManager->changeStatus($contrat->idBien(), "Disponible");
    }
}
$contratManager->desisterContrat($idContrat);
$_SESSION['contrat-desister-success'] = "<strong>Opération valide : </strong>Le contrat est désisté avec succès.";
$redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet;
Example #10
0
 $biensDiponible = 0;
 $biensVendu = 0;
 $biensPromesseVente = 0;
 $biens = 0;
 //begin process
 $type = $_GET['type'];
 if ($type == "appartements") {
     $appartementManager = new AppartementManager($pdo);
     $appartements = $appartementManager->getAppartementsNonVendu();
     $biens = $appartementManager->getNumberBiens();
     $biensDiponible = $appartementManager->getNumberBienDisbonible();
     $biensVendu = $appartementManager->getNumberBienVendu();
     $biensPromesseVente = $appartementManager->getNumberBienPromesseVente();
 } else {
     if ($type == "locaux") {
         $locauxManager = new LocauxManager($pdo);
         $locaux = $locauxManager->getLocauxNonVendu();
         $biens = $locauxManager->getNumberBiens();
         $biensDiponible = $locauxManager->getNumberBienDisbonible();
         $biensVendu = $locauxManager->getNumberBienVendu();
         $biensPromesseVente = $locauxManager->getNumberBienPromesseVente();
     } else {
         if ($type == "maisons") {
             $maisonManager = new MaisonManager($pdo);
             $maisons = $maisonManager->getMaisonsNonVendu();
             $biens = $maisonManager->getNumberBiens();
             $biensDiponible = $maisonManager->getNumberBienDisbonible();
             $biensVendu = $maisonManager->getNumberBienVendu();
             $biensPromesseVente = $maisonManager->getNumberBienPromesseVente();
         } else {
             if ($type == "terrains") {
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();
if (isset($_SESSION['userMerlaTrav']) and isset($_GET['idProjet'])) {
    //classes managers
    $appartementManager = new AppartementManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    $usersManager = new UserManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $contratManager = new ContratManager($pdo);
    $clientManager = new ClientManager($pdo);
    $chargeManager = new ChargeManager($pdo);
    $chargeCommunManager = new ChargeCommunManager($pdo);
    $livraisonsManager = new LivraisonManager($pdo);
    $livraisonDetailManager = new LivraisonDetailManager($pdo);
    $fournisseursManager = new FournisseurManager($pdo);
    $reglementsFournisseurManager = new ReglementFournisseurManager($pdo);
    $caisseEntreesManager = new CaisseEntreesManager($pdo);
    $caisseSortiesManager = new CaisseSortiesManager($pdo);
    $operationsManager = new OperationManager($pdo);
    //classes and vars
    $idProjet = $_GET['idProjet'];
Example #12
0
									</div>
									<div class="tab-pane" id="tab_1_3">
										<div class="scroller" data-height="290px" data-always-visible="1" data-rail-visible1="1">
											<ul class="feeds">
												<?php 
    //$notesClient = $notesClientsManager->getNotes();
    foreach ($contrats as $contrat) {
        $nomBien = "";
        $typeBien = "";
        if ($contrat->typeBien() == "maison") {
            $maisonManager = new MaisonManager($pdo);
            $typeBien = "Maison";
            $nomBien = $maisonManager->getMaisonById($contrat->idBien())->nom();
        } else {
            if ($contrat->typeBien() == "localCommercial") {
                $locauxManager = new LocauxManager($pdo);
                $typeBien = "Local Commercial";
                $nomBien = $locauxManager->getLocauxById($contrat->idBien())->nom();
            } else {
                if ($contrat->typeBien() == "appartement") {
                    $appartementManager = new AppartementManager($pdo);
                    $typeBien = "Appartement";
                    $nomBien = $appartementManager->getAppartementById($contrat->idBien())->nom();
                } else {
                    if ($contrat->typeBien() == "terrain") {
                        $terrainManager = new TerrainManager($pdo);
                        $typeBien = "Terrain";
                        $nomBien = $terrainManager->getTerrainById($contrat->idBien())->nom();
                    }
                }
            }
Example #13
0
                                 <tbody>
                                     <?php 
 foreach ($contratsEnCours as $element) {
     $projet = $projetManager->getProjetById($element->idProjet());
     $bien = "";
     $typeBien = "";
     //if the property is a "Local commercial" we don't need to mention niveau attribute
     $niveau = "";
     if ($element->typeBien() == "appartement") {
         $appartementManager = new AppartementManager($pdo);
         $bien = $appartementManager->getAppartementById($element->idBien());
         $niveau = $bien->niveau();
         $typeBien = "Appartement";
     } else {
         if ($element->typeBien() == "localCommercial") {
             $locauxManager = new LocauxManager($pdo);
             $bien = $locauxManager->getLocauxById($element->idBien());
             $typeBien = "Local Commercial";
         } else {
             if ($element->typeBien() == "maison") {
                 $maisonManager = new MaisonManager($pdo);
                 $bien = $maisonManager->getMaisonById($element->idBien());
                 $typeBien = "Maison";
             } else {
                 if ($element->typeBien() == "terrain") {
                     $terrainManager = new TerrainManager($pdo);
                     $bien = $terrainManager->getTerrainById($element->idBien());
                     $typeBien = "Terrain";
                 }
             }
         }
         $contratManager->activerContrat($idContrat);
         //add history data to db
         $createdBy = $_SESSION['userMerlaTrav']->login();
         $created = date('Y-m-d h:i:s');
         $history = new History(array('action' => "Activation", 'target' => "Table des contrats", 'description' => "Activer un contrat", 'created' => $created, 'createdBy' => $createdBy));
         //add it to db
         $historyManager->add($history);
         $actionMessage = "<strong>Opération valide : </strong>Le contrat est activé avec succès.";
         $typeMessage = "success";
     } else {
         $actionMessage = "<strong>Erreur Activation Contrat : </strong>Le bien est déjà réservé par un autre client.";
         $typeMessage = "error";
     }
 } else {
     if ($contrat->typeBien() == "localCommercial") {
         $locauxManager = new LocauxManager($pdo);
         if ($locauxManager->getLocauxById($contrat->idBien())->status() == "Disponible") {
             $locauxManager->changeStatus($contrat->idBien(), "Vendu");
             $contratManager->activerContrat($idContrat);
             //add history data to db
             $createdBy = $_SESSION['userMerlaTrav']->login();
             $created = date('Y-m-d h:i:s');
             $history = new History(array('action' => "Activation", 'target' => "Table des contrats", 'description' => "Activer un contrat", 'created' => $created, 'createdBy' => $createdBy));
             //add it to db
             $historyManager->add($history);
             $actionMessage = "<strong>Opération valide : </strong>Le contrat est activé avec succès.";
             $typeMessage = "success";
         } else {
             $actionMessage = "<strong>Erreur Activation Contrat : </strong>Le bien est déjà réservé par un autre client.";
             $typeMessage = "error";
         }
Example #15
0
    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();
    if(isset($_SESSION['userMerlaTrav']) and (isset($_GET['idProjet']))){
    	//classes managers
    	$appartementManager = new AppartementManager($pdo);
        $locauxManager = new LocauxManager($pdo);
		$usersManager = new UserManager($pdo);
		$projetManager = new ProjetManager($pdo);
		$contratManager = new ContratManager($pdo);
		$clientManager = new ClientManager($pdo);
        $chargeManager = new ChargeManager($pdo);
        $chargeCommunManager = new ChargeCommunManager($pdo);
		$livraisonsManager = new LivraisonManager($pdo);
        $livraisonDetailManager = new LivraisonDetailManager($pdo);
		$fournisseursManager = new FournisseurManager($pdo);
		$reglementsFournisseurManager = new ReglementFournisseurManager($pdo);
		$caisseEntreesManager = new CaisseEntreesManager($pdo);
		$caisseSortiesManager = new CaisseSortiesManager($pdo);
		$operationsManager = new OperationManager($pdo);
		//classes and vars
		$idProjet = $_GET['idProjet'];
Example #16
0
            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
        $projetManager = new ProjetManager($pdo);
        $appartementManager = new AppartementManager($pdo);
        $locauxManager = new LocauxManager($pdo);
        $contratManager = new ContratManager($pdo);
        $clientManager = new ClientManager($pdo);
        $appartements = $appartementManager->getAppartementsNonVendu();
        $appartementsRevendre = $contratManager->getAppartementsRevendre();
        $locaux = $locauxManager->getLocauxNonVendu();
        $locauxRevendre = $contratManager->getLocauxRevendre();
?>
<!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" />
    <title>ImmoERP - Management Application</title>
Example #17
0
 $nombrePiece = htmlentities($_POST['nombrePiece']);
 $nombreEtage = htmlentities($_POST['nombreEtage']);
 $emplacement = htmlentities($_POST['emplacement']);
 $status = "Disponible";
 $cave = htmlentities($_POST['cave']);
 $prix = htmlentities($_POST['prix']);
 $createdBy = $_SESSION['userMerlaTrav']->login();
 $created = date('d/m/Y h:m');
 if (htmlentities($_POST['typeImmobiliere']) == "appartement") {
     $appartement = new Appartement(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'niveau' => $niveau, 'facade' => $facade, 'nombrePiece' => $nombrePiece, 'status' => $status, 'superficie' => $superficie, 'surplan' => $surplan, 'cave' => $cave, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
     $appartementManager = new AppartementManager($pdo);
     $appartementManager->add($appartement);
 } else {
     if (htmlentities($_POST['typeImmobiliere']) == "local") {
         $local = new Locaux(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'mezzanine' => $mezzanine, 'facade' => $facade, 'status' => $status, 'superficie' => $superficie, 'surplan' => $surplan, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
         $locauxManager = new LocauxManager($pdo);
         $locauxManager->add($local);
     } else {
         if (htmlentities($_POST['typeImmobiliere']) == "maison") {
             $maison = new Maison(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'nombreEtage' => $nombreEtage, 'emplacement' => $emplacement, 'status' => $status, 'superficie' => $superficie, 'surplan' => $surplan, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
             $maisonManager = new MaisonManager($pdo);
             $maisonManager->add($maison);
         } else {
             if (htmlentities($_POST['typeImmobiliere']) == "terrain") {
                 $terrain = new Terrain(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'emplacement' => $emplacement, 'status' => $status, 'superficie' => $superficie, 'surplan' => $surplan, 'idProjet' => $idProjet, 'created' => $created, 'createdBy' => $createdBy));
                 $terrainManager = new TerrainManager($pdo);
                 $terrainManager->add($terrain);
             }
         }
     }
 }
//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();
if (isset($_SESSION['userMerlaTrav'])) {
    $clientManager = new ClientManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    $contratManager = new ContratManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $idAppartement = 0;
    if (isset($_GET['idLocaux']) and $_GET['idLocaux'] > 0 and $_GET['idLocaux'] <= $locauxManager->getLastId()) {
        $idLocaux = $_GET['idLocaux'];
        $local = $locauxManager->getLocauxById($idLocaux);
        $contrat = $contratManager->getContratByIdBien($local->id());
        $client = $clientManager->getClientById($contrat->idClient());
        $projet = $projetManager->getProjetById($contrat->idProjet());
        $piecesLocauxManager = new PiecesLocauxManager($pdo);
        $piecesNumber = $piecesLocauxManager->getPiecesLocauxNumberByIdLocaux($local->id());
        $pieces = "";
        if ($piecesNumber > 0) {
            $pieces = $piecesLocauxManager->getPiecesLocauxByIdLocaux($local->id());
        }
        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']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
//The History Component is used in all ActionControllers to mention a historical version of each action
$historyManager = new HistoryManager($pdo);
$locauxManager = new LocauxManager($pdo);
$projetManager = new ProjetManager($pdo);
$idProjet = htmlentities($_POST['idProjet']);
$nomProjet = $projetManager->getProjetById($idProjet)->nom();
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['code'])) {
        $code = htmlentities($_POST['code']);
        $prix = htmlentities($_POST['prix']);
        $superficie = htmlentities($_POST['superficie']);
        $facade = htmlentities($_POST['facade']);
        $mezzanine = htmlentities($_POST['mezzanine']);
        $status = htmlentities($_POST['status']);
        $par = htmlentities($_POST['par']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
    } 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
$idProjet = $_POST['idProjet'];
$idSociete = $_POST['idSociete'];
$idContrat = $_POST['idContrat'];
$status = $_POST['status'];
//create classes managers
$contratManager = new ContratManager($pdo);
$locauxManager = new LocauxManager($pdo);
$appartementManager = new AppartementManager($pdo);
$maisonManager = new MaisonManager($pdo);
$terrainManager = new TerrainManager($pdo);
//create classes
$contrat = $contratManager->getContratById($idContrat);
$redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet . '&idSociete=' . $idSociete;
if (isset($_GET['p']) and $_GET['p'] == 99) {
    $redirectLink = 'Location:../clients-search.php';
}
if ($contrat->typeBien() == "appartement") {
    if ($appartementManager->getAppartementById($contrat->idBien())->status() == "Disponible") {
        $appartementManager->updateStatus($status, $contrat->idBien());
        $contratManager->activerContrat($idContrat);
        $_SESSION['contrat-activation-success'] = "<strong>Opération valide : </strong>Le contrat est activé avec succès.";
        header($redirectLink);
     //set the redirect link
     $redirectLink = 'Location:../contrats-desistes-list.php?idProjet=' . $idProjet;
     if (isset($_POST["source"]) and $_POST["source"] == "clients-search") {
         $redirectLink = 'Location:../clients-search.php';
     }
 } else {
     if ($action == "revendre") {
         $idContrat = $_POST['idContrat'];
         $idBien = $_POST['idBien'];
         $typeBien = $_POST['typeBien'];
         $montantRevente = $_POST['montantRevente'];
         if ($typeBien == "appartement") {
             $appartementManager = new AppartementManager($pdo);
             $appartementManager->updateMontantRevente($montantRevente, $idBien);
         } else {
             $locauxManager = new LocauxManager($pdo);
             $locauxManager->updateMontantRevente($montantRevente, $idBien);
         }
         $contrat = $contratManager->getContratById($idContrat);
         //Change status of the old contrat Bien from "Vendu" to "Disponible"
         if ($contrat->revendre() == 0) {
             $contratManager->updateRevendre($idContrat, 1);
         } else {
             if ($contrat->revendre() == 1) {
                 $contratManager->updateRevendre($idContrat, 0);
             }
         }
         //add history data to db
         $createdBy = $_SESSION['userMerlaTrav']->login();
         $created = date('Y-m-d h:i:s');
         $history = new History(array('action' => "Modification Status Revendre", 'target' => "Table des contrats", 'description' => "Modification de status Revendement du contrat dont l'identifiant est : " . $idContrat . " - Projet : " . $nomProjet, 'created' => $created, 'createdBy' => $createdBy));
Example #22
0
        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
    	$projetManager = new ProjetManager($pdo);
		$locauxManager = new LocauxManager($pdo);
		$appartement = "";
		$idLocaux = 0;
		$idProjet = $_GET['idProjet'];
        $projet = $projetManager->getProjetById($idProjet);
		if( isset($_GET['idLocaux']) and 
		( $_GET['idLocaux']>0 and $_GET['idLocaux']<=$locauxManager->getLastId() ) ){
			$idLocaux = htmlentities($_GET['idLocaux']);
			$locaux = $locauxManager->getLocauxById($idLocaux);
			$piecesManager = new PiecesLocauxManager($pdo);
			$piecesNumber = $piecesManager->getPiecesLocauxNumberByIdLocaux($idLocaux);
			if($piecesNumber != 0){
				$piecesLocaux = $piecesManager->getPiecesLocauxByIdLocaux($idLocaux);
			}	
		}
		
Example #23
0
            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);
		if(isset($_GET['idProjet']) and ($_GET['idProjet'])>0 and $_GET['idProjet']<=$projetManager->getLastId()){
			$idProjet = $_GET['idProjet'];
			$projet = $projetManager->getProjetById($idProjet);
			$locauxManager = new LocauxManager($pdo);
            $contratManager = new ContratManager($pdo);
            $clientManager = new ClientManager($pdo);
			$locaux = "";
			//test the locaux object number: if exists get locaux else do nothing
			$locauxNumber = $locauxManager->getLocauxNumberByIdProjet($idProjet);
			if($locauxNumber != 0){
				/*$locauxPerPage = 10;
		        $pageNumber = ceil($locauxNumber/$locauxPerPage);
		        $p = 1;
		        if(isset($_GET['p']) and ($_GET['p']>0 and $_GET['p']<=$pageNumber)){
		            $p = $_GET['p'];
		        }
		        else{
		            $p = 1;
		        }
    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
    $projetManager = new ProjetManager($pdo);
    $clientManager = new ClientManager($pdo);
    $contratManager = new ContratManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    //objs and vars
    $idProjet = $_GET['idProjet'];
    $projet = $projetManager->getProjetById($idProjet);
    $locaux = $locauxManager->getLocauxByIdProjet($idProjet);
    ob_start();
    ?>
<style type="text/css">
    p, h1{
        text-align: center;
        text-decoration: underline;
    }
    table, tr, td, th {
        border-collapse: collapse;
        width:auto;
        border: 1px solid black;
        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']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
//The History Component is used in all ActionControllers to mention a historical version of each action
$historyManager = new HistoryManager($pdo);
$locauxManager = new LocauxManager($pdo);
$idProjet = htmlentities($_POST['idProjet']);
//Action Add Processing Begin
if ($action == "add") {
    if (!empty($_POST['code'])) {
        $code = htmlentities($_POST['code']);
        $prix = htmlentities($_POST['prix']);
        $superficie = htmlentities($_POST['superficie']);
        $facade = htmlentities($_POST['facade']);
        $mezzanine = htmlentities($_POST['mezzanine']);
        $status = htmlentities($_POST['status']);
        $par = htmlentities($_POST['par']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        $created = date('Y-m-d h:i:s');
        //create object
        $locaux = new Locaux(array('nom' => $code, 'prix' => $prix, 'superficie' => $superficie, 'facade' => $facade, 'mezzanine' => $mezzanine, 'idProjet' => $idProjet, 'status' => $status, 'par' => $par, 'createdBy' => $createdBy, 'created' => $created));
Example #26
0
     $nombreEtage = htmlentities($_POST['nombreEtage']);
 }
 if (isset($_POST['emplacement'])) {
     $emplacement = htmlentities($_POST['emplacement']);
 }
 if (isset($_POST['cave'])) {
     $cave = htmlentities($_POST['cave']);
 }
 if (htmlentities($_POST['typeImmobiliere']) == "appartement") {
     $appartement = new Appartement(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'niveau' => $niveau, 'facade' => $facade, 'nombrePiece' => $nombrePiece, 'superficie' => $superficie, 'surplan' => $surplan, 'cave' => $cave, 'id' => $id));
     $appartementManager = new AppartementManager($pdo);
     $appartementManager->update($appartement);
 } else {
     if (htmlentities($_POST['typeImmobiliere']) == "local") {
         $local = new Locaux(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'mezzanine' => $mezzanine, 'facade' => $facade, 'superficie' => $superficie, 'surplan' => $surplan, 'id' => $id));
         $locauxManager = new LocauxManager($pdo);
         $locauxManager->update($local);
     } else {
         if (htmlentities($_POST['typeImmobiliere']) == "maison") {
             $maison = new Maison(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'nombreEtage' => $nombreEtage, 'emplacement' => $emplacement, 'superficie' => $superficie, 'surplan' => $surplan, 'id' => $id));
             $maisonManager = new MaisonManager($pdo);
             $maisonManager->update($maison);
         } else {
             if (htmlentities($_POST['typeImmobiliere']) == "terrain") {
                 $terrain = new Terrain(array('numeroTitre' => $numeroTitre, 'prix' => $prix, 'nom' => $nom, 'emplacement' => $emplacement, 'superficie' => $superficie, 'surplan' => $surplan, 'id' => $id));
                 $terrainManager = new TerrainManager($pdo);
                 $terrainManager->update($terrain);
             }
         }
     }
 }
Example #27
0
         include('model/'.$myClass.'.php');
     }
     elseif(file_exists('controller/'.$myClass.'.php')){
         include('controller/'.$myClass.'.php');
     }
 }
 spl_autoload_register("classLoad"); 
 include('config.php');  
 //process begin
 if ( isset($_POST['idProjet']) ) {
     //load classes managers
     $clientManager = new ClientManager($pdo);
     $contratManager = new ContratManager($pdo);
     $projetManager = new ProjetManager($pdo);
     $appartementManager = new AppartementManager($pdo);
     $locauxManager = new LocauxManager($pdo);
     //begin processing
     $idProjet = htmlentities($_POST['idProjet']);
     $requete = "SELECT * FROM t_contrat WHERE idProjet = '".$idProjet."' AND status='actif'";
     $projet = $projetManager->getProjetById($idProjet);
     // connexion à la base de données
     //try{
         //$bdd = new PDO('mysql:host=localhost;dbname=maroccar', 'root', '');
     //} 
     //catch(Exception $e){
         //exit('Impossible de se connecter à la base de données.');
     //}
     // exécution de la requête
     $resultat = $pdo->query($requete) or die(print_r($bdd->errorInfo()));
      
     // résultats