Subversion Repositories eFlore/Applications.cel

Rev

Rev 3239 | Rev 3242 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

<!DOCTYPE html>
<html xmlns="https://www.w3.org/1999/xhtml">
        <head>
                <title><?= $widget['titre']; ?></title>

                <meta charset="utf-8" />
                <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
                <meta http-equiv="Content-style-type" content="text/css" />
                <meta http-equiv="Content-script-type" content="text/javascript" />
                <meta http-equiv="Content-language" content="fr" />

                <meta name="revisit-after" content="15 days" />
                <meta name="robots" content="index,follow" />
                <meta name="author" content="Tela Botanica" />
                <meta name="keywords" content="Tela Botanica, CEL" />
                <meta name="description" content="Widgets de saisie du carnet en ligne" />
                <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no, user-scalable=no" />

                <!-- OpenGraph pour Facebook, Pinterest, Google+ -->
                <meta property="og:type" content="website" />
                <meta property="og:title" content="Widgets de saisie du CeL" />
                <meta property="og:site_name" content="Tela Botanica" />
                <meta property="og:description" content="Widgets de saisie du Carnet en Ligne" />
                <meta property="og:image" content="https://resources.tela-botanica.org/tb/img/256x256/carre_englobant.png" />
                <meta property="og:image:type" content="image/png" />
                <meta property="og:image:width" content="256" />
                <meta property="og:image:height" content="256" />
                <meta property="og:locale" content="fr_FR" />

                <!-- Favicone -->
                <link rel="shortcut icon" type="image/x-icon" href="https://resources.tela-botanica.org/tb/img/16x16/favicon.ico" />
                <!-- Jquery-ui custom css-->
                <link href="https://www.tela-botanica.org/commun/jquery/jquery-ui/1.8.18/css/smoothness/jquery-ui-1.8.18.custom.css" rel="stylesheet" type="text/css" media="screen" />
                <!-- Bootstrap CSS -->
                <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous" />
                <!-- Fontawesome -->
                <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.1.1/css/all.css" integrity="sha384-O8whS3fhG2OnA5Kas0Y9l3cfpmYjapjI0E4theH4iuMD+pLhbf6JI0jIMfYcK3yZ" crossorigin="anonymous" />
                <!-- Carto -->
                <link href="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/styles.css" rel="stylesheet" type="text/css" media="screen" />
                <!-- STYLE SAISIE -->
                <link href="<?= $url_base; ?>modules/saisie2/squelettes/css/saisie.css" rel="stylesheet" type="text/css" media="screen" />

                <!--  Google Analytics -->
                <?php if( $prod ): ?>
                        <?php include "analytics.html"; ?>
                <?php endif; ?>
                <!-- <link rel="icon" type="image/x-icon" href="favicon.ico" /> -->
                <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet" />
        </head>

        <body>
                <?php
                        echo ( $widget['image_fond'] ) ? '<div id="image-fond" style="' . htmlspecialchars( 'background:url("' . $widget['chemin_fichiers'] . 'image_fond.' . preg_replace( '/(?:imag)?e\/?/','',$widget['image_fond']) . '") no-repeat center center;background-size:cover') . '"></div>': '';
                ?>
                <!-- <?php //var_dump($widget['especes']['url_ws_autocompletion_ns']); ?> -->
                <div id="zone-appli" class="container" data-projet="<?= $widget['projet']; ?>" data-url-fichiers="<?= $widget['chemin_fichiers']; ?>">
                        <div class="layout-wrapper page">
                                <div class="media">
                                        <img class="d-flex mr-3" src="<?php echo htmlspecialchars( $widget['chemin_fichiers'] . 'logo.' . preg_replace( '/(?:imag)?e\/?/','', $widget['logo'] ) ); ?>" alt="logo <?= $widget['projet']; ?>" />
                                        <div class="media-body">
                                                <h1 id="titre-projet" class="mt-0"><?php echo ( $widget['info'] ) ? $widget['titre'] . ' <div id="info-button" class="btn btn-outline-info btn-sm border-0" data-mime-info="' . $widget['info'] . '"><i class="fas fa-info-circle"></i></div>' : $widget['titre']; ?></h1>
                                        </div>
                                </div>

                                <div class="row">
                                        <div class="col-md-6">
                                                <div id="description"><?= $widget['description']; ?></div>
                                        </div>
                                        <div class="col-md-6">
                                                <div id="aide" class="well well-lg hidden-sm-down">
                                                        <h3><?= $aide['titre']; ?></h3>
                                                        <div id="aide-txt" class="hiden-sm-down">
                                                                <p><?= $aide['description']; ?></p>
                                                        </div>
                                                </div>
                                        </div>
                                </div>

                                <div id="formulaire" class="row mb-3 bloc-top">
                                        <form id="form-observateur" role="form" autocomplete="on">
                                                <h2><?= $observateur['titre']; ?></h2>
                                                <!--la partie tb-navigation vient du widget stats http://svn.tela-botanica.net/websvn/filedetails.php?repname=eFlore%2FApplications.cel&path=%2Ftrunk%2Fwidget%2Fmodules%2Fstats%2Fsquelettes%2Fstats_utilisateur.tpl.html
                                                la partie contenu-souce vient de http://svn.tela-botanica.net/websvn/filedetails.php?repname=Applications.reseau&path=%2Ftrunk%2Fwidget%2Fmodules%2Fnavigation%2Fsquelettes%2Fbootstrap3.tpl.php
                                                le javascript auth.js vient de http://svn.tela-botanica.net/websvn/filedetails.php?repname=Applications.reseau&path=%2Ftrunk%2Fresources%2Fjs%2Fnavigation.js
                                                de l'aide dans la partie Intégration dans l'interface (applications AJAX) de https://www.tela-botanica.org/wikini/DevInformatiques/wakka.php?wiki=MemoIntegrationSSO-->
                                                <!-- prod : -->
                                                <!-- <div id="tb-navigation" data-courant="widget-cel-saisie2" data-squelette="navigation" data-mode="prod"> -->
                                                <!-- beta (test) :-->
                                                <div id="tb-navigation" data-courant="widget-cel-saisie2" data-squelette="navigation" data-mode="test">
                                                <!-- dev (localhost) : -->
                                                <!-- <div id="tb-navigation" data-courant="widget-cel-saisie2" data-squelette="navigation" data-mode="local"> -->
                                                        <div class="navbar-default mb-3" id="tb-navbar">
                                                                <div class="nav navbar-nav navbar-right row">
                                                                        <div id="bouton-connexion" class="volet col-md-6 col-sm-8">
                                                                                <label for="bouton-connexion"><?= $observateur['compte']; ?></label>
                                                                                <a id="connexion" href="<?= $authTpl; ?>" class="btn btn-success  mr-1 mb-1" taget="_blank"><?= $observateur['connexion']; ?></a>
                                                                                <a id="bouton-inscription" href="https://beta.tela-botanica.org/test/inscription" class="btn btn-primary mr-1 mb-1" taget="_blank"><?= $observateur['inscription']; ?></a>
                                                                        </div>
                                                                        <div id="creation-compte" class="volet col-md-6 col-sm-8">
                                                                                <label for="creation-compte"><?= $observateur['noninscription']; ?></label>
                                                                                <a id="bouton-anonyme" href="#" class="btn btn-info mr-1 mb-1"><?= $observateur['nonconnexion']; ?></a>
                                                                        </div>
                                                                        <div id="utilisateur-connecte" class="volet hidden">
                                                                                <label for="utilisateur-connecte"><?= $observateur['bienvenue']; ?></label>
                                                                                <a href="#" class="list-tool btn btn-large btn-primary volet-toggle" data-toggle="volet">
                                                                                        <span id="nom-complet"></span> <!-- <i class="fas fa-caret-down"></i> -->
                                                                                </a>
                                                                                <div class="volet-menu hidden">
                                                                                        <div id="profil-utilisateur">
                                                                                                <a href="https://beta.tela-botanica.org/test/inscription" taget="_blank"><?= $observateur['profil']; ?></a>
                                                                                        </div>
                                                                                        <div id="deconnexion"><a href="#"><?= $observateur['deconnexion']; ?></a></div>
                                                                                </div>
                                                                        </div>
                                                                </div>
                                                        </div>
                                                </div>

                                                <div id="anonyme" class="mb-3 hidden">
                                                        <div id="zone-courriel" class="row">
                                                                <div class="control-group col-md-6">
                                                                        <label for="courriel" class="col-sm-8 obligatoire" title="<?= $observateur['courriel-title']; ?>">
                                                                                <i class="fa fa-envelope" aria-hidden="true"></i>
                                                                                <?= $observateur['courriel']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <input id="courriel" name="courriel" class="form-control" type="email" title="<?= $observateur['courriel-title']; ?> ">
                                                                                <input id="id_utilisateur" name="id_utilisateur" type="hidden">
                                                                        </div>
                                                                </div>

                                                                <div id="zone-courriel-confirmation" class="control-group col-md-6 hidden">
                                                                        <label for="courriel_confirmation" class="col-sm-8 obligatoire" title="Veuillez confirmer le courriel.">
                                                                                <i class="fa fa-envelope" aria-hidden="true"></i>
                                                                                <?= $observateur['courriel-confirmation']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8">
                                                                                <input id="courriel_confirmation" name="courriel_confirmation" class="form-control" type="email">
                                                                        </div>
                                                                </div>
                                                        </div>

                                                        <div id="zone-prenom-nom" class="row hidden">
                                                                <div class="control-group col-md-6">
                                                                        <label for="prenom" class="col-sm-8">
                                                                                <i class="fa fa-user" aria-hidden="true"></i>
                                                                                <?= $observateur['prenom']; ?>
                                                                        </label>
                                                                        <div class="input-group col-sm-8">
                                                                                <input id="prenom" name="prenom" class="form-control" type="text">
                                                                        </div>
                                                                </div>
                                                                <div class="control-group col-md-6">
                                                                        <label for="nom" class="col-sm-8">
                                                                                <i class="fa fa-user" aria-hidden="true"></i>
                                                                                <?= $observateur['nom']; ?>
                                                                        </label>
                                                                        <div class="input-group col-sm-8">
                                                                                <input id="nom" name="nom" class="form-control" type="text">
                                                                        </div>
                                                                </div>
                                                        </div>
                                                </div>
                                        </form>

                                        <!-- Messages d'erreur du formulaire-->
                                        <div class="zone-alerte">
                                                <div id="dialogue-bloquer-copier-coller" class="alert alert-info alert-block hidden">
                                                        <a class="close">×</a>
                                                        <h4 class="alert-heading"><?= $observateur['alertcc-title']; ?></h4>
                                                        <p><?= $observateur['alertcc']; ?></p>
                                                </div>
                                                <div id="dialogue-utilisateur-non-identifie" class="alert alert-warning alert-block hidden">
                                                        <a class="close">×</a>
                                                        <h4 class="alert-heading"><?= $observateur['alertni-title']; ?></h4>
                                                        <p><?= $observateur['alertni']; ?></p>
                                                </div>
                                                <div id="dialogue-geoloc-ko" class="alert alert-warning alert-block hidden">
                                                        <a class="close">×</a>
                                                        <h4 class="alert-heading"><?= $observateur['alertgk-title']; ?></h4>
                                                        <p><?= $observateur['alertgk']; ?></p>
                                                </div>
                                        </div>

                                        <form id="form-observation" role="form" autocomplete="on" class="bloc-top">
                                                <h2><?= $observation['titre']; ?></h2>
                                                <div id="zone-observation" class="row">
                                                        <div class="col-md-6">

                                                                <div class="">
                                                                        <label for="geolocalisation" class="col-sm-8 obligatoire" title="<?= $observateur['courriel-title']; ?>">
                                                                                <i class="fa fa-street-view" aria-hidden="true"></i>
                                                                                <?= $observation['geolocalisation']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <input id="geolocalisation" name="geolocalisation" type="hidden">

                                                                                <!-- retirer "ok" après test -->
                                                                                <input type="hidden" id="geoloc" name="geoloc" value="ok" style="display:none">
                                                                                <input type="hidden" id="pays" name="pays" value="" style="display:none">
                                                                                <input type="hidden" id="commune-nom" name="commune-nom" value="" style="display:none">
                                                                                <input type="hidden" id="latitude" name="latitude" value="0.00000" style="display:none">
                                                                                <input type="hidden" id="longitude" name="longitude" value="0.00000" style="display:none">
                                                                                <input type="hidden" id="commune-insee" name="commune-insee" value="" style="display:none">
                                                                                <input type="hidden" id="lieudit" name="lieudit" value="" style="display:none">
                                                                                <input type="hidden" id="station" name="station" value="" style="display:none">
                                                                                <input type="hidden" id="altitude" name="altitude" value="" style="display:none">
                                                                                <tb-geolocation-element id="tb-geolocation"></tb-geolocation-element>
                                                                        </div>
                                                                </div>

                                                                <div class="">
                                                                        <label for="milieu" class="col-sm-8">
                                                                                <i class="fa fa-street-view" aria-hidden="true"></i>
                                                                                <?= $observation['milieu']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <?php if ( 0 < count( (array) $widget['milieux'] ) ) :?>
                                                                                        <select id="milieu" class="form-control" >
                                                                                                <?php foreach ( $widget['milieux'] as $milieu ) :?>
                                                                                                        <option value="<?= $milieu; ?>"><?= $milieu; ?></option>
                                                                                                <?php endforeach; ?>
                                                                                        </select>
                                                                                <?php else : ?>
                                                                                        <input id="milieu" name="milieu" class="form-control" type="text" placeholder="<?= $observation['milieu-ph']; ?>">
                                                                                <?php endif; ?>
                                                                        </div>
                                                                </div>

                                                        </div>

                                                        <div class="col-md-6">

                                                                <div class="control-group">
                                                                        <label for="date_releve" class="col-sm-8 obligatoire" title="">
                                                                                <i class="fa fa-calendar" aria-hidden="true"></i>
                                                                                <?= $observation['date']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <input type="date" id="date_releve" name="date_releve" class="form-control" max="<?= date('Y-m-d', time()); ?>" placeholder="jj/mm/aaaa" title="jj/mm/aaaa" required>
                                                                        </div>
                                                                </div>

                                                                <?php if( ( $widget['type_especes'] === 'referentiel' || $widget['type_especes'] === '' ) && $widget['referentiel'] === '' ) : ?>
                                                                        <div class="control-group">
                                                                                <label for="referentiel" class="col-sm-8 obligatoire" title="">
                                                                                        <i class="fa fa-book" aria-hidden="true"></i>
                                                                                        <?= $observation['referentiel']; ?>
                                                                                </label>
                                                                                <div class="col-sm-8 mb-3">
                                                                                        <select id="referentiel" class="form-control" >
                                                                                                <option value="bdtfxr" selected="selected" title="Trachéophytes de France métropolitaine">Métropole (index réduit)</option>
                                                                                                <option value="bdtfx" title="Trachéophytes de France métropolitaine">Métropole (BDTFX)</option>
                                                                                                <option value="bdtxa" title="Trachéophytes des Antilles">Antilles françaises (BDTXA)</option>
                                                                                                <option value="bdtre" title="Trachéophytes de La Réunion">Réunion (BDTRE)</option>
                                                                                                <option value="aublet" title="Guyane">Guyane (AUBLET2)</option>
                                                                                                <option value="florical" title="Nouvelle-Calédonie">Nouvelle-Calédonie (FLORICAL)</option>
                                                                                                <option value="isfan" title="Afrique du Nord">Afrique du Nord (ISFAN)</option>
                                                                                                <option value="apd" title="Afrique de l'Ouest et du Centre">Afrique de l'Ouest et du Centre (APD)</option>
                                                                                                <option value="lbf" title="Liban">Liban (LBF)</option>
                                                                                                <option value="autre" title="Autre/Inconnu">Autre/Inconnu</option>
                                                                                        </select>
                                                                                </div>
                                                                        </div>
                                                                <?php else : ?>
                                                                        <input id="referentiel" name="referentiel" value="<?= $widget['referentiel']; ?>" type="hidden">
                                                                <?php endif; ?>

                                                                <div class="control-group">
                                                                        <label for="taxon" class="col-sm-8 obligatoire" title="">
                                                                                <i class="fa fa-leaf" aria-hidden="true"></i>
                                                                                <?= $observation['espece']; ?><?php if ( $widget['referentiel'] !== '' && $widget['referentiel'] !== NULL ) echo " (" . $widget['referentiel'] . ")"; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <input id="taxon" name="taxon" class="form-control" type="text" required>
                                                                        </div>
                                                                </div>

                                                                <div class="control-group">
                                                                        <label for="certitude" class="col-sm-8 obligatoire" title="">
                                                                                <i class="fa fa-question" aria-hidden="true"></i>
                                                                                <?= $observation['certitude']; ?>
                                                                        </label>
                                                                        <div class="col-sm-8 mb-3">
                                                                                <select id="certitude" name="certitude" class="form-control">
                                                                                        <option value="aDeterminer" ><?= $observation['certADet']; ?></option>
                                                                                        <option value="douteuse" ><?= $observation['certDout']; ?></option>
                                                                                        <option value="certaine" selected="selected" ><?= $observation['certCert']; ?></option>
                                                                                </select>
                                                                        </div>
                                                                </div>
                                                                <div class="">
                                    <label for="notes" class="col-sm-8" title="">
                                        <i class="fa fa-pen" aria-hidden="true"></i>
                                        <?= $observation['notes']; ?>
                                    </label>
                                    <div class="col-sm-8 mb-3">
                                        <textarea id="notes" form="form-observation" class="col-md-12" rows="7" name="notes" placeholder="<?= $observation['notes_ph']; ?>"></textarea>
                                    </div>
                                </div>

                                                        </div>
                                                </div>
                                        </form>

                                        <!-- Champs supplémentaires -->
                                        <?php if ( isset($widget['chpSupp'] ) && 0 < count( (array) $widget['chpSupp'] ) ) : ?>
                                                <form id="form-supp"  class="bloc-top" role="form" autocomplete="on">
                                                        <h2><?= $chpsupp['titre']; ?></h2>
                                                        <div id="zone-supp" class="row">
                                                                <div class="col-md-6">

                                                                        <?php foreach( $widget['chpSupp'][ $widget['projet'] ]['champs-supp'] as $champ ) : ?>
                                                                                <?php
                                                                                        $min         = ( $champ['fieldValues']['min'] )? ' min="' . $champ['fieldValues']['min'] . '"':'';
                                                                                        $max         = ( $champ['fieldValues']['max'] )? ' max="' . $champ['fieldValues']['max'] . '"':'';
                                                                                        $step        = ( $champ['fieldValues']['step'] )? ' step="' . $champ['fieldValues']['step'] . '"':'';
                                                                                        $default     = ( $champ['fieldValues']['default'] )? ' value="' . $champ['fieldValues']['default'] . '"':'';
                                                                                        $description = ( $champ['description'] )? ' title="' . $champ['description'] . '"':'';
                                                                                        $placeholder = ( $champ['fieldValues']['placeholder'] )? ' placeholder="' . $champ['fieldValues']['placeholder'] . '"':'';
                                                                                        $required    = '';
                                                                                        $mandatory   = '';
                                                                                        $pattern     = '';
                                                                                        $obs_radio   = '';
                                                                                        $help        = '';
                                                                                        $help_button = '';

                                                                                        if( $champ['help'] ) {
                                                                                                $help = ' and-help';
                                                                                                $help_button = ' <div class="help-button help-' . $champ['key'] . ' btn btn-outline-info btn-sm border-0" data-key="' . $champ['key'] . '" data-name="' . $champ['name'] . '" data-mime-type="' . $champ['help'] . '"><i class="fas fa-info-circle"></i></div>';
                                                                                        }

                                                                                        if( $champ['mandatory'] ) {
                                                                                                // Attr required
                                                                                                $required  = ' required';
                                                                                                // class="obligatoire"
                                                                                                $mandatory = ' obligatoire';
                                                                                        }

                                                                                        // if( 'date' === $champ['element'] ) {
                                                                                        //      $pattern    = ' pattern="(^(((0[1-9]|1[0-9]|2[0-8])[\/](0[1-9]|1[012]))|((29|30|31)[\/](0[13578]|1[02]))|((29|30)[\/](0[4,6,9]|11)))[\/](19|[2-9][0-9])\d\d$)|(^29[\/]02[\/](19|[2-9][0-9])(00|04|08|12|16|20|24|28|32|36|40|44|48|52|56|60|64|68|72|76|80|84|88|92|96)$)"';
                                                                                        // }

                                                                                        switch( $champ['element'] ) {
                                                                                                case 'radio':
                                                                                                case 'checkbox': ?>
                                                                                                        <div class="control-group <?= $champ['element']; ?> mb-3"<?php echo $description . $required; ?>>
                                                                                                                <div class="col-sm-8 list-label<?php echo $help . $mandatory; ?>">
                                                                                                                        <?= $champ['name'] . $help_button; ?>
                                                                                                                </div>
                                                                                                                <div class="col-sm-8">

                                                                                                                        <?php foreach ( $champ['fieldValues']['listValue'] as $i => $list_value ) : ?>

                                                                                                                                        <?php
                                                                                                                                                $checked = '';
                                                                                                                                                if ( '#' === substr( $list_value, -1 ) ) :
                                                                                                                                                        $checked = ' checked';
                                                                                                                                                        $list_value = substr( $list_value, 0, -1 );
                                                                                                                                                endif;
                                                                                                                                        ?>

                                                                                                                                        <?php if( 'other' !== $list_value ) : ?>
                                                                                                                                                <label for="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>" class="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>">
                                                                                                                                                        <input type="<?= $champ['element']; ?>" id="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>" name="<?= $champ['key']; ?>" value="<?= $list_value; ?>"<?= $checked; ?> class="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>" data-label="<?= $champ['name']; ?>">
                                                                                                                                                        <?= $list_value; ?>
                                                                                                                                                </label>
                                                                                                                                        <?php else : ?>
                                                                                                                                                <label for="other-<?= $champ['key']; ?>">
                                                                                                                                                        <input type="<?= $champ['element']; ?>" id="other-<?= $champ['key']; ?>" name="<?= $champ['key']; ?>" value="other" class="other" data-label="<?= $champ['name']; ?>" data-element="<?= $champ['element']; ?>">
                                                                                                                                                        Autre
                                                                                                                                                </label>
                                                                                                                                        <?php endif; ?>

                                                                                                                        <?php endforeach; ?>

                                                                                                                </div>
                                                                                                        </div>
                                                                                                <?php break;

                                                                                                case 'list-checkbox': ?>
                                                                                                        <div class="multiselect <?php echo $champ['element'] . $help; ?>">
                                                                                                                <label class="col-sm-8<?= $mandatory; ?>"><?= $champ['name'] . $help_button; ?></label>
                                                                                                                <div class="control-group col-sm-8 mb-3">
                                                                                                                        <div class="selectBox">
                                                                                                                                <select class="form-control list-checkbox" id="list-checkbox-<?= $champ['key']; ?>"<?php echo $description . $required; ?> class="form-control">
                                                                                                                                        <option>Plusieurs choix possibles</option>
                                                                                                                                </select>
                                                                                                                                <div class="overSelect"></div>
                                                                                                                        </div>
                                                                                                                        <div class="checkboxes hidden">
                                                                                                                                <?php foreach ( $champ['fieldValues']['listValue'] as $i => $list_value ) : ?>

                                                                                                                                        <?php
                                                                                                                                                $checked = '';
                                                                                                                                                if ( '#' === substr( $list_value, -1 ) ) :
                                                                                                                                                        $checked = ' checked';
                                                                                                                                                        $list_value = substr( $list_value, 0, -1 );
                                                                                                                                                endif;
                                                                                                                                        ?>

                                                                                                                                        <?php if( 'other' !== $list_value ) : ?>
                                                                                                                                                <label for="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>">
                                                                                                                                                        <input type="checkbox" id="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>" name="<?= $champ['key']; ?>" value="<?= $list_value; ?>"<?= $checked; ?> class="<?php echo $champ['fieldValues']['cleanListValue'][$i]; ?>" data-label="<?= $champ['name']; ?>">
                                                                                                                                                        <?= $list_value; ?>
                                                                                                                                                </label>
                                                                                                                                        <?php else : ?>
                                                                                                                                                <label for="other-<?= $champ['key']; ?>">
                                                                                                                                                        <input type="checkbox" id="other-<?= $champ['key']; ?>" name="<?= $champ['key']; ?>" value="other" class="other" data-label="<?= $champ['name']; ?>" data-element="<?= $champ['element']; ?>">
                                                                                                                                                        Autre
                                                                                                                                                </label>
                                                                                                                                        <?php endif; ?>

                                                                                                                                <?php endforeach; ?>

                                                                                                                        </div>
                                                                                                                </div>
                                                                                                        </div>
                                                                                                <?php break;

                                                                                                case 'select': ?>
                                                                                                        <label for="<?= $champ['key']; ?>" class="col-sm-8<?= $mandatory; ?>"<?= $description; ?>><?= $champ['name'] . $help_button; ?></label>
                                                                                                        <div class="champ col-sm-8 mb-3">
                                                                                                                <div class="select-wrapper add-field-select <?php echo $champ['element'] . $help; ?>">
                                                                                                                        <select name="<?= $champ['key']; ?>" id="<?= $champ['key']; ?>" class="<?= $champ['key']; ?> form-control"<?= $required; ?> data-label="<?= $champ['name']; ?>">

                                                                                                                                <?php foreach ( $champ['fieldValues']['listValue'] as $list_value ) : ?>

                                                                                                                                        <?php
                                                                                                                                                $selected = '';
                                                                                                                                                if ( '#' === substr( $list_value, -1 ) ) :
                                                                                                                                                        $selected = ' selected="selected"';
                                                                                                                                                        $list_value = substr( $list_value, 0, -1 );
                                                                                                                                                endif;
                                                                                                                                        ?>

                                                                                                                                        <?php if( 'other' !== $list_value ) : ?>
                                                                                                                                                <option value="<?= $list_value; ?>"<?= $selected; ?>>
                                                                                                                                                        <?php echo ucfirst( $list_value ); ?>
                                                                                                                                                </option>
                                                                                                                                        <?php else : ?>
                                                                                                                                                <option class="other form-control is-select" value="other" data-element="<?= $champ['element']; ?>">Autre</option>
                                                                                                                                        <?php endif; ?>

                                                                                                                                <?php endforeach; ?>

                                                                                                                        </select>
                                                                                                                </div>
                                                                                                        </div>
                                                                                                <?php break;

                                                                                                case 'textarea': ?>
                                                                                                        <div class="control-group">
                                                                                                                <label for="<?= $champ['key']; ?>" class="col-sm-8<?php echo $help . $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label>
                                                                                                                <div class="col-sm-8 mb-3">
                                                                                                                        <textarea type="<?= $champ['element']; ?>" id="<?= $champ['key']; ?>" name="<?= $champ['key']; ?>" class="<?= $champ['key'] . $help; ?> form-control" <?php echo $description . $placeholder . $required; ?> data-label="<?= $champ['name']; ?>"></textarea>
                                                                                                                </div>
                                                                                                        </div>
                                                                                                <?php break;

                                                                                                case 'range': ?>
                                                                                                        <div class="control-group">
                                                                                                                <label for="<?= $champ['key']; ?>" class="col-sm-8<?= $help . $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label>
                                                                                                                <div class="col-sm-8 mb-3 row">
                                                                                                                        <?php
                                                                                                                                $div_range_min_max = '';

                                                                                                                                if ( $champ['fieldValues']['min'] )  {
                                                                                                                                        $div_range_min_max =
                                                                                                                                                "<p class=\"col-sm-2 range-values text-center font-weight-bold\">".
                                                                                                                                                        "Min " . $champ['fieldValues']['min'] .
                                                                                                                                                "</p>";
                                                                                                                                }

                                                                                                                                $div_range_min_max .= '<div class="range-live-value range-values text-center font-weight-bold col-sm-';

                                                                                                                                if ( $champ['fieldValues']['min'] && $champ['fieldValues']['max'] ) {
                                                                                                                                        $div_range_min_max .= '8';
                                                                                                                                } elseif ( $champ['fieldValues']['min'] || $champ['fieldValues']['max'] ) {
                                                                                                                                        $div_range_min_max .= '10';
                                                                                                                                } else {
                                                                                                                                        $div_range_min_max .= '12';
                                                                                                                                }

                                                                                                                                $div_range_min_max .= '"></div>';

                                                                                                                                if( $champ['fieldValues']['max'] ) {
                                                                                                                                        $div_range_min_max .=
                                                                                                                                                "<p class=\"col-sm-2 range-values text-center font-weight-bold\">".
                                                                                                                                                        "Max " . $champ['fieldValues']['max'] .
                                                                                                                                                "</p>";
                                                                                                                                }

                                                                                                                                echo $div_range_min_max;
                                                                                                                        ?>
                                                                                                                        <input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="custom-range <?= $champ['key'] . $help; ?> form-control" <?= $description . $placeholder . $step . $default . $min . $max . $required; ?> data-label="<?= $champ['name']; ?>">
                                                                                                                </div>
                                                                                                        </div>
                                                                                                        <?php break;

                                                                                                case 'number':
                                                                                                case 'date': ?>
                                                                                                        <div class="control-group">
                                                                                                                <label for="<?= $champ['key']; ?>" class="col-sm-8<?php echo $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label>
                                                                                                                <div class="col-sm-8 mb-3">
                                                                                                                        <input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="<?= $champ['key'] . $help; ?> form-control"<?php echo  $pattern . $description . $placeholder . $step . $default . $min . $max . $required; ?> data-label="<?= $champ['name']; ?>">
                                                                                                                </div>
                                                                                                        </div>
                                                                                                        <?php break;

                                                                                                case 'text' :
                                                                                                case 'email':
                                                                                                default: ?>
                                                                                                        <div class="control-group">
                                                                                                                <label for="<?= $champ['key']; ?>" class="col-sm-8<?= $mandatory; ?>" <?= $description; ?>><?= $champ['name'] . $help_button; ?></label>
                                                                                                                <div class="col-sm-8 mb-3">
                                                                                                                        <input type="<?= $champ['element']; ?>" name="<?= $champ['key']; ?>" class="<?= $champ['key'] . $help; ?> form-control" <?php echo $description . $placeholder . $required; ?> data-label="<?= $champ['name']; ?>">
                                                                                                                </div>
                                                                                                        </div>
                                                                                                <?php break;
                                                                                        }
                                                                                ?>

                                                                        <?php endforeach; ?>
                                                                </div>
                                                        </div>
                                                </form>
                                        <?php endif; ?><!-- Fin champs supplémentaires -->

                                        <form id="form-upload" class="form-horizontal bloc-top" action="<?= $url_ws_upload ?>" method="post" enctype="multipart/form-data">
                                                <h2><?= $image['titre']; ?></h2>
                                                <p class="miniature-info" class="discretion help-inline">
                                                        <?= $image['aide']; ?>
                                                </p>
                                                <div id ="photos-conteneur" class="control-group">
                                                        <div>
                                                                <label for="fichier" class="label-file btn btn-large btn-info mb-3">
                                                                        <span class="label-text"><i class="fas fa-download"></i> <?= $image['ajouter']; ?></span>
                                                                        <input type="file" id="fichier" name="fichier" class="input-file" accept="image/jpeg" multiple>
                                                                        <input type="hidden" name="MAX_FILE_SIZE" value="5242880">
                                                                </label>
                                                        </div>

                                                        <div id="miniatures"></div>
                                                        <p class="miniature-msg" class="span12">&nbsp;</p>
                                                </div>
                                        </form>

                                        <div id="image" class="row"></div>
                                </div>

                                <!-- Bouton cr&ation d'une obs -->
                                <div class="row mb-3">
                                        <div class="centre" title="<?= $resume['creer-title']; ?>">
                                                <button id="ajouter-obs" class="btn btn-primary"><i class="fas fa-check-square"></i> <?= $resume['creer']; ?></button>
                                        </div>
                                </div>

                                <!-- Messages d'erreur du formulaire-->
                                <div class="row">
                                        <div class="zone-alerte">
                                                <div id="dialogue-bloquer-creer-obs" class="alert alert-warning alert-block hidden">
                                                        <a class="close">×</a>
                                                        <h4 class="alert-heading"><?= $resume['alert10max']; ?></h4>
                                                        <p><?= $resume['alert10max-desc']; ?></p>
                                                </div>
                                        </div>
                                        <div class="zone-alerte">
                                                <div id="dialogue-form-invalide" class="alert alert-warning alert-block hidden">
                                                        <a class="close">×</a>
                                                        <h4 class="alert-heading"><?= $resume['alertchp']; ?></h4>
                                                        <p><?= $resume['alertchp-desc']; ?></p>
                                                </div>
                                        </div>
                                </div>

                                <!-- Affiche le tableau récapitualif des observations ajoutées -->
                                <div id="zone-liste-obs" class="bloc-top hidden">
                                        <div class="alert alert-info">
                                                <h2 class="transmission-title"><strong><?= $resume['titre']; ?> <span class="obs-nbre badge badge-info">0</span></strong></h2>
                                                <button id="transmettre-obs" class="btn btn-primary droite" disabled="disabled"
                                                        title="<?= $resume['trans-title']; ?>" type="button">
                                                        <?= $resume['trans']; ?>
                                                </button>
                                        </div>
                                        <div id="liste-obs" ></div>
                                        <div class="row">
                                                <div class="zone-alerte">
                                                        <div id="dialogue-zero-obs" class="alert alert-block hidden">
                                                                <a class="close">×</a>
                                                                <h4 class="alert-heading"><?= $resume['alert0obs']; ?></h4>
                                                                <p><?= $resume['alert0obs-desc']; ?></p>
                                                        </div>
                                                        <div id="dialogue-obs-transaction-ok" class="alert alert-success alert-block hidden">
                                                                <a class="close">×</a>
                                                                <h4 class="alert-heading"><?= $resume['info-trans']; ?></h4>
                                                                <div class="alert-txt"></div>
                                                        </div>
                                                        <div id="dialogue-obs-transaction-ko" class="alert alert-error alert-block hidden">
                                                                <a class="close">×</a>
                                                                <h4 class="alert-heading"><?= $resume['alerttrans']; ?></h4>
                                                                <div class="alert-txt"></div>
                                                        </div>
                                                </div>
                                        </div>
                                </div>

                                <!-- Fenêtres modales -->
                                <div id="chargement" class="modal-fenetre hidden">
                                        <div id="chargement-centrage" class="modal-contenu">
                                                <div class="progress progress-striped active">
                                                        <div id="barre-progression-upload" class="bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="10" style="">
                                                                        <span class="sr-only">0/10 <?= $resume['nbobs']; ?></span>
                                                                </div>
                                                </div>
                                                <p id="chargement-txt" style="color:white;font-size:1.5em;">
                                                        <?= $resume['transencours']; ?>
                                                </p>
                                        </div>
                                </div>

                                <!-- Templates HTML -->
                                <div id="tpl-transmission-ok" class="hidden">
                                        <p class="msg"><?= $resume['transok']; ?></p>
                                </div>
                                <div id="tpl-transmission-ko" class="hidden">
                                        <p class="msg"><?= $resume['transko']; ?></p>
                                </div>
                        </div>
                </div>
                <div id="help-modal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="help-modal-label" style="display: none;" aria-hidden="true">
                        <div class="modal-dialog modal-dialog-centered" role="document">
                                <div class="modal-content">
                                        <div class="modal-header">
                                                <h5 class="modal-title" id="help-modal-label"></h5>
                                                <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                                        <span aria-hidden="true">&times;</span>
                                                </button>
                                        </div>
                                        <div class="modal-body" id="print_content"></div>
                                        <div class="modal-footer">
                                                <button type="button" class="btn btn-secondary" data-dismiss="modal">Fermer</button>
                                        </div>
                                </div>
                        </div>
                </div>
                <!-- carto -->
                <?php if( $widget["type_localisation"] === 'point' ): ?>
                        <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app.js"></script>
                <?php elseif ( $widget["type_localisation"] === 'rue' ) : ?>
                        <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-custom-element.js"></script>
                <?php endif; ?>
                <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/tb-geoloc/tb-geoloc-lib-app_inputs.js"></script>
                <script type="text/javascript">
                        var tbGeolocation = document.getElementById( 'tb-geolocation' );

                        tbGeolocation.addEventListener( 'location', function( location ) {
                                console.log( location.detail );
                                var locationDatas = location.detail;
                                var latitude = '';
                                var longitude = '';
                                if ( undefined !== locationDatas.geometry.features ) {
                                        latitude = ( locationDatas.geometry.features[0].geometry.coordinates[0][1] + locationDatas.geometry.features[0].geometry.coordinates[1][1]) / 2;
                                        longitude = ( locationDatas.geometry.features[0].geometry.coordinates[0][0] + locationDatas.geometry.features[0].geometry.coordinates[1][0]) / 2;
                                } else  if ( undefined !== locationDatas.geometry.coordinates ) {
                                        latitude = locationDatas.geometry.coordinates[1];
                                        longitude = locationDatas.geometry.coordinates[0];
                                }

                                document.getElementById('pays').value = locationDatas.osmCountry;
                                document.getElementById('commune-nom').value = locationDatas.locality;
                                // À modifier quand on recevra les codes insee
                                document.getElementById('commune-insee').value = locationDatas.osmPostcode;
                                document.getElementById('latitude').value = latitude;
                                document.getElementById('longitude').value = longitude;
                                document.getElementById('altitude').value = locationDatas.elevation;
                                document.getElementById('geoloc').value = 'ok';
                        });
                </script>

                <!-- Jquery -->
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/1.11.1/jquery-1.11.1.min.js"></script>

                <!-- Jquery UI : nécessaire pour le minicalendrier et l'auto-complétion -->
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/jquery-ui/1.11.0/js/jquery-ui.min.js"></script>
                <!-- <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/jquery-ui/1.11.0/js/datepicker-fr.js"></script> -->
                <!-- Jquery Plugins -->
                <!-- Jquery Validate : nécessaire pour la validation des formulaires -->
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/validate/1.11.1/jquery.validate.min.js"></script>
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/validate/1.11.1/additional-methods.min.js"></script>
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/validate/1.11.1/messages_fr.js"></script>
                <!-- Jquery Form :nécessaire pour l'upload des images -->
                <script type="text/javascript" src="https://resources.tela-botanica.org/jquery/form/3.51/jquery.form.min.js"></script>
                <!-- Bootstrap -->
                <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
                <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
                <!-- Authentification -->
                <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/auth.js"></script>
                <!-- Connexion, bloc de prévisualisation, date -->
                <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/WidgetSaisie.js"></script>
                <script type="text/javascript" src="<?= $url_base; ?>modules/saisie2/squelettes/js/champs-supp.js"></script>
                <script type="text/javascript">
                        //<![CDATA[
                                $( document ).ready( function() {

                                        // OMG un modèle objet !!
                                        var widget = new WidgetSaisie();

                                        //
                                        //
                                        //
                                        // La présence du parametre 'debug' dans l'URL enclenche le débogage
                                        widget.debug = <?= isset( $_GET['debug'] ) ? 'true' : 'false'; ?>;
                                        // La présence du parametre 'html5' dans l'URL enclenche les fonctions avancées HTML5
                                        widget.html5 = <?= isset($_GET['html5']) ? 'true' : 'false'; ?>;
                                        // Mot-clé du widget/projet
                                        widget.tagProjet = "WidgetSaisie";
                                        // Mots-clés à ajouter aux images
                                        widget.tagImg = "<?= isset($_GET['tag-img']) ? $_GET['tag-img'] : ''; ?>";
                                        widget.separationTagImg = "<?= isset($_GET['motcle']) && isset($_GET['tag-img']) ? ',' : ''; ?>";
                                        widget.tagImg = <?= isset($_GET['motcle']) ? "'".$_GET['motcle']."' + widget.separationTagImg + widget.tagImg" : 'widget.tagImg'; ?>;
                                        // Mots-clés à ajouter aux observations
                                        widget.tagObs = "<?= isset($_GET['tag-obs']) ? $_GET['tag-obs'] : ''; ?>";
                                        widget.separationTagObs = "<?= isset($_GET['projet']) && isset($_GET['tag-obs']) ? ',' : ''; ?>";
                                        widget.tagObs = <?= isset($_GET['projet']) ? "'".$_GET['projet']."' + widget.separationTagObs + widget.tagObs" : 'widget.tagObs'; ?>;
                                        // Précharger le formulaire avec les infos d'une observation
                                        widget.obsId = "<?= isset($_GET['id-obs']) ? $_GET['id-obs'] : ''; ?>";
                                        // URL du web service réalisant l'insertion des données dans la base du CEL.
                                        widget.serviceSaisieUrl = "<?= $url_ws_saisie; ?>";
                                        // URL du web service permettant de récupérer les infos d'une observation du CEL.
                                        widget.serviceObsUrl = "<?= $url_ws_obs; ?>";
                                        //
                                        //
                                        //

                                        // langue
                                        widget.langue = "<?= $widget['langue']; ?>";
                                        // Squelette d'URL du web service de l'annuaire.
                                        widget.serviceAnnuaireIdUrl = "<?= $url_ws_annuaire; ?>";
                                        // URL de l'icône du chargement en cours
                                        widget.chargementIconeUrl = "<?= $url_base; ?>modules/saisie/squelettes/defaut/img/icones/chargement.gif";
                                        // URL de l'icône du chargement en cours d'une image
                                        widget.chargementImageIconeUrl = "<?= $url_base; ?>modules/saisie/squelettes/defaut/img/icones/chargement-image.gif";
                                        // URL de l'icône du calendrier
                                        widget.calendrierIconeUrl = "<?= $url_base; ?>modules/saisie/squelettes/defaut/img/icones/calendrier.png";
                                        // URL de l'icône pour une photo manquante
                                        widget.pasDePhotoIconeUrl = "<?= $url_base; ?>modules/saisie/squelettes/defaut/img/icones/pasdephoto.png";

                                        // Code du référentiel utilisé pour les nom scientifiques.
                                        widget.nomSciReferentiel = "<?= strtolower( $widget['referentiel'] ); ?>";
                                        // Indication de la présence d'une espèce imposée
                                        widget.especeImposee = "<?= $espece_imposee; ?>";
                                        // Tableau d'informations sur l'espèce imposée
                                        widget.infosEspeceImposee = "<?= $infos_espece; ?>";
                                        // Nombre d'élément dans les listes d'auto-complétion
                                        widget.autocompletionElementsNbre = 20;
                                        // Indication de la présence d'un référentiel imposé
                                        widget.referentielImpose = "<?= $referentiel_impose; ?>";

                                        // URL du web service permettant l'auto-complétion des noms scientifiques
                                        widget.serviceAutocompletionNomSciUrl = "<?= $widget['especes']['url_ws_autocompletion_ns']; ?>?"+
                                                "masque={masque}&"+
                                                "recherche=etendue&"+
                                                "retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
                                                "ns.structure=au&"+
                                                "navigation.limite=" + widget.autocompletionElementsNbre;
                                        // Squelette d'URL du web service permettant l'auto-complétion des noms scientifiques
                                        widget.serviceAutocompletionNomSciUrlTpl = "<?= $widget['especes']['url_ws_autocompletion_ns_tpl']; ?>?"+
                                                "masque={masque}&"+
                                                "recherche=etendue&"+
                                                "retour.champs=famille,nom_retenu,nom_retenu_complet,num_taxonomique,nom_retenu.id&"+
                                                "retour.tri=alpharet&"+ // tri "à la CeL"
                                                "ns.structure=au&"+
                                                "navigation.limite=" + widget.autocompletionElementsNbre;
                                        // Nombre d'observations max autorisé avant transmission
                                        widget.obsMaxNbre = 10;
                                        // Durée d'affichage en milliseconde des messages d'informations
                                        widget.dureeMessage = 30000;
                                        //
                                        //
                                        //
                                        // Squelette d'URL du web service d'eFlore fournissant les noms de communes.
                                        widget.serviceNomCommuneUrl = "https://api.tela-botanica.org/service:eflore:0.1/osm/nom-commune?lon={lon}&lat={lat}";
                                        // Squelette d'URL du web service d'eFlore fournissant les noms de communes hors de France (localisation approximative).
                                        widget.serviceNomCommuneUrlAlt = "https://api.tela-botanica.org/service:eflore:0.1/wikipedia/nom-commune?lon={lon}&lat={lat}&nbre=1";
                                        // URL du marqueur à utiliser dans la carte Google Map
                                        widget.googleMapMarqueurUrl = "<?=$url_base?>modules/saisie/squelettes/defaut/img/marqueurs/epingle.png";
                                        //
                                        //
                                        //

                                        // Initialisation du bousin
                                        widget.init();
                                });
                        //]]>
                </script>

                <!-- Barre de navigation -->
                <?php if ( $bar ): ?>
                        <script src="<?= $url_script_navigation; ?>"></script>
                <?php endif; ?>
        </body>
</html>