extranet/includes/scoresws/annonces.php
2009-09-29 08:48:12 +00:00

90 lines
2.4 KiB
PHP

<?php
function block_annonces($wsresult)
{
global $firephp;
$annonces = tri_annonces($wsresult);
$Siret = trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
$page = array();
$page['titre'] = 'ANNONCES L&Eacute;GALES';
$page['blocks'] = array();
$i = -1;
//Annonces BODACC
if(count($annonces['bodacc'])>0)
{
$i++;
$page['blocks'][$i]['titre'] = 'EV&Eacute;NEMENTS L&Eacute;GAUX';
$lignes = array();
foreach ($annonces['bodacc'] as $ann)
{
$lignes[] = format_content( 'Bodacc' , array('Siret'=>$Siret, 'id'=>$ann['id'], 'evenements'=>$ann['evenements'], 'dateEffet'=>$ann['dateEffet'], 'DateParution'=>$ann['DateParution'], 'BodaccCode'=>$ann['BodaccCode'], 'BodaccNum'=>$ann['BodaccNum'] ) );
}
$page['blocks'][$i]['ligne'] = $lignes;
}
//Annonces BALO
if(count($annonces['balo'])>0)
{
$i++;
$page['blocks'][$i]['titre'] = 'BALO';
$lignes = array();
foreach ($annonces['balo'] as $ann)
{
$lignes[] = format_content( 'Balo' , array('Siret'=>$Siret, 'DateParution'=>$ann['DateParution'], 'BodaccNum'=>$ann['BodaccNum'], 'id'=>$ann['id'], 'evenements'=>$ann['evenements'], 'dateEffet'=>$ann['dateEffet']) );
}
$page['blocks'][$i]['ligne'] = $lignes;
}
//Annonces ASSO
if(count($annonces['asso'])>0)
{
$i++;
$page['blocks'][$i]['titre'] = 'Associations';
$lignes = array();
foreach ($annonces['asso'] as $ann)
{
$lignes[] = format_content( 'Asso', array('Siret'=>$Siret, 'DateParution'=>$ann['DateParution'], 'BodaccNum'=>$ann['BodaccNum'], 'id'=>$ann['id'], 'evenements'=>$ann['evenements'], 'dateEffet'=>$ann['dateEffet'] ) );
}
$page['blocks'][$i]['ligne'] = $lignes;
}
return $page;
}
function block_annonce($wsresult)
{
global $firephp;
$Siret = trim(preg_replace('/[^0-9]/', '', $_REQUEST['siret']));
$page = array();
$page['titre'] = 'ANNONCES L&Eacute;GALES';
$page['blocks'] = array();
$i = -1;
}
function tri_annonces($annonces)
{
$annoncesBodacc = array();
$annoncesBalo = array();
$annoncesAsso = array();
if (count($annonces)>0)
{
foreach ($annonces as $i => $ann) {
if ($ann['BodaccCode']=='BODA' || $ann['BodaccCode']=='BODB' || $ann['BodaccCode']=='BODC') {
$annoncesBodacc[] = $ann;
}elseif ($ann['BodaccCode']=='BALO') {
$annoncesBalo[] = $ann;
}elseif ($ann['BodaccCode']=='ASSO') {
$annoncesAsso[] = $ann;
}else {
$annoncesBodacc[] = $ann;
}
}
}
return array('bodacc'=>$annoncesBodacc, 'balo'=>$annoncesBalo, 'asso'=>$annoncesAsso);
}