Explode view annonce

This commit is contained in:
Michael RICOIS 2017-01-17 16:23:31 +01:00
parent 4363454eb1
commit 38cc757542
6 changed files with 276 additions and 228 deletions

View File

@ -25,20 +25,19 @@ class JuridiqueController extends Zend_Controller_Action
$request = $this->getRequest();
$autrePage = $request->getParam('apage');
$vue = $request->getParam('vue', 'bodacc');
$idAnn = $request->getParam('idAnn', null);
$siren = substr($this->siret, 0,9);
$vue = $request->getParam('vue', 'bodacc');
$source = $request->getParam('source');
if (!empty($source)) {
switch ($source){
case 1: $vue='bodacc'; break;
case 2: $vue='balo'; break;
case 3: $vue='asso'; break;
case 1: $vue = 'bodacc'; break;
case 2: $vue = 'balo'; break;
case 3: $vue = 'asso'; break;
}
}
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$fj = $session->getFormeJuridique();
if ($fj > 9000 && $fj < 9999 && intval($siren) == 0) {
@ -56,27 +55,29 @@ class JuridiqueController extends Zend_Controller_Action
} else {
$this->view->assign('vue', $vue);
//Pagination
// Pagination
$page = $request->getParam('page', 1);
if ( $page <= 0 ) {
if ($page <= 0) {
$page = 1;
}
$nbAffichage = 20;
$position = ($page - 1 ) * $nbAffichage;
$position = ($page - 1) * $nbAffichage;
$ws = new WsScores();
switch ( $vue ) {
switch ($vue) {
case 'balo':
$infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage);
break;
case 'asso':
if ( intval($siren)==0 && substr($session->getAutreId(),0,1)=='W' ) {
if (intval($siren) == 0 && substr($session->getAutreId(),0,1) == 'W') {
$infos = $ws->getAnnoncesAsso($session->getAutreId(), $idAnn, null, $position, $nbAffichage);
} elseif (intval($siren)!=0) {
} elseif (intval($siren) != 0) {
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage);
} else {
$idAnn = $session->getSourceId();
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage);
$this->redirect($this->view->url(array('controller'=>'juridique',
'action'=>'annonce', 'siret'=>$this->siret, 'id'=>$this->id,
'idAnn'=>$idAnn, 'vue'=>$vue), 'default', true));
}
break;
case 'bomp':
@ -88,8 +89,11 @@ class JuridiqueController extends Zend_Controller_Action
case 'bodacc':
case 'abod':
default:
if(intval($siren)==0) {
if(intval($siren) == 0) {
$idAnn = $session->getSourceId();
$this->redirect($this->view->url(array('controller'=>'juridique',
'action'=>'annonce', 'siret'=>$this->siret, 'id'=>$this->id,
'idAnn'=>$idAnn, 'vue'=>$vue), 'default', true));
}
$infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAffichage);
break;
@ -114,85 +118,6 @@ class JuridiqueController extends Zend_Controller_Action
$this->view->assign('exportObjet', $infos);
$this->view->assign('surveillance', $user->checkPerm('survannonce'));
//Affichage pour une annonce
if (!empty($idAnn) && in_array($vue, array('bodacc', 'abod', 'balo', 'asso', 'bomp')) ) {
if ( $user->checkModeEdition() ){
$this->view->headScript()->appendFile($this->theme->pathScript.'/saisieannonces.js', 'text/javascript');
}
$classType = 'annonces'.ucfirst($vue);
foreach($objAnnonces->$classType as $ann) {
if($ann->id==$idAnn) break;
}
Zend_Registry::get('firebug')->info($ann);
$annonce = array(
'Desc' => $objAnnonces->getAnnonceDesc($ann),
'Entree' => $objAnnonces->getAnnonceEntree($ann),
'EntreeSD' => $objAnnonces->getAnnonceEntreeSD($ann),
'Even' => $objAnnonces->getAnnonceEven($ann),
'Texte' => $objAnnonces->getAnnonceTexte($ann),
'Type' => $objAnnonces->getType($ann),
'Code' => $objAnnonces->getCode($ann),
'Annee' => $objAnnonces->getAnnee($ann),
'Num' => $objAnnonces->getNum($ann),
'Deleted' => $objAnnonces->isDeleted($ann),
'Entites' => $objAnnonces->getAnnonceEntite($ann)
);
$this->view->assign('source', $session->getSource());
if (intval($this->siret) == 0){
$this->view->assign('sourceId', $session->getSourceId());
} else {
$this->view->assign('sourceId', null);
}
$this->view->assign('idAnn', $idAnn);
$this->view->assign('annonce', $annonce);
if ($request->getParam('q') == 'ajax') {
$this->_helper->layout()->disableLayout();
$this->renderScript('juridique/annonce-ajax.phtml');
} else {
$this->view->assign('PageCurrent', $page);
//Définir url pour téléchargement pdf
if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC'))) {
$datePublication = DateTime::createFromFormat('Y-m-d', $ann->DateParution);
$dateBodacc = DateTime::createFromFormat('Ymd', '20080101');
$dateTemoinA = DateTime::createFromFormat('Ymd', '20161115');
$dateTemoinB = DateTime::createFromFormat('Ymd', '20161011');
$dateTemoinC = DateTime::createFromFormat('Ymd', '20160223');
$params = null;
if ($annonce['Code'] == 'BODA' && $datePublication >= $dateTemoinA) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODB' && $datePublication >= $dateTemoinB) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODC' && $datePublication >= $dateTemoinC) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($datePublication >= $dateBodacc) {
$params = array();
$this->view->assign('bodaccLinkLabel', 'Télécharger le bulletin officiel');
}
if ($params !== null) {
$params = array_merge($params, array('controller'=>'juridique',
'action'=>'bodaccpdf', 'siren'=>$siren, 'type'=>substr($annonce['Code'],3,1),
'parution'=>$annonce['Annee'].str_pad($ann->BodaccNum, 4, '0', STR_PAD_LEFT),
'annonce'=>$ann->NumAnnonce
));
$lienBodacc = $this->view->url($params, 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
}
}
$this->renderScript('juridique/annonce.phtml');
}
// --- Affichage pour la liste des annonces
} else {
// --- Titre de la page
if ( empty($autrePage) ) {
if( empty($siren) ){
@ -235,11 +160,173 @@ class JuridiqueController extends Zend_Controller_Action
$annonces[] = $objAnnonces->getAnnonceResume($ann);
}
Zend_Registry::get('firebug')->info($annonces);
$this->view->assign($classType, $annonces);
$this->view->assign('annonces', $annonces);
}
$this->view->headScript()->appendFile($this->theme->pathScript.'/annonces.js', 'text/javascript');
}
}
/**
* Affichage d'une annonce
*/
public function annonceAction()
{
$request = $this->getRequest();
$autrePage = $request->getParam('apage');
$idAnn = $request->getParam('idAnn', null);
$siren = substr($this->siret, 0,9);
$vue = $request->getParam('vue', 'bodacc');
$source = $request->getParam('source');
if (!empty($source)) {
switch ($source){
case 1: $vue = 'bodacc'; break;
case 2: $vue = 'balo'; break;
case 3: $vue = 'asso'; break;
}
}
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$fj = $session->getFormeJuridique();
if ($fj > 9000 && $fj < 9999 && intval($siren) == 0) {
$vue = 'asso';
}
$page = $request->getParam('page');
$this->view->assign('page', $page);
$this->view->assign('id', $session->getId());
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('AutrePage', $autrePage);
if ($session->getSource() == '006' || $session->getSourceId() == '007') {
$this->view->assign('AutreSource', true);
} else {
$this->view->assign('vue', $vue);
$ws = new WsScores();
switch ($vue) {
case 'balo':
$infos = $ws->getAnnoncesBalo($siren, $idAnn, null, $position, $nbAffichage);
break;
case 'asso':
if ( intval($siren)==0 && substr($session->getAutreId(),0,1)=='W' ) {
$infos = $ws->getAnnoncesAsso($session->getAutreId(), $idAnn, null, $position, $nbAffichage);
} elseif (intval($siren)!=0) {
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage);
} else {
$idAnn = $session->getSourceId();
$infos = $ws->getAnnoncesAsso($siren, $idAnn, null, $position, $nbAffichage);
}
break;
case 'bomp':
$filtre = $request->getParam('filtre', 'A');
$this->view->assign('filtre', $filtre);
$infos = $ws->getAnnoncesBoamp($siren, $idAnn, $filtre, $position, $nbAffichage);
break;
case 'bodacc':
case 'abod':
default:
if(intval($siren)==0) {
$idAnn = $session->getSourceId();
}
$infos = $ws->getAnnoncesLegales($siren, $idAnn, null, $position, $nbAffichage);
break;
}
Zend_Registry::get('firebug')->info($infos);
if ($infos === false) {
$this->forward('soap', 'error');
}
require_once 'Scores/Annonces.php';
$objAnnonces = new Annonces($infos->result->item);
$typeAnnonces = array(
'Bodacc',
'Balo',
'Bomp',
'Asso',
);
$user = new Scores_Utilisateur();
$this->view->assign('hasModeEdition', $user->checkModeEdition());
$this->view->assign('exportObjet', $infos);
$this->view->assign('surveillance', $user->checkPerm('survannonce'));
if ( $user->checkModeEdition() ){
$this->view->headScript()
->appendFile($this->theme->pathScript.'/saisieannonces.js', 'text/javascript');
}
$classType = 'annonces'.ucfirst($vue);
foreach($objAnnonces->$classType as $ann) {
if($ann->id==$idAnn) break;
}
Zend_Registry::get('firebug')->info($ann);
$annonce = array(
'Desc' => $objAnnonces->getAnnonceDesc($ann),
'Entree' => $objAnnonces->getAnnonceEntree($ann),
'EntreeSD' => $objAnnonces->getAnnonceEntreeSD($ann),
'Even' => $objAnnonces->getAnnonceEven($ann),
'Texte' => $objAnnonces->getAnnonceTexte($ann),
'Type' => $objAnnonces->getType($ann),
'Code' => $objAnnonces->getCode($ann),
'Annee' => $objAnnonces->getAnnee($ann),
'Num' => $objAnnonces->getNum($ann),
'Deleted' => $objAnnonces->isDeleted($ann),
'Entites' => $objAnnonces->getAnnonceEntite($ann)
);
$this->view->assign('source', $session->getSource());
if (intval($this->siret) == 0){
$this->view->assign('sourceId', $session->getSourceId());
} else {
$this->view->assign('sourceId', null);
}
$this->view->assign('idAnn', $idAnn);
$this->view->assign('annonce', $annonce);
if ($request->getParam('q') == 'ajax') {
$this->_helper->layout()->disableLayout();
$this->view->assign('ajax', 1);
} else {
// Définir url pour téléchargement pdf
if (in_array($annonce['Code'], array('BODA', 'BODB', 'BODC'))) {
$datePublication = DateTime::createFromFormat('Y-m-d', $ann->DateParution);
$dateBodacc = DateTime::createFromFormat('Ymd', '20080101');
$dateTemoinA = DateTime::createFromFormat('Ymd', '20161115');
$dateTemoinB = DateTime::createFromFormat('Ymd', '20161011');
$dateTemoinC = DateTime::createFromFormat('Ymd', '20160223');
$params = null;
if ($annonce['Code'] == 'BODA' && $datePublication >= $dateTemoinA) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODB' && $datePublication >= $dateTemoinB) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($annonce['Code'] == 'BODC' && $datePublication >= $dateTemoinC) {
$params = array('unit'=>1);
$this->view->assign('bodaccLinkLabel', 'Télécharger le témoin de publication');
} elseif ($datePublication >= $dateBodacc) {
$params = array();
$this->view->assign('bodaccLinkLabel', 'Télécharger le bulletin officiel');
}
if ($params !== null) {
$params = array_merge($params, array('controller'=>'juridique',
'action'=>'bodaccpdf', 'siren'=>$siren, 'type'=>substr($annonce['Code'],3,1),
'parution'=>$annonce['Annee'].str_pad($ann->BodaccNum, 4, '0', STR_PAD_LEFT),
'annonce'=>$ann->NumAnnonce
));
$lienBodacc = $this->view->url($params, 'default', true);
$this->view->assign('bodaccLink', $lienBodacc);
}
}
}
}
}
/**

View File

@ -1 +0,0 @@
<?=$this->RemplaceSiren(substr($this->annonce['Texte'],0,1000))?>

View File

@ -1,3 +1,6 @@
<?php if ($this->ajax) {?>
<?=$this->RemplaceSiren(substr($this->annonce['Texte'],0,1000))?>
<?php } else {?>
<div id="center">
<h1 class="titre">ANNONCES L&Eacute;GALES</h1>
<div class="paragraph">
@ -89,12 +92,9 @@ if ($this->hasModeEdition){
foreach ( $liensEdit as $lienId => $lienItem ){
?>
<a class="<?=$lienItem['class']?>" title="<?=$lienItem['title']?>" href="<?=$this->url(array(
'controller' => 'saisie',
'action' => 'annoncedialog',
'siret' => $this->siret,
'op' => $lienId,
'code' => $this->annonce['Code'],
'idAnn' => $this->idAnn,), 'default', true)?>"><?=$lienItem['img']?></a>
'controller'=>'saisie', 'action'=>'annoncedialog', 'siret'=>$this->siret, 'op'=>$lienId,
'code'=>$this->annonce['Code'], 'idAnn'=>$this->idAnn,), 'default', true)?>">
<?=$lienItem['img']?></a>
<?php
}
}
@ -137,14 +137,13 @@ if ($this->hasModeEdition){
<div class="paragraph" style="text-align:center;">
<?php if (intval($this->siret)!=0) {?>
<?php
$href = $this->url(array('controller' => 'juridique', 'action' => 'annonces',
'siret' => $this->siret, 'id' => $this->id, 'vue' => $this->vue, 'page' => $this->PageCurrent,
), 'default', true);
?>
<a href="<?=$href?>">Revenir à la liste des annonces</a>
<a href="<?=$this->url(array('controller'=>'juridique', 'action'=>'annonces', 'siret'=>$this->siret,
'id'=>$this->id, 'vue'=>$this->vue, 'page'=>$this->page), 'default', true)?>">
Revenir à la liste des annonces</a>
<?php }?>
</div>
<?=$this->render('cgu.phtml', $this->cgu)?>
</div>
<?php }?>

View File

@ -1,31 +0,0 @@
<?php
$class = '';
if ($this->deleted!='') {
$class = ' class="deleted"';
}
?>
<tr<?=$class?>>
<td width="140" class="StyleInfoLib">
<span id="annoncesDate">Le <?=$this->date?></span>
</td>
<td>
<span id="annoncesImg">
<?php if (!empty($this->logo)) {?>
<img src="/themes/default/images/annonces/<?=$this->logo?>" title="<?=$this->title?>" />
<?php }?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a class="tiptxt" href="<?=$this->partialLoop()->view->url(array(
'controller' => 'juridique',
'action' => 'annonces',
'siret' => $this->partialLoop()->view->siret,
'id' => $this->partialLoop()->view->id,
'idAnn' => $this->idAnn,
'vue' => $this->type,
))?>">
<?=$this->lib?>
</a>
<span style="display:none;"><?=$this->RemplaceSiren($this->texte)?></span>
</td>
</tr>

View File

@ -35,10 +35,10 @@
<?php }?>
<?php if ($this->AutreSource){ ?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<div class="paragraph">
Aucune annonces disponible pour cette entité.
</div>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<div class="paragraph">
Aucune annonces disponible pour cette entité.
</div>
<?php } else {?>
<?php if (empty($this->AutrePage)) {?>
@ -131,36 +131,10 @@ a.lienType {
</div>
<?php }?>
<?php if ($this->vue=='bodacc') {?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<div class="paragraph">
<?php if (count($this->annoncesBodacc) == 0) { ?>
Néant
<?php } else {?>
<table class="data">
<?=$this->partialLoop('juridique/annonces-resume.phtml', $this->annoncesBodacc)?>
</table>
<?php }?>
</div>
<?php }?>
<?php if ($this->vue=='balo') {?>
<h2>BALO</h2>
<div class="paragraph">
<?php if(count($this->annoncesBalo) == 0){ ?>
Néant
<?php } else {?>
<table class="data">
<?=$this->partialLoop('juridique/annonces-resume.phtml', $this->annoncesBalo)?>
</table>
<?php }?>
</div>
<?php }?>
<?php if ($this->vue == 'bomp') {?>
<div class="paragraph" style="margin:0 0 0 40px;">
<form name="filtreBoamp" method="post" action="<?=$this->url(array('controller'=>'juridique', 'action'=>'annonces', 'vue'=>'bomp',
'siret'=>$this->siret, 'id'=>$this->id), 'default', true)?>">
<form name="filtreBoamp" method="post" action="<?=$this->url(array('controller'=>'juridique',
'action'=>'annonces', 'vue'=>'bomp', 'siret'=>$this->siret, 'id'=>$this->id), 'default', true)?>">
<label>Type d'annonce</label>
<select name="filtre">
<option value="A"<?=($this->filtre=='A')?' selected':'';?>>Avis d'attribution</option>
@ -174,31 +148,50 @@ $('select[name=filtre]').on('change', function(e){
});
</script>
</div>
<?php }?>
<?php if ($this->vue=='bodacc') {?>
<h2>EV&Eacute;NEMENTS L&Eacute;GAUX</h2>
<?php } elseif ($this->vue=='balo') {?>
<h2>BALO</h2>
<?php } elseif ($this->vue == 'bomp') {?>
<h2>March&eacute;s publics</h2>
<div class="paragraph">
<?php if (count($this->annoncesBomp) == 0) {?>
Néant
<?php } else {?>
<table class="data">
<?=$this->partialLoop('juridique/annonces-resume.phtml', $this->annoncesBomp)?>
</table>
<?php }?>
</div>
<?php }?>
<?php if ($this->vue=='asso') { ?>
<?php } elseif ($this->vue=='asso') { ?>
<h2>Associations</h2>
<?php }?>
<div class="paragraph">
<?php if (count($this->annoncesAsso) == 0){ ?>
Néant
<?php if (count($this->annonces) == 0) { ?>
Néant
<?php } else {?>
<table class="data">
<?=$this->partialLoop('juridique/annonces-resume.phtml', $this->annoncesAsso)?>
<?php foreach ($this->annonces as $ann) {?>
<?php
$class = '';
if ($ann['deleted'] != '') {
$class = ' class="deleted"';
}
?>
<tr<?=$class?>>
<td width="140" class="StyleInfoLib"><span id="annoncesDate">Le <?=$ann['date']?></span></td>
<td>
<span id="annoncesImg">
<?php if (!empty($ann['logo'])) {?>
<img src="/themes/default/images/annonces/<?=$ann['logo']?>" title="<?=$ann['title']?>" />
<?php }?>
</span>
</td>
<td width="450" colspan="2" class="StyleInfoData">
<a class="tiptxt" href="<?=$this->url(array('controller'=>'juridique', 'action'=>'annonce',
'siret'=>$this->siret, 'id'=>$this->id, 'idAnn'=>$ann['idAnn'], 'vue'=>$ann['type'],
'page'=>$this->PageCurrent), 'default', true)?>"><?=$ann['lib']?>
</a>
<span style="display:none;"><?=$this->RemplaceSiren($ann['texte'])?></span>
</td>
</tr>
<?php }?>
</table>
<?php }?>
</div>
<?php }?>
<?php if (empty($this->AutrePage)) {?>

View File

@ -255,6 +255,7 @@ class Scores_Menu
'label' => 'ELEMENTS JURIDIQUES',
'activateMenu' => array(
array('controller'=>'juridique', 'action'=>'ctxdetail'),
array('controller'=>'juridique', 'action'=>'annonce'),
),
'pages' => array(
array(