Controle des paramètres du menu
This commit is contained in:
parent
1ff1c94975
commit
1ed663ce9b
@ -348,23 +348,30 @@ class Menu
|
||||
$visible = false;
|
||||
if (array_key_exists('visibleSansPermission', $page)){
|
||||
$visible = $page['visibleSansPermission'];
|
||||
//unset($page['visibleSansPermission']);
|
||||
}
|
||||
$perm = true;
|
||||
if (array_key_exists('permission', $page)){
|
||||
$perm = $this->checkPermission($page['permission']);
|
||||
//unset($page['permission']);
|
||||
}
|
||||
if ($perm){
|
||||
$computePage = array();
|
||||
$computePage = $page;
|
||||
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
|
||||
$computePages[] = $computePage;
|
||||
} elseif (!$perm && $visible){
|
||||
if (!$perm && $visible){
|
||||
$computePage = array();
|
||||
$computePage['label'] = $page['label'];
|
||||
$computePage['class'] = 'inactif';
|
||||
$computePage['uri'] = '#';
|
||||
$computePages[] = $computePage;
|
||||
} elseif ($perm){
|
||||
if ($this->checkParams($page['controller'], $page['action'])){
|
||||
$computePage = array();
|
||||
$computePage = $page;
|
||||
$computePage['params'] = $this->setParams($page['controller'], $page['action']);
|
||||
$computePages[] = $computePage;
|
||||
} else {
|
||||
$computePage = array();
|
||||
$computePage['label'] = $page['label'];
|
||||
$computePage['class'] = 'inactif';
|
||||
$computePage['uri'] = '#';
|
||||
$computePages[] = $computePage;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $computePages;
|
||||
@ -392,6 +399,19 @@ class Menu
|
||||
|
||||
}
|
||||
|
||||
protected function checkParams($controller, $action)
|
||||
{
|
||||
switch($controller){
|
||||
case 'identite':
|
||||
case 'dirigeant':
|
||||
case 'finance':
|
||||
if ( empty($this->siret) || empty($this->id) )
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected function setParams($controller, $action){
|
||||
$params = array();
|
||||
switch($controller) {
|
||||
@ -412,8 +432,4 @@ class Menu
|
||||
}
|
||||
return $params;
|
||||
}
|
||||
|
||||
protected function checkParams($controller, $action) {
|
||||
|
||||
}
|
||||
}
|
@ -1,7 +1,6 @@
|
||||
div#menu {
|
||||
width:200px;
|
||||
margin:0;
|
||||
|
||||
margin:0;
|
||||
}
|
||||
|
||||
div#menu .ui-widget {
|
||||
@ -50,6 +49,10 @@ div#menu ul.navigation li ul li a:hover {
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
div#menu ul.navigation li ul li a.inactif {
|
||||
color:gray;
|
||||
}
|
||||
|
||||
div#menu ul.navigation li a .ui-icon-triangle-1-e {
|
||||
background:url(/themes/default/images/menu/collapsed.gif) no-repeat left center;
|
||||
}
|
||||
@ -86,5 +89,3 @@ div#menu ul.navigation li a.ui-state-hover,
|
||||
div#menu ul.navigation li a.ui-state-active {
|
||||
border: 0;
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user