extranet/application/controllers/DirigeantController.php
2015-07-08 20:38:22 +00:00

128 lines
3.7 KiB
PHP

<?php
class DirigeantController extends Zend_Controller_Action
{
protected $theme;
protected $siret;
protected $id;
public function init()
{
// --- Theme
$this->theme = Zend_Registry::get('theme');
$request = $this->getRequest();
$this->siret = $request->getParam('siret');
$this->id = $request->getParam('id', 0);
require_once 'Scores/WsScores.php';
}
/**
* Affichage de la liste des dirigeants
*/
public function listeAction()
{
$request = $this->getRequest();
$autrePage = $this->getRequest()->getParam('apage');
$siren = substr($this->siret, 0, 9);
if (empty($autrePage)) {
$this->view->headTitle()->prepend('Liste des dirigeants');
$this->view->headTitle()->prepend('Siret '.$this->siret);
}
$ws = new WsScores();
$infos = $ws->getDirigeants($siren);
if ($infos === false){
$this->forward('soap', 'error');
}
$dirigeants = $infos->result->item;
$user = new Scores_Utilisateur();
$session = new Scores_Session_Entreprise($this->siret, $this->id);
if ($user->checkPerm('dirigeantsop')){
$href = $this->view->url(array('controller'=>'dirigeant', 'action'=>'op', 'siret'=>$this->siret), 'default', true);
$this->view->assign('dirigeantsop', $href);
}
$this->view->assign('edition', $user->checkModeEdition());
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
}
/**
* Affichage de l'historiques des dirigeants
*/
public function histoAction()
{
$siren = substr($this->siret, 0, 9);
$this->view->headTitle()->prepend('Historique des dirigeants');
$this->view->headTitle()->prepend('Siret '.$this->siret);
$ws = new WsScores();
$infos = $ws->getDirigeants($siren, true);
if ($infos === false){
$this->_forward('soap', 'error');
}
$dirigeants = $infos->result->item;
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('infos', $infos);
$user = new Scores_Utilisateur();
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
}
public function opAction()
{
$siren = substr($this->siret, 0, 9);
$this->view->headTitle()->prepend('Liste des dirigeants opérationnels');
$this->view->headTitle()->prepend('Siret '.$this->siret);
$ws = new WsScores();
$infos = $ws->getDirigeantsOp($siren);
if ($infos === false){
$this->_forward('soap', 'error');
}
$dirigeants = $infos->item;
$session = new Scores_Session_Entreprise($this->siret, $this->id);
$this->view->assign('siren', $siren);
$this->view->assign('siret', $this->siret);
$this->view->assign('raisonSociale', $session->getRaisonSociale());
$this->view->assign('dirigeants', $dirigeants);
$this->view->assign('exportObjet', $dirigeants);
$this->view->assign('AutrePage', $this->getRequest()->getParam('apage'));
$user = new Scores_Utilisateur();
$this->view->assign('accessWorldCheck', $user->checkPerm('WORLDCHECK'));
$this->view->assign('surveillance', $user->checkPerm('survdirigeants'));
$this->view->assign('edition', $user->checkModeEdition());
}
}