<!DOCTYPE html>
<html lang="en"><head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <title><?php echo strip_tags($site['titre']); ?></title>
    <meta name="description" content="Un dérivé de XML collection">
    <meta name="keywords" content="<?php echo $site['keywords'] ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="subject" content="collection">

    <link rel="icon" type="image/png" href="images/favicon-16.png" sizes="16x16">
    <link rel="icon" type="image/png" href="images/favicon-32.png" sizes="32x32"> 
    <link rel="icon" type="image/png" href="images/favicon-96.png" sizes="96x96">

    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/heebo-fontfacekit/stylesheet.css">
    <link rel="stylesheet" href="css/trumbowyg.min.css">
    <link rel="stylesheet" href="css/main.css">
    <link rel="stylesheet" href="css/css-awesome/all.min.css">
    <?php 
    // charger les css du dossier custom
    $csss=glob(DOSSIER_CUSTOM."*.css");
          foreach($csss as $css){
              echo "<link rel=\"stylesheet\" href=\"".$css."\">\n";
          }
          $liste_criteres=implode(",",$xml->get_liste_pour_attribut("afficher","oui",array("illustration")));
    ?> 
    </head>
    <body data-type-action="<?php echo DISPLAY_ACTION; ?>" data-type-tri="<?php echo DISPLAY_TRI; ?>" data-type-affichage="items" data-items-infos="<?php echo $liste_criteres; ?>" data-items-search="<?php echo $liste_criteres; ?>">
        <!-- NAV -->
        <section class="container-fluid mt-2">
            <nav class="navbar navbar-expand-md navbar-light" id="main-navbar">
                <a class="navbar-brand" href="./"><?php echo $site['titre'] ?></a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#menu" aria-controls="menu" aria-expanded="false" aria-label="Toggle navigation">
                    <span><i class="navbar-toggler-icon"></i></span>
                </button>
                <div class="collapse navbar-collapse my-3 my-md-0" id="menu">
                    <ul class="navbar-nav ml-auto">
                        <?php
    // ici un chargement des pages custom comme par exemple "about"
    include(CHEMIN."inc/inc-menu-pages.php");
                        ?>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="admindropdown" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                                Admin
                            </a>
                            <div id="admin-menu" class="dropdown-menu" aria-labelledby="admindropdown">
                                <?php
                                include("inc/inc-menu-admin.php");
                                ?>
                            </div>
                        </li>
                    </ul>
                </div>
            </nav>
        </section>
        <section class="container-fluid mb-3">
            <div id="descriptif" class="texte-medium mx-3">
                <?php echo $site['descriptif'] ?>
            </div>
        </section>
        <!-- END nav -->
        <?php
    // insert du pipeline en bottom
    if(file_exists(CHEMIN.DOSSIER_CUSTOM."insert-pre-mosaique.php")){
        include(CHEMIN.DOSSIER_CUSTOM."insert-pre-mosaique.php");
    }
        ?>
        <section class="container-fluid my-2"  id="toolbar">
            <div class="border-top border-bottom py-1 mx-3">
                <ul class="nav" id="toolnav">
                    <li class="nav-item">
                        <a class="nav-link pl-0" data-showhide="tool-items-search" href="#">Rechercher</a>
                    </li>
                    <?php 
                    if(DISPLAY_TOOL_TRI){ ?>
                    <li class="nav-item">
                        <a class="nav-link" data-showhide="tool-tri" href="#">Tri</a>
                    </li>
                    <?php } 
                    if(DISPLAY_TOOL_INFOS){
                    ?>
                    <li class="nav-item">
                        <a class="nav-link" data-showhide="tool-items-infos" href="#">Affichage</a>
                    </li>
                    <?php } 
                    if(DISPLAY_TOOL_ACTION){
                    ?>
                    <li class="nav-item">
                        <a class="nav-link" data-showhide="tool-action" href="#">Action</a>
                    </li>
                    <?php
                    }
                    if(COLLECTION){
                    ?>
                    <li>
                        <a class="nav-link" data-showhide="tool-affichage" href="#">Collections</a>
                    </li>
                    <?php
                    }
                    ?>
                </ul>

                <div id="tool-items-search" data-select-type="checkbox" data-hideonstart="oui" class="row no-gutters form-inline pb-1" style="display: none;" data-hideonstart="oui">
                    <input id="live-search" type="text" class="form-control form-control-usm mr-sm-2" placeholder="enter a few letters">
                    <?php
                    foreach($structure as $tag=>$c){
                        if(isset($c['@attributes']['afficher']) && !in_array($c['@attributes']['type'],array('image','file'))){
                            echo "<div class=\"form-check form-control-usm mr-sm-2\">
                        <input class=\"form-check-input\" type=\"checkbox\" data-critere=\"".$tag."\" id=\"".$tag."\">
                        <label class=\"form-check-label\" for=\"".$tag."\">".$c['@attributes']['titre']."</label> 
                    </div>";
                        }
                    } 
                    ?>
                </div>
                <?php if(DISPLAY_TOOL_INFOS){ ?>
                <div class="row" id="tool-items-infos"  style="display:none">
                    <div class="col">
                        <div data-select-type="checkbox" class="row no-gutters form-inline pb-1">
                            <div class="form-check form-control-usm mr-sm-2">
                                Afficher :  
                            </div>
                            <?php
    
    $field_ok=array("text","textarea","select");
    foreach($structure as $tag=>$c){
        if(isset($c['@attributes']['afficher']) && in_array($c['@attributes']['type'],$field_ok)){
            echo "<div class=\"form-check form-control-usm mr-sm-2\">\n<input class=\"form-check-input\" type=\"checkbox\" id=\"items-".$tag."\" data-critere=\"".$tag."\" checked=\"checked\">\n<label class=\"form-check-label\" for=\"items-".$tag."\">".$c['@attributes']['titre']."</label>\n</div>"; 
        } 
    }
                            ?>
                        </div>
                    </div>

                    <?php
}
                    ?>
                </div>
                <?php
                if(DISPLAY_TOOL_TRI){ ?>
                <div id="tool-tri" data-select-type="radio" data-hideonstart="oui" class="row no-gutters form-inline pb-1" style="display: none;">
                    <div class="form-check form-control-usm mr-sm-2">
                        Réordonner : 
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="ordre" type="radio" id="byid" data-critere="byid">
                        <label class="form-check-label" for="byid">
                            Date
                        </label>
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="ordre" type="radio" id="byantiid" data-critere="byantiid" checked="checked">
                        <label class="form-check-label" for="byantiid">
                            Date inverse 
                        </label>
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="ordre" type="radio" id="alpha" data-critere="alpha">
                        <label class="form-check-label" for="alpha">
                            Alphabétique
                        </label>
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="ordre" type="radio" id="antialpha" data-critere="antialpha">
                        <label class="form-check-label" for="antialpha">
                            Anti alphabétique
                        </label>
                    </div>
                </div>
                <?php } 
                if(DISPLAY_TOOL_ACTION){ ?>
                <div id="tool-action" data-select-type="radio" data-hideonstart="oui" class="row no-gutters form-inline pb-1" style="display: none;">
                    <div class="form-check form-control-usm mr-sm-2">
                        Un clic produit : 
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="action" type="radio" id="showgal" data-critere="showgal">
                        <label class="form-check-label" for="showgal">
                            Affichage de l'image
                        </label>
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="action" type="radio" id="showlateral" data-critere="showlateral" checked="checked">
                        <label class="form-check-label" for="showlateral">
                            Affichage latéral de la fiche
                        </label>
                    </div>
                    <div class="form-check form-control-usm mr-sm-2">
                        <input class="form-check-input" name="action" type="radio" id="showfullpage" data-critere="showfullpage">
                        <label class="form-check-label" for="showfullpage">
                            Affichage pleine page de la fiche
                        </label>
                    </div>
                </div>
                <?php
                }
                if(COLLECTION){
                ?>
                <section id="tool-affichage" class="mt-3" data-hideonstart="oui">
                    <div class="row py-1" id="collections-container">
                        <?php
                    $collec=new classe_xml(MODELE_COLLECTION);
                    $liste=glob(CHEMIN.DOSSIER_COLLECTION."*.xml",GLOB_BRACE);
                    foreach($liste as $item){
                        $collec->lire_xml($item);
                        display_mosaique_collection($collec,false);
                    } 
                    if(count($liste)<1){
                        echo "<div class='col-12'>Pas encore de collection.</div>";
                    }
                        ?>
                    </div>

                    <div class="my-2"  id="collection-display">
                        <div class="container-inner"></div>
                    </div>

                </section>
                <?php
                }
                ?>

            </div>
        </section>

