86 lines
2.5 KiB
PHP
86 lines
2.5 KiB
PHP
<?php
|
|
require_once 'Framework/Controleur.php';
|
|
require_once 'Modele/Client.php';
|
|
require_once 'Modele/Police.php';
|
|
require_once 'Modele/Menuvueutilisateur.php';
|
|
|
|
class ControleurListeclients extends Controleur {
|
|
private $menuvue;
|
|
private $client;
|
|
private $police;
|
|
|
|
public function __construct() {
|
|
$this->menuvue = new Menuvueutilisateur();
|
|
$this->menuvue->getMenuVue("Listeclients");
|
|
|
|
$this->client = new Client();
|
|
$this->police = new Police();
|
|
|
|
$_SESSION['modeDevis'] = "0";
|
|
}
|
|
|
|
public function index($numeroclientsearch="", $nomsearch="", $prenomsearch="", $telsearch="", $numeroPolicesearch="", $idPolicesearch="")
|
|
{
|
|
if (isset($_POST['numeroclientsearch']))
|
|
{
|
|
$numeroclientsearch = $_POST['numeroclientsearch'];
|
|
$numeroPolicesearch = $_POST['numeroPolicesearch'];
|
|
$idPolicesearch = $_POST['idPolicesearch'];
|
|
|
|
if ($numeroclientsearch>" ") {
|
|
$clients = $this->client->getClientsearch($numeroclientsearch);
|
|
}
|
|
elseif($idPolicesearch>"0")
|
|
{
|
|
$idPolice = $this->police->getClientsearchPolId($idPolicesearch);
|
|
if ($idPolice<>"0")
|
|
{
|
|
$this->police->getContexteClientId($idPolice);
|
|
$this->police->getContexteAjaxPolice($idPolice);
|
|
$this->rediriger("Fichepolice");
|
|
}
|
|
else
|
|
{
|
|
$clients = $this->client->getClientVide();
|
|
}
|
|
}
|
|
elseif($numeroPolicesearch>"0")
|
|
{
|
|
$idPolice = $this->police->getClientsearchPol($numeroPolicesearch);
|
|
if ($idPolice<>"0")
|
|
{
|
|
$this->police->getContexteClientId($idPolice);
|
|
$this->police->getContexteAjaxPolice($idPolice);
|
|
$this->rediriger("Fichepolice");
|
|
}
|
|
else
|
|
{
|
|
$clients = $this->client->getClients($numeroPolicesearch, "", "");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$nomsearch=$_POST['nomsearch'];
|
|
$prenomsearch=$_POST['prenomsearch'];
|
|
$telsearch=$_POST['telsearch'];
|
|
$clients = $this->client->getClients($nomsearch, $prenomsearch, $telsearch);
|
|
}
|
|
}
|
|
else
|
|
{
|
|
$clients = $this->client->getClientVide();
|
|
}
|
|
|
|
if ($clients->rowCount() == 1)
|
|
{
|
|
$client = $clients->fetch();
|
|
$_SESSION['idClientAjax'] = $client['id'];
|
|
$this->rediriger("Ficheclient");
|
|
}
|
|
else
|
|
{
|
|
$this->genererVue(array('clients' => $clients, 'numeroclientsearch' => $numeroclientsearch, 'idPolicesearch' => $idPolicesearch,
|
|
'nomsearch' => $nomsearch, 'prenomsearch' => $prenomsearch, 'telsearch' => $telsearch, 'numeroPolicesearch' => $numeroPolicesearch));
|
|
}
|
|
}
|
|
} |