Proyectos de Subversion LeadersLinked - Backend

Rev

Rev 16805 | Rev 16822 | Ir a la última revisión | Autoría | Comparar con el anterior | Ultima modificación | Ver Log |

<?php 
use LeadersLinked\Model\UserType;

$currentUserPlugin = $this->currentUserHelper();
$currentUser = $currentUserPlugin->getUser();
$currentCompany = $currentUserPlugin->getCompany(); 


if($currentCompany) {
    $menu = getAclMenuCompany();
} else {
    $menu = getAclMenuSystem();
}




$usertype_id = $currentUser->usertype_id; 

//[REQUEST_URI] => /settings/company-sizes/
$request_uri = isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '';


if($request_uri) {
    if(substr($request_uri, 0, 1) == '/') {
        $request_uri = substr($request_uri, 1);
    }
    if(substr($request_uri, strlen($request_uri) -1 , 1) == '/') {
        $request_uri = substr($request_uri, 0, strlen($request_uri) -1 );
    }  
}


$acl = $this->viewModel()->getCurrent()->getVariable('acl');

$liCount = 0;
foreach($menu as $level1) : 

    if(!$level1 || !$level1['route'] || !$acl->isAllowed($usertype_id , $level1['route'])) {
       continue; 
    }

    $liCount++;

    if(empty($level1['pages'])) : 
    ?>
        <li class="nav-item" id="nav-item<?php echo $liCount ?>">
                <a href="/<?php echo $level1['route'] ?>" class="nav-link"><?php echo $level1['label'] ?></a>
        </li>
    <?php else: ?>
        <li class="nav-item dropdown" id="nav-item<?php echo $liCount ?>">
                <a id="dropdownSubMenu<?php echo $liCount ?>" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="nav-link dropdown-toggle"><?php echo $level1['label'] ?></a>
                <ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow" style="left: 0px; right: inherit;">
             
                        <?php foreach($level1['pages'] as $level2) : 
                        if(!$level2 || !$level2['route'] || !$acl->isAllowed($usertype_id , $level2['route'])) {
                            continue;
                        }
                                
                        $liCount++;
                        if(empty($level2['pages'])) : 
                        ?>
                        <li><a href="/<?php echo $level2['route'] ?>" class="dropdown-item"><?php echo $level2['label'] ?></a></li>
                        <?php else: ?>
                        <li class="dropdown-submenu dropdown-hover">
                        <a id="dropdownSubMenu<?php echo $liCount ?>" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-item dropdown-toggle"><?php echo $level2['label'] ?></a>
                <ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow">
                
                <?php foreach($level2['pages'] as $level3) : 
                if(!$level3 || !$level3['route'] || !$acl->isAllowed($usertype_id , $level3['route'])) {
                    continue;
                }
                
                $liCount++;
                if(empty($level3['pages'])) : 
                ?>
                                        <li>
                                                <a tabindex="-1" href="/<?php echo $level3['route'] ?>" class="dropdown-item"><?php echo $level3['label'] ?></a>
                                        </li>
                <?php else: ?>
                                        <li class="dropdown-submenu">
                        <a id="dropdownSubMenu<?php echo $liCount ?>" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" class="dropdown-item dropdown-toggle"><?php echo $level3['label'] ?></a>
                        <ul aria-labelledby="dropdownSubMenu<?php echo $liCount ?>" class="dropdown-menu border-0 shadow">
                                <?php foreach($level3['pages'] as $level4) : 
                            if(!$level4 || !$level4['route'] || !$acl->isAllowed($usertype_id , $level4['route'])) {
                                continue;
                            }
                            
                            $liCount++;
                            ?>
                            <li><a href="/<?php echo $level4['route'] ?>" class="dropdown-item"><?php echo $level4['label'] ?></a></li>
                            
                            <?php endforeach; ?>
                        </ul>
                    </li>       
                <?php endif;?>
                <?php endforeach; ?>

                </ul>
                        <li>
                                
                                
                        <?php endif; ?>
                                
                        <?php endforeach; ?>    
                </ul>   
    </li>          
    <?php endif; ?> 


      
<?php endforeach; ?>