Commit 26281068 authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Adaptation pour BS5

parent c61a0b53
Loading
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -51,6 +51,11 @@ span.number span.number-dec-00 {

/* FIN */

.navbar {
    padding-top: .25rem;
    padding-bottom: .25rem;
}

a.navbar-brand h1 {
    font-size: 30px;
    padding: 0;
@@ -149,6 +154,10 @@ div.messenger span.icon {
    margin-right: 0.5em;
}

#user-status-icon {
    font-size: 16px;
}

.user-profile-select-form {
    padding-left: 25px;
}
+20 −15
Original line number Diff line number Diff line
@@ -20,9 +20,9 @@ $navigationHelper = $this->navigation('navigation');
        <?php echo $this->headTitle($this->appInfos()->nom)->setSeparator(' - ')->setAutoEscape(false) ?>

        <!-- Links -->
        <?php echo $this->headLink(array(
        <?php echo $this->headLink([
            'rel'  => 'shortcut icon',
            'href' => '//www.unicaen.fr/favicon.ico')) ?>
            'href' => $this->basePath('favicon.png')]) ?>
        
        <!-- Scripts -->
        <?php echo $this->headScript(); ?>
@@ -30,18 +30,23 @@ $navigationHelper = $this->navigation('navigation');
    
    <body class="<?php echo getenv('APPLICATION_ENV') ?: 'development' ?>">

        <div id="navbar" class="navbar fixed-top navbar-expand-lg" role="navigation">
        <nav id="navbar" class="navbar navbar-dark fixed-top navbar-expand-lg" role="navigation">
            <div class="container-fluid">
                <?php echo $this->appLink($this->appInfos()->nom) ?>
                <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#menuPrincipalNavbar" aria-controls="menuPrincipalNavbar" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="menuPrincipalNavbar">
                <?php echo $navigationHelper->menuPrincipal('navigation'); ?>
                <div class="navbar-text navbar-right">
                    <?php echo $navigationHelper
                        ->menu('navigation')
                        ->setUlClass('navbar-nav me-auto')
                        ->setPartial('layout/menu-principal.phtml'); ?>
                    <div class="navbar-text text-end">
                        <?php echo $this->appConnection(); ?>
                    </div>
                </div>
            </div>
        </nav>

        <div class="container ">
            <?php echo $navigationHelper->filAriane(); ?>
@@ -50,7 +55,7 @@ $navigationHelper = $this->navigation('navigation');
        <div id="contenu-principal" class="container">
            <?php
            $menuSecondaireHelper = $navigationHelper->menuSecondaire('navigation');
            if ($menuSecondaire = (string) $menuSecondaireHelper->setMaxDepth(1)): ?>
            if ($menuSecondaire = (string) $menuSecondaireHelper): ?>
                <div class="row">
                    <div class="col-12 col-md-2">
                        <nav id="sidebar" role="navigation">
@@ -67,7 +72,7 @@ $navigationHelper = $this->navigation('navigation');
        </div>

        <nav id="footer" class="navbar navbar-fixed-bottom">
            <div id="footer" class="container">
            <div class="container">
                <?php echo $navigationHelper->menuPiedDePage('navigation'); ?>
            </div>
        </nav>
+106 −0
Original line number Diff line number Diff line
<?php

use Laminas\Navigation\AbstractContainer;
use Laminas\Navigation\Page\AbstractPage;

// Pointeur sur la première page du conteneur
$this->container->rewind();
// On récupère le conteneur en-dessous du 'home'
/** @var AbstractContainer $container */
$container = $this->container->getChildren();

// tri des pages de niveau 1 par 'order'
$sorterByOrder = function(AbstractPage $p1, AbstractPage $p2) { return ($p1->getOrder()?:0) <=> ($p2->getOrder()?:0); };
$pagesNiv1 = iterator_to_array($container);
uasort($pagesNiv1, $sorterByOrder);
?>
<ul class="<?php echo $this->navigation()->menu()->getUlClass(); ?>">
    <?php foreach ($pagesNiv1 as $page): ?>
        <?php if (!$this->navigation()->accept($page)) continue; ?>
        <?php /* @var $page Laminas\Navigation\Page\Mvc */ ?>
        <?php $hasChildren = $page->hasPages() ?>
        <?php if (!$hasChildren): ?>
            <li class="nav-item <?php if ($page->isActive()) echo 'active' ?>">
                <a class="nav-link" href="<?php echo $page->getHref() ?>"
                    <?php if ($page->getTarget() != ""): ?>
                        target="<?php echo $page->getTarget(); ?>"
                    <?php endif; ?>>
                    <?php if ($page->get("icon") !== ""): ?>
                        <span class="<?php echo $page->get("icon"); ?>"></span>
                    <?php elseif (in_array('divider', explode(' ', $page->getClass()))): ?>
                        <div class="dropdown-divider <?php echo $page->getClass() ?>"></div>
                    <?php endif; ?>
                    <?php echo $this->escapeHtml($this->translate($page->getLabel(), $this->navigation($container)->getTranslatorTextDomain())); ?>
                </a>
            </li>
        <?php else: ?>
            <?php
            //check if access is allowed at least one item
            $access = false;
            foreach ($page->getPages() as $child) {
                if ($this->navigation()->accept($child) && $child->get("separator") !== true) {
                    $access = true;
                }
            }
            if ($access) :
                ?>
                <li class="nav-item dropdown <?php if ($page->isActive(true)) echo ' nav-item active' ?>">
                    <a class="nav-link dropdown-toggle" id="navbarDropdownMenuLink" data-bs-toggle="dropdown" href="<?php echo $page->getHref() ?>" aria-expanded="false">
                        <?php if ($page->get("icon") != ""): ?>
                            <span class="icon">
                                <i class="<?php echo $page->get("icon"); ?>"></i>
                            </span>
                        <?php endif; ?>
                        <?php echo $this->escapeHtml($this->translate($page->getLabel(), $this->navigation($container)->getTranslatorTextDomain())); ?>
<!--                        <b class="caret"></b>-->
                    </a>
                    <ul class="dropdown-menu" aria-labelledby="navbarDropdownMenuLink">
                        <?php
                        // tri des pages de niveau 2 par 'order'
                        $pagesNiv2 = $page->getPages();
                        uasort($pagesNiv2, $sorterByOrder);
                        ?>
                        <?php foreach ($pagesNiv2 as $child): ?>
                            <?php if (!$this->navigation()->accept($child)) continue; ?>
                            <?php if ($child->get("dropdown-header") === true): ?>
                                <li class="dropdown-item">
                                    <?php if ($child->get("icon") != ""): ?>
                                        <span class="icon">
                                            <i class="<?php echo $child->get("icon"); ?>"></i>
                                        </span>
                                    <?php elseif (in_array('divider', explode(' ', $child->getClass()))): ?>
                                        <div class="dropdown-divider <?php echo $child->getClass() ?>"></div>
                                    <?php endif; ?>
                                    <?php echo $this->escapeHtml($this->translate($child->getLabel(), $this->navigation($container)->getTranslatorTextDomain())); ?>
                                </li>
                                <?php
                                continue;
                            endif;
                            ?>
                            <?php if ($child->get("separator") === true): ?>
                                <li class="dropdown-divider"></li>
                                <?php
                                continue;
                            endif;
                            ?>
                            <li>
                                <a class="dropdown-item <?php if ($child->isActive()) echo 'active' ?>"
                                    href="<?php echo $child->getHref() ?>"
                                    <?php if ($child->getTarget() != ""): ?>
                                        target="<?php echo $child->getTarget(); ?>"
                                    <?php endif; ?>>
                                    <?php if ($child->get("icon") != ""): ?>
                                        <span class="icon">
                                            <i class="<?php echo $child->get("icon"); ?>"></i>
                                        </span>
                                    <?php endif; ?>
                                    <?php echo $this->escapeHtml($this->translate($child->getLabel(), $this->navigation($container)->getTranslatorTextDomain())); ?>
                                </a>
                            </li>
                        <?php endforeach ?>
                    </ul>
                </li>
            <?php endif; ?>
        <?php endif ?>
    <?php endforeach ?>
</ul>
 No newline at end of file