2010-09-29 15:03:33 +00:00
|
|
|
<?php
|
2011-04-05 07:16:07 +00:00
|
|
|
require_once 'common/dates.php';
|
2010-09-29 15:03:33 +00:00
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @author mricois
|
|
|
|
*
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
class Annonces
|
|
|
|
{
|
|
|
|
public $annoncesBodacc = array();
|
|
|
|
public $annoncesBalo = array();
|
|
|
|
public $annoncesAsso = array();
|
|
|
|
public $annoncesBomp = array();
|
|
|
|
|
|
|
|
protected $annonces;
|
|
|
|
|
|
|
|
public function __construct($annonces = array())
|
|
|
|
{
|
2011-03-17 11:25:59 +00:00
|
|
|
if (is_array($annonces) && count($annonces)>0) {
|
2010-09-29 15:03:33 +00:00
|
|
|
$this->annonces = $annonces;
|
|
|
|
$this->triAnnonces();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2011-03-17 11:25:59 +00:00
|
|
|
public function getAnnonceDesc($ann)
|
2010-09-29 15:03:33 +00:00
|
|
|
{
|
2011-03-17 11:25:59 +00:00
|
|
|
if ($this->isBodacc($ann['BodaccCode'])) {
|
|
|
|
|
|
|
|
$tabSource = explode('-', $ann['BodaccCode']);
|
|
|
|
$source = $tabSource[0];
|
|
|
|
$idSource = $tabSource[1];
|
|
|
|
if ($source[0] == 'B') {
|
|
|
|
$logo = 'img/logo_jo.png';
|
|
|
|
if ($ann['BodaccNum']==0){
|
|
|
|
$libelle = 'Source BODACC '.substr($ann['BodaccCode'],-1).
|
|
|
|
' du '.$this->dateAnnonce($ann['DateParution']);
|
|
|
|
} else {
|
|
|
|
$libelle = 'Source BODACC n°'.$ann['BodaccNum'].' '.
|
|
|
|
substr($ann['BodaccCode'],-1).
|
|
|
|
' du '.$this->dateAnnonce($ann['DateParution']).
|
|
|
|
'. Département n°'.$ann['Departement'].
|
|
|
|
'. <a href="/?page=competences&siret='.
|
|
|
|
$_SESSION['tabInfo']['entrep']['siret'].
|
|
|
|
'&type=tri">'.$ann['Tribunal'].'</a>';
|
|
|
|
}
|
|
|
|
}elseif ($source[0] == 'G' || $source[0] == 'T'){
|
|
|
|
$logo = './img/logo_greffe.png';
|
|
|
|
$libelle = 'Source Greffe du Tribunal';
|
|
|
|
}elseif ($source[0] == 'P'){
|
|
|
|
$logo = './img/logo_inpi.png';
|
|
|
|
$libelle = 'Source Registre National du Commerce';
|
|
|
|
}else{
|
|
|
|
$logo = './img/logo_jal.png';
|
|
|
|
$libelle = '';
|
|
|
|
if( hasModeEdition() &&
|
|
|
|
(substr($source,0,2)=='JT' || $source=='ANTE') ){
|
|
|
|
$libelle = '<b>Source TESSI</b> - ';
|
|
|
|
}
|
|
|
|
$libelle.= 'Source Journal Annonces Légales';
|
|
|
|
}
|
|
|
|
return '<img src="'.$logo.'" /> '.$libelle.'.';
|
|
|
|
|
|
|
|
} elseif ($this->isBalo($ann['BodaccCode'])) {
|
|
|
|
|
|
|
|
return 'BALO n°'.$ann['BodaccNum'].' du '.
|
|
|
|
$this->dateAnnonce($ann['DateParution']).'.';
|
|
|
|
|
|
|
|
} elseif ($this->isAsso($ann['BodaccCode'])) {
|
2010-09-29 15:03:33 +00:00
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
return 'J.O. ASSOCIATION n°'.$ann['BodaccNum'].' du '.
|
|
|
|
$this->dateAnnonce($ann['DateParution']).'.';
|
|
|
|
|
|
|
|
} elseif ($this->isBomp($ann['BodaccCode'])){
|
|
|
|
|
|
|
|
return 'Annonce n°'.$ann['NumAnnonce'] . '. ' .
|
|
|
|
'Source ' . $ann['BodaccCode'] . ' ' .
|
|
|
|
'n°' . ($ann['BodaccNum']*1) . ' ' .
|
|
|
|
' du '.$this->dateAnnonce($ann['DateParution']).
|
|
|
|
'. Département n°'.$ann['Departement'].'.';
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
2010-09-29 15:03:33 +00:00
|
|
|
}
|
2011-03-17 11:25:59 +00:00
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2011-03-17 11:25:59 +00:00
|
|
|
public function getAnnonceEntree($ann)
|
|
|
|
{
|
|
|
|
if ($this->isBodacc($ann['BodaccCode'])) {
|
|
|
|
if ($ann['dateInsertionSD']!='') {
|
|
|
|
return ' - Entrée en base : '.
|
|
|
|
$this->dateAnnonce($ann['dateInsertionSD']);
|
|
|
|
}
|
|
|
|
} elseif ($this->isBalo($ann['BodaccCode'])) {
|
|
|
|
|
|
|
|
return 'Entré n°'.$ann['NumAnnonce'].'.';
|
|
|
|
|
|
|
|
} elseif ($this->isAsso($ann['BodaccCode'])) {
|
2010-09-29 15:03:33 +00:00
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
return 'Annonce n°'.$ann['NumAnnonce'].'.';
|
|
|
|
|
|
|
|
} elseif ($this->isBomp($ann['BodaccCode'])){
|
|
|
|
return '';
|
|
|
|
} else {
|
|
|
|
|
|
|
|
|
2010-09-29 15:03:33 +00:00
|
|
|
}
|
2011-03-17 11:25:59 +00:00
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2011-03-17 11:25:59 +00:00
|
|
|
public function getAnnonceEntreeSD($ann)
|
|
|
|
{
|
|
|
|
if ($this->isBodacc($ann['BodaccCode'])) {
|
|
|
|
|
|
|
|
} elseif ($this->isBalo($ann['BodaccCode'])) {
|
2010-09-29 15:03:33 +00:00
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
return 'Entrée en base S&D : '.
|
|
|
|
$this->dateAnnonce($ann['dateInsertionSD']).'.';
|
|
|
|
|
|
|
|
} elseif ($this->isAsso($ann['BodaccCode'])) {
|
2010-09-29 15:03:33 +00:00
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
return 'Entrée en base S&D : '.
|
|
|
|
$this->dateAnnonce($ann['dateInsertionSD']).'.';
|
|
|
|
|
|
|
|
} elseif ($this->isBomp($ann['BodaccCode'])){
|
|
|
|
return '';
|
|
|
|
} else {
|
|
|
|
|
2010-09-29 15:03:33 +00:00
|
|
|
}
|
|
|
|
}
|
2011-03-17 11:25:59 +00:00
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2011-03-17 11:25:59 +00:00
|
|
|
public function getAnnonceEven($ann)
|
2010-09-29 15:03:33 +00:00
|
|
|
{
|
2011-03-17 11:25:59 +00:00
|
|
|
$output = '';
|
|
|
|
foreach ($ann['evenements'] as $i=>$even) {
|
|
|
|
$output.= $even['LibEven'].'<br/>';
|
|
|
|
}
|
|
|
|
return $output;
|
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2011-03-17 11:25:59 +00:00
|
|
|
public function getAnnonceTexte($ann)
|
|
|
|
{
|
|
|
|
$pattern = "/((?:[0-9]{9,9})|(?:[0-9]{3,3} [0-9]{3,3} [0-9]{3,3})|(?:[0-9]{3,3}\.[0-9]{3,3}\.[0-9]{3,3})|(?:[0-9]{3,3}-[0-9]{3,3}-[0-9]{3,3}))/";
|
|
|
|
return preg_replace_callback($pattern, 'replace_siren', $ann['texteAnnonce']);
|
2010-09-29 15:03:33 +00:00
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
public function getAnnonceResume($ann)
|
|
|
|
{
|
|
|
|
return array(
|
|
|
|
'date' => $this->dateAnnonce($ann['DateParution']),
|
|
|
|
'logo' => $this->logoAnnonce($ann),
|
|
|
|
'href' => $this->hrefAnnonce($ann),
|
|
|
|
'lib' => $this->libAnnonce($ann)
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2011-04-05 07:16:07 +00:00
|
|
|
/**
|
|
|
|
*
|
|
|
|
* Enter description here ...
|
|
|
|
* @param unknown_type $ann
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function hrefAnnonce($ann)
|
|
|
|
{
|
|
|
|
$href = false;
|
2011-03-17 11:25:59 +00:00
|
|
|
if ($this->isBodacc($ann['BodaccCode'])) {
|
2010-09-29 15:03:33 +00:00
|
|
|
$href = 'idan='.$ann['id'].'&vue=bodacc';
|
|
|
|
} elseif ($this->isBalo($ann['BodaccCode'])) {
|
|
|
|
$href = 'idan='.$ann['id'].'&vue=balo';
|
|
|
|
} elseif ($this->isAsso($ann['BodaccCode'])) {
|
|
|
|
$href = 'idan='.$ann['id'].'&vue=asso';
|
|
|
|
} elseif ($this->isBomp($ann['BodaccCode'])){
|
|
|
|
$href = 'idan='.$ann['id'].'&vue=bomp';
|
|
|
|
} else {
|
|
|
|
$href = 'idan='.$ann['id'].'&vue=bodacc';
|
|
|
|
}
|
|
|
|
return $href;
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Retourne une date formatté
|
2011-04-05 07:16:07 +00:00
|
|
|
* @param string $date
|
2011-03-17 11:25:59 +00:00
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function dateAnnonce($date)
|
|
|
|
{
|
|
|
|
return WDate::dateT('Y-m-d', 'd/m/Y', $date);
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* logoAnnonce
|
2011-04-05 07:16:07 +00:00
|
|
|
* @param array $ann
|
2011-03-17 11:25:59 +00:00
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function logoAnnonce($ann)
|
|
|
|
{
|
|
|
|
$src = '';
|
|
|
|
$title = '';
|
2010-09-30 15:59:49 +00:00
|
|
|
if ($this->isBalo($ann['BodaccCode']))
|
2010-09-29 15:03:33 +00:00
|
|
|
{
|
|
|
|
$src = './img/logo_jo.png';
|
|
|
|
$title = 'Source BALO n°'.$ann['BodaccNum'];
|
|
|
|
}
|
2010-09-30 15:59:49 +00:00
|
|
|
elseif ($this->isAsso($ann['BodaccCode']))
|
2010-09-29 15:03:33 +00:00
|
|
|
{
|
|
|
|
$src = './img/logo_jo.png';
|
|
|
|
$title = 'Source JO ASSOCIATION n°'.$ann['BodaccNum'];
|
|
|
|
}
|
2010-09-30 15:59:49 +00:00
|
|
|
elseif ($this->isBomp($ann['BodaccCode']))
|
|
|
|
{
|
|
|
|
$src = './img/logo_jo.png';
|
|
|
|
if ($ann['BodaccCode'] == 'MAPA' ){
|
|
|
|
$title = 'Source '.$ann['BodaccCode'] . ' ' .
|
|
|
|
($ann['BodaccNum']*1);
|
|
|
|
}else {
|
|
|
|
|
|
|
|
$title = 'Source '.$ann['BodaccCode'] . ' ' .
|
|
|
|
'n°' . ($ann['BodaccNum']*1) . ' de ' .
|
|
|
|
substr($ann['DateParution'],0,4);
|
|
|
|
}
|
|
|
|
}
|
2010-09-29 15:03:33 +00:00
|
|
|
else
|
|
|
|
{
|
|
|
|
$tabSource = explode('-', $ann['BodaccCode']);
|
|
|
|
$source = $tabSource[0];
|
|
|
|
$idSource = $tabSource[1];
|
|
|
|
if ($source[0] == 'B')
|
|
|
|
{
|
|
|
|
$src = './img/logo_jo.png';
|
|
|
|
$title = 'Source BODACC ' . $ann['BodaccNum'] . ' ' .
|
|
|
|
substr($source,-1) . ' ' .
|
2010-09-30 15:59:49 +00:00
|
|
|
'de ' . substr($ann['DateParution'],0,4);
|
2010-09-29 15:03:33 +00:00
|
|
|
}
|
|
|
|
else if ($source[0] == 'G' || $source[0] == 'T')
|
|
|
|
{
|
|
|
|
$src = './img/logo_greffe.png';
|
|
|
|
$title = 'Source Collecte Greffe';
|
|
|
|
}
|
|
|
|
else if ($source[0] == 'P')
|
|
|
|
{
|
|
|
|
$src = './img/logo_inpi.png';
|
|
|
|
$title = 'Source Collecte RNCS';
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
$src = './img/logo_jal.png';
|
|
|
|
$title = 'Source Collecte JAL';
|
|
|
|
if ($idSource>0) $title.= ' '.$idSource;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ($src != '') {
|
|
|
|
return '<img src="'.$src.'" title="'.$title.'">';
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Retourne le libellé de l'annonce
|
2011-04-05 07:16:07 +00:00
|
|
|
* @param array $ann
|
2011-03-17 11:25:59 +00:00
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function libAnnonce($ann)
|
|
|
|
{
|
|
|
|
$lib = '';
|
|
|
|
foreach ($ann['evenements'] as $i=>$even) {
|
|
|
|
$lib.= $even['LibEven'];
|
|
|
|
$tabSource = explode('-', $ann['BodaccCode']);
|
|
|
|
$source = $tabSource[0];
|
|
|
|
$idSource = $tabSource[1];
|
|
|
|
$numEven = $even['CodeEven']*1;
|
|
|
|
if ($numEven>3000 && $numEven<3999) {
|
|
|
|
if (isset($ann['dateEffet'])){
|
|
|
|
$lib.= ' (clôture au '.WDate::dateT('Y-m-d','d/m/Y',$ann['dateEffet']).')';
|
|
|
|
}
|
|
|
|
}
|
2010-11-24 09:26:42 +00:00
|
|
|
if (hasModeEdition() &&
|
|
|
|
(substr($source,0,2)=='JT' || $source=='ANTE')) {
|
2010-09-29 15:03:33 +00:00
|
|
|
$lib.= ' - <b>(Source TESSI)</b>';
|
|
|
|
}
|
|
|
|
$lib.= '<br/>';
|
|
|
|
}
|
|
|
|
return $lib;
|
|
|
|
}
|
2011-03-17 11:25:59 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Tri les annonces en fonction de la source
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function triAnnonces()
|
|
|
|
{
|
|
|
|
foreach ($this->annonces as $i => $ann)
|
|
|
|
{
|
|
|
|
if ($this->isBodacc($ann['BodaccCode'])){
|
|
|
|
$this->annoncesBodacc[] = $ann;
|
|
|
|
} elseif ($this->isBalo($ann['BodaccCode'])) {
|
2011-03-17 11:25:59 +00:00
|
|
|
$ann['texteAnnonce'] = utf8_decode($ann['texteAnnonce']);
|
2010-09-29 15:03:33 +00:00
|
|
|
$this->annoncesBalo[] = $ann;
|
|
|
|
} elseif ($this->isAsso($ann['BodaccCode'])) {
|
|
|
|
$this->annoncesAsso[] = $ann;
|
|
|
|
} elseif ($this->isBomp($ann['BodaccCode'])){
|
|
|
|
$this->annoncesBomp[] = $ann;
|
|
|
|
} else {
|
|
|
|
$this->annoncesBodacc[] = $ann;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Détermine si l'annonce est une annonce BODACC
|
|
|
|
* @param string $code
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function isBodacc($code)
|
|
|
|
{
|
|
|
|
if (in_array($code, array('BODA', 'BODB', 'BODC'))){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Détermine si l'annonce est une annonce BALO
|
|
|
|
* @param string $code
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function isBalo($code)
|
|
|
|
{
|
|
|
|
if ($code == 'BALO'){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Détermine si l'annonce est une annonce ASSO
|
|
|
|
* @param string $code
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function isAsso($code)
|
|
|
|
{
|
|
|
|
if ($code == 'ASSO'){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-17 11:25:59 +00:00
|
|
|
/**
|
|
|
|
* Détermine si l'annonce est une annonce BOAMP
|
|
|
|
* @param string $code
|
|
|
|
*/
|
2010-09-29 15:03:33 +00:00
|
|
|
protected function isBomp($code)
|
|
|
|
{
|
|
|
|
if (in_array($code, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))){
|
|
|
|
return true;
|
|
|
|
} else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|