    <?php

	/*
	* copyright (c) 2013-2023 Heliac Technologies
	* license http://opensource.org/licenses/gpl-license.php GNU GPL v3 
	*
	* linee guida per l'utilizzo del logo http://www.geecom.org/articolo.php?id=34&alias=linee-guida-per-l%27uso-del-logo-geecom
	*/
    
        $arrayColori = array(""=>"Trasparente","bg-primary"=>"Primary","bg-secondary"=>"Secondary","bg-success"=>"Success","bg-info"=>"Info","bg-warning"=>"Warning","bg-danger"=>"Danger","bg-light"=>"Light","bg-dark"=>"Dark","bg-white"=>"Bianco");
        $coloreMenu = array("navbar-dark"=>"Chiaro","navbar-light"=>"Scuro");
    ?>

    <h4 class="mb-4 title">Barra superiore</h4>
    <form class="form-horizontal" role="form" name="formSettaggiBarraSuperiore" action="../controller/controllerImpostazioni.php" method="post" enctype="multipart/form-data">
        <input type="text" class="d-none" name="operazione" value="aggiornaImpostazioniBarraSuperiore">
        <div class="row mt-5">
            <div class="col-12">
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="select1" class="d-block">Mostra barra superiore</label>
                        <input type="checkbox" name="attivaBarraSuperiore" class="js-switch" value="si" <?php if($impostazioni["attivaBarraSuperiore"]=="si") echo"checked"; ?> />
                    </div>
                    
                    <div class="form-group col-md-4">
                        <label for="InputFile" >Colore di sfondo</label>
                        <select class="form-control" name="coloreBarraSuperiore">
                        <?php 
                            foreach($arrayColori as $classe=>$colore) {
                                if($impostazioni["coloreBarraSuperiore"]==$classe) {
                                    echo"<option value=\"$classe\" selected>$colore</option>";
                                }
                                else {
                                    echo"<option value=\"$classe\">$colore</option>";
                                }
                            }
                        ?>
                        </select>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="InputFile" >Colore testi</label>
                        <select class="form-control" name="coloreTestoBarraSuperiore">
                        <?php 
                            foreach($coloreMenu as $classe=>$colore) {
                                if($impostazioni["coloreTestoBarraSuperiore"]==$classe) {
                                    echo"<option value=\"$classe\" selected>$colore</option>";
                                }
                                else {
                                    echo"<option value=\"$classe\">$colore</option>";
                                }
                            }
                        ?>
                        </select>
                    </div>
                </div>
            </div>
            
            <div class="col-12">
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="select1" class="d-block">Mostra menu secondario</label>
                        <input type="checkbox" name="menuSecondario" class="js-switch" value="si" <?php if($impostazioni["menuSecondario"]=="si") echo"checked"; ?> />
                    </div>
                    
                    <div class="form-group col-md-4">
                        <label for="InputFile" >Scegli il menu</label>
                        <select class="form-control" name="idMenuSecondario">
                            <option value="0">Seleziona</option>
                            <?php 
                                $query = "SELECT * FROM geecD_menu";
                                $risMenu = $geecomDb->eseguiQueryLettura($query);
                                while($menu = $risMenu->fetch_assoc()) {
                                    if($impostazioni["idMenuSecondario"]==$menu["id"]) {
                                        echo"<option value=\"{$menu["id"]}\" selected>{$menu["nome"]}</option>";
                                    }
                                    else {
                                         echo"<option value=\"{$menu["id"]}\">{$menu["nome"]}</option>";
                                    }
                                }
                            ?>
                        </select>
                    </div>

                    <div class="form-group col-md-4">
                        <label for="InputFile" >Posizionamento</label>
                        <select class="form-control" name="allineamentoMenuSecondario">
                        <?php 
                            $arrayPosizionamento = array("mr-auto"=>"sinistra","ml-auto"=>"destra");
                            foreach($arrayPosizionamento as $classe=>$posizionamento) {
                                if($impostazioni["allineamentoMenuSecondario"]==$classe) {
                                    echo"<option value=\"$classe\" selected>$posizionamento</option>";
                                }
                                else {
                                    echo"<option value=\"$classe\">$posizionamento</option>";
                                }
                            }
                        ?>
                        </select>
                    </div>
                </div>
            </div>
            
            <div class="col-12">
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="select1" class="d-block">Mostra testo</label>
                        <input type="checkbox" name="mostraTestoBarraSuperiore" class="js-switch" value="si" <?php if($impostazioni["mostraTestoBarraSuperiore"]=="si") echo"checked"; ?> />
                    </div>
                    
                    <div class="form-group col-md-4">
                        <label for="InputFile" >Testo da inserire</label>
                        <input class="form-control" name="testoBarraSuperiore" value="<?php echo $impostazioni["testoBarraSuperiore"] ?>">
                    </div>

                    <div class="form-group col-md-4">
                        <label for="InputFile" >Posizionamento</label>
                        <select class="form-control" name="allineamentoTestoBarraSuperiore">
                        <?php 
                            $arrayPosizionamento = array("mr-auto"=>"sinistra","ml-auto"=>"destra");
                            foreach($arrayPosizionamento as $classe=>$posizionamento) {
                                if($impostazioni["allineamentoTestoBarraSuperiore"]==$classe) {
                                    echo"<option value=\"$classe\" selected>$posizionamento</option>";
                                }
                                else {
                                    echo"<option value=\"$classe\">$posizionamento</option>";
                                }
                            }
                        ?>
                        </select>
                    </div>
                </div>
            </div>
            
            <div class="col-12">
                <div class="form-row">
                    <div class="form-group col-md-4">
                        <label for="select1" class="d-block">Mostra menu scelta lingue</label>
                        <input type="checkbox" name="menuSceltaLingue" class="js-switch" value="si" <?php if($impostazioni["menuSceltaLingue"]=="si") echo"checked"; ?> />
                    </div>
                </div>
            </div>
        </div>
        
        <div class="footer">
            <button type="button" class="btn btn-primary float-right" onclick=document.formSettaggiBarraSuperiore.submit()><i class="fas fa-check"></i> Salva</button>
        </div>

    </form>