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); } } ?> <!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>
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()); } } //property data ob_start(); ?> <style type="text/css"> table{ width:100%; border: solid 1px black; } </style>
{ if (file_exists('../model/' . $myClass . '.php')) { include '../model/' . $myClass . '.php'; } elseif (file_exists('../controller/' . $myClass . '.php')) { include '../controller/' . $myClass . '.php'; } } spl_autoload_register("classLoad"); include '../config.php'; include '../lib/image-processing.php'; //classes loading end session_start(); $idProjet = htmlentities($_POST['idProjet']); $idLocaux = htmlentities($_POST['idLocaux']); $redirect = 'Location:../locaux.php?idProjet=' . $idProjet; if ($_GET['p'] == 2) { $redirect = 'Location:../locaux-detail.php?idLocaux=' . $idLocaux . '&idProjet=' . $idProjet; } if (file_exists($_FILES['url']['tmp_name']) || is_uploaded_file($_FILES['url']['tmp_name'])) { $url = imageProcessing($_FILES['url'], '/pieces/pieces_locaux/'); $nom = "Fiche descriptif du local commercial"; //htmlentities($_POST['nom']); $pieceLocaux = new PiecesLocaux(array('nom' => $nom, 'url' => $url, 'idLocaux' => $idLocaux)); $pieceLocauxManager = new PiecesLocauxManager($pdo); $pieceLocauxManager->add($pieceLocaux); $_SESSION['pieces-add-success'] = "<strong>Opération valide : </strong>La pièce a été ajouté avec succès."; header($redirect); } else { $_SESSION['pieces-add-error'] = "<strong>Erreur Ajout Pièces Local : </strong>Vous devez ajouté un lien."; header($redirect); }
<?php //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(); //post input processing $idProjet = $_POST['idProjet']; $idLocaux = $_POST['idLocaux']; $idPieceLocaux = $_POST['idPieceLocaux']; $piecesLocauxManager = new PiecesLocauxManager($pdo); $piecesLocauxManager->delete($idPieceLocaux); //delete file from the disk $_SESSION['pieces-delete-success'] = "<strong>Opération valide : </strong>Pièce supprimé avec succès."; header('Location:../locaux-detail.php?idLocaux=' . $idLocaux . '&idProjet=' . $idProjet);