224 lines
5.0 KiB
PHP
224 lines
5.0 KiB
PHP
<?php
|
|
|
|
|
|
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();
|
|
}
|
|
}
|
|
|
|
public function getAnnonceHead($ann)
|
|
{
|
|
if ($this->isBalo($ann['BodaccCode']))
|
|
{
|
|
|
|
|
|
}
|
|
elseif ($this->isAsso($ann['BodaccCode']))
|
|
{
|
|
|
|
}
|
|
elseif ($this->isBomp($ann['BodaccCode']))
|
|
{
|
|
|
|
}
|
|
elseif ($this->isBodacc($ann['BodaccCode']))
|
|
{
|
|
|
|
}
|
|
else
|
|
{
|
|
|
|
}
|
|
|
|
}
|
|
|
|
public function getAnnonceTexte($id)
|
|
{
|
|
|
|
}
|
|
|
|
public function getAnnonceResume($ann)
|
|
{
|
|
return array(
|
|
'date' => $this->dateAnnonce($ann['DateParution']),
|
|
'logo' => $this->logoAnnonce($ann),
|
|
'href' => $this->hrefAnnonce($ann),
|
|
'lib' => $this->libAnnonce($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;
|
|
}
|
|
|
|
protected function dateAnnonce($date)
|
|
{
|
|
return WDate::dateT('Y-m-d', 'd/m/Y', $date);
|
|
}
|
|
|
|
protected function logoAnnonce($ann)
|
|
{
|
|
$src = '';
|
|
$title = '';
|
|
if ($this->isBalo($ann['BodaccCode']))
|
|
{
|
|
$src = './img/logo_jo.png';
|
|
$title = 'Source BALO n°'.$ann['BodaccNum'];
|
|
}
|
|
elseif ($this->isAsso($ann['BodaccCode']))
|
|
{
|
|
$src = './img/logo_jo.png';
|
|
$title = 'Source JO ASSOCIATION n°'.$ann['BodaccNum'];
|
|
}
|
|
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);
|
|
}
|
|
}
|
|
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) . ' ' .
|
|
'de ' . substr($ann['DateParution'],0,4);
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|
|
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']).')';
|
|
}
|
|
}
|
|
if (hasModeEdition() &&
|
|
(substr($source,0,2)=='JT' || $source=='ANTE')) {
|
|
$lib.= ' - <b>(Source TESSI)</b>';
|
|
}
|
|
$lib.= '<br/>';
|
|
}
|
|
return $lib;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|
|
|
|
protected function isBodacc($code)
|
|
{
|
|
if (in_array($code, array('BODA', 'BODB', 'BODC'))){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected function isBalo($code)
|
|
{
|
|
if ($code == 'BALO'){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected function isAsso($code)
|
|
{
|
|
if ($code == 'ASSO'){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
protected function isBomp($code)
|
|
{
|
|
if (in_array($code, array('BOMP A', 'BOMP B', 'BOMP C', 'MAPA'))){
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
} |