Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 19 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This file is part of Herbier - Administration.                                                       |
// |                                                                                                      |
// | Foobar is free software; you can redistribute it and/or modify                                       |
// | it under the terms of the GNU General Public License as published by                                 |
// | the Free Software Foundation; either version 2 of the License, or                                    |
// | (at your option) any later version.                                                                  |
// |                                                                                                      |
// | Foobar is distributed in the hope that it will be useful,                                            |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
// | GNU General Public License for more details.                                                         |
// |                                                                                                      |
// | You should have received a copy of the GNU General Public License                                    |
// | along with Foobar; if not, write to the Free Software                                                |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: hba_manipulation.fonct.php,v 1.5 2007-08-22 14:33:44 jp_milcent Exp $
/**
* Fonctions de manipulation de la base de données Herbier.
*
* Fonctions permettant d'ajouter, modifier ou supprimer des informations dans la base de données Herbier.
*
*@package Herbier-Administration
*@subpackage Fonctions
//Auteur original :
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
*@copyright     Tela-Botanica 2000-2005
*@version       $Revision: 1.5 $ $Date: 2007-08-22 14:33:44 $
// +------------------------------------------------------------------------------------------------------+
*/

// +------------------------------------------------------------------------------------------------------+
// |                                           LISTE de FONCTIONS                                         |
// +------------------------------------------------------------------------------------------------------+

// +------------------------------------------------------------------------------------------------------+
// GESTION du MENU

function entete(&$un_herbier)
{
    $retour =   '<div id="hba_info">'."\n";
    
    // Gestion des infos
    $retour .=  '<h1>'.'Vous êtes'.'</h1>'."\n";
    // Affichage des droits
    if ($un_herbier->utilisateur->getAdminBool()) {
        $retour .=  '<p>'.'Administrateur de ce projet'.'</p>'."\n";
    } elseif ($un_herbier->utilisateur->getCoordBool()) {
        $retour .=  '<p>'.'Coordinateur de ce projet'.'</p>'."\n";
    } elseif ($un_herbier->utilisateur->getRedacBool()) {
        $retour .=  '<p>'.'Rédacteur de ce projet'.'</p>'."\n";
    }
    // Affichage du noms de l'institution
    /*
    if (is_object($une_organisation = $un_herbier->getOrganisation())) {
        $retour .=  '<dt>'.'Institution :'.'</dt>'."\n".'<dd>';
        if ($txt_court = raccourcirTexte($une_organisation->getNom(), HBA_LONGUEUR_ORG_NOM)) {
            $retour .= '<abbr title="'.$une_organisation->getNom().'">'.$txt_court.'</abbr>';
        } else {
            $retour .= $une_organisation->getNom();
        }
        $retour .=  '</dd>'."\n";
    }
    */
    
    // Gestion des menus
    if ($un_herbier->utilisateur->getDroit()) {
        $retour .=  '<ul>'."\n";
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_ANNULER).'">'.
                        'Accueil'.
                        '</a></li>'."\n";
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_HERBIER_AJOUT).'">'.
                    'Ajouter une institution (herbier)'.
                    '</a></li>'."\n";
        if ($un_herbier->utilisateur->getAdminBool()) {
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUVEAU_CORR).'">'.
                        'Inscrire un correspondant'.
                        '</a></li>'."\n";
        } elseif ($un_herbier->utilisateur->getCoordBool()) {
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUV_RED).'">'.
                        'Inscrire un rédacteur'.
                        '</a></li>'."\n";
        }
        $retour .=  '</ul>'."\n";
        // Gestion du menu contextuel
        $menu_contextuel = '';
        switch ($un_herbier->getAction()) {
            case NOUV_COLL : // 4
            case MOD_DESC : // 21
            case MOD_ADM : // 22
            case NOUV_TEAM : // 30
            case MOD_STAFF : // 32
            case NOUV_INDIC : // 40
            case MOD_NOTE : // 42
                $id_org = $un_herbier->organisation->getId();
                $menu_contextuel .= '<li><a href="'.
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_HERB, $id_org).'">'.
                                    'Retour à l\'institution'.
                                    '</a></li>'."\n";
                break;
            case MOD_HERB : // 20
            case MOD_ADM_V : // 26
            case MOD_DESC_V : // 27
            case SUPPR_COLL : // 29
            case NOUV_TEAM_V : // 31
            case MOD_STAFF_V : // 33
            case SUPPR_STAFF : // 34
            case NOUV_INDIC_V : // 41
            case SUPPR_NOTE : // 43
            case MOD_NOTE_V : // 44
            case HBA_ACTION_COLL_DEROULER : // 5
                $id_org = $un_herbier->organisation->getId();
                $menu_contextuel .= '<li><a href="'.
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_ADM, $id_org).'">'.
                                    'Modifier l\'institution'.
                                    '</a></li>'."\n".
                                    '<li><a href="'.
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_TEAM, $id_org).'">'.
                                    'Ajouter un membre à l\'équipe'.
                                    '</a></li>'."\n".
                                    '<li><a href="'.
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_COLL, $id_org).'">'.
                                    'Ajouter une collection'.
                                    '</a></li>'."\n";
                break;
        }
        if (!empty($menu_contextuel)) {
            $retour .=  '<hr class="clear"/>'."\n";
            $retour .=  '<ul>'."\n";
            $retour .=  $menu_contextuel;
            $retour .=  '</ul>'."\n";
        }
    }
    $retour .=  '</div>'."\n";
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// GESTION de l'ACCUEIL

// Affichage de l'accueil
function menu(&$un_herbier)
{
    $retour = '';
    
    // Message d'accueil et aide
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
        $retour .= '<h1>'.'Bienvenue sur la console d\'administration du projet Herbiers.'.'</h1>'."\n";
        $retour .= fournirAideAccueil();
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
    } else {
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
        $retour .= fournirAideAccueilOrganisation();
    }
    // Les herbiers de l'utilisateur courant
    $retour .= mesherbiers($un_herbier);
    
    // Les herbiers des correspondants
    if ($un_herbier->utilisateur->getAdminBool()) {
        $retour .= liste_corr($un_herbier);
    }
    
    // Les herbiers des rédacteurs
    if ($un_herbier->utilisateur->getCoordBool()) {
        $retour .= liste_red($un_herbier);
    }
    return $retour;
}

// Affichage des herbiers d'un utilisateur
function mesherbiers(&$un_herbier) 
{
    $retour = '';
    
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
        $retour .= '<p class="hba_attention">'.'Aucun herbier encore saisi !'.'</p>'."\n";
    } else {
        // Si l'utilisateur à saisi des herbiers : nous les affichons...
        $retour .=  '<div class="hba_liste_organisation">'."\n".
                    '<table>'."\n".
                    '<thead>'."\n".
                    '<tr>'."\n".'<th>'.'Ville'.'</th><th>'.'Institution'.'</th><th colspan="2">'.'Actions'.'</th>'."\n".'</tr>'."\n".
                    '</thead>'."\n";
        $retour .=  '<tbody>'."\n";
        foreach ($un_herbier->utilisateur->getOrganisationListe() as $valeur) {
            $retour .=  '<tr class="'.color_alterne(&$flag).'">'."\n";
            $retour .= '<td>'.$valeur->TOWN.'</td><td>'.$valeur->INSTITUTION_NAME.'</td>';
            
            // Gestion des actions
            $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, MOD_HERB, $valeur->ID_ORG).'">'.'modifier'.'</a></td>';
            // Protection de l'institution exemple
            if ($valeur->ID_ORG != HBA_EXEMPLE_ID) {
                $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, SUPPR_HERB, $valeur->ID_ORG).'"';
                $retour .= ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette institution ?'.'\');"';
                $retour .= '>'.'supprimer'.'</a></td>'."\n";
            }
            $retour .= '</tr>';
        }
        $retour .=  '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
    }
    // Si l'utilisateur est un coordinateur nous affichons les herbiers saisis par ses rédacteurs
    if ($un_herbier->utilisateur->getCoordBool()) {
        $retour .= leursherbiers($un_herbier);
    }
    
    return $retour;
}

// Renvoie les herbiers des rédacteurs dépendant d'un coordinateur
function leursherbiers(&$un_herbier)
{
    // Initialisation de variables
    $retour = '';
    
    // Recheche de la liste des rédacteurs
    $requete =  'SELECT U_NAME, U_SURNAME, U_ID '.
                'FROM '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
                'WHERE HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId().' '.
                'AND HC_ID_REDACTEUR = U_ID';
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    $id_utilisateur_courant_tmp = $un_herbier->utilisateur->getId();
    while ($ligne = mysql_fetch_object($resultat)) {
        $retour .= '<h2>'.'Herbiers de '.$ligne->U_NAME.' '.$ligne->U_SURNAME.'</h2>'."\n";
        $un_herbier->utilisateur->setId($ligne->U_ID);
        $retour .= mesherbiers($un_herbier)."\n";
    }
    $un_herbier->utilisateur->setId($id_utilisateur_courant_tmp);
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// GESTION de l'ORGANISATION (Institution)

function mod_herb(&$un_herbier)
{
    // Initialisation de variables
    $organisation_nom = $un_herbier->organisation->getNom();
    
    $retour = '<h1>'.'Édition d\'une institution'.' - '.$organisation_nom.'</h1>';
    $retour .= fournirAideOrganisation();
    $liste_equipe = team_liste($un_herbier);
    if ($liste_equipe != '') {
        $retour .= '<h1>'.'L\'équipe de l\'institution'.'</h1>';
        $retour .= fournirAideEquipe();
        $retour .= $liste_equipe;
    }
    $liste_coll = liste_coll($un_herbier);
    if ($liste_coll != '') {
        $retour .= '<h1>'.'Liste des collections de l\'institution'.'</h1>'."\n";
        $retour .= fournirAideCollection();
        $retour .= $liste_coll;
    }
    
    return $retour;
}

function nouveau(&$un_herbier)
{
    $retour = '<h1>'.'Saisie des renseignements administratifs d\'une institution'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
    form_administratif(&$form, $un_herbier);
    $javascript = 'onsubmit="javascript:return validateAndSubmitAdd(this);"';
    $retour .= $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), $javascript, 'liste');
    $retour .= '<div class="nettoyage">&nbsp;</div>'."\n";
    $form->finalise('un_form');
    return $retour;
}

// insertion des donnees administrative dans la base
// et des informations sur le correspondant
function nouveau_v(&$un_herbier)
{
    $retour = '';
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
    $form = $form->acquerir('HERBIERS_ORGANISATION');
    
    $id = $form->insertMySQL();
    if ($_POST['INSTITUTION_NAME'] == '') {
        $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $id, 'ID_ORG');
        form_administratif(&$form, $un_herbier);
        $retour .=  '<h1>'.'Vous devez saisir un nom d\'institution'.'</h1>'."\n";
        $retour .=  $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), 'onsubmit="javascript:return validateAndSubmitAdd(this);"');
        return $retour;
    }
    $une_organisation = new H_organisation();
    $une_organisation->setId($id);
    if (!$un_herbier->utilisateur->getAdminBool()) {
        $un_herbier->utilisateur->insererOrganisationListe($une_organisation);
    }
    return TRUE;
}

function form_administratif(&$form, &$un_herbier)
{
    // Définition des styles
    $form->style_general = 'hba_formulaire';
    $form->style_label = 'hba_label';
    $form->style_button = 'hba_bouton';
    $form->style_commentaire = 'hba_commentaire';
    $form->style_radiocheckbox = 'hba_radio';
    
    // Choix des champs
    $form->addChamps('INSTITUTION_NAME', 'Nom de l\'institution <span class="symbole_obligatoire">*</span> : ');
    $form->addCommentaire('Dans le champs "Nom de l\'institution", ne saisissez que le nom de l\'institution, ne saisissez pas l\'adresse ou l\'index herbariorum.');
    $form->addChamps('ADRESS_LINE', 'Adresse : ');
    $form->addChamps('INDEX_HERB', 'Index Herbariorum : ');
    $form->addCommentaire('<br />'.'Ne saisir que des chiffres, sans espace ( 54789 oui, F-54789 non )');
    $form->addChamps('ZIP', 'Code postal <span class="symbole_obligatoire">*</span> : ');
    $form->addChamps('TOWN', 'Ville : ');
    $form->addChamps('REGION', 'Région : ');
    $form->selectFromTable('COUNTRY_CODE par gen_COUNTRY', 'fr', 'GC_ID', 'GC_NAME', 'Pays : ');
    $form->addChamps('TEL', 'Téléphone : ');
    $form->addChamps('FAX', 'fax : ') ;
    $form->addCommentaire('Saisir l\'e-mail de l\'organisation (ex: accueil@organisation.org), pas de mail individuel.');
    $form->addChamps('EMAIL', 'E-mail : ');
    $form->addCommentaire('<br />'.'Un lien internet vers l\'institution, de la forme <b>http://www.mon_institution.org</b>.');
    $form->addChamps('HO_URL', 'URL : ');
    $form->addChamps('LOGO', 'Logo (URL vers un fichier graphique) : ');
    $form->addCommentaire('Indiquez ci-dessous tous les détails concernant l\'accès aux collections de l\'institution, comme les horaires d\'ouverture, les droits à acquitter...');
    $form->addChamps('ACCESS_RESTRICTION', 'Conditions d\'accès : ');
    $form->addCommentaire('<br />'.'Pensez à supprimer le contenu du champs ci-dessous si les informations que vous saisissez ne viennent pas de l\'Index Herbariorum, remplacez par votre nom.');
    $form->addChamps('SOURCE_DES_DONNEES', 'Source des informations');
    $form->addCommentaire('<strong><span class="symbole_obligatoire">'.'*'.'</span>'.' : '.'</strong>'.'champ obligatoire.');
        // Gestion des métadonnées
        gererMetaForm(&$form, &$un_herbier);
            
    if ($form->id != HBA_EXEMPLE_ID) {
        $form->submit('Valider', 'herbier_pere');
    }
    $form->annuler('Annuler', sprintf($un_herbier->url_action, HBA_ACTION_ANNULER));
}

function mod_adm($un_herbier)
{
    $retour = '<h1>'.'Modification d\'une institution'.' - '.$un_herbier->organisation->getNom().'</h1>';
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $un_herbier->organisation->getId(), 'ID_ORG');
    form_administratif(&$form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, MOD_ADM_V, $un_herbier->organisation->getId()));
    $form->finalise('un_form');
    return $retour;
}

function mod_adm_v(&$un_herbier)
{
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
    $form = $form->acquerir('HERBIERS_ORGANISATION');
    
    if (($_POST['gen_COUNTRY'] == 'fr') and (!checkZip($_POST['ZIP']))) {
        $retour .= checkvalue('Le code postal n\'a pas la forme adéquate', '');
        return $retour;
    }
    
    $form->updateMySQL('ID_ORG', $un_herbier->organisation->getId());
}

function suppr_herb(&$un_herbier)
{
    // Initialisation des variables
    $id_org = $un_herbier->organisation->getId();
    
    // Supression des collections (et par cascades des notes, indic...) des collections de l'organisation
    $requete =  'SELECT ID '.
                'FROM HERBIERS_COLLECTION '.
                'WHERE PARENT_ID = '.$id_org;
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    while ($ligne = mysql_fetch_object($resultat)) {
        suppr_coll($un_herbier, $ligne->ID);
    }
    
    // Suppression de l'organisation
    $requete = 'DELETE FROM HERBIERS_ORGANISATION WHERE ID_ORG = '.$id_org;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    
    // Supression de chaque membre de l'équipe (ou contact) de l'organisation
    $requete_01 = 'SELECT ID_STAFF '.
            'FROM HERBIERS_ont_un_staff '.
            'WHERE ID_ORG = '.$id_org;
    $resultat_01 = mysql_query($requete_01) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_01));
    while ($ligne_01 = mysql_fetch_object($resultat_01)) {
        $requete_02 =   'DELETE FROM HERBIERS_STAFF '.
                        'WHERE ID_STAFF = '.$ligne_01->ID_STAFF;
        mysql_query($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02));
    }
    // Suppression de la liste des équipiers (et/ou contacts) de l'organisation
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
                'WHERE ID_ORG = '.$id_org;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    
    // Suppression de l'organisation dans la liste des organisations (= herbiers) de l'utilisateur (HERBIERS_ADMINISTRER)
    $requete =  'DELETE FROM HERBIERS_ADMINISTRER '.
                'WHERE HA_ID_ORG = '.$id_org;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
}

// +------------------------------------------------------------------------------------------------------+
// GESTION de l'ÉQUIPE, d'un ÉQUIPIER et d'un CONTACT

function team_liste(&$un_herbier)
{
    $retour = '';
    
    $requete =  'SELECT HERBIERS_STAFF.* '.
                'from HERBIERS_STAFF, HERBIERS_ont_un_staff, HERBIERS_ORGANISATION '.
                'WHERE HERBIERS_ORGANISATION.ID_ORG = '.$un_herbier->organisation->getId().' '.
                'AND HERBIERS_ont_un_staff.ID_ORG = HERBIERS_ORGANISATION.ID_ORG '.
                'AND HERBIERS_STAFF.ID_STAFF = HERBIERS_ont_un_staff.ID_STAFF';
    
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) == 0) {
        $retour .= '<p class="hba_attention">'.'Aucune équipe renseignée !'.'</p>'."\n";
        return $retour;
    }
    $retour .= '<div class="hba_liste_equipe">'."\n";
    $retour .= '<table>'."\n";
    $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n";
    $retour .= '<tbody>'."\n";
    while ($ligne = mysql_fetch_object($resultat)) {
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td>'.$ligne->NOM.'</td><td>'.$ligne->PRENOM.'</td>'."\n";
        $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, MOD_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'">'.
                    'modifier'.'</a></td>'."\n";
        
        if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
            $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, SUPPR_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'" '.
                        ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer : '.$ligne->NOM.' '.$ligne->PRENOM.' ?'.'\');">'.
                        'supprimer'.'</a></td>'."\n";
        }
        $retour .= '</tr>'."\n";
    }
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
    
    return $retour;
}

function nouv_team(&$un_herbier)
{
    $retour = '<h1>'.'Ajout d\'un membre'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
    form_team($form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUV_TEAM_V, $un_herbier->organisation->getId()))."\n";
    $form->finalise('form_team');
    return $retour;
}

function nouv_team_v(&$un_herbier)
{
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
    $form = $form->acquerir('HERBIERS_STAFF');
    $un_herbier->organisation->insererMembreEquipe($form->insertMySQL());
}

function form_team(&$form , &$un_herbier)
{
    // Définition des styles
    $form->style_general = 'hba_formulaire';
    $form->style_label = 'hba_label';
    $form->style_button = 'hba_bouton';
    $form->style_commentaire = 'hba_commentaire';
    $form->style_radiocheckbox = 'hba_radio';
    
    // Propose par defaut l'adresse de l'organisation
    $requete =    'SELECT ADRESS_LINE, TOWN, ZIP '.
                'FROM HERBIERS_ORGANISATION '.
                'WHERE ID_ORG = '.$un_herbier->organisation->getId();
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    $ligne = mysql_fetch_object($resultat);
    
    $form->addChamps('NOM', 'Nom : ');
    $form->addChamps('PRENOM', 'Prénom : ');
    $form->addChamps('ADRESSE1', 'Adresse : ', $ligne->ADRESS_LINE);
    $form->addChamps('ADRESSE2', 'Adresse : ');
    $form->addChamps('CP', 'Code postal : ', $ligne->ZIP);
    $form->addChamps('VILLE', 'Ville : ', $ligne->TOWN);
    $form->addChamps('MAIL', 'email : ');
    $form->addChamps('TEL', 'Tél : ');
    $form->addChamps('FAX', 'Fax : ');
    $form->addChamps('FONCTION', 'Fonction : ');
    $form->radioEnum('CONTACT', 'La personne est-elle contact ? : ','non');
    // Gestion des métadonnées
        gererMetaForm(&$form, &$un_herbier);
        
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
        $form->submit('Valider');
    }
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
}

function suppr_staff(&$un_herbier)
{
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
                'WHERE ID_STAFF = '.$un_herbier->equipe->getId().' '.
                'AND ID_ORG = '.$un_herbier->organisation->getId();
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    // Verification que la fiche de herbiers_staff ai encore une utilite
    $requete = 'SELECT ID_STAFF FROM HERBIERS_ont_un_staff WHERE ID_STAFF = '.$un_herbier->equipe->getId();
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    // le membre n'est plus dans aucun herbier, on le supprime
    if (mysql_num_rows($resultat) == 0) {
        $requete = 'DELETE FROM HERBIERS_STAFF WHERE ID_STAFF = '.$un_herbier->equipe->getId();
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    }
}

function mod_staff(&$un_herbier)
{
    // Initialisation de variables
    $id_equipe = $un_herbier->equipe->getId();
    $id_org = $un_herbier->organisation->getId();
    
    // Création du formulaire de modification
    $retour = '<h1>'.'Modification d\'un membre de l\'équipe'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF', 'MOD', $id_equipe, 'ID_STAFF');
    form_team($form, $un_herbier);
    $url = sprintf($un_herbier->getUrlActionOrgEquipe(), MOD_STAFF_V, $id_org, $id_equipe);
    $retour .= $form->printForm($url);
    $form->finalise('form_staff');
    return $retour;
}

function mod_staff_v(&$un_herbier)
{
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
    $form = $form->acquerir('HERBIERS_STAFF');
    $form->updateMySQL('ID_STAFF', $un_herbier->equipe->getId());
}

// +------------------------------------------------------------------------------------------------------+
// GESTION des COLLECTIONS

function liste_coll(&$un_herbier)
{
    // Initialisation de variables
    $retour = '';
    $id_action = $un_herbier->getAction();
    $id_org = $un_herbier->organisation->getId();
    $id_coll = null;
    if (is_object($un_herbier->getCollection())) {
        $id_coll = $un_herbier->collection->getId();
    }
    
    $requete =  'SELECT NOM_COLLECTION,ID '.
                'FROM HERBIERS_COLLECTION '.
                'WHERE PARENT_ID = '.$id_org;
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    
    if (mysql_num_rows($resultat) == 0) {
        $retour .= '<p class="hba_attention">'.'Aucune collection renseignée !'.'</p>'."\n";
        return $retour;
    }
    $retour .=  '<div class="hba_liste_collection">'."\n".
                '<table>'."\n".
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th colspan="3">'.'Actions'.'</th></tr></thead>'."\n".
                '<tbody>'."\n";
    while ($ligne = mysql_fetch_object($resultat)) {
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
        $requete_indic =    'SELECT ID_INDIC '.
                            'FROM HERBIERS_INDIC '.
                            'WHERE ID = '.$ligne->ID;
        $resultat_indic = mysql_query($requete_indic) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_indic));
        if (mysql_num_rows($resultat_indic) > 0) {
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
                            '</a>'."\n";
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $ligne->ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
                            '</a>'."\n";
            if ($id_coll == $ligne->ID) {
                switch ($id_action) {
                    case HBA_ACTION_COLL_DEROULER :
                    case SUPPR_NOTE :
                    case MOD_NOTE :
                    case MOD_NOTE_V :
                        $retour .= $xhtml_fermer;
                    break;
                    default :
                        $retour .= $xhtml_ouvrir;
                }
            } else {
                $retour .= $xhtml_ouvrir;
            }
        }
        $retour .= '</td><td>';
        $retour .= $ligne->NOM_COLLECTION.'</td>';
        $retour .=  '<td><a href="'.
                    sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC, $id_org, $ligne->ID).
                    '">'.'modifier'.'</a></td>'."\n";
        if ($id_org != HBA_EXEMPLE_ID) {
            $retour .=  '<td><a href="'.
                        sprintf($un_herbier->getUrlActionOrgColl(), SUPPR_COLL, $id_org, $ligne->ID).
                        '" onclick="javascript:return confirm(\''.'Étes vous sûr de vouloir supprimer cette collection ?'.'\');">'.
                        'supprimer'.'</a>&nbsp;</td>'."\n";
        }
        $retour .=  '<td><a href="'.
                    sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC, $id_org, $ligne->ID).
                    '">'.'ajouter note'.'</a></td>'."\n";
        $retour .= '</tr>';
        
        switch ($id_action) {
            case HBA_ACTION_COLL_DEROULER :
            case SUPPR_NOTE :
            case MOD_NOTE :
            case MOD_NOTE_V :
                if ($id_coll == $ligne->ID) {
                    $retour .= '<tr class="hba_liste_note"><td colspan="5">'.liste_indic($un_herbier).'</td></tr>'."\n";
                }
                break;
        }
    }
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>';
    
    return $retour;
}

function nouv_coll(&$un_herbier)
{
    $retour = '<h1>'.'Ajout d\'une collection'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
    $form->style_general = 'insInputForm';
    form_herb_2($form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUVEAU_HERB4, $un_herbier->organisation->getId()))."\n";//, null, 'liste'
    $form->finalise('form_2');
    return $retour;
}

function form_herb_2(&$form, &$un_herbier)
{
    // Définition des styles
    $form->style_general = 'hba_formulaire';
    $form->style_label = 'hba_label';
    $form->style_button = 'hba_bouton';
    $form->style_commentaire = 'hba_commentaire';
    $form->style_radiocheckbox = 'hba_radio';
    
    // Choix des champs
    $form->addChamps('NOM_COLLECTION', 'Nom de la collection : ');
    $form->addChamps('COLLECTION_CODE', 'Sigle d\'usage de la collection : ');
    $form->addChamps('DESCRIPTION', 'Description générale : ');
    $form->radioFromTable('STATUT par HERBIERS_COLL_STATUT', 1, 'Statut de la collection : ');
    $form->addCommentaire('<strong>Notes sur les collecteurs</strong>');
    $form->addCommentaire('Les collecteurs doivent être séparés par un retour à la ligne (entrée).');
    $form->addCommentaire('Format : NOM, Prénom (notes) {date de naissance (lieu de naissance) - date de décès (lieu de décès)} [lieu de récolte, date de récolte;lieu de récole, date de récolte...]');
    $form->addCommentaire('Exemple : AARONSOHN, Aaron (2ème jeux après AAR) {?-1919} [IL,1905;PS,1906]');
    $form->addCommentaire('Pour les lieux de récolte, vous pouvez utiliser <a href="http://fr.wikipedia.org/wiki/ISO_3166-1" class="lien_ext">les codes ISO des pays</a>. '.
                'Pour les données inconnues, un point d\'interrogation. '.
                'Pour les dates, indiquer seulement l\'année sinon utiliser le format : jj/mm/aaaa');
    $form->addChamps('COLLECTEURS', 'Collecteurs : ');
    $form->addCommentaire('<b>Dates extrêmes de récolte des spécimens</b>');
    $form->addCommentaire('Les dates doivent être saisies selon le format jj-mm-année, par ex: 05-06-1956');
    $form->addCommentaire('Laisser en blanc la date de fin si la collection est encore alimentée');
    
    // Les dates de début et fin de récolte
    $form->addChamps('DATE_DEBUT', 'Date extrême de récolte des spécimens (début) : ', '', 'text');
    $form->radioFromTable('DATE_DEBUT_CARAC par HERBIERS_DATE_DEBUT_CARAC', '', 'Caractériser la date de début : ');
    $form->addChamps('DATE_FIN', 'Date extrême de récolte des spécimens (fin) : ');
    $form->radioFromTable('DATE_FIN_CARAC par HERBIERS_DATE_FIN_CARAC', '', 'Caractériser la date de fin : ');
    
    // L'url de la collection
    $form->addChamps('URL', 'URL vers le site de la collection (optionnel) : ');
    
    // Types, spécimens et dénombrement
    $radio = array('0', 'indéterminé', '1', 'non', '2', 'oui');
    $form->radio('INCLUDED_TYPE', $radio, 'Y-a-t\'il des échantillons-types : ');
    $form->addCommentaire('<b>Mode de conservation des spécimens :</b>');
    $form->checkboxFromTable('HERBIERS_COLLECTION par HERBIERS_ont_pres et HERBIERS_PRES', 'Cocher les cases : ', '','LIGNE', 'ID', 'ID_PRES', 'ID_PRES');
    $form->addChamps('NUM_SPECIMENS', 'Nombre de spécimens : ');
    $form->radioFromTable('PREC_SPECIMENS par HERBIERS_DENOMBREMENT_CARAC_SP', '', 'Caractériser le dénombrement');
    $form->addChamps('NUM_SPECIES', 'Nombre d\'espèces : ');
    $form->radioFromTable('PREC_SPECIES par HERBIERS_DENOMBREMENT_CARAC_SC', '', 'Caractériser le dénombrement');
    
    // État de la collection
    $form->addCommentaire('État de la collection : de 1 (= inconnu) à 4 (= excellent, parfait)');
    $form->radioEnum('ETAT_SPECIMENS', 'État des spécimens : ');
    $form->radioEnum('ETAT_CLASSEMENT', 'État du classement : ');
    $form->radioEnum('ETAT_PRESENTATION', 'État de la présentation : ');
    $form->addCommentaire('<br />');
    
    // Classement
    $form->addChamps('MODE_CLASSEMENT', 'Méthode de classement : ');
    
    // Documentation
    $form->addCommentaire(  '<h2>'.'Informations sur la documentation disponible :'.'</h2>'.
                            '<ul>'."\n".
                            '<li>'.'documents associés à la collection (publications directement liées comme Flores, '.
                            'documents in&eacute;dits tels que dessins, aquarelles, carnets de notes de terrain...)'.'</li>'.
                            '<li>'.'documents sur la collection ou les collecteurs (publications relatant '.
                            'l\'acquisition, notices nécrologiques et/ou biographiques...)'.'</li>'.
                            '</ul>'."\n"
                        );
    $form->addChamps('DOC_STATE', 'État de la documentation : ');
    $form->addChamps('PERCENT_DATABASED', '% de la documentation en base de données : ');
        // Gestion des métadonnées
        gererMetaForm(&$form, &$un_herbier); 
    
    
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
        $form->submit('Valider');
    }
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
}

function nouveau_herb4(&$un_herbier)
{
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], '');
    $form = $form->acquerir('HERBIERS_COLLECTION');
    $form->insertMySQL('PARENT_ID = '.$un_herbier->organisation->getId());
}

function mod_desc(&$un_herbier)
{
    // Intitialisation de variables
    $id_coll = $un_herbier->collection->getId();
    $id_org = $un_herbier->organisation->getId();
    
    // Création du formulaire de modification
    $retour = '<h1>'.'Modification d\'une collection'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION', 'MOD', $id_coll, 'ID');
    form_herb_2($form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC_V, $id_org, $id_coll));
    $form->finalise('un_form');
    
    return $retour;
}

function mod_desc_v(&$un_herbier)
{
    // Intitialisation de variables
    $id_coll = $un_herbier->collection->getId();
    
    // Insertion des infos après vérification
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
    $form = $form->acquerir('HERBIERS_COLLECTION');
    $form->updateMySQL('ID', $id_coll);
}

function suppr_coll(&$un_herbier, $id_coll_param = null)
{
    // Initialisation de variables
    // Si l'identifiant de la collection est passé comme argument de la fonction
    if (!is_null($id_coll_param)) {
        $id_coll = $id_coll_param;
    } else {
        $id_coll = $un_herbier->collection->getId();
    }
    
    $requete =  'DELETE FROM HERBIERS_COLLECTION '.
                'WHERE ID = '.$id_coll;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    $requete =  'SELECT ID_INDIC '.
                'FROM HERBIERS_INDIC '.
                'WHERE ID = '.$id_coll;
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    while ($ligne = mysql_fetch_object($resultat)) {
        suppr_note($un_herbier, $ligne->ID_INDIC);
    }
}

// +------------------------------------------------------------------------------------------------------+
// GESTION des NOTES

function liste_indic(&$un_herbier)
{
    // Initialisation des variables
    $id_org = $un_herbier->organisation->getId();
    $id_coll = $un_herbier->collection->getId();
    
    $requete =  'SELECT ID_INDIC, TXT_INDIC '.
                'FROM HERBIERS_INDIC WHERE ID = '.$id_coll;
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    
    $retour =   '<div class="hba_liste_note">'."\n".
                '<table>'."\n";
    $num_row = mysql_num_rows($resultat);
    $compteur = 0;
    while ($row = mysql_fetch_object($resultat)) {
        $compteur++;
        $retour .= '<tr class="hb_arborescence"><td>';
        if ($compteur == $num_row) {
            $retour .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
        } else {
            $retour .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
        }
        $retour .= '</td><td>';
        if ($txt_court = raccourcirTexte($row->TXT_INDIC, HBA_LONGUEUR_NOTE_TXT)) {
            $retour .= '<abbr title="'.$row->TXT_INDIC.'">'.$txt_court.'</abbr>';
        } else {
            $retour .= $row->TXT_INDIC;
        }
        $retour .= '</td>'."\n";
        $retour .= '<td><a href="'.
                    sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE, $id_org, $id_coll, $row->ID_INDIC).
                    '">'.'modifier'.'</a></td>'."\n";
        if ($id_org != HBA_EXEMPLE_ID) {
            $retour .=  '<td><a href="'.
                        sprintf($un_herbier->getUrlActionOrgCollNote(), SUPPR_NOTE, $id_org, $id_coll, $row->ID_INDIC).'" '.
                        'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette note ?'.'\');"'.
                        '>'.'supprimer'.'</a></td></tr>'."\n";
        }
    }
    $retour .= '</table>'."\n".'</div>'."\n";
    return $retour;
}

function nouv_indic(&$un_herbier)
{
    // Initialisation des variables
    $id_org = $un_herbier->organisation->getId();
    $id_coll = $un_herbier->collection->getId();
    
    $retour = '<h1>'.'Ajout d\'une note'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
    form_indic($form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC_V, $id_org, $id_coll));
    $form->finalise('form_indic');
    return $retour;
}

function form_indic(&$form, &$un_herbier)
{
    // Initialisation des variables
    $id_org = $un_herbier->organisation->getId();
    $id_coll = $un_herbier->collection->getId();
    
    // Définition des styles
    $form->style_general = 'hba_formulaire';
    $form->style_label = 'hba_label';
    $form->style_button = 'hba_bouton';
    $form->style_commentaire = 'hba_commentaire';
    $form->style_radiocheckbox = 'hba_radio';
    
    $form->addChamps('TXT_INDIC', 'Texte de la note : ');
    $form->addChamps('REM_INDIC', 'Remarque : ');
    $form->checkboxFromTable(   'HERBIERS_INDIC par HERBIERS_A_UN_TYPE et HERBIERS_TYPE', 
                                'Cocher les cases : ', '', 'LIGNE', 'ID_INDIC', 'ID_TYPE', 'ID_TYPE');
        
    $form->submit('Valider');
    $form->annuler('Annuler', sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $id_coll));
}

function nouv_indic_v(&$un_herbier)
{
    // Initialisation des variables
    $id_coll = $un_herbier->collection->getId();
    $id_utilisateur = $un_herbier->utilisateur->getId();
    
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
    $form = $form->acquerir('HERBIERS_INDIC');
    $id_note = $form->insertMySQL('ID = '.$id_coll.', MAJ_INDIC = UNIX_TIMESTAMP()');
    
    // Insertion dans la table des historiques des indications
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES ("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.' )';
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
}

function mod_note(&$un_herbier)
{
    // Initialisation des variables
    $id_org = $un_herbier->organisation->getId();
    $id_coll = $un_herbier->collection->getId();
    $id_note = $un_herbier->note->getId();
    
    $retour = '<h1>'.'Modification d\'une note'.'</h1>'."\n";
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC', 'MOD', $id_note, 'ID_INDIC') ;
    form_indic($form, $un_herbier);
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE_V, $id_org, $id_coll, $id_note));
    $form->finalise('form_indic');
    return $retour;
}

function mod_note_v(&$un_herbier)
{
    // Initialisation des variables
    $id_note = $un_herbier->note->getId();
    $id_utilisateur = $un_herbier->utilisateur->getId();
    
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
    $form = $form->acquerir('HERBIERS_INDIC');
    $form->updateMySQL('ID_INDIC', $id_note, 'MAJ_INDIC = UNIX_TIMESTAMP()');
    // Insertion dans la table des historiques des indications
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.')';
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
}

function suppr_note(&$un_herbier, $id_note_param = null)
{
    // Initialisation de variables
    // Si l'identifiant de la note est passé comme argument de la fonction
    if (!is_null($id_note_param)) {
        $id_note = $id_note_param;
    } else {
        $id_note = $un_herbier->note->getId();
    }
    
    $requete =  'DELETE FROM HERBIERS_INDIC '.
                'WHERE ID_INDIC = '.$id_note;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    
    $requete =  'DELETE FROM HERBIERS_A_UN_TYPE '.
                'WHERE ID_INDIC = '.$id_note;
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
}

// +------------------------------------------------------------------------------------------------------+
// GESTION des CORRESPONDANTS
// renvoie le code html d'une liste de correspondant
function liste_corr(&$un_herbier)
{
    // Initialisation de variables
    $retour = '';
    $id_action = $un_herbier->getAction();
    
    $id_cor = null;
    if (is_object($un_herbier->getCorrespondant())) {
        $id_cor = $un_herbier->correspondant->getId();
    }
    
    $retour .= '<h1 class="hba_titre">'.'Liste des correspondants régionaux'.'</h1>'."\n";
    
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.EFLORE_DROIT_POSSEDER '.
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = EDP_ID_UTILISATEUR '.
                'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.' ASC';
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) == 0) {
        $retour .= '<p class="hba_attention">'.'Aucun correspondant inscrit !'.'</p>'."\n";
        return $retour;
    }
    
    $liste_inst = '';
    $retour .=  '<div class="hba_liste_correspondant">'."\n".
                '<table>'."\n".
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n".
                '<tbody>'."\n";
    while ($ligne = mysql_fetch_object($resultat)) {
        // Recherche des institutions dont ils ont la responsabilité
        $requete_inst = 'SELECT INSTITUTION_NAME '.
                        'FROM '.HB_BDD_NOM.'.HERBIERS_ORGANISATION, '.HB_BDD_NOM.'.HERBIERS_ADMINISTRER '.
                        'WHERE HA_ID_ANNUAIRE = '.$ligne->U_ID.' '.
                        'AND HA_ID_ORG = ID_ORG '.
                        'ORDER BY INSTITUTION_NAME ASC';
        $resultat_inst = mysql_query($requete_inst) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_inst));
        
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td id="hba_correspondant_'.$ligne->U_ID.'" class="hb_plier_deplier">';
        if (mysql_num_rows($resultat_inst) > 0) {
            $nbre_ligne = mysql_num_rows($resultat_inst);
            $compteur = 0;
            $liste_inst = '<table>'."\n";
            while ($ligne_inst = mysql_fetch_object($resultat_inst)) {
                $compteur++;
                $liste_inst .= '<tr class="hb_arborescence"><td>';
                if ($compteur == $nbre_ligne) {
                    $liste_inst .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
                } else {
                    $liste_inst .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
                }
                $liste_inst .= '</td><td>'.$ligne_inst->INSTITUTION_NAME.'</td></tr>'."\n";
            }
            $liste_inst .= '</table>'."\n";
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_ANNULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
                            '</a>'."\n";
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_COR_DEROULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
                            '</a>'."\n";
            if ($id_cor == $ligne->U_ID) {
                switch ($id_action) {
                    case HBA_ACTION_COR_DEROULER :
                        $retour .= $xhtml_fermer;
                    break;
                    default :
                        $retour .= $xhtml_ouvrir;
                }
            } else {
                $retour .= $xhtml_ouvrir;
            }
        } else {
            $retour .= '&nbsp;';
        }
        $retour .= '</td>';
        $retour .= '<td>'.$ligne->U_NAME.'</td>';
        $retour .= '<td>'.$ligne->U_SURNAME.'</td>';
        $retour .=  '<td><a href="'.sprintf($un_herbier->getUrlActionCor(), SUPPR_CORR, $ligne->U_ID, $ligne->U_ID).'" '.
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce correspondant ?'.'\');"'.
                    '>'.'supprimer'.'</a></td></tr>'."\n";
        
        switch ($id_action) {
            case HBA_ACTION_COR_DEROULER :
                if ($id_cor == $ligne->U_ID) {
                    $retour .= '<tr class="hba_liste_organisation"><td colspan="4">'.$liste_inst.'</td></tr>'."\n";
                }
                break;
        }
    }
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
    return $retour;
}

function nouveau_corr_v(&$un_herbier)
{
    $id_cor = $un_herbier->correspondant->getId();
    
    $requete =  'SELECT EDP_ID_DROIT '.
                'FROM EFLORE_DROIT_POSSEDER '.
                'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
                'AND EDP_ID_PROJET = 1 '.
                'AND EDP_ID_DROIT < 3';
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) == 0) {
        $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
                    'SET EDP_ID_DROIT = 2, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_cor;
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
    } else {
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme correspondant régional'.'</p>'."\n";
    }
    return $retour;
}

function suppr_corr(&$un_herbier)
{
    // Initialisation des variables
    $id_cor = $un_herbier->correspondant->getId();
    
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
                'FROM EFLORE_DROIT_POSSEDER '.
                'WHERE EDP_ID_PROJET = 1 '.
                'AND EDP_ID_UTILISATEUR = '.$id_cor;
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) != 0) {
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
                    'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
                    'AND EDP_ID_PROJET = 1';
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        $retour = '<p class="hba_information">'.'Le correspondant a été supprimé de la base'.'</p>'."\n";
    } else {
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un correspondant régional'.'</p>'."\n";
    }
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// GESTION des RÉDACTEURS

// renvoie le code html d'une liste de rédacteur
function liste_red(&$un_herbier)
{
    $retour = '';
    $retour .= '<h1 class="hba_titre">'.'Liste de vos rédacteurs'.'</h1>'."\n";
    
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = HC_ID_REDACTEUR '.
                'AND HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId();
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) == 0) {
        $retour .= '<p class="hba_attention">'.'Aucun rédacteur inscrit !'.'</p>'."\n";
        return $retour;
    }
    $retour .=  '<div class="hba_liste_redacteur">'."\n".
                '<table>';
    while ($ligne = mysql_fetch_object($resultat)) {
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
        /*
        if (mysql_num_rows($resultat_indic) > 0) {
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
                            '</a>'."\n";
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_RED_DEROULER, $id_org, $ligne->ID).'">'."\n".
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
                            '</a>'."\n";
            if ($id_coll == $ligne->ID) {
                switch ($id_action) {
                    case HBA_ACTION_RED_DEROULER :
                        $retour .= $xhtml_fermer;
                    break;
                    default :
                        $retour .= $xhtml_ouvrir;
                }
            } else {
                $retour .= $xhtml_ouvrir;
            }
        }
        */
        $retour .=  '</td><td>'.$ligne->U_NAME.'</td>'.
                    '<td>'.$ligne->U_SURNAME.'</td>'."\n".
                    '<td><a href="'.sprintf($un_herbier->getUrlActionRed(), SUPPR_RED, $ligne->U_ID).'" '.
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce rédacteur ?'.'\');">'.
                    'supprimer'.
                    '</a></td>'.
                    '</tr>'."\n";
    }
    $retour .= '</table>'."\n".'</div>'."\n";
    
    return $retour;
}

function nouveau_red_v(&$un_herbier)
{
    $id_red = $un_herbier->redacteur->getId();
    $id_utilisateur = $un_herbier->utilisateur->getId();
    
    $requete =  'SELECT HERBIERS_COORDONNE.HC_ID_REDACTEUR '.
                'FROM HERBIERS_COORDONNE, EFLORE_DROIT_POSSEDER '.
                'WHERE HC_ID_REDACTEUR = '.$id_red.' '.
                'AND HC_ID_COORDINATEUR = EDP_ID_UTILISATEUR '.
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_UTILISATEUR = '.$id_utilisateur.' '.
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_DROIT < 3 '.
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_PROJET = 1';
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) == 0) {
        $requete =  'INSERT INTO HERBIERS_COORDONNE '.
                    'SET HC_ID_REDACTEUR = '.$id_red.', HC_ID_COORDINATEUR = '.$id_utilisateur;
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        
        // Insertion du rédacteur dans EFLORE_DROIT_POSSEDER, s'il n'y est pas déjà
        $requete =  'SELECT * '.
                    'FROM EFLORE_DROIT_POSSEDER '.
                    'WHERE EDP_ID_PROJET = 1 '.
                    'AND EDP_ID_UTILISATEUR = '.$id_red;
        $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        
        // Si le rédacteur n'existe pas on l'insere avec le droit 3 (modération ou ici rédacteur)
        if (mysql_num_rows($resultat) == 0) {
            $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
                        'SET EDP_ID_DROIT = 3, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_red;
            mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        }
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
    } else {
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme rédacteur'.'</p>'."\n";
    }
    return $retour;
}

function suppr_red(&$un_herbier)
{
    // Initialisation des variables
    $id_red = $un_herbier->redacteur->getId();
    $id_utilisateur = $un_herbier->utilisateur->getId();
    
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
                'FROM EFLORE_DROIT_POSSEDER '.
                'WHERE EDP_ID_PROJET = 1 '.
                'AND EDP_ID_UTILISATEUR = '.$id_red.' '.
                'AND EDP_ID_DROIT = 3';
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
    if (mysql_num_rows($resultat) != 0) {
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
                    'WHERE EDP_ID_UTILISATEUR = '.$id_red.' '.
                    'AND EDP_ID_PROJET = 1';
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        $requete =  'DELETE FROM HERBIERS_COORDONNE '.
                    'WHERE HC_ID_REDACTEUR = '.$id_red;
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
        $retour = '<p class="hba_information">'.'Le rédacteur a été supprimé de la base'.'</p>'."\n";
    } else {
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un rédacteur'.'</p>'."\n";
    }
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// GESTION des AIDES

function fournirAideInscription()
{
    $retour =  '<h1>'.'Interface d\'administration de la base de données des herbiers de France'.'</h1>'."\n".
                '<p class="hba_aide">'.
                'Vous n\'êtes pas inscrit comme '.'<strong>'.'correspondant régional'.'</strong>'.' ou '.
                '<strong>'.'rédacteur'.'</strong>'.'. '.'<br />'.
                'Si vous souhaitez participer activement au projet d\'inventaire des herbiers de France, vous '.
                'pouvez envoyer un courriel à :'.
                '</p>'."\n".
                '<ul class="hba_aide">'."\n".
                '<li><a href="mailto:mathezf@wanadoo.fr">'.'Joël MATHEZ'.'</a>'.' ou à '.
                '<a href="mailto:pasch@isem.univ-montp2.fr">'.'P.A. Schäfer'.'</a>'.
                ' : pour des questions sur le contenu'.'</li>'."\n".
                '<li><a href="mailto:jpm@tela-botanica.org">'.'Jean-Pascal MILCENT'.'</a>'.
                ' : pour obtenir un droit d\'accès'.'</li>'."\n".
                '</ul>'."\n";
    return $retour;
}

function fournirAideAccueil()
{
    $retour =   '<p class="hba_aide">'.
                'Vous devriez voir, ci-contre, un "cartouche" contenant des '.'<emphasis>'.'informations'.'</emphasis>'.
                ' sur votre compte utilisateur (nom, droit d\'accès...)'.
                'ainsi qu\'un '.'<emphasis>'.'menu'.'</emphasis>'.' qui vous permet d\'accèder aux différents '.
                'formulaires de saisi composant l\'interface d\'admnistration des herbiers.'.
                '</p>'."\n".
                '<p class="hba_aide">'.
                'La saisie d\'une nouvelle collection commence par la saisie d\'une structure accueillant '.
                'la ou les collections.'.'<br />'.
                'Pour ce faire, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
                'dans le cartouche.'.
                '</p>'."\n";
    return $retour;
}

function fournirAideAccueilOrganisation()
{
    $retour =  '<p class="hba_aide">'.
                'Pour <b>créer</b> une institution, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
                'dans le cartouche ci-contre.'.'<br />'.
                'Pour <b>éditer</b> une institution existante, son équipe et ses collections, cliquez sur le lien '.
                '<b>modifier</b> situé sur la même ligne que l\'institution que vous avez choisie.'.'<br />'.
                'Vous pouvez également la supprimer en cliquant sur le lien <b>supprimer</b>.'.
                '</p>'."\n";
    return $retour;
}

function fournirAideOrganisation()
{
    $retour =  '<p class="hba_aide">'.
                'Le "cartouche" contenant le menu vous propose maintenant de :'.
                '</p>'."\n".
                '<ul class="hba_aide">'."\n".
                '<li><strong>'.'Modifier'.'</strong>'.' les renseignements concernant l\'institution '.'<strong>'.
                '->'.'Modifier l\'institution'.'</strong></li>'."\n".
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les membres travaillant dans l\'institution '.
                'ou dans le cas de petites structures pour indiquer qui est le contact.'.'<strong>'.
                '->'.'Ajouter un membre à l\'équipe</strong></li>'."\n".
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les collections possédées par l\'institution'.'<strong>'.
                '->'.'Ajouter une collection'.'</strong></li>'."\n".
                '</ul>'."\n";
    return $retour;
}

function fournirAideEquipe()
{
    $retour =   '<p class="hba_aide">'.
                'Pour une institution donnée, on peut ajouter autant de <b>membres d\'équipe (et/ou contacts)</b> '.
                'que nécessaire.'.'<br />'.
                'Cliquez sur le lien <b>modifier</b> situé sur la même ligne que le membre de l\'équipe que vous avez '.
                'choisie, pour mettre à jour ses informations.'.'<br />'.
                'Vous pouvez également le supprimer en cliquant sur le lien <b>supprimer</b>.'.
                '</p>'."\n";
    return $retour;
}


function fournirAideCollection()
{
    $retour =   '<p class="hba_aide">'.
                'Pour une collection donnée, on peut ajouter autant de <b>notes (compléments '.
                'd\'information)</b> que nécessaire. Lorsqu\'une collection contient des compléments '.
                'd\'information, un <b>+</b> apparait à gauche de son nom, on peut les éditer en '.
                'cliquant dessus.'.
                '</p>'."\n";
    return $retour;
}

function fournirAideParcourirAnnuaire()
{
    $retour =   '<p class="hba_aide">'.
                'Cliquez sur une lettre pour afficher la liste des inscrits au site Tela Botanica dont le nom '.
                'débute par cette lettre.'.
                '</p>'."\n";
    return $retour;
}

// +------------------------------------------------------------------------------------------------------+
// FONCTIONS COMMUNES

// verifie une valeur et affiche du texte en cons&eacute;quence
function checkvalue($prose, $value = '')
{
    if ($value == '') {
        $retour = '<h1>'.$prose.'</h1>'."\n";
        $retour .= '<input type="submit" value="'.'Recommencer'.'" onclick="javascript:history.go(-1);" />'."\n";
        return $retour;
        }
    return false ;
}

function color_alterne(&$flag)
{
    if ($flag) {
        $flag = FALSE;
        return 'pair';
    } else {
        $flag = TRUE;
        return 'impair';
    }
}

/** Fonction checkZip() - Teste un code postal français.
*
* L'expression régulière ^[0-9]{5}$ est utilisée pour vérifier
* que nous avons à faire à un code postal français.
*
* @param  string  Le code postal à tester.
* @return boolean retourne vrai si code postal est valide.
*/
function checkZip($code)
{
    if (ereg('^[0-9]{5}$', $code, $match)){
        return TRUE;
    } else {
        return FALSE;
    }
}

/** Fonction raccourcirTexte() - Raccourci un texte.
*
* Renvoie le $texte coupe a la $taille indique avec 3 point de suspension.
* Si le texte est plus court que $taille, il n'est pas modifie
*
* @param  string le texte à raccourcir.
* @param  integer le nombre de caractère maximum du texte raccourci.
* @param  boolean mettre FALSE pour ne pas afficher de points de suspenssion.
* @return mixed retourne le texte abrégé ou FALSE.
*/
function raccourcirTexte($texte, $taille = null, $bool_suspenssion = TRUE) {
    if (!is_null($taille) && strlen($texte) > $taille) {
        if ($bool_suspenssion) {
            return substr($texte, 0, $taille - 3).'...';
        } else {
            return substr($texte, 0, $taille);
        }
    }
    return FALSE;
}

function parcourrirAnnu(&$un_herbier, $id_action)
{
    // Initialisation de variables
    $db =& $GLOBALS['_HERBIER_']['bdd'];
    $retour = '';
    
    if (NOUVEAU_CORR) {
        $retour .= '<h1>'.'Inscription d\'un correspondant'.'</h1>'."\n";
    } elseif (NOUVEAU_RED) {
        $retour .= '<h1>'.'Inscription d\'un rédacteur'.'</h1>'."\n";
    }
    $retour .= fournirAideParcourirAnnuaire();
    $retour .= '<p class="hba_alphabet">';
    // Ecrire toutes les lettres avec un lien
    for ($i = 65 ; $i < 91 ; $i++) {
        $retour .= '<a href="'.sprintf(HB_URL_COURANTE_ADMIN_ACTION_LETTRE, $un_herbier->getAction(), chr($i));
        $retour .= '">'.chr($i).'</a>'."\n";
    }
    $retour .= '</p>';
    
    // si une lettre est selectionne
    if (!empty($_REQUEST['lettre'])) {
        $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.', '.
                    HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_MAIL.' '.
                    'FROM '.HB_BDD_TAB_ANNUAIRE.' '.
                    'WHERE ';
        if ($_REQUEST['lettre'] != 'tous') {
            $requete .= HB_BDD_TAB_ANNUAIRE_CHP_NOM.' LIKE "'.$_REQUEST['lettre'].'%" ';
        }
        $requete .= 'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM;
        $resultat = $db->query($requete);
        if (DB::isError($resultat)) {
            die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete, $resultat->getDebugInfo()));
        }
        if ($resultat->numRows() != 0) {
            // Pour chaque nom, inscription des infos
            $retour .= '<h1>'.' Inscrits dont le nom débute par : '.$_REQUEST['lettre'].'</h1>'."\n";
            $retour .= '<div class="hba_liste_inscrit">'."\n";
            $retour .= '<table id="hba_table_annuaire">'."\n";
            $retour .= '<colgroup><col width="30%" /><col width="30%" /><col width="30%" /><col width="10%" /></colgroup>'."\n";
            $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th>'.'Courriel'.'</th><th>'.'Action'.'</th></tr></thead>'."\n";
            $retour .= '<tbody>'."\n";
            $pair = true;
            while ($row = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
                $retour .= '<tr ';
                if ($pair) {
                    $retour .= 'class="impair"';
                    $pair = false ;
                } else {
                    $retour .= 'class="pair"';
                    $pair = true;
                }
                $retour .= '>';
                $retour .=  '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_NOM].'</td>'.
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_PRENOM].'</td>'.
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_MAIL].'</td>'."\n";
                if ($un_herbier->getAction() == NOUVEAU_CORR) {
                    $retour .= '<td><a href="'.
                                sprintf($un_herbier->getUrlActionCor(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID], $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
                                '">'.'inscrire'.'</a></td>'."\n";
                } elseif ($un_herbier->getAction() == NOUV_RED) {
                    $retour .=  '<td><a href="'.
                                sprintf($un_herbier->getUrlActionRed(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
                                '">'.'inscrire'.'</a></td>'."\n";
                }
                $retour .= '</tr>'."\n";
            }
            $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
        } else {
            $retour .= '<p class="hba_attention">'.'Aucun inscrit!'.'</p>'."\n";
        }
    }
    return $retour;
}

function gererMetaForm(&$form, &$herbier)
{
        // Pour écraser ces valeurs même en modification nous métons temporairement le mode à vide. 
    $mode = '';
    if ($form->mode == 'MOD') {
        $form->mode = '';
        $mode = 'MOD';
    }
    $form->addChamps('DATE_DERNIERE_MODIF', '', date('Y-m-j H:i:s', time()), $type = 'hidden');
    $form->addChamps('CE_MODIFIER_PAR', '',  $herbier->utilisateur->getId(), $type = 'hidden');
    $form->mode = $mode;
}
// +------------------------------------------------------------------------------------------------------+

/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.4  2007-02-02 14:59:16  jp_milcent
* Agrandissement du champ "Collecteurs".
*
* Revision 1.3  2006/10/31 15:06:44  jp_milcent
* Fin de gestion des flux rss.
*
* Revision 1.2  2006/10/30 18:57:46  jp_milcent
* Ajout de champs pour les flux rss.
*
* Revision 1.1  2005/11/23 10:32:32  jp_milcent
* Ajout au dépot de l'application Herbiers.
* Elle doit à terme migrer dans eFlore.
*
* Revision 1.5  2005/06/09 17:31:42  jpm
* Affichage en permanence dans le menu du lien vers l'accueil.
*
* Revision 1.4  2005/06/07 15:30:44  jpm
* Modid esthetique.
*
* Revision 1.3  2005/06/02 17:53:37  jpm
* Modification de l'affichage du menu.
*
* Revision 1.2  2005/05/18 07:30:13  jpm
* Correction des bogues et derniers réglages avant mise en ligne du site v4.
*
* Revision 1.1  2005/04/06 13:33:40  jpm
* Ajout du fichier contenant les fonctions réalisant la mise en page et la gestion des données.
* Cela devrait normalement être divisé en un modèle et une vue...
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>