2009-05-20 15:49:08 +00:00
< ? php
if ( ! $_SESSION [ 'connected' ])
2009-08-21 14:46:58 +00:00
echo ( 'Vous devez <20> tre connect<63> afin de pouvoir utiliser cette fonctionnalit<69> ' );
2009-06-03 09:57:18 +00:00
2009-06-04 13:20:41 +00:00
/*
2009-12-10 09:54:47 +00:00
if ( ! preg_match ( '/\bSURVLISTE\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ])) {
2009-06-04 13:20:41 +00:00
print 'Vous n\'avez pas les droits n<> cessaires.' ;
2009-08-21 14:46:58 +00:00
exit ;
2009-06-03 09:57:18 +00:00
}
2009-08-21 14:46:58 +00:00
*/
isset ( $_REQUEST [ 'idEntreprise' ]) ? $idEntreprise = $_REQUEST [ 'idEntreprise' ] : $idEntreprise = '' ;
isset ( $_REQUEST [ 'siret' ]) ? $siret = $_REQUEST [ 'siret' ] : $siret = '' ;
2009-06-04 13:20:41 +00:00
2009-05-20 15:49:08 +00:00
if ( $_REQUEST [ 'action' ] == 'supprimer' ){
require_once 'surveillance/surveillance.php' ;
2009-06-12 14:57:18 +00:00
deleteSurveillance ( $_REQUEST [ 'siren' ], $_REQUEST [ 'email' ], $_REQUEST [ 'ref' ], $_REQUEST [ 'source' ], true );
2009-06-04 13:20:41 +00:00
header ( 'Location: ./?page=surveillance&idEntreprise=' . $idEntreprise . '&siret=' . $siret );
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 = '' ;
2009-06-12 12:14:35 +00:00
isset ( $_REQUEST [ 'p' ]) ? $position = $_REQUEST [ 'p' ] : $position = 0 ;
2009-06-12 15:52:25 +00:00
$fonctionTri = $vue . 'TriTab' ;
switch ( $tri ){
default :
case 'siren' : $triws = 'siren' ; break ;
case 'rs' : $triws = 'rs' ; break ;
case 'reference' : $triws = 'ref' ; break ;
case 'dateajout' : $triws = 'dateAjout' ; break ;
case 'datederenvoi' : $triws = 'dateDerEnvoi' ; break ;
}
2009-10-16 15:21:58 +00:00
// Source => Permission
$tabSource = array ( 'annonces' => 'annonce' , 'insee' => 'insee' , 'bilans' => 'bilan' , 'score' => 'score' , 'actes' => 'actes' , 'dirigeants' => 'dirigeants' );
2009-06-12 12:14:35 +00:00
$nbAffichage = 100 ;
2009-06-12 06:57:41 +00:00
2009-09-15 09:18:59 +00:00
//Enregistrement pour liste derni<6E> re recherche
require_once 'recherche/session.php' ;
$parametres = recherche_element ( 0 );
if ( isset ( $parametres ) && $parametres [ 'info' ][ 'page' ] == 'recherche' ){ recherche_saveinfo ( array ( 'page' => $page ) ); }
2009-05-25 07:35:14 +00:00
//Liste des surveillances de l'utilisateur
2009-08-21 14:46:58 +00:00
try {
$result = $client -> getSurveillances ( 0 , $source , true , $position , $nbAffichage , $triws );
2009-06-12 06:57:41 +00:00
$listSurveillance = $result [ 'results' ][ 'reponses' ];
2009-08-21 15:05:19 +00:00
/*
2009-06-12 12:14:35 +00:00
print '<!--' ;
print_r ( $listSurveillance );
print '-->' ;
2009-08-21 15:05:19 +00:00
*/
2009-06-12 12:14:35 +00:00
$nbReponses = $result [ 'results' ][ 'nbReponses' ];
$nbSurveillances = $result [ 'results' ][ 'nbReponsesTotal' ];
2009-08-21 14:46:58 +00:00
2009-06-12 12:14:35 +00:00
$totPage = ceil ( $nbSurveillances / $nbAffichage );
2009-12-21 10:25:04 +00:00
$curPage = ceil ( $position / $nbAffichage );
2009-06-12 12:14:35 +00:00
2009-05-20 15:49:08 +00:00
} catch ( SoapFault $fault ) {
require_once 'soaperror.php' ;
processSoapFault ( $client , $fault , $tabInfo );
die ();
}
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
?>
2009-05-25 13:17:22 +00:00
< script type = " text/javascript " >
2009-12-04 17:17:09 +00:00
$ ( document ) . ready ( function ()
{
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 13:17:22 +00:00
if ( $source == '' ){
?>
$ ( " #surveillance " ) . tablesorter ({
2009-08-21 14:46:58 +00:00
headers : {
2 : { sorter : false },
3 : { sorter : false },
4 : { sorter : false },
5 : { sorter : false }
2009-05-25 13:17:22 +00:00
}
2009-08-21 14:46:58 +00:00
});
2009-05-25 13:17:22 +00:00
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 13:17:22 +00:00
} else {
2009-08-21 14:46:58 +00:00
?>
2009-05-25 15:35:51 +00:00
$ ( " #surveillance " ) . tablesorter ({
2009-08-21 14:46:58 +00:00
headers : {
3 : { sorter : false }
2009-06-03 09:57:18 +00:00
}
2009-08-21 14:46:58 +00:00
});
< ? php
2009-05-25 13:17:22 +00:00
}
?>
$ ( " select[name=type] " ) . change ( function (){
var value = $ ( this ) . val ();
if ( value == '-' ){
2009-06-04 13:20:41 +00:00
document . location . href = './?page=surveillance&idEntreprise=<?=$idEntreprise?>&siret=<?=$siret?>' ;
2009-05-25 13:17:22 +00:00
} else {
2009-06-04 13:20:41 +00:00
document . location . href = './?page=surveillance&vue=source&source=' + value + '&idEntreprise=<?=$idEntreprise?>&siret=<?=$siret?>' ;
2009-08-21 14:46:58 +00:00
}
2009-05-25 13:17:22 +00:00
});
2009-08-21 14:46:58 +00:00
});
2009-05-25 13:17:22 +00:00
</ script >
2009-05-20 15:49:08 +00:00
< div id = " center " >
< h1 class = " titre " > SURVEILLANCE </ h1 >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 07:35:14 +00:00
//Affichage du nombre de surveillances
$nbEtab = count ( $listTrier );
2009-05-25 15:25:44 +00:00
if ( $vue == 'default' ){
2009-05-25 07:35:14 +00:00
?>
< table id = " info " >
2009-06-12 12:14:35 +00:00
< tr >< td width = " 200 " class = " StyleInfoLib " > Nombre d ' entit<EFBFBD> s affich<EFBFBD> es </ td >< td >< ? php print $nbEtab ; ?> </td></tr>
2009-05-25 07:35:14 +00:00
< tr >< td class = " StyleInfoLib " > Nombre de surveillances </ td >< td >< ? php print $nbSurveillances ; ?> </td></tr>
</ table >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 15:25:44 +00:00
} else {
2009-08-21 14:46:58 +00:00
?>
2009-05-25 15:25:44 +00:00
< table id = " info " >
< tr >< td class = " StyleInfoLib " > Nombre de surveillances < ? php print $source ; ?> </td><td><?php print $nbSurveillances; ?></td></tr>
</ table >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 15:25:44 +00:00
}
?>
2009-05-25 07:35:14 +00:00
2009-05-25 13:17:22 +00:00
< h2 > Options de tri </ h2 >
< p class = " options " >
2009-08-21 14:46:58 +00:00
Afficher uniquement les suveillances de type
2009-05-25 13:17:22 +00:00
< select name = " type " >
2009-05-25 13:43:59 +00:00
< option value = " - " > toutes </ option >
2009-09-18 17:09:22 +00:00
< ? php
2009-10-16 15:21:58 +00:00
foreach ( $tabSource as $s => $perm )
2009-09-18 17:09:22 +00:00
{
2009-12-10 09:54:47 +00:00
if ( preg_match ( '/\bsurv' . $perm . '\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]))
2009-10-16 15:21:58 +00:00
{
?>
< option value = " <?= $s ?> " < ? php if ( isset ( $source ) && $source == $s ){ print 'selected' ;} ?> ><?=$s?></option>
< ? php
}
2009-09-18 17:09:22 +00:00
}
?>
2009-05-25 13:17:22 +00:00
</ select >
</ p >
2009-09-18 17:09:22 +00:00
< p class = " options " >
< ul id = " tri " >
2009-06-04 13:20:41 +00:00
< li >< a href = " ./?page=surveillance&vue=<?php print $vue ;?><?php if(isset( $source )) { print '&source='. $source ;}?>&tri=siren&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " > Tri par Siren </ a ></ li >
< li >< a href = " ./?page=surveillance&vue=<?php print $vue ;?><?php if(isset( $source )) { print '&source='. $source ;}?>&tri=rs&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " > Tri par Raison sociale </ a ></ li >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 13:17:22 +00:00
if ( $source != '' ){
2009-08-21 14:46:58 +00:00
?>
2009-06-04 13:20:41 +00:00
< li >< a href = " ./?page=surveillance&vue=<?php print $vue ;?><?php if(isset( $source )) { print '&source='. $source ;}?>&tri=reference&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " > 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&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " > 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&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " > Tri par Date de dernier envoi </ a ></ li >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 13:17:22 +00:00
}
?>
2009-09-18 17:09:22 +00:00
</ ul >
</ p >
2009-05-25 13:17:22 +00:00
< p class = " options " >
2009-08-21 14:46:58 +00:00
Les options de tri pemettent de trier la liste de vos surveillances .
2009-05-25 13:17:22 +00:00
Il est ensuite possible de trier les surveillances affich<EFBFBD> es dans le tableau en cliquant sur chaque titre de colonnes .
</ p >
2009-12-21 10:25:04 +00:00
< ? php
if ( $totPage != 1 )
{
?>
2009-06-12 06:57:41 +00:00
< p class = " options " > Page : </ p >
< p class = " options " >
2009-08-21 14:46:58 +00:00
< ? php
2009-12-21 10:25:04 +00:00
for ( $countPage = 0 ; $countPage < $totPage ; $countPage ++ )
{
if ( $countPage == $curPage )
{
2009-06-12 06:57:41 +00:00
?>
& nbsp ; < ? = $countPage + 1 ?>
< ? php
} else {
?>
2009-06-12 12:14:35 +00:00
& nbsp ; < a href = " ./?page=surveillance&vue=<?= $vue ;?>
< ? php if ( isset ( $tri )){ print '&tri=' . $tri ;} ?>
< ? php if ( isset ( $source )){ print '&source=' . $source ;} ?> &idEntreprise=<?=$idEntreprise?>&siret=<?=$siret?>&p=<?=$nbReponses*$countPage?>"><?=$countPage+1?></a>
2009-06-12 06:57:41 +00:00
< ? php
}
}
?>
</ p >
2009-08-21 14:46:58 +00:00
< ? php
2009-06-12 06:57:41 +00:00
}
?>
2009-05-25 13:17:22 +00:00
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 >
2009-05-25 16:19:39 +00:00
< th > Raison Sociale </ th >
2009-05-25 13:17:22 +00:00
< th > R<EFBFBD> f<EFBFBD> rence </ th >
< th > Surveillance </ th >
2009-05-25 15:25:44 +00:00
< th > Ajout le </ th >
2009-05-25 13:17:22 +00:00
< 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-25 15:25:44 +00:00
//Si vue=defaut alors on affiche les entit<69> s avec toutes leurs surveillances
if ( $vue == 'default' ){
2009-08-21 14:46:58 +00:00
foreach ( $listTrier as $item )
{
2009-05-20 15:49:08 +00:00
?>
< 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>
2009-08-21 15:04:15 +00:00
< td width = " 110 " >< ? php print $item [ 'rs' ]; ?> <br/><i><?php print $item['cp'].' '.$item['ville']; ?></i></td>
2009-05-25 07:35:14 +00:00
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-10-16 15:21:58 +00:00
foreach ( $tabSource as $source => $perm )
{
2009-12-10 09:54:47 +00:00
if ( preg_match ( '/\bsurv' . $perm . '\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]))
2009-10-16 15:21:58 +00:00
{
if ( isset ( $item [ 'sources' ][ $source ]))
{
foreach ( $item [ 'sources' ][ $source ] as $surveillance )
{
2009-05-25 15:25:44 +00:00
if ( $surveillance [ 'ref' ] != '' ){
print '<p>' . $surveillance [ 'ref' ] . '</p>' ;
} else { ?> <p>-</p> <?php }
}
2009-10-16 15:21:58 +00:00
} else { ?> <p>-</p> <?php }
}
2009-08-21 14:46:58 +00:00
}
2009-05-20 15:49:08 +00:00
?>
</ td >
2009-05-25 16:19:39 +00:00
< td id = " type " class = " aleft " >
2009-08-21 14:46:58 +00:00
< ? php
2009-10-16 15:21:58 +00:00
foreach ( $tabSource as $source => $perm )
{
2009-12-10 09:54:47 +00:00
if ( preg_match ( '/\bsurv' . $perm . '\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]))
2009-10-16 15:21:58 +00:00
{
if ( array_key_exists ( $source , $item [ 'sources' ]))
{
foreach ( $item [ 'sources' ][ $source ] as $surveillance )
{
?>
< div id = " a<?php print $item['siren'] ;?> " class = " action " >
< p >< ? php print ucfirst ( $source ); ?> </p>
2009-12-15 17:14:21 +00:00
< a class = " thickbox " href = " ./pages/ajax_surveillance.php?q=ajouter&siren=<?= $item['siren'] ?>&source=<?= $source ?> " title = " Ajouter la surveillance <?= $source ?> " >< img src = " ./img/interface/ajouter.png " /></ a >
< a class = " thickbox " href = " ./pages/ajax_surveillance.php?q=ajouter&siren=<?= $item['siren'] ?>&source=<?= $source ?>&ref=<?= $surveillance['ref'] ?>&email=<?= $surveillance['email'] ?> " title = " Editer la surveillance <?= $source ?> " >< img src = " ./img/interface/editer.png " /></ a >
< a href = " ./?page=surveillance&action=supprimer&siren=<?= $item['siren'] ; ?>&ref=<?= $surveillance['ref'] ?>&source=<?= $source ?>&email=<?= $surveillance['email'] ?>&idEntreprise=<?= $idEntreprise ?>&siret=<?= $siret ?> " title = " Supprimer la surveillance <?= $source .' '. $surveillance['email'] ?> " >< img src = " ./img/interface/supprimer.png " /></ a >
2009-10-16 15:21:58 +00:00
</ div >
< ? php
}
2009-05-25 15:25:44 +00:00
}
2009-10-16 15:21:58 +00:00
else
{
?>
< 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 ;?> " title = " Ajouter la surveillance <?= $source ?> " >< img src = " ./img/interface/ajouter.png " /></ a >
</ div >
< ? php
}
?>
< br />
< ? php
2009-05-20 15:49:08 +00:00
}
2009-08-21 14:46:58 +00:00
}
2009-05-20 15:49:08 +00:00
?>
</ td >
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-10-16 15:21:58 +00:00
foreach ( $tabSource as $source => $perm ){
if ( preg_match ( '/surv' . $perm . '/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]))
{
if ( array_key_exists ( $source , $item [ 'sources' ])){
foreach ( $item [ 'sources' ][ $source ] as $surveillance ){
print '<p>' . substr ( $surveillance [ 'dateAjout' ], 8 , 2 ) . '/' . substr ( $surveillance [ 'dateAjout' ], 5 , 2 ) . '/' . substr ( $surveillance [ 'dateAjout' ], 0 , 4 ) . '</p>' ;
}
} else { ?> <p>-</p> <?php }
}
2009-08-21 14:46:58 +00:00
}
2009-05-20 15:49:08 +00:00
?>
</ td >
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-10-16 15:21:58 +00:00
foreach ( $tabSource as $source => $perm ){
2009-12-10 09:54:47 +00:00
if ( preg_match ( '/\bsurv' . $perm . '\b/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]))
2009-10-16 15:21:58 +00:00
{
if ( array_key_exists ( $source , $item [ 'sources' ])){
foreach ( $item [ 'sources' ][ $source ] as $surveillance ){
$pDate = substr ( $surveillance [ 'dateDerEnvoi' ], 8 , 2 ) . '/' . substr ( $surveillance [ 'dateDerEnvoi' ], 5 , 2 ) . '/' . substr ( $surveillance [ 'dateDerEnvoi' ], 0 , 4 );
if ( $pDate != '00/00/0000' ){ print '<p>' . $pDate . '</p>' ; } else { print '<p>-</p>' ;}
}
} else { ?> <p>-</p> <?php }
}
2009-08-21 14:46:58 +00:00
}
2009-05-20 15:49:08 +00:00
?>
</ td >
</ tr >
< ? php
}
2009-05-25 15:25:44 +00:00
//si vue=source alors on a forc<72> ment qu'une seul source donc 1 ligne par surveillance d'entit<69>
2009-08-21 14:46:58 +00:00
}
elseif ( $vue == 'source' )
{
2009-05-25 15:25:44 +00:00
foreach ( $listTrier as $item ){
?>
< tr >
< td class = " aleft " >< a href = " ./?page=identite&siret=<?php print $item['siren'] ; ?> " >< ? php print $item [ 'siren' ]; ?> </a></td>
2009-05-25 16:19:39 +00:00
< td >< ? php print $item [ 'rs' ]; ?> <br/><i><?php print $item['cp'].' '.$item['ville']; ?></i></td>
2009-05-25 15:25:44 +00:00
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 15:25:44 +00:00
if ( $item [ 'ref' ] != '' ){
print '<p>' . $item [ 'ref' ] . '</p>' ;
} else { ?> <p>-</p> <?php }
?>
</ td >
< td class = " aleft " >
< div id = " a<?php print $item['siren'] ;?> " class = " action " >
< p >< ? php print ucfirst ( $item [ 'source' ]); ?> </p>
< a class = " thickbox " href = " ./pages/ajax_surveillance.php?q=ajouter&siren=<?php print $item['siren'] ; ?>&source=<?php print $item['source'] ;?>&ref=<?php print $item['ref'] ;?>&email=<?php print $item['email'] ;?> " title = " Editer la surveillance <?php print $item['source'] ;?> " >< img src = " ./img/interface/editer.png " /></ a >
2009-08-21 14:46:58 +00:00
< a href = " ./?page=surveillance&action=supprimer&siren=<?php print $item['siren'] ; ?>&ref=<?php print $item['ref'] ; ?>&source=<?php print $item['source'] ;?>&email=<?php print $item['email'] ; ?> " title = " Supprimer la surveillance <?php print $item['source'] .' '. $item['email'] ;?> " >< img src = " ./img/interface/supprimer.png " /></ a >
2009-05-25 15:25:44 +00:00
</ div >
< br />
</ td >
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 15:25:44 +00:00
print '<p>' . substr ( $item [ 'dateAjout' ], 8 , 2 ) . '/' . substr ( $item [ 'dateAjout' ], 5 , 2 ) . '/' . substr ( $item [ 'dateAjout' ], 0 , 4 ) . '</p>' ;
?>
</ td >
< td >
2009-08-21 14:46:58 +00:00
< ? php
2009-05-25 15:25:44 +00:00
$pDate = substr ( $item [ 'dateDerEnvoi' ], 8 , 2 ) . '/' . substr ( $item [ 'dateDerEnvoi' ], 5 , 2 ) . '/' . substr ( $item [ 'dateDerEnvoi' ], 0 , 4 );
if ( $pDate != '00/00/0000' ){ print '<p>' . $pDate . '</p>' ; } else { print '<p>-</p>' ;}
?>
</ td >
</ tr >
< ? php
}
} //Fin vue==source
2009-05-20 15:49:08 +00:00
?>
2009-05-25 13:17:22 +00:00
< tbody >
2009-05-20 15:49:08 +00:00
</ table >
</ div >