204 lines
6.0 KiB
PHP
204 lines
6.0 KiB
PHP
<?php
|
|
if (!$_SESSION['connected'])
|
|
echo ('Vous devez être connecté afin de pouvoir utiliser cette fonctionnalité');
|
|
|
|
if($_REQUEST['action']=='supprimer'){
|
|
require_once 'surveillance/surveillance.php';
|
|
deleteSurveillance($_REQUEST['siren'], $_REQUEST['email'], '', $_REQUEST['source'], true);
|
|
}
|
|
|
|
//Liste des surveillances de l'utilisateur
|
|
/*
|
|
Mode de présentation :
|
|
Siren | Raison Sociale | CP | Ville | Surveillance (Annonces légales, INSEE, Bilan, IndiScore )
|
|
|
|
*/
|
|
|
|
try{
|
|
$result = $client->getSurveillances(0,'', true);
|
|
$listSurveillance = $result['results'];
|
|
} catch (SoapFault $fault) {
|
|
require_once 'soaperror.php';
|
|
processSoapFault($client,$fault,$tabInfo);
|
|
die();
|
|
}
|
|
$firephp->log($listSurveillance, 'Surveillance');
|
|
//Trier la liste de surveillance
|
|
$tabIndex = array();
|
|
$i=0;
|
|
$listTrier = array();
|
|
foreach($listSurveillance as $item){
|
|
if(!array_key_exists($item['siren'], $tabIndex)){
|
|
//Tableau d'index
|
|
$tabIndex[$item['siren']] = $i;
|
|
//Création du tableau trier
|
|
$listTrier[$i]['siren'] = $item['siren'];
|
|
$listTrier[$i]['nic'] = $item['nic'];
|
|
$listTrier[$i]['rs'] = $item['rs'];
|
|
|
|
$dateAjoutTS = mktime(0, 0, 0, substr($item['dateAjout'],5,2), substr($item['dateAjout'],8,2), substr($item['dateAjout'],0,4));
|
|
$dateDerEnvoiTS = mktime(substr($item['dateDerEnvoi'],11,2), substr($item['dateDerEnvoi'],14,2), substr($item['dateDerEnvoi'],17,2), substr($item['dateDerEnvoi'],5,2), substr($item['dateDerEnvoi'],8,2), substr($item['dateDerEnvoi'],0,4));
|
|
|
|
$listTrier[$i]['sources'] = array(
|
|
$item['source']=>array(
|
|
'email'=>$item['email'],
|
|
'ref'=>$item['ref'],
|
|
'dateAjout'=>$item['dateAjout'],
|
|
'dateAjoutTS'=>$dateAjoutTS,
|
|
'dateDerEnvoi'=> $item['dateDerEnvoi'],
|
|
'dateDerEnvoiTS'=>$dateDerEnvoiTS,
|
|
)
|
|
);
|
|
|
|
$i++;
|
|
}else{
|
|
$key = $tabIndex[$item['siren']];
|
|
|
|
$dateAjoutTS = mktime(0, 0, 0, substr($item['dateAjout'],5,2), substr($item['dateAjout'],8,2), substr($item['dateAjout'],0,4));
|
|
$dateDerEnvoiTS = mktime(substr($item['dateDerEnvoi'],11,2), substr($item['dateDerEnvoi'],14,2), substr($item['dateDerEnvoi'],17,2), substr($item['dateDerEnvoi'],5,2), substr($item['dateDerEnvoi'],8,2), substr($item['dateDerEnvoi'],0,4));
|
|
|
|
$source = array(
|
|
'email'=>$item['email'],
|
|
'ref'=>$item['ref'],
|
|
'dateAjout'=>$item['dateAjout'],
|
|
'dateAjoutTS'=>$dateAjoutTS,
|
|
'dateDerEnvoi'=> $item['dateDerEnvoi'],
|
|
'dateDerEnvoiTS'=>$dateDerEnvoiTS,
|
|
);
|
|
|
|
$listTrier[$key]['sources'][$item['source']] = $source;
|
|
}
|
|
}
|
|
$firephp->log($listTrier, 'listTrier');
|
|
//Tri selon le siren
|
|
//Tri selon la date d'ajout
|
|
//Tri selon la date de dernier envoi
|
|
//Tri selon les types d'annonces (présentation du tableau différent)
|
|
$tabSource = array('annonces', 'insee', 'bilans', 'score');
|
|
?>
|
|
<style>
|
|
#center {background: #ffffff; width:580px; padding:5px; }
|
|
#center h1 {margin:5px; padding:5px; background:#606060; color:#ffffff; font:600 1.4em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height:1.2em;}
|
|
#center h2 {margin:5px; padding:5px; background:#00008c; color:#ffffff; font:bold 1.2em Arial, Verdana, Sans-serif; }
|
|
#surveillance {margin:5px; border-collapse:collapse; border:1px solid; font:normal 1em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height: 1em;}
|
|
#surveillance tr {border:1px solid;}
|
|
#surveillance th {border:1px solid; padding:5px;}
|
|
#surveillance td {border:1px solid; text-align: center; padding:5px;}
|
|
#surveillance .left {text-align:left;}
|
|
#surveillance .actionred {color:#cc0000;}
|
|
#surveillance .actiongreen {color:#00cc00;}
|
|
</style>
|
|
<link rel="stylesheet" href="./css/thickbox.css" type="text/css" />
|
|
<script type="text/javascript" src="./js/thickbox.js"></script>
|
|
|
|
<div id="center">
|
|
|
|
<h1 class="titre">SURVEILLANCE</h1>
|
|
|
|
<h2>Liste des surveillances: </h2>
|
|
|
|
<table id="surveillance" width="570">
|
|
<thead>
|
|
<th colspan="2">Identité</th>
|
|
<th colspan="4">Type de surveillance</th>
|
|
</thead>
|
|
<tr>
|
|
<td>Siren</td>
|
|
<td>Raison Sociale</td>
|
|
<td>Surveillance</td>
|
|
<td>Action</td>
|
|
<td>Ajouter le</td>
|
|
<td>Envoyé le</td>
|
|
</tr>
|
|
|
|
|
|
<?php
|
|
foreach($listTrier as $item){
|
|
?>
|
|
<tr>
|
|
<td class="left"><?php print $item['siren']; ?></td>
|
|
<td><?php print $item['rs']; ?></td>
|
|
<td class="left">
|
|
<?php
|
|
foreach($tabSource as $source){
|
|
if(array_key_exists($source, $item['sources'])){
|
|
?>
|
|
<?php print $source;?>
|
|
<br/>
|
|
<?php
|
|
}else{
|
|
?>
|
|
<?php print $source;?>
|
|
<br/>
|
|
<?php
|
|
}
|
|
}
|
|
if(array_key_exists('', $item['sources'])){
|
|
?>
|
|
Inconnu
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<td class="left">
|
|
<?php
|
|
foreach($tabSource as $source){
|
|
if(array_key_exists($source, $item['sources'])){
|
|
?>
|
|
<a class="actionred" href="./?page=surveillance&action=supprimer&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>&email=<?php print $item['sources'][$source]['email']; ?>" title="Supprimer la surveillance">Supprimer</a>
|
|
<br/>
|
|
<?php
|
|
}else{
|
|
?>
|
|
<a class="actiongreen thickbox" href="./pages/ajax_surveillance.php?q=ajouter&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>" title="Ajouter la surveillance">Ajouter</a>
|
|
<br/>
|
|
<?php
|
|
}
|
|
}
|
|
|
|
if(array_key_exists('', $item['sources'])){
|
|
?>
|
|
<a class="actionred" href="./?page=surveillance&action=supprimer&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>&email=<?php print $item['sources']['']['email']; ?>" title="Supprimer la surveillance">Supprimer</a>
|
|
<br/>
|
|
<?php
|
|
}
|
|
?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
foreach($tabSource as $source){
|
|
if(array_key_exists($source, $item['sources'])){
|
|
?>
|
|
<?php print substr($item['sources'][$source]['dateAjout'],8,2).'/'.substr($item['sources'][$source]['dateAjout'],5,2).'/'.substr($item['sources'][$source]['dateAjout'],0,4); ?>
|
|
<br/>
|
|
<?php
|
|
}else{
|
|
?>
|
|
-<br/>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</td>
|
|
<td>
|
|
<?php
|
|
foreach($tabSource as $source){
|
|
if(array_key_exists($source, $item['sources'])){
|
|
?>
|
|
<?php print substr($item['sources'][$source]['dateDerEnvoi'],8,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],5,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],0,4); ?>
|
|
<br/>
|
|
<?php
|
|
}else{
|
|
?>
|
|
-<br/>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</td>
|
|
</tr>
|
|
<?php
|
|
}
|
|
?>
|
|
</table>
|
|
</div>
|