410 lines
10 KiB
PHP
410 lines
10 KiB
PHP
<?php
|
|
require_once 'common/dates.php';
|
|
require_once 'Scores/Utilisateur.php';
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @author mricois
|
|
*
|
|
*/
|
|
class Annonces
|
|
{
|
|
public $annoncesBodacc = array();
|
|
public $annoncesBalo = array();
|
|
public $annoncesAsso = array();
|
|
public $annoncesBomp = array();
|
|
|
|
protected $annonces;
|
|
|
|
public function __construct($annonces = array())
|
|
{
|
|
if (is_array($annonces) && count($annonces)>0) {
|
|
$this->annonces = $annonces;
|
|
$this->triAnnonces();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceDesc($ann)
|
|
{
|
|
if ($this->isBalo($ann->BodaccCode)) {
|
|
|
|
return 'BALO n°'.$ann->BodaccNum.' du '.
|
|
$this->dateAnnonce($ann->DateParution).'.';
|
|
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
|
|
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 {
|
|
|
|
$tabSource = explode('-', $ann->BodaccCode);
|
|
$source = $tabSource[0];
|
|
$idSource = $tabSource[1];
|
|
if ($source[0] == 'B') {
|
|
$logo = '/themes/default/images/annonces/logo_jo.png';
|
|
if ($ann->BodaccNum==0){
|
|
$libelle = 'Source BODACC '.substr($ann->BodaccCode,-1).
|
|
' du '.$this->dateAnnonce($ann->DateParution);
|
|
} else {
|
|
$view = new Zend_View();
|
|
$session = new SessionEntreprise('');
|
|
$href = $view->url(array(
|
|
'controller' => 'juridiques',
|
|
'action' => 'competences',
|
|
'type' => 'tri',
|
|
'siret' => $session->getSiret(),
|
|
));
|
|
$libelle = 'Source BODACC n°'.$ann->BodaccNum.' '.
|
|
substr($ann->BodaccCode,-1).
|
|
' du '.$this->dateAnnonce($ann->DateParution).
|
|
'. Département n°'.$ann->Departement.
|
|
'. <a href="'.$href.'">'.$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 = '/themes/default/images/annonces/logo_inpi.png';
|
|
$libelle = 'Source Registre National du Commerce';
|
|
} else {
|
|
$logo = '/themes/default/images/annonceslogo_jal.png';
|
|
$libelle = '';
|
|
$user = new Utilisateur();
|
|
if( $user->checkModeEdition() &&
|
|
(substr($source,0,2)=='JT' || $source=='ANTE') ){
|
|
$libelle = '<b>Source TESSI</b> - ';
|
|
}
|
|
$libelle.= 'Source Journal Annonces Légales';
|
|
}
|
|
return '<img src="'.$logo.'" /> '.$libelle.'.';
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceEntree($ann)
|
|
{
|
|
if ($this->isBalo($ann->BodaccCode)) {
|
|
|
|
return 'Entré n°'.$ann->NumAnnonce.'.';
|
|
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
|
|
return 'Annonce n°'.$ann->NumAnnonce.'.';
|
|
|
|
} elseif ($this->isBomp($ann->BodaccCode)){
|
|
return '';
|
|
|
|
} else {
|
|
|
|
if ($ann->dateInsertionSD!='') {
|
|
return ' - Entrée en base : '.
|
|
$this->dateAnnonce($ann->dateInsertionSD);
|
|
}
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceEntreeSD($ann)
|
|
{
|
|
if ($this->isBodacc($annBodaccCode)) {
|
|
|
|
} elseif ($this->isBalo($ann->BodaccCode)) {
|
|
|
|
return 'Entrée en base S&D : '.
|
|
$this->dateAnnonce($ann->dateInsertionSD).'.';
|
|
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
|
|
return 'Entrée en base S&D : '.
|
|
$this->dateAnnonce($ann->dateInsertionSD).'.';
|
|
|
|
} elseif ($this->isBomp($ann->BodaccCode)){
|
|
return '';
|
|
} else {
|
|
|
|
}
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceEven($ann)
|
|
{
|
|
$output = '';
|
|
foreach ($ann->evenements->item as $i=>$even) {
|
|
$output.= $even->LibEven.'<br/>';
|
|
}
|
|
return $output;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceTexte($ann)
|
|
{
|
|
return $ann->texteAnnonce;
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
public function getAnnonceResume($ann)
|
|
{
|
|
return array(
|
|
'date' => $this->dateAnnonce($ann->DateParution),
|
|
'title' => $this->logoTitleAnnonce($ann),
|
|
'logo' => $this->logoAnnonce($ann),
|
|
'idAnn' => $ann->id,
|
|
'lib' => $this->libAnnonce($ann),
|
|
'type' => $this->getType($ann)
|
|
);
|
|
}
|
|
|
|
/**
|
|
*
|
|
* Enter description here ...
|
|
* @param unknown_type $ann
|
|
*/
|
|
protected function hrefAnnonce($ann)
|
|
{
|
|
/*
|
|
$href = false;
|
|
if ($this->isBodacc($ann->BodaccCode)) {
|
|
$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;
|
|
*/
|
|
}
|
|
|
|
/**
|
|
* Retourne une date formatté
|
|
* @param string $date
|
|
*/
|
|
protected function dateAnnonce($date)
|
|
{
|
|
return WDate::dateT('Y-m-d', 'd/m/Y', $date);
|
|
}
|
|
|
|
protected function logoTitleAnnonce()
|
|
{
|
|
$title = '';
|
|
if ($this->isBalo($ann->BodaccCode)) {
|
|
$title = 'Source BALO n°'.$annBodaccNum;
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
$title = 'Source JO ASSOCIATION n°'.$ann->BodaccNum;
|
|
} elseif ($this->isBomp($ann->BodaccCode)) {
|
|
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);
|
|
}
|
|
} else {
|
|
$tabSource = explode('-', $ann->BodaccCode);
|
|
$source = $tabSource[0];
|
|
$idSource = $tabSource[1];
|
|
if ($source[0] == 'B') {
|
|
$title = 'Source BODACC ' . $ann->BodaccNum . ' ' .
|
|
substr($source,-1) . ' ' .
|
|
'de ' . substr($ann->DateParution,0,4);
|
|
} else if ($source[0] == 'G' || $source[0] == 'T') {
|
|
$title = 'Source Collecte Greffe';
|
|
} else if ($source[0] == 'P') {
|
|
$title = 'Source Collecte RNCS';
|
|
} else {
|
|
$title = 'Source Collecte JAL';
|
|
if ($idSource>0) $title.= ' '.$idSource;
|
|
}
|
|
}
|
|
return $title;
|
|
}
|
|
|
|
/**
|
|
* logoAnnonce
|
|
* @param array $ann
|
|
*/
|
|
protected function logoAnnonce($ann)
|
|
{
|
|
$src = '';
|
|
if ($this->isBalo($ann->BodaccCode)) {
|
|
$src = 'logo_jo.png';
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
$src = 'logo_jo.png';
|
|
} elseif ($this->isBomp($ann->BodaccCode)) {
|
|
$src = 'logo_jo.png';
|
|
} else {
|
|
$tabSource = explode('-', $ann->BodaccCode);
|
|
$source = $tabSource[0];
|
|
if ($source[0] == 'B') {
|
|
$src = 'logo_jo.png';
|
|
} else if ($source[0] == 'G' || $source[0] == 'T') {
|
|
$src = 'logo_greffe.png';
|
|
} else if ($source[0] == 'P') {
|
|
$src = 'logo_inpi.png';
|
|
} else {
|
|
$src = 'logo_jal.png';
|
|
}
|
|
}
|
|
if ($src != '') {
|
|
return $src;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Retourne le libellé de l'annonce
|
|
* @param array $ann
|
|
*/
|
|
protected function libAnnonce($ann)
|
|
{
|
|
$lib = '';
|
|
foreach ($ann->evenements->item 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).')';
|
|
}
|
|
}
|
|
/*
|
|
if (hasModeEdition() &&
|
|
(substr($source,0,2)=='JT' || $source=='ANTE')) {
|
|
$lib.= ' - <b>(Source TESSI)</b>';
|
|
}
|
|
*/
|
|
$lib.= '<br/>';
|
|
}
|
|
return $lib;
|
|
}
|
|
|
|
/**
|
|
* Tri les annonces en fonction de la source
|
|
*/
|
|
protected function triAnnonces()
|
|
{
|
|
foreach ($this->annonces as $i => $ann)
|
|
{
|
|
if ($this->isBodacc($ann->BodaccCode)){
|
|
$this->annoncesBodacc[] = $ann;
|
|
} elseif ($this->isBalo($ann->BodaccCode)) {
|
|
$this->annoncesBalo[] = $ann;
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
$this->annoncesAsso[] = $ann;
|
|
} elseif ($this->isBomp($ann->BodaccCode)){
|
|
$this->annoncesBomp[] = $ann;
|
|
} else {
|
|
$this->annoncesBodacc[] = $ann;
|
|
}
|
|
}
|
|
}
|
|
|
|
public function getType($ann)
|
|
{
|
|
if ($this->isBodacc($ann->BodaccCode)){
|
|
return 'bodacc';
|
|
} elseif ($this->isBalo($ann->BodaccCode)) {
|
|
return 'balo';
|
|
} elseif ($this->isAsso($ann->BodaccCode)) {
|
|
return 'asso';
|
|
} elseif ($this->isBomp($ann->BodaccCode)){
|
|
return 'bomp';
|
|
} else {
|
|
return 'bodacc';
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Détermine si l'annonce est une annonce BODACC
|
|
* @param string $code
|
|
*/
|
|
protected function isBodacc($code)
|
|
{
|
|
if (in_array($code, array('BODA', 'BODB', 'BODC'))){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Détermine si l'annonce est une annonce BALO
|
|
* @param string $code
|
|
*/
|
|
protected function isBalo($code)
|
|
{
|
|
if ($code == 'BALO'){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Détermine si l'annonce est une annonce ASSO
|
|
* @param string $code
|
|
*/
|
|
protected function isAsso($code)
|
|
{
|
|
if ($code == 'ASSO'){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Détermine si l'annonce est une annonce BOAMP
|
|
* @param string $code
|
|
*/
|
|
protected function isBomp($code)
|
|
{
|
|
if (in_array($code, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |