Ajout de condition pour l'affichage du menu

This commit is contained in:
Michael RICOIS 2011-08-29 14:19:14 +00:00
parent 10d6f3de15
commit b4462ae9cb

View File

@ -31,6 +31,11 @@ class Menu
array('controller'=>'recherche', 'action'=>'list'),
array('controller'=>'recherche', 'action'=>'annonceslist'),
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'),
),
'pages' => array(
array(
@ -389,6 +394,7 @@ class Menu
public function __construct($siret = null, $id = 0)
{
require_once 'Scores/Utilisateur.php';
require_once 'Scores/SessionEntreprise.php';
$this->siret = $siret;
$this->id = $id;
@ -583,6 +589,13 @@ class Menu
}
return false;
break;
case 'annonce':
$user = new Utilisateur();
if($user->getIdClient()==1){
return true;
}
return false;
break;
}
return true;
break;
@ -606,20 +619,66 @@ class Menu
return true;
break;
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;
}
break;
case 'etablissements':
case 'liens':
case 'evenements':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
}
break;
case 'dirigeant':
case 'finance':
case 'evaluation':
case 'juridique':
case 'pieces':
//@todo : Améliorer la condition car il doit y en avoir d'autre
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
if ( !empty($this->id) ){
return false;
break;
case 'finance':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'juridique':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'evaluation':
switch($action){
case 'indiscore':
$session = new SessionEntreprise($this->siret, $this->id);
$siretSiege = $session->getSiretSiege();
if (!empty($siretSiege) && intval($siretSiege)==0 ){
return true;
}
return false;
break;
}
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
case 'pieces':
if ( !empty($this->siret) && intval($this->siret)!=0 ){
return true;
}
return false;
break;
}
}
@ -633,7 +692,7 @@ class Menu
$params = array();
switch($controller) {
case 'recherche':
break;
break;
case 'evaluation':
case 'pieces':
case 'identite':
@ -641,7 +700,7 @@ class Menu
case 'dirigeant':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
break;
break;
case 'juridique':
if (!empty($this->siret)) { $params['siret'] = $this->siret; }
if (!empty($this->id)) { $params['id'] = $this->id; }
@ -653,7 +712,7 @@ class Menu
$params['idAnn'] = $session->getSourceId();
$params['source'] = $session->getSource();
}
break;
break;
}
break;
}