2009-07-21 07:17:54 +00:00
< ?
2009-05-20 15:49:08 +00:00
if ( ! $_SESSION [ 'connected' ]) die ();
2009-03-05 16:19:38 +00:00
2009-04-01 12:45:45 +00:00
$tabInfo = $_SESSION [ 'tabInfo' ];
2009-05-20 15:49:08 +00:00
$firephp -> log ( $tabInfo , 'tabInfo' );
2009-04-01 12:45:45 +00:00
2009-05-20 15:49:08 +00:00
require_once 'partenaires/classMTva.php' ;
require_once 'partenaires/classMMap.php' ;
require_once 'common/dates.php' ;
require_once 'cache.php' ;
2009-03-05 16:19:38 +00:00
2009-02-17 13:14:53 +00:00
$siret = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'siret' ]));
if ( strlen ( $siret ) <> 0 && strlen ( $siret ) <> 9 && strlen ( $siret ) <> 14 ) die ( 'Param<61> tres incorrects !' );
2009-03-11 07:51:18 +00:00
$idEntreprise = trim ( preg_replace ( '/[^0-9]/' , '' , $_REQUEST [ 'idEntreprise' ])) * 1 ; // Si id=0 alors non communiqu<71>
if (( $siret * 1 ) == 0 && $idEntreprise == 0 ) die ( 'Param<61> tres incorrects !' );
2009-02-17 13:14:53 +00:00
$siren = substr ( $siret , 0 , 9 );
$mil = false ;
2009-05-20 15:49:08 +00:00
$raisonSociale = $tabInfo [ 'entrep' ][ 'raisonSociale' ];
?>
< table width = " 580 " border = " 0 " align = " left " bgcolor = " #FFFFFF " >
< tr >
< td colspan = " 3 " align = " center " >< img src = " ./img/rub_evenements.png " width = " 577 " height = " 36 " /></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Num & eacute ; ro identifiant Siren </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = substr ( $siren , 0 , 3 ) . ' ' . substr ( $siren , 3 , 3 ) . ' ' . substr ( $siren , 6 , 3 ) ?> </td>
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td width = " 200 " class = " StyleInfoLib " > Raison Sociale </ td >
< td width = " 350 " class = " StyleInfoData " >< ? = $raisonSociale ?> </td>
</ tr >
< tr >
< td colspan = " 3 " >& nbsp ; </ td >
</ tr >
< tr >
< td colspan = " 3 " >< img src = " ./img/srub_even_insee.png " width = " 576 " height = " 27 " /></ td >
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
< td colspan = " 2 " width = " 550 " class = " StyleInfoData " >
< ? php
2009-03-05 16:19:38 +00:00
//G<> n<EFBFBD> rer un nom de fichier pour le cache et l'export des fichiers
2009-03-10 15:07:24 +00:00
if (( $siret * 1 ) == 0 && ( $siren * 1 ) < 100 ){
2009-03-05 16:19:38 +00:00
$fileName = $page2 . '-' . $idEntreprise ;
} else {
2009-03-10 15:07:24 +00:00
$fileName = $page2 . '-' . $siret ;
2009-03-10 09:13:05 +00:00
}
2009-03-06 16:29:16 +00:00
//Mise en Cache
2009-03-05 16:19:38 +00:00
$cache = new Cache ();
2009-03-10 09:13:05 +00:00
//Forcer la cr<63> ation de la page dans le cache lorsque l'utilisateur a le mode saisie
2009-03-11 18:31:26 +00:00
if ( preg_match ( '/saisie/i' , $_SESSION [ 'tabInfo' ][ 'droits' ]) || $_SESSION [ 'tabInfo' ][ 'mode_edition' ] == 1 ) {
2009-03-10 09:13:05 +00:00
$cache -> disable = TRUE ;
$cache -> forceStart = TRUE ;
}
if ( $cache -> startCapture ( $fileName . '.html' ) == FALSE ){
2009-03-05 16:19:38 +00:00
print $cache -> displayCache ();
} else {
2009-07-21 07:17:54 +00:00
2009-03-05 16:19:38 +00:00
try {
$O = $client -> getListeEvenements ( $siren );
$evens = $O [ 'result' ];
} catch ( SoapFault $fault ) {
2009-05-20 15:49:08 +00:00
require_once 'soaperror.php' ;
2009-03-05 16:19:38 +00:00
processSoapFault ( $client , $fault , $tabInfo );
die ();
}
2009-05-20 15:49:08 +00:00
?>
< table >
< ? php
foreach ( $evens as $i => $even ) {
if ( $even [ 'Siege' ] == 1 ) $type = 'si<73> ge' ;
else $type = '<27> tablissement' ;
$lien = '<a title="Voir la fiche d\'identit<69> " href="/?page=identite&siret=' . $siren . $even [ 'Nic' ] . '&idEntreprise=' . $idEntreprise . '">' ;
$lien2 = '<a title="Voir la fiche d\'identit<69> " href="/?page=identite&siret=' . $even [ 'SiretAss' ] . '&idEntreprise=' . $idEntreprise . '">' ;
?>
2009-03-05 16:19:38 +00:00
< tr >
2009-05-20 15:49:08 +00:00
< td class = " StyleInfoLib " width = " 60 " >< ? = WDate :: dateT ( 'Ymd' , 'd/m/Y' , $even [ 'DateInfo' ]) ?> </td>
< td class = " StyleInfoData " width = " 480 " >< b >< ? = $even [ 'EvenLib' ] ?> </b> <i> - NIC <?=$lien.$even['Nic'].'</a>'?> le <?=WDate::dateT('Ymd','d/m/Y',$even['EvenDate'])?></i>
< ?
if ( trim ( $even [ 'EvenLibDet' ]) <> '' ) echo '<br/>' . str_replace ( ', ' , '<br/>' , $even [ 'EvenLibDet' ]);
2009-08-26 09:28:04 +00:00
if ( $even [ 'SiretAss' ] * 1 <> 0 && $even [ 'TypeSiretAss' ] <> '' ) echo '<br/>Siret du ' . $even [ 'TypeSiretAss' ] . ' : ' . $lien2 . substr ( $even [ 'SiretAss' ], 0 , 9 ) . ' ' . substr ( $even [ 'SiretAss' ], 9 , 5 ) . '</a>' ;
elseif ( $even [ 'SiretAss' ] * 1 <> 0 && $even [ 'TypeSiretAss' ] == '' ) echo '<br/>Siret associé : ' . $lien2 . substr ( $even [ 'SiretAss' ], 0 , 9 ) . ' ' . substr ( $even [ 'SiretAss' ], 9 , 5 ) . '</a>' ;
2009-05-20 15:49:08 +00:00
?>
2009-03-05 16:19:38 +00:00
</ td >
2009-05-20 15:49:08 +00:00
</ tr >
< ?
}
if ( count ( $evens ) == 0 )
2009-05-26 10:07:52 +00:00
echo '<tr><td class="StyleInfoData" width="580"> Aucun évènement n\'est présent dans notre base</td></tr>' ;
2009-05-20 15:49:08 +00:00
?>
</ table >
2009-07-21 07:17:54 +00:00
< ? php
2009-03-05 16:19:38 +00:00
//Exportation des donn<6E> es sous forme de fichier
function htmldecode ( $value ){
$value = is_array ( $value ) ? array_map ( 'htmldecode' , $value ) : html_entity_decode ( $value , ENT_QUOTES , 'UTF-8' );
return $value ;
}
2009-07-21 07:17:54 +00:00
//$firephp->log($evens, 'Evenements');
2009-03-05 16:19:38 +00:00
$tabForExport = htmldecode ( $evens );
2009-03-13 17:31:17 +00:00
//$firephp->log($tabForExport, 'tabForExport');
2009-07-21 07:17:54 +00:00
2009-03-06 17:12:26 +00:00
if ( count ( $tabForExport ) > 0 ){
2009-07-21 07:17:54 +00:00
require_once 'export.php' ;
2009-03-06 17:12:26 +00:00
$array2csv = new ExportCSV ();
$array2csv -> records = $tabForExport ;
$array2csv -> writeCSV ( $fileName );
2009-07-21 07:17:54 +00:00
2009-03-06 17:12:26 +00:00
$array2xml = new ExportXML ();
2009-03-10 15:07:24 +00:00
$array2xml -> rootName = $page . 's' ;
$array2xml -> defaultTagName = $page ;
2009-03-06 17:12:26 +00:00
$array2xml -> records = $tabForExport ;
$array2xml -> writeXML ( $fileName );
}
2009-03-05 16:19:38 +00:00
} //Fin test mise en cache
$cache -> stopCapture (); //On arrete la capture pour le cache
2009-05-20 15:49:08 +00:00
?>
2009-07-21 07:17:54 +00:00
</ td >
2009-05-20 15:49:08 +00:00
</ tr >
< tr >
< td width = " 30 " >& nbsp ; </ td >
2009-05-22 09:53:48 +00:00
< td colspan = " 3 " width = " 550 " class = " StyleInfoData " >
2009-07-21 07:17:54 +00:00
< ? php
2009-05-20 15:49:08 +00:00
require_once 'surveillance/surveillance.php' ;
print getSurveillance ( $page , $siret );
?>
</ td >
</ tr >
</ table >