792 lines
19 KiB
PHP
Raw Normal View History

2011-01-05 09:59:49 +00:00
<?php
class Menu
{
2011-01-05 15:14:23 +00:00
protected $menu = null;
2011-04-15 09:05:30 +00:00
protected $siret = null;
protected $id = 0;
/**
* Définition du menu avec ces groupes et pages
* Groupes
* => label : titre du menu
* => check : nom du controller
* => permission : code de la permission nécessaire pour l'affichage
* activateMenu : Définir controller/action pour activer le menu
* => controller : nom du controller
* => action : nom de l'action
* Pages
* => label : titre de la page
* => title : titre de l'infobulle
* => controller : nom du controller
* => action : nom de l'action
* => permission : code de la permission nécessaire pour l'affichage
* => forceVisible : boolean, affiche le menu en grisé même si l'utilisateur n'a pas la permission
* @var array
*/
2011-01-05 09:59:49 +00:00
protected $defineMenu = array(
array(
'label' => 'RECHERCHES',
'activateMenu' => array(
array('controller'=>'recherche', 'action'=>'liste'),
array('controller'=>'recherche', 'action'=>'list'),
2011-09-20 07:26:03 +00:00
array('controller'=>'recherche', 'action'=>'annonceliste'),
array('controller'=>'recherche', 'action'=>'enquete'),
array('controller'=>'giant', 'action'=>'search'),
array('controller'=>'giant', 'action'=>'identite'),
array('controller'=>'giant', 'action'=>'commandes'),
array('controller'=>'giant', 'action'=>'rapport'),
),
2011-01-05 09:59:49 +00:00
'pages' => array(
array(
'label' => "Rechercher une entreprise",
2011-01-06 08:37:20 +00:00
'title' => "Rechercher une entreprise",
'controller' => 'recherche',
'action' => 'entreprise',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Rechercher par dirigeant",
2011-01-06 08:37:20 +00:00
'controller' => 'recherche',
'action' => 'dirigeant',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Recherche Internationale",
'controller' => '',
'action' => '',
2011-04-15 10:25:46 +00:00
'permission' => 'INTERNATIONAL'
2011-01-05 09:59:49 +00:00
),
array( // idClient = 1 && idClient =
2011-01-05 09:59:49 +00:00
'label' => "Rechercher une annonce",
'controller' => 'recherche',
'action' => 'annonce',
2011-01-05 09:59:49 +00:00
),
array(
2011-11-23 13:06:55 +00:00
'label' => "Rechercher par actionnaire",
'controller' => 'recherche',
'action' => 'actionnaire'
2011-04-15 09:05:30 +00:00
),
array(
2011-01-05 09:59:49 +00:00
'label' => "Dernière recherche",
2011-01-06 08:37:20 +00:00
'controller' => 'recherche',
'action' => 'last',
2011-01-05 09:59:49 +00:00
),
array(
2011-01-05 09:59:49 +00:00
'label' => "Liste des dernières recherches",
2011-01-06 08:37:20 +00:00
'controller' => 'recherche',
'action' => 'list',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Centrale IparI",
2011-04-15 09:05:30 +00:00
'controller' => 'recherche',
'action' => 'ipari',
2011-01-05 15:14:23 +00:00
'permission' => 'ipari',
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'IDENTITE',
'pages' => array(
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Fiche d'identité",
2011-04-15 09:05:30 +00:00
'controller' => 'identite',
'action' => 'fiche',
2011-05-09 08:47:50 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Fiche Procédure Collective",
2011-04-15 09:05:30 +00:00
'controller' => 'identite',
'action' => 'fichepc',
'permission' => 'idprocol'
2011-01-05 09:59:49 +00:00
),
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Liste des établissements",
2011-04-15 09:05:30 +00:00
'controller' => 'identite',
'action' => 'etablissements',
2011-05-09 08:47:50 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Liens inter-entreprise",
'controller' => 'identite',
'action' => 'liens',
2011-05-09 08:47:50 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Modifications Insee",
'controller' => 'identite',
2011-04-22 15:10:03 +00:00
'action' => 'evenements',
2011-08-29 10:07:19 +00:00
'permission' => 'eveninsee',
2011-08-29 14:24:02 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'DIRIGEANTS',
'pages' => array(
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Liste des dirigeants",
2011-04-19 06:23:20 +00:00
'controller' => 'dirigeant',
'action' => 'liste',
2011-05-09 08:47:50 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
2011-05-03 15:58:48 +00:00
array(
2011-01-05 09:59:49 +00:00
'label' => "Historique des dirigeants",
2011-04-19 06:23:20 +00:00
'controller' => 'dirigeant',
'action' => 'histo',
2011-05-09 08:47:50 +00:00
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'ELEMENTS FINANCIERS',
'pages' => array(
array(
'label' => "Synthèse",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'synthese',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Bilans, Compte de résultat",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'bilan',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Ratios",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'ratios',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Liasse fiscale",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'liasse',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Bourse & Cotations",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'bourse',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Relations bancaires",
2011-04-19 07:21:06 +00:00
'controller' => 'finance',
'action' => 'banque',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'ELEMENTS JURIDIQUES',
'pages' => array(
array(
'label' => "Annonces Légales",
2011-04-20 07:25:37 +00:00
'controller' => 'juridique',
'action' => 'annonces',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Information Réglementée",
2011-04-20 07:25:37 +00:00
'controller' => 'juridique',
'action' => 'infosreg',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Compétences Territoriales",
2011-04-20 07:25:37 +00:00
'controller' => 'juridique',
'action' => 'competences',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Conventions collectives",
2011-04-20 07:25:37 +00:00
'controller' => 'juridique',
'action' => 'conventions',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Marques déposées",
2011-04-20 07:25:37 +00:00
'controller' => 'juridique',
2011-05-02 13:38:52 +00:00
'action' => 'marques',
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'BANQUE DE FRANCE',
2011-01-05 15:14:23 +00:00
'permission' => 'BDF',
2011-01-05 09:59:49 +00:00
'pages' => array(
array(
'label' => "27. Panorama",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
'label' => "28. Concours Bancaires",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
'label' => "29. Impayés",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
'label' => "40. Relations Bancaires",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
'label' => "51. Dirigeants",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
array(
'label' => "Autres",
2011-04-20 07:25:37 +00:00
'controller' => 'bdf',
2011-01-05 09:59:49 +00:00
'action' => '',
),
),
),
array(
'label' => 'EVALUATION',
'activateMenu' => array(
array('controller'=>'evaluation', 'action'=> 'scoringcommande'),
),
2011-01-05 09:59:49 +00:00
'pages' => array(
array(
'label' => "IndiScore",
2011-04-20 07:25:37 +00:00
'controller' => 'evaluation',
'action' => 'indiscore',
2011-08-29 10:07:19 +00:00
'permission' => array('indiscore', 'indiscorep'),
'class' => 'demanderef',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Rapport de synthèse",
2011-04-20 07:25:37 +00:00
'controller' => 'evaluation',
'action' => 'indiscore2',
2011-08-29 10:07:19 +00:00
'permission' => array('indiscore2', 'indiscore2p'),
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Rapport complet",
2011-04-20 07:25:37 +00:00
'controller' => 'evaluation',
2011-06-03 08:53:22 +00:00
'action' => 'indiscore3',
2011-08-29 10:07:19 +00:00
'permission' => array('indiscore3', 'indiscore3p'),
'class' => 'demanderef',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Scoring Credit Safe",
2011-04-20 07:25:37 +00:00
'controller' => 'evaluation',
'action' => 'scoring',
2011-08-29 10:07:19 +00:00
'permission' => 'scorecsf',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Enquête commerciale",
2011-04-20 07:25:37 +00:00
'controller' => 'evaluation',
'action' => 'enquetec',
2011-08-29 10:07:19 +00:00
'permission' => 'enquetec',
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'PIECES OFFICIELLES',
'activateMenu' => array(
array('controller'=> 'pieces', 'action'=>'cmdassociation'),
array('controller'=> 'pieces', 'action'=>'association'),
array('controller'=> 'pieces', 'action'=>'cmdcourrier'),
array('controller'=> 'pieces', 'action'=>'kbis'),
),
2011-01-05 09:59:49 +00:00
'pages' => array(
array(
'label' => "Commande de Pièces",
2011-04-20 07:25:37 +00:00
'controller' => 'pieces',
'action' => 'commande',
2011-08-29 10:07:19 +00:00
'permission' => array('kbis', 'privileges'),
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Comptes annuels",
2011-04-20 07:25:37 +00:00
'controller' => 'pieces',
'action' => 'bilans',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Actes & Statuts",
2011-04-20 07:25:37 +00:00
'controller' => 'pieces',
'action' => 'actes',
'forceVisible' => true,
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Suivi Privilèges",
2011-04-20 07:25:37 +00:00
'controller' => 'pieces',
'action' => 'privileges',
2011-08-29 10:07:19 +00:00
'permission' => 'survpriv',
2011-01-05 09:59:49 +00:00
),
),
),
array(
'label' => 'OPTIONS',
'pages' => array(
2011-06-27 12:56:19 +00:00
array(
'label' => 'Documentation',
'controller' => 'user',
'action' => 'documentation',
'target' => '_blank',
),
2011-01-05 09:59:49 +00:00
array(
'label' => "Mes options",
2011-01-07 17:16:07 +00:00
'controller' => 'user',
'action' => 'index',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Mes surveillances",
2011-04-20 07:25:37 +00:00
'controller' => 'surveillance',
'action' => 'liste',
2011-08-23 09:14:06 +00:00
'permission' => 'survliste'
2011-01-05 09:59:49 +00:00
),
2011-05-24 06:25:58 +00:00
array(
'label' => "Surveillances fichier",
'controller' => 'surveillance',
'action' => 'fichier',
),
2011-01-05 09:59:49 +00:00
array(
'label' => "Mon portefeuille",
2011-04-20 07:25:37 +00:00
'controller' => 'surveillance',
'action' => 'portefeuille',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Administration",
2011-05-03 15:58:48 +00:00
'controller' => 'user',
'action' => 'liste',
2011-01-05 09:59:49 +00:00
),
array(
'label' => "Surveillances",
'controller' => '',
'action' => '',
),
array(
'label' => "Se déconnecter",
'controller' => 'user',
'action' => 'logout',
),
),
),
array(
'label' => 'GESTION S&D',
'check' => 'dashboard',
'pages' => array(
array(
'label' => "Gestion",
'controller' => 'dashboard',
'action' => 'index',
),
2011-11-28 13:05:41 +00:00
array(
'label' => "Saisie / Edition",
'controller' => 'saisie',
'action' => 'fiche',
),
),
),
2011-01-05 09:59:49 +00:00
);
/**
* Construit le menu en fonction du siret et de l'identifiant S&D
* @param string $siret
* @param integer $id
*/
public function __construct($siret = null, $id = 0)
{
2011-08-23 15:12:53 +00:00
require_once 'Scores/Utilisateur.php';
require_once 'Scores/SessionEntreprise.php';
2011-08-23 15:12:53 +00:00
2011-04-15 09:05:30 +00:00
$this->siret = $siret;
$this->id = $id;
2011-01-05 15:14:23 +00:00
$this->menu = new Zend_Navigation();
2011-01-05 09:59:49 +00:00
$this->computeMenu();
}
/**
* Retourne le menu généré
*/
public function getMenu()
{
2011-01-05 09:59:49 +00:00
return $this->menu;
}
/**
* Retourne la position du groupe à activé
* @param unknown_type $controller
* @param unknown_type $action
*/
public function getIdMenu($controller, $action)
{
$i = 0;
2011-08-23 09:14:06 +00:00
$stop = false;
foreach($this->defineMenu as $menu){
$perm = true;
if (array_key_exists('permission', $menu)){
$perm = $this->checkPermission($menu['permission']);
}
$visible = true;
if (array_key_exists('check', $menu)){
$visible = $this->checkMenu($menu['check']);
}
foreach($menu['pages'] as $item){
if($controller == $item['controller'] && $action == $item['action']){
$stop = true;
break;
}
}
if (array_key_exists('activateMenu', $menu)){
foreach($menu['activateMenu'] as $item){
if($controller == $item['controller'] && $action == $item['action']){
$stop = true;
break;
}
}
}
2011-08-23 09:14:06 +00:00
if ($stop === true) break;
if ($perm && $visible){
$i++;
}
}
return $i;
}
/**
* Parcours la définition du menu en gérant les permissions et autres
* particularités
*/
protected function computeMenu()
{
2011-01-05 09:59:49 +00:00
foreach($this->defineMenu as $element){
$perm = true;
2011-01-05 15:14:23 +00:00
if (array_key_exists('permission', $element)){
$perm = $this->checkPermission($element['permission']);
2011-01-05 09:59:49 +00:00
}
$visible = true;
if (array_key_exists('check', $element)){
$visible = $this->checkMenu($element['check']);
}
if ($perm && $visible){
2011-01-05 09:59:49 +00:00
$menu = array();
$menu['label'] = $element['label'];
2011-01-05 15:14:23 +00:00
$menu['uri'] = '#';
2011-04-01 12:14:40 +00:00
$menu['class'] = 'header';
2011-01-05 09:59:49 +00:00
if (array_key_exists('pages', $element)){
2011-01-05 15:14:23 +00:00
$menu['pages'] = $this->computePage($element['pages']);
2011-01-05 09:59:49 +00:00
}
2011-01-05 15:14:23 +00:00
$this->menu->addPage($menu);
2011-01-05 09:59:49 +00:00
}
}
}
/**
* Parcours les pages d'un groupe du menu pour vérifier les permissions
* et autres particularités
* @param array $pages
*/
protected function computePage($pages)
{
2011-01-05 15:14:23 +00:00
$computePages = array();
foreach($pages as $page){
$visible = false;
2011-05-03 15:58:48 +00:00
if (array_key_exists('forceVisible', $page)){
$visible = $page['forceVisible'];
2011-01-05 15:14:23 +00:00
}
2011-01-05 09:59:49 +00:00
$perm = true;
2011-01-05 15:14:23 +00:00
if (array_key_exists('permission', $page)){
$perm = $this->checkPermission($page['permission']);
2011-01-05 09:59:49 +00:00
}
2011-04-21 13:57:47 +00:00
if (!$perm && $visible){
2011-01-05 15:14:23 +00:00
$computePage = array();
$computePage['label'] = $page['label'];
2011-04-21 13:57:47 +00:00
$computePage['class'] = 'inactif';
2011-01-05 15:14:23 +00:00
$computePage['uri'] = '#';
$computePages[] = $computePage;
2011-04-21 13:57:47 +00:00
} elseif ($perm){
if ($this->checkParams($page['controller'], $page['action'])){
$computePage = array();
$computePage = $page;
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
2011-10-18 10:50:40 +00:00
if ($this->hasPref('demanderef') && $page['demanderef'] ){
$computePage['class'] = 'demanderef';
}
2011-04-21 13:57:47 +00:00
$computePages[] = $computePage;
2011-05-03 15:58:48 +00:00
} elseif ($visible) {
2011-04-21 13:57:47 +00:00
$computePage = array();
$computePage['label'] = $page['label'];
$computePage['class'] = 'inactif';
$computePage['uri'] = '#';
$computePages[] = $computePage;
}
2011-01-05 09:59:49 +00:00
}
}
2011-01-05 15:14:23 +00:00
return $computePages;
2011-01-05 09:59:49 +00:00
}
/**
* Vérifie les permissions de l'utilisateur
* Enter description here ...
* @param unknown_type $perm
*/
protected function checkPermission($perm)
{
2011-01-05 09:59:49 +00:00
$hasPerm = false;
2011-01-05 15:14:23 +00:00
if (is_array($perm)){
$list = $perm;
} else if (is_string($perm)){
$list = (array)$perm;
}
2011-08-23 15:12:53 +00:00
$user = new Utilisateur();
2011-01-05 15:14:23 +00:00
foreach($list as $permission){
2011-08-23 15:12:53 +00:00
if ($user->checkPerm($permission)){
2011-01-05 15:14:23 +00:00
$hasPerm = true;
break;
2011-01-05 09:59:49 +00:00
}
}
return $hasPerm;
}
/**
* Enter description here ...
* @param unknown_type $pref
*/
public function hasPref($pref)
{
$user = new Utilisateur();
if ($user->checkPref($pref)){
return true;
}
return false;
}
/**
* Permet d'effectuer une vérification pour la visibilité d'un menu (Groupe)
* @param string $controller
*/
protected function checkMenu($controller)
{
switch($controller) {
case 'dashboard':
2011-08-23 15:12:53 +00:00
$user = new Utilisateur();
if ($user->checkModeEdition() && $user->getIdClient()==1){
return true;
}
return false;
break;
}
2011-04-15 09:05:30 +00:00
}
/**
* Vérifie les paramètres pour un controller et/ou une action
* @param string $controller
* @param string $action
*/
protected function checkParams($controller, $action = '')
2011-04-21 13:57:47 +00:00
{
switch($controller) {
case 'dashboard':
return true;
break;
2011-05-03 15:58:48 +00:00
case 'administration':
2011-08-23 15:12:53 +00:00
$user = new Utilisateur();
if (in_array($user->getProfil(),array('Administrateur', 'SuperAdministrateur'))) {
2011-05-03 15:58:48 +00:00
return true;
}
return false;
break;
case 'recherche':
switch($action) {
case 'last':
case 'list':
//Vérifier la présence d'au moins une recherche
require_once 'Scores/RechercheHistorique.php';
$recherches = new RechercheHistorique();
if (count($recherches->liste()>0)){
return true;
}
return false;
break;
case 'annonce':
$user = new Utilisateur();
if($user->getIdClient()==1){
return true;
}
return false;
break;
}
return true;
break;
case 'user':
switch($action){
case 'liste':
2011-09-06 12:27:55 +00:00
$user = new Utilisateur();
if (!$user->isAdmin()){
return false;
}
break;
}
return true;
break;
case 'surveillance':
2011-05-24 06:25:58 +00:00
switch($action) {
case 'fichier':
2011-08-23 15:12:53 +00:00
$user = new Utilisateur();
if (substr($user->getLogin(),0,6)=='cnasea'
|| strtolower($user->getLogin())=='omni04'
|| $user->getIdClient()==32
2011-08-23 15:16:01 +00:00
|| $user->getIdClient()==82 ) {
2011-08-09 15:48:43 +00:00
return true;
} else {
return false;
2011-08-09 15:48:43 +00:00
}
2011-05-24 06:25:58 +00:00
break;
}
return true;
break;
2011-04-21 13:57:47 +00:00
case 'identite':
switch($action) {
case 'fiche':
case 'fichepc':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
2011-10-25 09:48:08 +00:00
return false;
break;
case 'etablissements':
case 'liens':
case 'evenements':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
}
break;
2011-04-21 13:57:47 +00:00
case 'dirigeant':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
2011-04-21 13:57:47 +00:00
case 'finance':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'juridique':
2011-10-25 09:48:08 +00:00
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
2011-08-20 13:17:03 +00:00
}
2011-10-25 09:48:08 +00:00
switch($action){
case 'annonces':
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
break;
}
return false;
break;
case 'evaluation':
switch($action){
2011-10-26 12:18:25 +00:00
case 'indiscore':
$siretSiege = substr($this->siret, 0,9);
2011-08-31 13:07:03 +00:00
if (!empty($siretSiege) && intval($siretSiege)!=0 ){
return true;
}
return false;
break;
}
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
2011-08-20 13:17:03 +00:00
}
return false;
2011-04-21 13:57:47 +00:00
break;
case 'pieces':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
2011-11-28 13:05:41 +00:00
case 'saisie':
switch($action){
case 'fiche':
if ( !empty($this->id) && intval($this->id)!=0 ){
return true;
}
break;
}
return false;
break;
2011-04-21 13:57:47 +00:00
}
}
/**
* Définit les paramètres nécessaire pour les liens des pages
* @param string $controller
* @param string $action
*/
protected function setParams($controller, $action)
{
2011-04-15 09:05:30 +00:00
$params = array();
switch($controller) {
2011-04-15 10:25:46 +00:00
case 'recherche':
break;
2011-05-20 08:25:05 +00:00
case 'evaluation':
2011-10-26 12:18:25 +00:00
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
switch($action){
case 'indiscore':
$session = new SessionEntreprise(null);
$params['siret'] = $session->getSiretSiege();
break;
}
break;
case 'pieces':
2011-04-15 09:05:30 +00:00
case 'identite':
2011-05-02 07:20:13 +00:00
case 'finance':
2011-04-19 06:23:20 +00:00
case 'dirigeant':
2011-04-19 07:21:06 +00:00
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
case 'juridique':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
switch($action){
case 'annonces':
if (empty($this->siret) || intval($this->siret)==0){
require_once 'Scores/SessionEntreprise.php';
2011-10-26 12:18:25 +00:00
$session = new SessionEntreprise(null);
$params['idAnn'] = $session->getSourceId();
$params['source'] = $session->getSource();
}
break;
2011-11-28 13:05:41 +00:00
}
break;
case 'saisie':
switch($action){
case 'fiche':
if (!empty($this->siret)) {
$params['siret'] = $this->siret;
}
if (!empty($this->id)) {
$params['id'] = $this->id;
}
break;
}
2011-11-28 13:05:41 +00:00
break;
2011-04-15 09:05:30 +00:00
}
return $params;
}
}