Ejemplo n.º 1
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);
        $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" />
Ejemplo n.º 2
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'])) {
    //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
     //add it to db
     $historyManager->add($history);
     $actionMessage = "<strong>Opération valide : </strong>Le contrat est désisté avec succès.";
     $typeMessage = "success";
     $redirectLink = 'Location:../contrats-list.php?idProjet=' . $idProjet;
     if (isset($_POST["source"]) and $_POST["source"] == "clients-search") {
         $redirectLink = 'Location:../clients-search.php';
     }
 } else {
     if ($action == "activer") {
         $idContrat = $_POST['idContrat'];
         //create classes
         $contrat = $contratManager->getContratById($idContrat);
         //test property type to decide which action to do
         if ($contrat->typeBien() == "appartement") {
             $appartementManager = new AppartementManager($pdo);
             if ($appartementManager->getAppartementById($contrat->idBien())->status() == "Disponible") {
                 $appartementManager->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";
             }
Ejemplo n.º 4
0
 $prixNegocie = htmlentities($_POST['prixNegocie']);
 $modePaiement = htmlentities($_POST['modePaiement']);
 $numeroCheque = $contrat->numeroCheque();
 if (isset($_POST['numeroCheque'])) {
     $numeroCheque = htmlentities($_POST['numeroCheque']);
 }
 //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);
Ejemplo n.º 5
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 $_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") {
Ejemplo n.º 6
0
        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);
        exit;
     $nombreMois = htmlentities($_POST['nombreMois']);
     $echeance = htmlentities($_POST['echeance']);
     $note = htmlentities($_POST['note']);
     $idClient = htmlentities($_POST['idClient']);
     $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);
Ejemplo n.º 8
0
 //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']) ){
     //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
Ejemplo n.º 9
0
	//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']) 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
        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;
if (isset($_GET['p']) and $_GET['p'] == 99) {
    $redirectLink = 'Location:../clients-search.php';
Ejemplo n.º 11
0
include 'lib/pagination.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav'])) {
    //les sources
    $projetManager = new ProjetManager($pdo);
    $contratManager = new ContratManager($pdo);
    $clientManager = new ClientManager($pdo);
    $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") {
Ejemplo n.º 12
0
//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']) 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
Ejemplo n.º 13
0
    //$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();
                    }
                }
            }
        }
        ?>
												<li>
													<div class="col1">
														<div class="cont">
Ejemplo n.º 14
0
                                         <th style="width: 10%">Montant</th>
                                         <th style="width: 10%">Date Création</th>
                                         <th style="width: 10%">Date Retour</th>
                                         <th style="width: 10%">Status</th>
                                     </tr>
                                 </thead>
                                 <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") {
Ejemplo n.º 15
0
}
spl_autoload_register("classLoad");
include '../config.php';
include '../lib/image-processing.php';
//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);
                }
            }
Ejemplo n.º 16
0
 $superficie = htmlentities($_POST['superficie']);
 $surplan = htmlentities($_POST['surplan']);
 $niveau = htmlentities($_POST['niveau']);
 $facade = htmlentities($_POST['facade']);
 $mezzanine = htmlentities($_POST['mezzanine']);
 $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);
    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);
Ejemplo n.º 18
0
             }
         }
     }
     //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
Ejemplo n.º 19
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);
        $appartementManager = new AppartementManager($pdo);
        $contratManager = new ContratManager($pdo);
        $clientManager = new ClientManager($pdo);
        $appartements = "";
        //test the appartement object number: if exists get appartement else do nothing
        $appartementNumber = $appartementManager->getAppartementNumberByIdProjet($idProjet);
        if ($appartementNumber != 0) {
            /*$appartementPerPage = 10;
              $pageNumber = ceil($appartementNumber/$appartementPerPage);
              $p = 1;
              if(isset($_GET['p']) and ($_GET['p']>0 and $_GET['p']<=$pageNumber)){
                  $p = $_GET['p'];
              }
              else{
                  $p = 1;
              }
Ejemplo n.º 20
0
include '../config.php';
//classes loading end
session_start();
//post input processing
$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);
            }
        }
    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);
    $appartementManager = new AppartementManager($pdo);
    //objs and vars
    $idProjet = $_GET['idProjet'];
    $projet = $projetManager->getProjetById($idProjet);
    $appartements = $appartementManager->getAppartementByIdProjet($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;
{
    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);
    $appartementManager = new AppartementManager($pdo);
    $appartement = "";
    $idAppartement = 0;
    $idProjet = $_GET['idProjet'];
    $projet = $projetManager->getProjetById($idProjet);
    if (isset($_GET['idAppartement']) and ($_GET['idAppartement'] > 0 and $_GET['idAppartement'] <= $appartementManager->getLastId())) {
        $idAppartement = htmlentities($_GET['idAppartement']);
        $appartement = $appartementManager->getAppartementById($idAppartement);
        $piecesManager = new AppartementPiecesManager($pdo);
        $piecesNumber = $piecesManager->getPiecesAppartementNumberByIdAppartement($idAppartement);
        if ($piecesNumber != 0) {
            $piecesAppartement = $piecesManager->getPiecesAppartementByIdAppartement($idAppartement);
        }
    }
    ?>
<!DOCTYPE html>
        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
$action = htmlentities($_POST['action']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
$appartementManager = new AppartementManager($pdo);
//The History Component is used in all ActionControllers to mention a historical version of each action
$historyManager = new HistoryManager($pdo);
$idProjet = htmlentities($_POST['idProjet']);
if ($action == "add") {
    if (!empty($_POST['code'])) {
        $code = htmlentities($_POST['code']);
        $niveau = htmlentities($_POST['niveau']);
        $prix = htmlentities($_POST['prix']);
        $superficie = htmlentities($_POST['superficie']);
        $facade = htmlentities($_POST['facade']);
        $nombrePiece = htmlentities($_POST['nombrePiece']);
        $cave = htmlentities($_POST['cave']);
        $status = htmlentities($_POST['status']);
        $par = htmlentities($_POST['par']);
        $createdBy = $_SESSION['userMerlaTrav']->login();
        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
$action = htmlentities($_POST['action']);
//This var contains result message of CRUD action
$actionMessage = "";
$typeMessage = "";
$appartementManager = new AppartementManager($pdo);
$projetManager = new ProjetManager($pdo);
//The History Component is used in all ActionControllers to mention a historical version of each action
$historyManager = new HistoryManager($pdo);
$idProjet = htmlentities($_POST['idProjet']);
$nomProjet = $projetManager->getProjetById($idProjet)->nom();
if ($action == "add") {
    if (!empty($_POST['code'])) {
        $code = htmlentities($_POST['code']);
        $niveau = htmlentities($_POST['niveau']);
        $prix = htmlentities($_POST['prix']);
        $superficie = htmlentities($_POST['superficie']);
        $facade = htmlentities($_POST['facade']);
        $nombrePiece = htmlentities($_POST['nombrePiece']);
        $cave = htmlentities($_POST['cave']);
        $status = htmlentities($_POST['status']);
Ejemplo n.º 25
0
 }
 if (isset($_POST['nombrePiece'])) {
     $nombrePiece = htmlentities($_POST['nombrePiece']);
 }
 if (isset($_POST['nombreEtage'])) {
     $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);
Ejemplo n.º 26
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');  
 //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()));