menu_responsive.ctp 6 KB
<?php

//$has_search_field = true;

// Variables passées à cet élément
$has_search_field = $has_search_field;
// ...

?>

<!-- début menu -->
<nav class="navbar navbar-expand-xl navbar-light bg-light">

	<!-- BOUTON MENU DEPLIANT MOBILE (3 traits horizontaux) -->
    <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    	<span class="navbar-toggler-icon"></span>
    </button>

	<!-- MENU HORIZONTAL -->
  	<div class="collapse navbar-collapse" id="navbarSupportedContent">
  	
		<ul class="navbar-nav mr-auto">
	
			<!-- RETOUR -->
            <li class="nav-item">
            	<?=$this->Html->link('<i class="nav-link" id="police">Retour</i>', 'javascript:window.history.go(-1)', ['escape' => false])?>
            </li>
            
			<!-- ACCUEIL -->
            <li class="nav-item">
            	<?=$this->Html->link('<i class="nav-link" id="police">Accueil</i>', ['controller' => 'pages','action' => 'home'], ['escape' => false]);?>
            </li>
            
            <!--  IF user is logued in -->
            <?php if(isset($username) && $username != " "): ?>
            
                <!-- MATÉRIEL -->
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="text-decoration-color: #17457F;">Matériel</a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                      <?=$this->Html->link('<i class="dropdown-item">Nouveau</i>', ['controller' => 'Materiels','action' => 'add'], ['escape' => false]);?> 
                      <?=$this->Html->link(
                          '<i class="dropdown-item">Ma liste</i>', 
                          [
                              'controller' => 'Materiels', 
                              'action' => 'index',
                              'age' => 0,
                              'MY' => $username 
                          ], 
                          ['escape' => false]
                      );?>
                      <?=$this->Html->link('<i class="dropdown-item">Tous</i>', ['controller' => 'Materiels','action' => 'index'], ['escape' => false])?>
                      <?=$this->Html->link('<i class="dropdown-item">Rechercher</i>', ['controller' => 'materiels','action' => 'find'], ['escape' => false]);?>
                    </div>                              
                </li>
                
                <!-- SUIVI -->
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="text-decoration-color: #17457F;">Suivi</a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                      <?=$this->Html->link('<i class="dropdown-item">Tous</i>', ['controller' => 'Suivis','action' => 'index'], ['escape' => false])?>
                      <?=$this->Html->link('<i class="dropdown-item">Rechercher</i>', ['controller' => 'suivis','action' => 'find'], ['escape' => false]);?> 
                    </div>                              
                </li>
                
                <!-- EMPRUNT -->
                <li class="nav-item dropdown">
                    <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" style="text-decoration-color: #17457F;">Emprunt</a>
                    <div class="dropdown-menu" aria-labelledby="navbarDropdown">
                      <?=$this->Html->link('<i class="dropdown-item">Tous</i>', ['controller' => 'Emprunts','action' => 'index'], ['escape' => false]);?> 
                      <?=$this->Html->link('<i class="dropdown-item">Rechercher</i>', ['controller' => 'emprunts','action' => 'find'], ['escape' => false])?> 
                    </div>                              
                </li>

                <!-- Autres listes -->
                <?php 
                if (! $USER_IS_UTILISATEUR) {
                echo '<li class="nav-item">';
                	echo $this->Html->link('<i class="nav-link aligner" id="police">Autres listes</i>', ['controller' => 'pages','action' => 'tools_sm'], ['escape' => false]);
                echo '</li>';
                }
                ?>                

                <!-- Outils -->                
                <?php if(isset($role) && !(in_array($role, ['Utilisateur']))): ?>
                <li class="nav-item">
                    <?=$this->Html->link('<i class="nav-link" id="police">Outils</i>', ['controller' => 'pages','action' => 'tools'], ['escape' => false])?>         
                </li>
                <?php endif; ?>
                
            <!--  ENDIF user is logued in -->
            <?php endif; ?>

            <!-- A propos -->                   
            <li class="nav-item">
            	<?=$this->Html->link('<i class="nav-link aligner" id="police">A propos</i>', ['controller' => 'pages','action' => 'about'], ['escape' => false])?>
            </li>

		</ul>

        <!-- Champ Recherche -->
        <div id="barre">
	        <?php 
            if ($has_search_field && isset($username) && $username != " ") {
            echo $this->Form->create('Materiel', ['url' => '/materiels/find']);
                echo '<input name="s_all_2" class="form-control mr-2 mr-sm-2 col-8 col-sm-6 col-md-6 col-lg-9" type="search" placeholder="Recherche (matériels)" aria-label="Search" id="MaterielSAll barre">';
                echo $this->Form->button('Chercher', [ 'class'=>'btn btn-outline-success', 'type'=>'submit', 'name' => 'MaterielSAll', 'id' => 'MaterielSAll', 'style' => 'margin: 0px;' ]); 
            echo $this->Form->end();
            }
            ?>
        </div>
    
    <!-- FIN MENU HORIZONTAL -->
	</div>

</nav>

<!-- fin menu -->