public function action_delete()
 {
     $cm = new ClientManager(DB::get_instance());
     $clt = $cm->get($this->req->id);
     $this->site->ajouter_message("ok");
     $cm->delete($clt);
     $this->site->ajouter_message($clt->getMail() . " supprimé!");
     Site::redirect("admClient");
 }
Example #2
0
 public function action_coajax()
 {
     $res = array();
     $res['bool'] = false;
     $cm = new ClientManager(DB::get_instance());
     $a = $cm->connexion($this->req->log, $this->req->mdp);
     if ($a) {
         $this->tpl->assign('idClient', $a->getIdClient());
         $this->tpl->assign('login', $a->getMail());
         $this->tpl->assign('nom', $a->getNom());
         $this->session->ouvrir($a);
         $res['bool'] = true;
         $res['who'] = $a->getMail();
     }
     echo json_encode($res);
     exit;
 }
    } 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
    $usersManager = new UserManager($pdo);
    $mailsManager = new MailManager($pdo);
    $notesClientsManager = new NotesClientManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $contratManager = new ContratManager($pdo);
    $clientManager = new ClientManager($pdo);
    $livraisonsManager = new LivraisonManager($pdo);
    $fournisseursManager = new FournisseurManager($pdo);
    $caisseManager = new CaisseManager($pdo);
    $caisseIaazaManager = new CaisseIaazaManager($pdo);
    $operationsManager = new OperationManager($pdo);
    $compteBancaire = new CompteBancaireManager($pdo);
    //classes and vars
    //users number
    $soldeCaisseAnnahda = $caisseManager->getTotalCaisseByType("Entree") - $caisseManager->getTotalCaisseByType("Sortie");
    $soldeCaisseIaaza = $caisseIaazaManager->getTotalCaisseByType("Entree") - $caisseIaazaManager->getTotalCaisseByType("Sortie");
    $projetNumber = $projetManager->getProjetsNumber();
    $usersNumber = $usersManager->getUsersNumber();
    $fournisseurNumber = $fournisseursManager->getFournisseurNumbers();
    $mailsNumberToday = $mailsManager->getMailsNumberToday();
    $mailsToday = $mailsManager->getMailsToday();
<?php

if (!isset($_POST['nom'])) {
    ?>
  <div class="container">
      <div class="row">
          <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            <h1>Ajouter un client</h1>
              <form action="#" method="post">
                <input type="text" name="nom" placeholder="Nom" required>
                <input type="text" name="prenom" placeholder="prenom" required>
                <input type="text" name="mail" placeholder="em@il" required>
                <input type="text" name="date" placeholder="DD/MM/YYYY" pattern="(0[1-9]|1[0-9]|2[0-9]|3[01])/(0[1-9]|1[012])/[0-9]{4}" required>
                <input type="text" name="idCompte" placeholder="ID compte" >
                <input type="text" name="login" placeholder="Login" required>
                <input type="password" name="pwd" value="Mot de passe" required>
                <input type="submit"  value="Valider">
              </form>
          </div>
      </div>
  </div>
  <?php 
} else {
    $clientData = array('nom' => $_POST['nom'], 'prenom' => $_POST['prenom'], 'mail' => $_POST['mail'], 'idCompte' => isset($_POST['idCompte']) ? $_POST['idCompte'] : null, 'date_naissance' => $_POST['date'], 'login' => $_POST['login'], 'pwd' => $_POST['pwd']);
    $client = new Client($clientData);
    $pdo = new Mypdo();
    $manager = new ClientManager($pdo);
    $retour = $manager->add($client);
    var_dump($retour);
}
Example #5
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);
    $clientManager = new ClientManager($pdo);
    $companyManager = new CompanyManager($pdo);
    $contratManager = new ContratManager($pdo);
    $compteBancaireManager = new CompteBancaireManager($pdo);
    $operationManager = new OperationManager($pdo);
    $locauxManager = new LocauxManager($pdo);
    $appartementManager = new AppartementManager($pdo);
    $comptesBancaires = $compteBancaireManager->getCompteBancaires();
    //obj and vars
    $contrats = $contratManager->getContratsToChange();
    ?>
<!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 -->
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
    $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;
//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 $_SESSION['userMerlaTrav']->profil() == "admin") {
    $clientManager = new ClientManager($pdo);
    $contratManager = new ContratManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $appartementManager = new AppartementManager($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);
    $client = $clientManager->getClientById($contrat->idClient());
    $projet = $projetManager->getProjetById($contrat->idProjet());
//include config file
include "model/ClientManager.php";
include "model/Client.php";
if ($_POST) {
    //sanitize post value
    $group_number = filter_var($_POST["group_no"], FILTER_SANITIZE_NUMBER_INT, FILTER_FLAG_STRIP_HIGH);
    //throw HTTP error if group number is not valid
    if (!is_numeric($group_number)) {
        header('HTTP/1.1 500 Invalid number!');
        exit;
    }
    //get current starting point of records
    $position = $group_number * $items_per_group;
    //Limit our results within a specified range.
    //$results = $pdo->query("SELECT * FROM t_client ORDER BY id ASC LIMIT $position, $items_per_group");
    $clientManager = new ClientManager($pdo);
    $clients = $clientManager->getClientsByLimits($position, $items_per_group);
    ?>
	<?php 
    if ($clients) {
        //output results from database
        foreach ($clients as $client) {
            ?>
		<tr class="clients">
			<td>
				<div class="btn-group">
					<a style="width: 200px" class="btn mini dark-cyan dropdown-toggle" href="#" data-toggle="dropdown">
						<?php 
            echo $client->nom();
            ?>
 
include '../lib/image-processing.php';
//classes loading end
session_start();
//post input processing
//the action input precise which action the controller is going to prossed,
//add action, update action or delete action
$action = htmlentities($_POST['action']);
//In this session variable we put all the POST, to get it in the contrats-add file
//in case of error, and this help the user to do not put again what he filled out.
$_SESSION['myFormData'] = $_POST;
//This var contains result message of CRUD action and the redirection url link
$actionMessage = "";
$typeMessage = "";
$redirectLink = "";
//class manager
$clientManager = new ClientManager($pdo);
//The History Component is used in all ActionControllers to mention a historical version of each action
$historyManager = new HistoryManager($pdo);
//process starts
//Case 1 : CRUD Add Action
if ($action == "add") {
    $idProjet = htmlentities($_POST['idProjet']);
    $codeClient = "";
    $client = "";
    //if the client exists in the database, and we get its information from the clients-add.php file
    //we just are going to send its informations to the next url : contrats-add.php
    if (!empty($_POST['idClient'])) {
        $idClient = htmlentities($_POST['idClient']);
        $client = $clientManager->getClientById($idClient);
        $codeClient = $client->code();
        $actionMessage = "<strong>Opération Valide : </strong>Client Récuperé avec succès.";
Example #10
0
    } 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
    $usersManager = new UserManager($pdo);
    $mailsManager = new MailManager($pdo);
    $notesClientsManager = new NotesClientManager($pdo);
    $projetManager = new ProjetManager($pdo);
    $contratManager = new ContratManager($pdo);
    $clientManager = new ClientManager($pdo);
    $livraisonsManager = new LivraisonManager($pdo);
    $fournisseursManager = new FournisseurManager($pdo);
    $caisseEntreesManager = new CaisseEntreesManager($pdo);
    $caisseSortiesManager = new CaisseSortiesManager($pdo);
    $operationsManager = new OperationManager($pdo);
    //classes and vars
    //users number
    $usersNumber = $usersManager->getUsersNumber();
    $mailsNumberToday = $mailsManager->getMailsNumberToday();
    $mailsToday = $mailsManager->getMailsToday();
    $clientWeek = $clientManager->getClientsWeek();
    $clientNumberWeek = $clientManager->getClientsNumberWeek();
    $livraisonsWeek = $livraisonsManager->getLivraisonsWeek();
    $livraisonsNumberWeek = $livraisonsManager->getLivraisonsNumberWeek();
    $operationsNumberWeek = $operationsManager->getOperationNumberWeek();
<?php

$db = new Mypdo();
$clientManager = new ClientManager($db);
$nbClients = json_decode($clientManager->getNbClient());
//var_dump($nbClients->nbClient);
?>
<div class="container">
    <div class="row">
        <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            <div class="post-preview">
              <h1>Tableau de bord</h1>

              <p>Nombre de client(s) connecté(s) : ??? / <?php 
echo $nbClients->nbClient;
?>
 </p>
              <p>Chiffre d'affaires actuel : <?php 
?>
 </p>
            </div>
        </div>
    </div>
</div>


<script src="js/statistiques.js"></script>
 public function action_ajax()
 {
     $cm = new ClientManager(DB::get_instance());
     $login = $this->req->login;
     if ($cm->chercherParMail($login)) {
         $err[] = "Ce mail a déjà un compte lié";
     }
     echo json_encode($err);
     exit;
 }
{
    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
if (!empty($_POST['searchOption']) and !empty($_POST['search'])) {
    $testRadio = 0;
    if (isset($_POST['searchOption'])) {
        if ($_POST['searchOption'] == "searchByName") {
            $testRadio = 1;
        } else {
            if ($_POST['searchOption'] == "searchByCIN") {
                $testRadio = 2;
            }
        }
    }
    $recherche = htmlentities($_POST['search']);
    $clientManager = new ClientManager($pdo);
    $_SESSION['searchClientResult'] = $clientManager->getClientBySearch($recherche, $testRadio);
    header('Location:../clients-search.php');
} else {
    $_SESSION['client-search-error'] = "<strong>Erreur Recherche Client</strong> : Vous devez séléctionner un choix 'Nom' ou 'CIN' \n        et 'Tapez votre recherche'";
    header('Location:../clients-search.php');
}
require '../objects/Client.class.php';
require '../managers/ClientManager.class.php';
try {
    $db = new PDO('mysql:host=127.0.0.1; port=3307;dbname=atelier_garage', 'root', 'toor');
} catch (Exception $e) {
    die('Erreur : ' . $e->getMessage());
}
/*$client = new Client([
	'numero'=>'12345',
	'nom'=>'PERROT',
	'prenom'=>'thomas',
	'adresse'=>'paris',
	'referent'=>'marc']);*/
//print_r($client);
//on cree le manager
$clientManager = new ClientManager($db);
//print_r($clientManager);
//on rajoute une client en bdd
//$clientManager->add($client);
//on compte, doit retourner 1
//echo $clientManager->count();
//on supprime la client
//$clientManager->delete($client);
//on verifie si elle existe en bdd (doit retourner 1 si oui, 0 si non)
//echo $clientManager->exists($client);
//on test le get
/*$client = $clientManager->get('20');
if(empty($client))
{echo "c'est vide";}
else
{print_r($client);}*/
Example #15
0
<?php

// Include the main TCPDF library (search for installation path).
require_once 'lib/tcpdf/tcpdf.php';
require_once 'model/Client.php';
require_once 'model/ClientManager.php';
require_once 'config.php';
$clientManager = new ClientManager($pdo);
$client = $clientManager->getClientById(312);
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 018');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
//$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 018', PDF_HEADER_STRING);
$pdf->setPrintHeader(false);
$pdf->setPrintFooter(false);
// set header and footer fonts
$pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
{
    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
$codeContrat = $_POST['codeContrat'];
if (!empty($_POST['nom'])) {
    $id = $_POST['idClient'];
    $nom = htmlentities($_POST['nom']);
    $adresse = htmlentities($_POST['adresse']);
    $telephone1 = htmlentities($_POST['telephone1']);
    $telephone2 = htmlentities($_POST['telephone2']);
    $cin = htmlentities($_POST['cin']);
    $email = htmlentities($_POST['email']);
    //update a Client object
    $client = new Client(array('id' => $id, 'nom' => $nom, 'adresse' => $adresse, 'telephone1' => $telephone1, 'telephone2' => $telephone2, 'cin' => $cin, 'email' => $email));
    $clientManager = new ClientManager($pdo);
    $clientManager->update($client);
    $_SESSION['client-update-success'] = "<strong>Opération valide</strong> : Informations du client '" . $nom . "' sont modifiées avec succès.";
    header('Location:../contrat.php?codeContrat=' . $codeContrat);
} else {
    $_SESSION['client-update-error'] = "<strong>Erreur Modification Client</strong> : Vous devez remplir au moins le champs 'Nom du client'.";
    header('Location:../contrat.php?codeContrat=' . $codeContrat);
}
Example #17
0
        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>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
<?php

$pdo = new Mypdo();
$manager = new FactureManager($pdo);
$clientManager = new ClientManager($pdo);
if (isset($_GET['idCommande'])) {
    $articleManager = new ArticleManager($pdo);
    $resu = $manager->get($_GET['idCommande']);
    ?>
    <div class="container">
        <div class="row">
            <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
              <p> Commande <?php 
    echo $resu['commande']->getIdCommande();
    ?>
                du <?php 
    echo $resu['commande']->getDateCommande() . ' par ' . $clientManager->getClient($resu['commande']->getIdClient(), false)->getNom();
    ?>
 <br/>
                Montant : <?php 
    echo $resu['total'];
    ?>
€
              </p>

              <table>
                <tr>
                  <th>Nom Article</th>
                  <th>Prix Unitaire</th>
                  <th>Quantite</th>
                  <th>Commentaire</th>
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';
include 'lib/pagination.php';
//classes loading end
session_start();
if (isset($_SESSION['userMerlaTrav'])) {
    //les sources
    $clientsManager = new ClientManager($pdo);
    $clientNumber = $clientsManager->getClientsNumber();
    if ($clientNumber != 0) {
        $clients = $clientsManager->getClients();
    }
    ?>
<!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>
    <meta content="width=device-width, initial-scale=1.0" name="viewport" />
    <meta content="" name="description" />
<?php

$pdo = new Mypdo();
$manager = new ClientManager($pdo);
if (!isset($_GET['idDelete'])) {
    $clients = $manager->getAllClients();
    ?>
  <div class="container">
    <a class="text-center" href="index.php?page=1">Ajouter un client</a>
      <div class="row">
          <div class="col-lg-8 col-lg-offset-2 col-md-10 col-md-offset-1">
            <table>
              <tr>
                <th>Nom</th>
                <th>Pr&eacute;nom</th>
                <th>Mail</th>
                <th>Date Naissance</th>
                <th>Login</th>
              </tr>
              <?php 
    foreach ($clients as $client) {
        ?>
                <tr>
                  <td><a href="index.php?page=2&amp;idDelete=<?php 
        echo $client->getIdClient();
        ?>
"><?php 
        echo $client->getNom();
        ?>
</a></td>
                  <td><a href="index.php?page=2&amp;idDelete=<?php 
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
    $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;
$idProjet = htmlentities($_POST['idProjet']);
//In this session variable we put all the POST, to get it in the contrats-add file
//In case of error, and this help the user to do not put again what he filled out.
$_SESSION['contrat-form-data'] = $_POST;
//If we get to this current ContratActionController through ClientActionController,
//which means, that the client data are valid, so we need to destroy the session
//"myFormData", that stores the client data form inputs
if (isset($_SESSION['myFormData'])) {
    unset($_SESSION['myFormData']);
}
//This var contains result message of CRUD action and the redirection url link
$actionMessage = "";
$typeMessage = "";
$redirectLink = "";
//class manager
$clientManager = new ClientManager($pdo);
$contratManager = new ContratManager($pdo);
$contratCasLibreManager = new ContratCasLibreManager($pdo);
$reglementPrevuManager = new ReglementPrevuManager($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);
//process starts
$nomProjet = $projetManager->getProjetById($idProjet)->nom();
//Action Add Processing Begin
if ($action == "add") {
    $codeClient = $_POST['codeClient'];
    //post input validation
    if (!empty($_POST['typeBien']) and !empty($_POST['prixNegocie']) and !empty($_POST['numero']) and !empty($_POST['bien']) and !empty($_POST['dateCreation']) and !empty($_POST['avance']) and !empty($_POST['modePaiement']) and !empty($_POST['dureePaiement']) and !empty($_POST['nombreMois']) and !empty($_POST['echeance'])) {
        if (!empty($_POST['prixNegocie'])) {
            $reference = 'C' . date('Ymd-his');
Example #23
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']) and ($_SESSION['userMerlaTrav']->profil() == "admin" or $_SESSION['userMerlaTrav']->profil() == "manager")) {
    $idProjet = 0;
    $projetManager = new ProjetManager($pdo);
    $clientManager = new ClientManager($pdo);
    $companieManager = new CompanyManager($pdo);
    $projet = "";
    if (isset($_GET['idProjet']) and $_GET['idProjet'] > 0 and $_GET['idProjet'] <= $projetManager->getLastId() and (isset($_GET['codeClient']) and (bool) $clientManager->getCodeClient($_GET['codeClient']))) {
        $idProjet = $_GET['idProjet'];
        $codeClient = $_GET['codeClient'];
        $projet = $projetManager->getProjetById($idProjet);
        $client = $clientManager->getClientByCode($codeClient);
        $companies = $companieManager->getCompanys();
    }
    ?>
<!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 -->
Example #24
0
    }
    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;
		        }
		        $begin = ($p - 1) * $locauxPerPage;
		        $pagination = paginate('locaux.php?idProjet='.$idProjet, '&p=', $pageNumber, $p);*/
        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'];
$codeClient = "";
//classModel
$client = "";
//classManager
$clientManager = new ClientManager($pdo);
if (!empty($_POST['idClient'])) {
    $idClient = htmlentities($_POST['idClient']);
    $client = $clientManager->getClientById($idClient);
    $codeClient = $client->code();
} else {
    if (empty($_POST['idClient'])) {
        if (!empty($_POST['nom'])) {
            $nom = htmlentities($_POST['nom']);
            if ($clientManager->exists($nom)) {
                $_SESSION['client-add-error'] = "<strong>Erreur Création Client : </strong>Un client existe déjà avec ce nom : " . $nom . " .";
                header('Location:../clients-add.php?idProjet=' . $idProjet);
                exit;
            } else {
                $cin = htmlentities($_POST['cin']);
                $adresse = htmlentities($_POST['adresse']);
Example #26
0
<?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');  
    //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.');
        //}