extranet/application/controllers/IdentiteController.php

233 lines
6.6 KiB
PHP
Raw Normal View History

2011-02-21 08:45:13 +00:00
<?php
class IdentiteController extends Zend_Controller_Action
{
2011-04-19 06:57:16 +00:00
protected $siret = null;
protected $id = 0;
2011-04-11 14:19:14 +00:00
public function init()
{
2011-04-19 06:57:16 +00:00
$request = $this->getRequest();
$this->siret = $request->getParam('siret');
$this->id = $request->getParam('id', 0);
2011-04-20 09:33:02 +00:00
require_once 'Scores/WsScores.php';
2011-04-21 13:31:59 +00:00
require_once 'Scores/Utilisateur.php';
2011-04-20 09:33:02 +00:00
require_once 'Scores/SessionEntreprise.php';
2011-04-21 13:31:59 +00:00
require_once 'Scores/IdentiteEntreprise.php';
require_once 'common/dates.php';
$this->view->headLink()->appendStylesheet('/themes/default/styles/identite.css', 'all');
2011-04-11 14:19:14 +00:00
}
2011-02-21 08:45:13 +00:00
2011-04-11 14:19:14 +00:00
public function indexAction()
{
$this->_forward('fiche', 'identite');
2011-04-11 14:19:14 +00:00
}
public function ficheAction()
{
2011-04-21 13:31:59 +00:00
$this->view->headScript()
->appendFile('/themes/default/scripts/identite.js', 'text/javascript');
2011-04-14 13:12:29 +00:00
//Modification du titre
2011-04-19 06:57:16 +00:00
if(empty($this->siret)){
$titre = 'Identifiant '.$this->id;
2011-04-14 13:12:29 +00:00
} else {
2011-04-19 06:57:16 +00:00
$titre = 'Siret '.$this->siret;
2011-04-14 13:12:29 +00:00
}
$this->view->headTitle()->append('Identité - '.$titre);
2011-04-20 09:33:02 +00:00
2011-04-21 13:31:59 +00:00
$user = new Utilisateur();
2011-04-14 13:12:29 +00:00
//Récupération des informations
$ws = new WsScores();
2011-04-19 06:57:16 +00:00
$infos = $ws->getIdentite($this->siret, $this->id);
2011-04-20 09:33:02 +00:00
//Mise en session
$session = new SessionEntreprise($this->siret, $this->id, true);
$session->setInfoEntrep($infos);
2011-04-21 13:31:59 +00:00
//Date de dernière mise à jour
$tabDate = array(
'DateMajINSEE' => "Insee&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ",
'DateMajRCS' => "RCS&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ",
'DateMajBILAN' => "Bilans&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : ",
'DateMajANN' => "Annonces : ",
);
$datemajTexte = '';
foreach ( $tabDate as $dateId => $dateLib ) {
if (isset($infos->{$dateId}) && !empty($infos->{$dateId}) && $infos->{$dateId}!='0000-00-00') {
Zend_Registry::get('firebug')->info($dateId);
$datemajTexte.= $dateLib;
$datemajTexte.= WDate::dateT('Y-m-d', 'd/m/Y', $infos->{$dateId});
$datemajTexte.= '<br/>';
}
}
$dateDerMaj = '';
if (isset($infos->DateMajID) && !empty($infos->DateMajID) && $infos->DateMajID!='0000-00-00' ){
if ( $user->checkModeEdition() ){
$datemajTexte.= "Scores & Décisions : ";
$datemajTexte.= WDate::dateT('Y-m-d', 'd/m/Y', $infos->DateMajID);
$datemajTexte.= '<br/>';
}
$dateDerMaj = ' le '.WDate::dateT('Y-m-d', 'd/m/Y', $infos->DateMajID);
}
$identite = new IdentiteEntreprise($infos, $this->view);
2011-04-21 13:31:59 +00:00
//Définition des blocks
$blocks = array(
'Siret',
'SiretSiege',
'TvaNumero',
'Isin',
'Capitalisation',
'NumRC',
'AutreId',
'Actif',
'SituationJuridique',
'AutreSiren',
'RaisonSociale',
'EnseigneSigle',
'FormeJuridique',
'DateImmat',
'DateCreaEn',
'DateCreaEt',
'Adresse',
'Zones',
'Tel',
'Fax',
'Web',
'Mail',
'ActiviteEt',
'ActiviteEn',
'Naf4',
'Nace',
'NatureActivite',
'OrigineFond',
'TypeExploitation',
'Saisonnalite',
'NbEtabActif',
'Capital',
'ChiffreAffaire',
'Dirigeants',
'Effectif',
'EffectifEtab'
);
2011-04-22 15:10:03 +00:00
2011-04-21 13:31:59 +00:00
$dBlock = array();
foreach ($blocks as $item) {
$display = array(
'label' => method_exists($identite, 'get'.$item.'Label') ? $identite->{'get'.$item.'Label'}() : '',
'texte' => method_exists($identite, 'get'.$item.'Texte') ? $identite->{'get'.$item.'Texte'}() : '',
'titre' => method_exists($identite, 'get'.$item.'Titre') ? $identite->{'get'.$item.'Titre'}() : '',
);
$dBlock[$item] = $display;
}
require_once 'Scores/Logo.php';
$logo = new Logo($infos->Siren, $infos->Isin);
$logoImg = array(
'label' => 'Logo',
'texte' => $logo->affiche(),
);
2011-04-21 13:31:59 +00:00
Zend_Registry::get('firebug')->info($infos);
$this->view->assign('dBlock', $dBlock);
$this->view->assign('logo', $logoImg);
2011-04-21 13:31:59 +00:00
$this->view->assign('dateDerMaj', $dateDerMaj);
$this->view->assign('datemajTexte', $datemajTexte);
2011-04-20 09:33:02 +00:00
$this->view->assign('raisonSociale', $session->getRaisonSociale());
2011-04-11 14:19:14 +00:00
}
2011-04-19 07:37:39 +00:00
public function fichepcAction()
{
//Méthode non disponible sur webservice
}
2011-04-11 14:19:14 +00:00
public function etablissementsAction()
{
2011-04-19 06:57:16 +00:00
$siren = substr($this->siret,0,9);
2011-04-22 13:30:35 +00:00
$actif = $this->getRequest()->getParam('actif', -1);
$this->view->headTitle()->append('Liste des établissements - Siren '.$siren);
2011-04-20 09:33:02 +00:00
$session = new SessionEntreprise($this->siret, $this->id);
$ws = new WsScores();
2011-04-22 13:30:35 +00:00
$infos = $ws->getListeEtablissements($siren, $actif);
2011-04-20 09:33:02 +00:00
2011-04-22 13:30:35 +00:00
$etabs = $infos->result->item;
2011-05-04 15:51:47 +00:00
2011-04-22 13:30:35 +00:00
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
2011-04-20 09:33:02 +00:00
$this->view->assign('raisonSociale', $session->getRaisonSociale());
2011-04-22 13:30:35 +00:00
$this->view->assign('etabs', $etabs);
2011-05-04 15:51:47 +00:00
$this->view->assign('listeEtablissement', $infos);
}
2011-04-11 14:19:14 +00:00
public function liensAction()
{
2011-04-19 06:57:16 +00:00
$siren = substr($this->siret,0,9);
$this->view->headTitle()->append('Liens inter-entreprises - Siren '.$siren);
2011-04-22 14:29:58 +00:00
$session = new SessionEntreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
if ( ($session->getFormeJuridique()>=1000 && $session->getFormeJuridique()<=1999)
|| ($session->getFormeJuridique()>=10 && $session->getFormeJuridique()<=19) ) {
$this->renderScript('identite/liens-personne-physique.phtml');
}
require_once 'Scores/WsScores.php';
2011-04-22 14:29:58 +00:00
$ws = new WsScores();
$infos = $ws->getLiens($siren);
2011-04-22 14:29:58 +00:00
$actionnaires = $infos->actionnaires->item;
$participations = $infos->participations->item;
//Informations de MAJ
if(count($actionnaires)>0){
$nb = count($actionnaires)-1;
$source = $actionnaires[$nb]->Source;
$dateMaj = $actionnaires[$nb]->DateMaj;
} else if (count($participations)>0){
$nb = count($participations)-1;
$source = $participations[$nb]->Source;
$dateMaj = $participations[$nb]->DateMaj;
} else {
$source = '';
$dateLien = '';
$dateMaj = '';
}
$this->view->assign('source', $source);
$this->view->assign('dateLien', $dateLien);
$this->view->assign('dateMaj', $dateMaj);
$this->view->assign('actionnaires', $actionnaires);
$this->view->assign('actionnaires', $participations);
}
2011-04-11 14:19:14 +00:00
2011-04-22 15:10:03 +00:00
public function evenementsAction()
{
2011-04-19 06:57:16 +00:00
$siren = substr($this->siret,0,9);
$this->view->headTitle()->append('Evènements - Siren '.$siren);
2011-04-22 15:10:03 +00:00
$session = new SessionEntreprise($this->siret, $this->id);
require_once 'Scores/WsScores.php';
2011-04-22 15:10:03 +00:00
$ws = new WsScores();
$infos = $ws->getListeEvenements($siren);
2011-04-22 15:10:03 +00:00
$evens = $infos->result->item;
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('id', $this->id);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('evens', $evens);
}
2011-02-21 08:45:13 +00:00
}