extranet/www/pages/options_surv.php

218 lines
8.4 KiB
PHP
Raw Normal View History

2009-05-20 15:49:08 +00:00
<?php
if (!$_SESSION['connected'])
echo ('Vous devez <20>tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69>');
if($_REQUEST['action']=='supprimer'){
require_once 'surveillance/surveillance.php';
deleteSurveillance($_REQUEST['siren'], $_REQUEST['email'], '', $_REQUEST['source'], true);
2009-05-25 07:35:14 +00:00
header('Location: ./?page=surveillance');
2009-05-25 13:17:22 +00:00
}
isset($_REQUEST['vue']) ? $vue = $_REQUEST['vue'] : $vue = 'default' ;
isset($_REQUEST['tri']) ? $tri = $_REQUEST['tri'] : $tri = 'siren' ;
isset($_REQUEST['source']) ? $source = $_REQUEST['source'] : $source = '' ;
$fonctionTri = $vue.'Tri'.ucfirst($tri);
if($source == ''){
$tabSource = array('annonces', 'insee', 'bilans', 'score');
}else{
$tabSource = array($source);
}
2009-05-25 07:35:14 +00:00
//Liste des surveillances de l'utilisateur
2009-05-20 15:49:08 +00:00
try{
2009-05-25 13:17:22 +00:00
$result = $client->getSurveillances(0, $source, true);
2009-05-20 15:49:08 +00:00
$listSurveillance = $result['results'];
} catch (SoapFault $fault) {
require_once 'soaperror.php';
processSoapFault($client,$fault,$tabInfo);
die();
}
$firephp->log($listSurveillance, 'Surveillance');
2009-05-25 13:17:22 +00:00
//Appel de la fonction de tri
require_once 'surveillance/surveillance_tri.php';
$listTrier = $fonctionTri($listSurveillance);
2009-05-20 15:49:08 +00:00
$firephp->log($listTrier, 'listTrier');
?>
<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;}
2009-05-25 13:17:22 +00:00
#surveillance th {border:1px solid; padding:5px 15px 5px 0;}
2009-05-25 07:35:14 +00:00
#surveillance td {border:1px solid; text-align:center; padding:5px; }
#surveillance .aleft {text-align:left;}
#surveillance .action {clear:both; font:normal 1em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height: 1em;}
#surveillance td p {line-height:16px;}
#surveillance .action p {display:block; float:left; line-height:16px;}
#surveillance .action a {display:block; float:right;}
#surveillance .action a.margin {margin-right:16px;}
#surveillance .action img {vertical-align:middle;}
#info {margin:5px 5px 5px 30px; font:normal 1em Arial, Verdana, Sans-serif; letter-spacing:1px; line-height: 1em;}
2009-05-25 13:17:22 +00:00
table.tablesorter thead tr .header { background-image:url(./img/bg.gif); background-repeat:no-repeat; background-position:center right; cursor:pointer; }
table.tablesorter thead tr .headerSortUp { background-image: url(./img/asc.gif); }
table.tablesorter thead tr .headerSortDown { background-image: url(./img/desc.gif); }
#tri li {list-syle:none; margin-left:10px; display:inline; }
p.options {margin-left:10px; margin-top:5px;}
2009-05-20 15:49:08 +00:00
</style>
<link rel="stylesheet" href="./css/thickbox.css" type="text/css" />
<script type="text/javascript" src="./js/thickbox.js"></script>
2009-05-25 13:17:22 +00:00
<script type="text/javascript" src="./js/jquery.tablesorter.js"></script>
<script type="text/javascript">
$(document).ready(function() {
<?php
if($source == ''){
?>
$("#surveillance").tablesorter({
// pass the headers argument and assing a object
headers: {
2: { sorter: false},
3: { sorter: false },
4: { sorter: false },
5: { sorter: false }
}
});
<?php
}else{
?>
$("#surveillance").tablesorter();
<?php
}
?>
$("select[name=type]").change(function(){
var value = $(this).val();
if (value == '-'){
document.location.href = './?page=surveillance';
}else{
document.location.href = './?page=surveillance&vue=source&source='+value;
}
});
});
</script>
2009-05-20 15:49:08 +00:00
<div id="center">
<h1 class="titre">SURVEILLANCE</h1>
2009-05-25 07:35:14 +00:00
<?php
//Affichage du nombre de surveillances
$nbSurveillances = count($listSurveillance);
$nbEtab = count($listTrier);
?>
<table id="info">
<tr><td width="200px" class="StyleInfoLib">Nombre d'entit<EFBFBD>s surveill<EFBFBD>es</td><td><?php print $nbEtab; ?></td></tr>
<tr><td class="StyleInfoLib">Nombre de surveillances</td><td><?php print $nbSurveillances; ?></td></tr>
</table>
2009-05-25 13:17:22 +00:00
<h2>Options de tri</h2>
<p class="options">
Afficher uniquement les suveillances de type
<select name="type">
<option value="-">Toutes</option>
<option value="annonces" <?php if(isset($source) && $source=='annonces'){print 'selected';}?>>Annonces</option>
<option value="insee" <?php if(isset($source) && $source=='insee'){print 'selected';}?>>Insee</option>
<option value="bilans" <?php if(isset($source) && $source=='bilans'){print 'selected';}?>>Bilans</option>
<option value="score" <?php if(isset($source) && $source=='score'){print 'selected';}?>>Score</option>
</select>
</p>
<p class="options"><ul id="tri">
<li><a href="./?page=surveillance&vue=<?php print $vue;?><?php if(isset($source)){print '&source='.$source;}?>&tri=siren">Tri par Siren</a></li>
<li><a href="./?page=surveillance&vue=<?php print $vue;?><?php if(isset($source)){print '&source='.$source;}?>&tri=rs">Tri par Raison sociale</a></li>
<?php
if($source != ''){
?>
<li><a href="./?page=surveillance&vue=<?php print $vue;?><?php if(isset($source)){print '&source='.$source;}?>&tri=reference">Tri par R<EFBFBD>f<EFBFBD>rence</a></li>
<li><a href="./?page=surveillance&vue=<?php print $vue;?><?php if(isset($source)){print '&source='.$source;}?>&tri=dateajout">Tri par Date d'ajout</a></li>
<li><a href="./?page=surveillance&vue=<?php print $vue;?><?php if(isset($source)){print '&source='.$source;}?>&tri=datederenvoi">Tri par Date de dernier envoi</a></li>
<?php
}
?>
</ul></p>
<p class="options">
Les options de tri pemettent de trier la liste de vos surveillances.
Il est ensuite possible de trier les surveillances affich<EFBFBD>es dans le tableau en cliquant sur chaque titre de colonnes.
</p>
2009-05-25 07:35:14 +00:00
<h2>Liste des surveillances</h2>
2009-05-20 15:49:08 +00:00
2009-05-25 13:17:22 +00:00
<table class="tablesorter" id="surveillance" width="570">
2009-05-20 15:49:08 +00:00
<thead>
<tr>
2009-05-25 13:17:22 +00:00
<th>Siren</th>
<th>Raison Sociale</th>
<th>R<EFBFBD>f<EFBFBD>rence</th>
<th>Surveillance</th>
<th>Ajouter le</th>
<th>Envoy<EFBFBD> le</th>
2009-05-20 15:49:08 +00:00
</tr>
2009-05-25 13:17:22 +00:00
</thead>
<tbody>
<?php
2009-05-20 15:49:08 +00:00
foreach($listTrier as $item){
?>
<tr>
2009-05-25 07:35:14 +00:00
<td class="aleft"><a href="./?page=identite&siret=<?php print $item['siren']; ?>"><?php print $item['siren']; ?></a></td>
<td><?php print $item['rs']; ?><br/><i><?php print $item['cp'].' '.$item['ville']; ?></i></td>
<td>
2009-05-20 15:49:08 +00:00
<?php
foreach($tabSource as $source){
2009-05-25 07:35:14 +00:00
if($item['sources'][$source]['ref']!=''){
print '<p>'.$item['sources'][$source]['ref'].'</p>';
}else{?> <p>-</p> <?php }
}
2009-05-20 15:49:08 +00:00
?>
</td>
2009-05-25 07:35:14 +00:00
<td class="aleft">
2009-05-20 15:49:08 +00:00
<?php
foreach($tabSource as $source){
if(array_key_exists($source, $item['sources'])){
?>
2009-05-25 07:35:14 +00:00
<div id="a<?php print $item['siren'];?>" class="action">
<p><?php print ucfirst($source);?></p>
<a class="thickbox" href="./pages/ajax_surveillance.php?q=ajouter&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>&ref=<?php print $item['sources'][$source]['ref'];?>&email=<?php print $item['sources'][$source]['email'];?>" title="Editer la surveillance <?php print $source;?>"><img src="./img/interface/editer.png"/></a>
<a 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"><img src="./img/interface/supprimer.png"/></a>
</div>
2009-05-20 15:49:08 +00:00
<?php
}else{
?>
2009-05-25 07:35:14 +00:00
<div id="a<?php print $item['siren'];?>" class="action">
<p><?php print ucfirst($source);?></p>
<a class="margin thickbox" href="./pages/ajax_surveillance.php?q=ajouter&siren=<?php print $item['siren']; ?>&source=<?php print $source;?>" title="Ajouter la surveillance <?php print $source;?>"><img src="./img/interface/ajouter.png"/></a>
</div>
2009-05-20 15:49:08 +00:00
<?php
}
?>
<br/>
2009-05-25 07:35:14 +00:00
<?php
}
2009-05-20 15:49:08 +00:00
?>
</td>
<td>
<?php
foreach($tabSource as $source){
2009-05-25 07:35:14 +00:00
print '<p id="dateajout'.$item['siren'].'">';
2009-05-20 15:49:08 +00:00
if(array_key_exists($source, $item['sources'])){
2009-05-25 07:35:14 +00:00
print substr($item['sources'][$source]['dateAjout'],8,2).'/'.substr($item['sources'][$source]['dateAjout'],5,2).'/'.substr($item['sources'][$source]['dateAjout'],0,4);
}else{?> - <?php }
print '</p>';
2009-05-20 15:49:08 +00:00
}
?>
</td>
<td>
<?php
foreach($tabSource as $source){
2009-05-25 07:35:14 +00:00
print '<p id="datederenvoi'.$item['siren'].'">';
if(array_key_exists($source, $item['sources'])){
$pDate = substr($item['sources'][$source]['dateDerEnvoi'],8,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],5,2).'/'.substr($item['sources'][$source]['dateDerEnvoi'],0,4);
if ($pDate!='00/00/0000'){print $pDate; }else{ print '-';}
}else{?> <p>-</p> <?php }
print '</p>';
2009-05-20 15:49:08 +00:00
}
?>
</td>
</tr>
<?php
}
?>
2009-05-25 13:17:22 +00:00
<tbody>
2009-05-20 15:49:08 +00:00
</table>
</div>