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") { $biens = $appartementManager->getAppartementById($contrat->idBien()); $typeBien = "Appartement";
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); } } } } //add history data to db $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Modification", 'target' => "Table des " . htmlentities($_POST['typeImmobiliere']), 'description' => "Modification de " . htmlentities($_POST['typeImmobiliere']) . " - ID : " . $id . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db
} } 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; } else {
//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()); } } } } } $newContrat = new Contrat(array('nomClient' => $nomClient, 'cin' => $cin, 'adresse' => $adresse, 'telephone' => $telephone, 'dateCreation' => $dateCreation, 'dateRetour' => $dateRetour, 'prixVente' => $prixNegocie, 'avance' => $avance, 'note' => $note, 'taille' => $taille, 'modePaiement' => $modePaiement, 'id' => $idContrat, 'idBien' => $idBien, 'typeBien' => $typeBien, 'numeroCheque' => $numeroCheque)); $contratManager->update($newContrat); //add history data to db
$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);
//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(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Suppression", 'target' => "Table des " . htmlentities($_POST['typeImmobiliere']), 'description' => "Suppression de " . htmlentities($_POST['typeImmobiliere']) . " - ID : " . $id . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db $historyManager->add($history);
$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); } } } } //add history data to db $createdBy = $_SESSION['userMerlaTrav']->login(); $created = date('Y-m-d h:i:s'); $history = new History(array('action' => "Ajout", 'target' => "Table des " . htmlentities($_POST['typeImmobiliere']), 'description' => "Ajout de " . htmlentities($_POST['typeImmobiliere']) . " - N° Titre : " . $numeroTitre . " - Nom : " . $nom . " - Projet : " . $projetManager->getProjetById($idProjet)->nom(), 'created' => $created, 'createdBy' => $createdBy)); //add it to db
include '../config.php'; //classes loading end session_start(); if (isset($_SESSION['userMerlaTrav']) and $_SESSION['userMerlaTrav']->profil() == "admin") { //classes managers $idProjet = $_GET['idProjet']; $idSociete = $_GET['idSociete']; $type = $_GET['type']; $projetManager = new ProjetManager($pdo); $societeManager = new SocieteManager($pdo); $contratManager = new ContratManager($pdo); $operationManager = new OperationManager($pdo); $appartementManager = new AppartementManager($pdo); $locauxManager = new LocauxManager($pdo); $terrainsManager = new TerrainManager($pdo); $maisonsManager = new MaisonManager($pdo); $contratNumber = $contratManager->getContratsNumberByIdProjet($idProjet); $contrats = $contratManager->getContratsByIdProjetOnly($idProjet); ob_start(); ?> <style type="text/css"> p, h1, h3{ text-align: center; text-decoration: underline; } table, tr, td, th { border-collapse: collapse; width:auto; border: 1px solid black; } td, th{
$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") { $terrainManager = new TerrainManager($pdo); $terrains = $terrainManager->getTerrainsNonVendu(); $biens = $terrainManager->getNumberBiens(); $biensDiponible = $terrainManager->getNumberBienDisbonible(); $biensVendu = $terrainManager->getNumberBienVendu(); $biensPromesseVente = $terrainManager->getNumberBienPromesseVente(); } }
<?php } ?> </ul> </div> </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 = ""; //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"; } } } } //activate the update link only for admin's profil $link = ""; if ($_SESSION['userMerlaTrav']->profil() == "admin") { $link = '#updateStatusReglementPrevuEnRetards' . $element->id();
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 //propeties managers $appartementManager = new AppartementManager($pdo); $locauxManager = new LocauxManager($pdo); $terrainManager = new TerrainManager($pdo); $maisonManager = new MaisonManager($pdo); //charges managers $chargesTerrainManager = new ChargesTerrainManager($pdo); $chargesConstructionManager = new ChargesConstructionManager($pdo); $chargesFinitionManager = new ChargesFinitionManager($pdo); //livraisons & fournisseurs managers $livraisonsManager = new LivraisonManager($pdo); $livraisonDetailManager = new LivraisonDetailManager($pdo); $fournisseursManager = new FournisseurManager($pdo); //other managers $caisseManager = new CaisseManager($pdo); $usersManager = new UserManager($pdo); $projetManager = new ProjetManager($pdo); $societeManager = new SocieteManager($pdo); $contratManager = new ContratManager($pdo); //classes and vars
} 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); $locauxNumber = $locauxManager->getNumberBienByIdProjet($idProjet);