Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 19 | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 19 Rev 20
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Herbier - Administration.                                                       |
8
// | This file is part of Herbier - Administration.                                                       |
9
// |                                                                                                      |
9
// |                                                                                                      |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
10
// | Foobar is free software; you can redistribute it and/or modify                                       |
11
// | it under the terms of the GNU General Public License as published by                                 |
11
// | it under the terms of the GNU General Public License as published by                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
23
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: hba_manipulation.fonct.php,v 1.4 2007-02-02 14:59:16 jp_milcent Exp $
24
// CVS : $Id: hba_manipulation.fonct.php,v 1.5 2007-08-22 14:33:44 jp_milcent Exp $
25
/**
25
/**
26
* Fonctions de manipulation de la base de données Herbier.
26
* Fonctions de manipulation de la base de données Herbier.
27
*
27
*
28
* Fonctions permettant d'ajouter, modifier ou supprimer des informations dans la base de données Herbier.
28
* Fonctions permettant d'ajouter, modifier ou supprimer des informations dans la base de données Herbier.
29
*
29
*
30
*@package Herbier-Administration
30
*@package Herbier-Administration
31
*@subpackage Fonctions
31
*@subpackage Fonctions
32
//Auteur original :
32
//Auteur original :
33
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
34
//Autres auteurs :
34
//Autres auteurs :
35
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
35
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
36
*@copyright     Tela-Botanica 2000-2005
36
*@copyright     Tela-Botanica 2000-2005
37
*@version       $Revision: 1.4 $ $Date: 2007-02-02 14:59:16 $
37
*@version       $Revision: 1.5 $ $Date: 2007-08-22 14:33:44 $
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
*/
39
*/
40
 
40
 
41
// +------------------------------------------------------------------------------------------------------+
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                           LISTE de FONCTIONS                                         |
42
// |                                           LISTE de FONCTIONS                                         |
43
// +------------------------------------------------------------------------------------------------------+
43
// +------------------------------------------------------------------------------------------------------+
44
 
44
 
45
// +------------------------------------------------------------------------------------------------------+
45
// +------------------------------------------------------------------------------------------------------+
46
// GESTION du MENU
46
// GESTION du MENU
47
 
47
 
48
function entete(&$un_herbier)
48
function entete(&$un_herbier)
49
{
49
{
50
    $retour =   '<div id="hba_info">'."\n";
50
    $retour =   '<div id="hba_info">'."\n";
51
    
51
    
52
    // Gestion des infos
52
    // Gestion des infos
53
    $retour .=  '<h1>'.'Vous êtes'.'</h1>'."\n";
53
    $retour .=  '<h1>'.'Vous êtes'.'</h1>'."\n";
54
    // Affichage des droits
54
    // Affichage des droits
55
    if ($un_herbier->utilisateur->getAdminBool()) {
55
    if ($un_herbier->utilisateur->getAdminBool()) {
56
        $retour .=  '<p>'.'Administrateur de ce projet'.'</p>'."\n";
56
        $retour .=  '<p>'.'Administrateur de ce projet'.'</p>'."\n";
57
    } elseif ($un_herbier->utilisateur->getCoordBool()) {
57
    } elseif ($un_herbier->utilisateur->getCoordBool()) {
58
        $retour .=  '<p>'.'Coordinateur de ce projet'.'</p>'."\n";
58
        $retour .=  '<p>'.'Coordinateur de ce projet'.'</p>'."\n";
59
    } elseif ($un_herbier->utilisateur->getRedacBool()) {
59
    } elseif ($un_herbier->utilisateur->getRedacBool()) {
60
        $retour .=  '<p>'.'Rédacteur de ce projet'.'</p>'."\n";
60
        $retour .=  '<p>'.'Rédacteur de ce projet'.'</p>'."\n";
61
    }
61
    }
62
    // Affichage du noms de l'institution
62
    // Affichage du noms de l'institution
63
    /*
63
    /*
64
    if (is_object($une_organisation = $un_herbier->getOrganisation())) {
64
    if (is_object($une_organisation = $un_herbier->getOrganisation())) {
65
        $retour .=  '<dt>'.'Institution :'.'</dt>'."\n".'<dd>';
65
        $retour .=  '<dt>'.'Institution :'.'</dt>'."\n".'<dd>';
66
        if ($txt_court = raccourcirTexte($une_organisation->getNom(), HBA_LONGUEUR_ORG_NOM)) {
66
        if ($txt_court = raccourcirTexte($une_organisation->getNom(), HBA_LONGUEUR_ORG_NOM)) {
67
            $retour .= '<abbr title="'.$une_organisation->getNom().'">'.$txt_court.'</abbr>';
67
            $retour .= '<abbr title="'.$une_organisation->getNom().'">'.$txt_court.'</abbr>';
68
        } else {
68
        } else {
69
            $retour .= $une_organisation->getNom();
69
            $retour .= $une_organisation->getNom();
70
        }
70
        }
71
        $retour .=  '</dd>'."\n";
71
        $retour .=  '</dd>'."\n";
72
    }
72
    }
73
    */
73
    */
74
    
74
    
75
    // Gestion des menus
75
    // Gestion des menus
76
    if ($un_herbier->utilisateur->getDroit()) {
76
    if ($un_herbier->utilisateur->getDroit()) {
77
        $retour .=  '<ul>'."\n";
77
        $retour .=  '<ul>'."\n";
78
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_ANNULER).'">'.
78
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_ANNULER).'">'.
79
                        'Accueil'.
79
                        'Accueil'.
80
                        '</a></li>'."\n";
80
                        '</a></li>'."\n";
81
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_HERBIER_AJOUT).'">'.
81
        $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), HBA_ACTION_HERBIER_AJOUT).'">'.
82
                    'Ajouter une institution (herbier)'.
82
                    'Ajouter une institution (herbier)'.
83
                    '</a></li>'."\n";
83
                    '</a></li>'."\n";
84
        if ($un_herbier->utilisateur->getAdminBool()) {
84
        if ($un_herbier->utilisateur->getAdminBool()) {
85
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUVEAU_CORR).'">'.
85
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUVEAU_CORR).'">'.
86
                        'Inscrire un correspondant'.
86
                        'Inscrire un correspondant'.
87
                        '</a></li>'."\n";
87
                        '</a></li>'."\n";
88
        } elseif ($un_herbier->utilisateur->getCoordBool()) {
88
        } elseif ($un_herbier->utilisateur->getCoordBool()) {
89
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUV_RED).'">'.
89
            $retour .=  '<li><a href="'.sprintf($un_herbier->getUrlAction(), NOUV_RED).'">'.
90
                        'Inscrire un rédacteur'.
90
                        'Inscrire un rédacteur'.
91
                        '</a></li>'."\n";
91
                        '</a></li>'."\n";
92
        }
92
        }
93
        $retour .=  '</ul>'."\n";
93
        $retour .=  '</ul>'."\n";
94
        // Gestion du menu contextuel
94
        // Gestion du menu contextuel
95
        $menu_contextuel = '';
95
        $menu_contextuel = '';
96
        switch ($un_herbier->getAction()) {
96
        switch ($un_herbier->getAction()) {
97
            case NOUV_COLL : // 4
97
            case NOUV_COLL : // 4
98
            case MOD_DESC : // 21
98
            case MOD_DESC : // 21
99
            case MOD_ADM : // 22
99
            case MOD_ADM : // 22
100
            case NOUV_TEAM : // 30
100
            case NOUV_TEAM : // 30
101
            case MOD_STAFF : // 32
101
            case MOD_STAFF : // 32
102
            case NOUV_INDIC : // 40
102
            case NOUV_INDIC : // 40
103
            case MOD_NOTE : // 42
103
            case MOD_NOTE : // 42
104
                $id_org = $un_herbier->organisation->getId();
104
                $id_org = $un_herbier->organisation->getId();
105
                $menu_contextuel .= '<li><a href="'.
105
                $menu_contextuel .= '<li><a href="'.
106
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_HERB, $id_org).'">'.
106
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_HERB, $id_org).'">'.
107
                                    'Retour à l\'institution'.
107
                                    'Retour à l\'institution'.
108
                                    '</a></li>'."\n";
108
                                    '</a></li>'."\n";
109
                break;
109
                break;
110
            case MOD_HERB : // 20
110
            case MOD_HERB : // 20
111
            case MOD_ADM_V : // 26
111
            case MOD_ADM_V : // 26
112
            case MOD_DESC_V : // 27
112
            case MOD_DESC_V : // 27
113
            case SUPPR_COLL : // 29
113
            case SUPPR_COLL : // 29
114
            case NOUV_TEAM_V : // 31
114
            case NOUV_TEAM_V : // 31
115
            case MOD_STAFF_V : // 33
115
            case MOD_STAFF_V : // 33
116
            case SUPPR_STAFF : // 34
116
            case SUPPR_STAFF : // 34
117
            case NOUV_INDIC_V : // 41
117
            case NOUV_INDIC_V : // 41
118
            case SUPPR_NOTE : // 43
118
            case SUPPR_NOTE : // 43
119
            case MOD_NOTE_V : // 44
119
            case MOD_NOTE_V : // 44
120
            case HBA_ACTION_COLL_DEROULER : // 5
120
            case HBA_ACTION_COLL_DEROULER : // 5
121
                $id_org = $un_herbier->organisation->getId();
121
                $id_org = $un_herbier->organisation->getId();
122
                $menu_contextuel .= '<li><a href="'.
122
                $menu_contextuel .= '<li><a href="'.
123
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_ADM, $id_org).'">'.
123
                                    sprintf($un_herbier->getUrlActionOrg(), MOD_ADM, $id_org).'">'.
124
                                    'Modifier l\'institution'.
124
                                    'Modifier l\'institution'.
125
                                    '</a></li>'."\n".
125
                                    '</a></li>'."\n".
126
                                    '<li><a href="'.
126
                                    '<li><a href="'.
127
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_TEAM, $id_org).'">'.
127
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_TEAM, $id_org).'">'.
128
                                    'Ajouter un membre à l\'équipe'.
128
                                    'Ajouter un membre à l\'équipe'.
129
                                    '</a></li>'."\n".
129
                                    '</a></li>'."\n".
130
                                    '<li><a href="'.
130
                                    '<li><a href="'.
131
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_COLL, $id_org).'">'.
131
                                    sprintf($un_herbier->getUrlActionOrg(), NOUV_COLL, $id_org).'">'.
132
                                    'Ajouter une collection'.
132
                                    'Ajouter une collection'.
133
                                    '</a></li>'."\n";
133
                                    '</a></li>'."\n";
134
                break;
134
                break;
135
        }
135
        }
136
        if (!empty($menu_contextuel)) {
136
        if (!empty($menu_contextuel)) {
137
            $retour .=  '<hr class="clear"/>'."\n";
137
            $retour .=  '<hr class="clear"/>'."\n";
138
            $retour .=  '<ul>'."\n";
138
            $retour .=  '<ul>'."\n";
139
            $retour .=  $menu_contextuel;
139
            $retour .=  $menu_contextuel;
140
            $retour .=  '</ul>'."\n";
140
            $retour .=  '</ul>'."\n";
141
        }
141
        }
142
    }
142
    }
143
    $retour .=  '</div>'."\n";
143
    $retour .=  '</div>'."\n";
144
    return $retour;
144
    return $retour;
145
}
145
}
146
 
146
 
147
// +------------------------------------------------------------------------------------------------------+
147
// +------------------------------------------------------------------------------------------------------+
148
// GESTION de l'ACCUEIL
148
// GESTION de l'ACCUEIL
149
 
149
 
150
// Affichage de l'accueil
150
// Affichage de l'accueil
151
function menu(&$un_herbier)
151
function menu(&$un_herbier)
152
{
152
{
153
    $retour = '';
153
    $retour = '';
154
    
154
    
155
    // Message d'accueil et aide
155
    // Message d'accueil et aide
156
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
156
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
157
        $retour .= '<h1>'.'Bienvenue sur la console d\'administration du projet Herbiers.'.'</h1>'."\n";
157
        $retour .= '<h1>'.'Bienvenue sur la console d\'administration du projet Herbiers.'.'</h1>'."\n";
158
        $retour .= fournirAideAccueil();
158
        $retour .= fournirAideAccueil();
159
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
159
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
160
    } else {
160
    } else {
161
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
161
        $retour .= '<h1 class="hba_titre">'.'Liste de vos herbiers'.'</h1>'."\n";
162
        $retour .= fournirAideAccueilOrganisation();
162
        $retour .= fournirAideAccueilOrganisation();
163
    }
163
    }
164
    // Les herbiers de l'utilisateur courant
164
    // Les herbiers de l'utilisateur courant
165
    $retour .= mesherbiers($un_herbier);
165
    $retour .= mesherbiers($un_herbier);
166
    
166
    
167
    // Les herbiers des correspondants
167
    // Les herbiers des correspondants
168
    if ($un_herbier->utilisateur->getAdminBool()) {
168
    if ($un_herbier->utilisateur->getAdminBool()) {
169
        $retour .= liste_corr($un_herbier);
169
        $retour .= liste_corr($un_herbier);
170
    }
170
    }
171
    
171
    
172
    // Les herbiers des rédacteurs
172
    // Les herbiers des rédacteurs
173
    if ($un_herbier->utilisateur->getCoordBool()) {
173
    if ($un_herbier->utilisateur->getCoordBool()) {
174
        $retour .= liste_red($un_herbier);
174
        $retour .= liste_red($un_herbier);
175
    }
175
    }
176
    return $retour;
176
    return $retour;
177
}
177
}
178
 
178
 
179
// Affichage des herbiers d'un utilisateur
179
// Affichage des herbiers d'un utilisateur
180
function mesherbiers(&$un_herbier) 
180
function mesherbiers(&$un_herbier) 
181
{
181
{
182
    $retour = '';
182
    $retour = '';
183
    
183
    
184
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
184
    if (!$un_herbier->utilisateur->recupererOrganisationListe($un_herbier->utilisateur)) {
185
        $retour .= '<p class="hba_attention">'.'Aucun herbier encore saisi !'.'</p>'."\n";
185
        $retour .= '<p class="hba_attention">'.'Aucun herbier encore saisi !'.'</p>'."\n";
186
    } else {
186
    } else {
187
        // Si l'utilisateur à saisi des herbiers : nous les affichons...
187
        // Si l'utilisateur à saisi des herbiers : nous les affichons...
188
        $retour .=  '<div class="hba_liste_organisation">'."\n".
188
        $retour .=  '<div class="hba_liste_organisation">'."\n".
189
                    '<table>'."\n".
189
                    '<table>'."\n".
190
                    '<thead>'."\n".
190
                    '<thead>'."\n".
191
                    '<tr>'."\n".'<th>'.'Ville'.'</th><th>'.'Institution'.'</th><th colspan="2">'.'Actions'.'</th>'."\n".'</tr>'."\n".
191
                    '<tr>'."\n".'<th>'.'Ville'.'</th><th>'.'Institution'.'</th><th colspan="2">'.'Actions'.'</th>'."\n".'</tr>'."\n".
192
                    '</thead>'."\n";
192
                    '</thead>'."\n";
193
        $retour .=  '<tbody>'."\n";
193
        $retour .=  '<tbody>'."\n";
194
        foreach ($un_herbier->utilisateur->getOrganisationListe() as $valeur) {
194
        foreach ($un_herbier->utilisateur->getOrganisationListe() as $valeur) {
195
            $retour .=  '<tr class="'.color_alterne(&$flag).'">'."\n";
195
            $retour .=  '<tr class="'.color_alterne(&$flag).'">'."\n";
196
            $retour .= '<td>'.$valeur->TOWN.'</td><td>'.$valeur->INSTITUTION_NAME.'</td>';
196
            $retour .= '<td>'.$valeur->TOWN.'</td><td>'.$valeur->INSTITUTION_NAME.'</td>';
197
            
197
            
198
            // Gestion des actions
198
            // Gestion des actions
199
            $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, MOD_HERB, $valeur->ID_ORG).'">'.'modifier'.'</a></td>';
199
            $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, MOD_HERB, $valeur->ID_ORG).'">'.'modifier'.'</a></td>';
200
            // Protection de l'institution exemple
200
            // Protection de l'institution exemple
201
            if ($valeur->ID_ORG != HBA_EXEMPLE_ID) {
201
            if ($valeur->ID_ORG != HBA_EXEMPLE_ID) {
202
                $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, SUPPR_HERB, $valeur->ID_ORG).'"';
202
                $retour .= '<td><a href="'.sprintf($un_herbier->url_action_org, SUPPR_HERB, $valeur->ID_ORG).'"';
203
                $retour .= ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette institution ?'.'\');"';
203
                $retour .= ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette institution ?'.'\');"';
204
                $retour .= '>'.'supprimer'.'</a></td>'."\n";
204
                $retour .= '>'.'supprimer'.'</a></td>'."\n";
205
            }
205
            }
206
            $retour .= '</tr>';
206
            $retour .= '</tr>';
207
        }
207
        }
208
        $retour .=  '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
208
        $retour .=  '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
209
    }
209
    }
210
    // Si l'utilisateur est un coordinateur nous affichons les herbiers saisis par ses rédacteurs
210
    // Si l'utilisateur est un coordinateur nous affichons les herbiers saisis par ses rédacteurs
211
    if ($un_herbier->utilisateur->getCoordBool()) {
211
    if ($un_herbier->utilisateur->getCoordBool()) {
212
        $retour .= leursherbiers($un_herbier);
212
        $retour .= leursherbiers($un_herbier);
213
    }
213
    }
214
    
214
    
215
    return $retour;
215
    return $retour;
216
}
216
}
217
 
217
 
218
// Renvoie les herbiers des rédacteurs dépendant d'un coordinateur
218
// Renvoie les herbiers des rédacteurs dépendant d'un coordinateur
219
function leursherbiers(&$un_herbier)
219
function leursherbiers(&$un_herbier)
220
{
220
{
221
    // Initialisation de variables
221
    // Initialisation de variables
222
    $retour = '';
222
    $retour = '';
223
    
223
    
224
    // Recheche de la liste des rédacteurs
224
    // Recheche de la liste des rédacteurs
225
    $requete =  'SELECT U_NAME, U_SURNAME, U_ID '.
225
    $requete =  'SELECT U_NAME, U_SURNAME, U_ID '.
226
                'FROM '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
226
                'FROM '.HB_BDD_NOM_ANNUAIRE.'.annuaire_tela, '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
227
                'WHERE HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId().' '.
227
                'WHERE HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId().' '.
228
                'AND HC_ID_REDACTEUR = U_ID';
228
                'AND HC_ID_REDACTEUR = U_ID';
229
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
229
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
230
    $id_utilisateur_courant_tmp = $un_herbier->utilisateur->getId();
230
    $id_utilisateur_courant_tmp = $un_herbier->utilisateur->getId();
231
    while ($ligne = mysql_fetch_object($resultat)) {
231
    while ($ligne = mysql_fetch_object($resultat)) {
232
        $retour .= '<h2>'.'Herbiers de '.$ligne->U_NAME.' '.$ligne->U_SURNAME.'</h2>'."\n";
232
        $retour .= '<h2>'.'Herbiers de '.$ligne->U_NAME.' '.$ligne->U_SURNAME.'</h2>'."\n";
233
        $un_herbier->utilisateur->setId($ligne->U_ID);
233
        $un_herbier->utilisateur->setId($ligne->U_ID);
234
        $retour .= mesherbiers($un_herbier)."\n";
234
        $retour .= mesherbiers($un_herbier)."\n";
235
    }
235
    }
236
    $un_herbier->utilisateur->setId($id_utilisateur_courant_tmp);
236
    $un_herbier->utilisateur->setId($id_utilisateur_courant_tmp);
237
    return $retour;
237
    return $retour;
238
}
238
}
239
 
239
 
240
// +------------------------------------------------------------------------------------------------------+
240
// +------------------------------------------------------------------------------------------------------+
241
// GESTION de l'ORGANISATION (Institution)
241
// GESTION de l'ORGANISATION (Institution)
242
 
242
 
243
function mod_herb(&$un_herbier)
243
function mod_herb(&$un_herbier)
244
{
244
{
245
    // Initialisation de variables
245
    // Initialisation de variables
246
    $organisation_nom = $un_herbier->organisation->getNom();
246
    $organisation_nom = $un_herbier->organisation->getNom();
247
    
247
    
248
    $retour = '<h1>'.'Édition d\'une institution'.' - '.$organisation_nom.'</h1>';
248
    $retour = '<h1>'.'Édition d\'une institution'.' - '.$organisation_nom.'</h1>';
249
    $retour .= fournirAideOrganisation();
249
    $retour .= fournirAideOrganisation();
250
    $liste_equipe = team_liste($un_herbier);
250
    $liste_equipe = team_liste($un_herbier);
251
    if ($liste_equipe != '') {
251
    if ($liste_equipe != '') {
252
        $retour .= '<h1>'.'L\'équipe de l\'institution'.'</h1>';
252
        $retour .= '<h1>'.'L\'équipe de l\'institution'.'</h1>';
253
        $retour .= fournirAideEquipe();
253
        $retour .= fournirAideEquipe();
254
        $retour .= $liste_equipe;
254
        $retour .= $liste_equipe;
255
    }
255
    }
256
    $liste_coll = liste_coll($un_herbier);
256
    $liste_coll = liste_coll($un_herbier);
257
    if ($liste_coll != '') {
257
    if ($liste_coll != '') {
258
        $retour .= '<h1>'.'Liste des collections de l\'institution'.'</h1>'."\n";
258
        $retour .= '<h1>'.'Liste des collections de l\'institution'.'</h1>'."\n";
259
        $retour .= fournirAideCollection();
259
        $retour .= fournirAideCollection();
260
        $retour .= $liste_coll;
260
        $retour .= $liste_coll;
261
    }
261
    }
262
    
262
    
263
    return $retour;
263
    return $retour;
264
}
264
}
265
 
265
 
266
function nouveau(&$un_herbier)
266
function nouveau(&$un_herbier)
267
{
267
{
268
    $retour = '<h1>'.'Saisie des renseignements administratifs d\'une institution'.'</h1>'."\n";
268
    $retour = '<h1>'.'Saisie des renseignements administratifs d\'une institution'.'</h1>'."\n";
269
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
269
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
270
    form_administratif(&$form, $un_herbier);
270
    form_administratif(&$form, $un_herbier);
271
    $javascript = 'onsubmit="javascript:return validateAndSubmitAdd(this);"';
271
    $javascript = 'onsubmit="javascript:return validateAndSubmitAdd(this);"';
272
    $retour .= $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), $javascript, 'liste');
272
    $retour .= $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), $javascript, 'liste');
273
    $retour .= '<div class="nettoyage">&nbsp;</div>'."\n";
273
    $retour .= '<div class="nettoyage">&nbsp;</div>'."\n";
274
    $form->finalise('un_form');
274
    $form->finalise('un_form');
275
    return $retour;
275
    return $retour;
276
}
276
}
277
 
277
 
278
// insertion des donnees administrative dans la base
278
// insertion des donnees administrative dans la base
279
// et des informations sur le correspondant
279
// et des informations sur le correspondant
280
function nouveau_v(&$un_herbier)
280
function nouveau_v(&$un_herbier)
281
{
281
{
282
    $retour = '';
282
    $retour = '';
283
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
283
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
284
    $form = $form->acquerir('HERBIERS_ORGANISATION');
284
    $form = $form->acquerir('HERBIERS_ORGANISATION');
285
    
285
    
286
    $id = $form->insertMySQL();
286
    $id = $form->insertMySQL();
287
    if ($_POST['INSTITUTION_NAME'] == '') {
287
    if ($_POST['INSTITUTION_NAME'] == '') {
288
        $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $id, 'ID_ORG');
288
        $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $id, 'ID_ORG');
289
        form_administratif(&$form, $un_herbier);
289
        form_administratif(&$form, $un_herbier);
290
        $retour .=  '<h1>'.'Vous devez saisir un nom d\'institution'.'</h1>'."\n";
290
        $retour .=  '<h1>'.'Vous devez saisir un nom d\'institution'.'</h1>'."\n";
291
        $retour .=  $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), 'onsubmit="javascript:return validateAndSubmitAdd(this);"');
291
        $retour .=  $form->printForm(sprintf($un_herbier->url_action, HBA_ACTION_HERBIER_VERIF), 'onsubmit="javascript:return validateAndSubmitAdd(this);"');
292
        return $retour;
292
        return $retour;
293
    }
293
    }
294
    $une_organisation = new H_organisation();
294
    $une_organisation = new H_organisation();
295
    $une_organisation->setId($id);
295
    $une_organisation->setId($id);
296
    if (!$un_herbier->utilisateur->getAdminBool()) {
296
    if (!$un_herbier->utilisateur->getAdminBool()) {
297
        $un_herbier->utilisateur->insererOrganisationListe($une_organisation);
297
        $un_herbier->utilisateur->insererOrganisationListe($une_organisation);
298
    }
298
    }
299
    return TRUE;
299
    return TRUE;
300
}
300
}
301
 
301
 
302
function form_administratif(&$form, &$un_herbier)
302
function form_administratif(&$form, &$un_herbier)
303
{
303
{
304
    // Définition des styles
304
    // Définition des styles
305
    $form->style_general = 'hba_formulaire';
305
    $form->style_general = 'hba_formulaire';
306
    $form->style_label = 'hba_label';
306
    $form->style_label = 'hba_label';
307
    $form->style_button = 'hba_bouton';
307
    $form->style_button = 'hba_bouton';
308
    $form->style_commentaire = 'hba_commentaire';
308
    $form->style_commentaire = 'hba_commentaire';
309
    $form->style_radiocheckbox = 'hba_radio';
309
    $form->style_radiocheckbox = 'hba_radio';
310
    
310
    
311
    // Choix des champs
311
    // Choix des champs
312
    $form->addChamps('INSTITUTION_NAME', 'Nom de l\'institution <span class="symbole_obligatoire">*</span> : ');
312
    $form->addChamps('INSTITUTION_NAME', 'Nom de l\'institution <span class="symbole_obligatoire">*</span> : ');
313
    $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.');
313
    $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.');
314
    $form->addChamps('ADRESS_LINE', 'Adresse : ');
314
    $form->addChamps('ADRESS_LINE', 'Adresse : ');
315
    $form->addChamps('INDEX_HERB', 'Index Herbariorum : ');
315
    $form->addChamps('INDEX_HERB', 'Index Herbariorum : ');
316
    $form->addCommentaire('<br />'.'Ne saisir que des chiffres, sans espace ( 54789 oui, F-54789 non )');
316
    $form->addCommentaire('<br />'.'Ne saisir que des chiffres, sans espace ( 54789 oui, F-54789 non )');
317
    $form->addChamps('ZIP', 'Code postal <span class="symbole_obligatoire">*</span> : ');
317
    $form->addChamps('ZIP', 'Code postal <span class="symbole_obligatoire">*</span> : ');
318
    $form->addChamps('TOWN', 'Ville : ');
318
    $form->addChamps('TOWN', 'Ville : ');
319
    $form->addChamps('REGION', 'Région : ');
319
    $form->addChamps('REGION', 'Région : ');
320
    $form->selectFromTable('COUNTRY_CODE par gen_COUNTRY', 'fr', 'GC_ID', 'GC_NAME', 'Pays : ');
320
    $form->selectFromTable('COUNTRY_CODE par gen_COUNTRY', 'fr', 'GC_ID', 'GC_NAME', 'Pays : ');
321
    $form->addChamps('TEL', 'Téléphone : ');
321
    $form->addChamps('TEL', 'Téléphone : ');
322
    $form->addChamps('FAX', 'fax : ') ;
322
    $form->addChamps('FAX', 'fax : ') ;
323
    $form->addCommentaire('Saisir l\'e-mail de l\'organisation (ex: accueil@organisation.org), pas de mail individuel.');
323
    $form->addCommentaire('Saisir l\'e-mail de l\'organisation (ex: accueil@organisation.org), pas de mail individuel.');
324
    $form->addChamps('EMAIL', 'E-mail : ');
324
    $form->addChamps('EMAIL', 'E-mail : ');
325
    $form->addCommentaire('<br />'.'Un lien internet vers l\'institution, de la forme <b>http://www.mon_institution.org</b>.');
325
    $form->addCommentaire('<br />'.'Un lien internet vers l\'institution, de la forme <b>http://www.mon_institution.org</b>.');
326
    $form->addChamps('HO_URL', 'URL : ');
326
    $form->addChamps('HO_URL', 'URL : ');
327
    $form->addChamps('LOGO', 'Logo (URL vers un fichier graphique) : ');
327
    $form->addChamps('LOGO', 'Logo (URL vers un fichier graphique) : ');
328
    $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...');
328
    $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...');
329
    $form->addChamps('ACCESS_RESTRICTION', 'Conditions d\'accès : ');
329
    $form->addChamps('ACCESS_RESTRICTION', 'Conditions d\'accès : ');
330
    $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.');
330
    $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.');
331
    $form->addChamps('SOURCE_DES_DONNEES', 'Source des informations');
331
    $form->addChamps('SOURCE_DES_DONNEES', 'Source des informations');
332
    $form->addCommentaire('<strong><span class="symbole_obligatoire">'.'*'.'</span>'.' : '.'</strong>'.'champ obligatoire.');
332
    $form->addCommentaire('<strong><span class="symbole_obligatoire">'.'*'.'</span>'.' : '.'</strong>'.'champ obligatoire.');
333
	// Gestion des métadonnées
333
	// Gestion des métadonnées
334
	gererMetaForm(&$form, &$un_herbier);
334
	gererMetaForm(&$form, &$un_herbier);
335
	    
335
	    
336
    if ($form->id != HBA_EXEMPLE_ID) {
336
    if ($form->id != HBA_EXEMPLE_ID) {
337
        $form->submit('Valider', 'herbier_pere');
337
        $form->submit('Valider', 'herbier_pere');
338
    }
338
    }
339
    $form->annuler('Annuler', sprintf($un_herbier->url_action, HBA_ACTION_ANNULER));
339
    $form->annuler('Annuler', sprintf($un_herbier->url_action, HBA_ACTION_ANNULER));
340
}
340
}
341
 
341
 
342
function mod_adm($un_herbier)
342
function mod_adm($un_herbier)
343
{
343
{
344
    $retour = '<h1>'.'Modification d\'une institution'.' - '.$un_herbier->organisation->getNom().'</h1>';
344
    $retour = '<h1>'.'Modification d\'une institution'.' - '.$un_herbier->organisation->getNom().'</h1>';
345
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $un_herbier->organisation->getId(), 'ID_ORG');
345
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION', 'MOD', $un_herbier->organisation->getId(), 'ID_ORG');
346
    form_administratif(&$form, $un_herbier);
346
    form_administratif(&$form, $un_herbier);
347
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, MOD_ADM_V, $un_herbier->organisation->getId()));
347
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, MOD_ADM_V, $un_herbier->organisation->getId()));
348
    $form->finalise('un_form');
348
    $form->finalise('un_form');
349
    return $retour;
349
    return $retour;
350
}
350
}
351
 
351
 
352
function mod_adm_v(&$un_herbier)
352
function mod_adm_v(&$un_herbier)
353
{
353
{
354
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
354
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_ORGANISATION');
355
    $form = $form->acquerir('HERBIERS_ORGANISATION');
355
    $form = $form->acquerir('HERBIERS_ORGANISATION');
356
    
356
    
357
    if (($_POST['gen_COUNTRY'] == 'fr') and (!checkZip($_POST['ZIP']))) {
357
    if (($_POST['gen_COUNTRY'] == 'fr') and (!checkZip($_POST['ZIP']))) {
358
        $retour .= checkvalue('Le code postal n\'a pas la forme adéquate', '');
358
        $retour .= checkvalue('Le code postal n\'a pas la forme adéquate', '');
359
        return $retour;
359
        return $retour;
360
    }
360
    }
361
    
361
    
362
    $form->updateMySQL('ID_ORG', $un_herbier->organisation->getId());
362
    $form->updateMySQL('ID_ORG', $un_herbier->organisation->getId());
363
}
363
}
364
 
364
 
365
function suppr_herb(&$un_herbier)
365
function suppr_herb(&$un_herbier)
366
{
366
{
367
    // Initialisation des variables
367
    // Initialisation des variables
368
    $id_org = $un_herbier->organisation->getId();
368
    $id_org = $un_herbier->organisation->getId();
369
    
369
    
370
    // Supression des collections (et par cascades des notes, indic...) des collections de l'organisation
370
    // Supression des collections (et par cascades des notes, indic...) des collections de l'organisation
371
    $requete =  'SELECT ID '.
371
    $requete =  'SELECT ID '.
372
                'FROM HERBIERS_COLLECTION '.
372
                'FROM HERBIERS_COLLECTION '.
373
                'WHERE PARENT_ID = '.$id_org;
373
                'WHERE PARENT_ID = '.$id_org;
374
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
374
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
375
    while ($ligne = mysql_fetch_object($resultat)) {
375
    while ($ligne = mysql_fetch_object($resultat)) {
376
        suppr_coll($un_herbier, $ligne->ID);
376
        suppr_coll($un_herbier, $ligne->ID);
377
    }
377
    }
378
    
378
    
379
    // Suppression de l'organisation
379
    // Suppression de l'organisation
380
    $requete = 'DELETE FROM HERBIERS_ORGANISATION WHERE ID_ORG = '.$id_org;
380
    $requete = 'DELETE FROM HERBIERS_ORGANISATION WHERE ID_ORG = '.$id_org;
381
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
381
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
382
    
382
    
383
    // Supression de chaque membre de l'équipe (ou contact) de l'organisation
383
    // Supression de chaque membre de l'équipe (ou contact) de l'organisation
384
    $requete_01 = 'SELECT ID_STAFF '.
384
    $requete_01 = 'SELECT ID_STAFF '.
385
            'FROM HERBIERS_ont_un_staff '.
385
            'FROM HERBIERS_ont_un_staff '.
386
            'WHERE ID_ORG = '.$id_org;
386
            'WHERE ID_ORG = '.$id_org;
387
    $resultat_01 = mysql_query($requete_01) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_01));
387
    $resultat_01 = mysql_query($requete_01) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_01));
388
    while ($ligne_01 = mysql_fetch_object($resultat_01)) {
388
    while ($ligne_01 = mysql_fetch_object($resultat_01)) {
389
        $requete_02 =   'DELETE FROM HERBIERS_STAFF '.
389
        $requete_02 =   'DELETE FROM HERBIERS_STAFF '.
390
                        'WHERE ID_STAFF = '.$ligne_01->ID_STAFF;
390
                        'WHERE ID_STAFF = '.$ligne_01->ID_STAFF;
391
        mysql_query($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02));
391
        mysql_query($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02));
392
    }
392
    }
393
    // Suppression de la liste des équipiers (et/ou contacts) de l'organisation
393
    // Suppression de la liste des équipiers (et/ou contacts) de l'organisation
394
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
394
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
395
                'WHERE ID_ORG = '.$id_org;
395
                'WHERE ID_ORG = '.$id_org;
396
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
396
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
397
    
397
    
398
    // Suppression de l'organisation dans la liste des organisations (= herbiers) de l'utilisateur (HERBIERS_ADMINISTRER)
398
    // Suppression de l'organisation dans la liste des organisations (= herbiers) de l'utilisateur (HERBIERS_ADMINISTRER)
399
    $requete =  'DELETE FROM HERBIERS_ADMINISTRER '.
399
    $requete =  'DELETE FROM HERBIERS_ADMINISTRER '.
400
                'WHERE HA_ID_ORG = '.$id_org;
400
                'WHERE HA_ID_ORG = '.$id_org;
401
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
401
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
402
}
402
}
403
 
403
 
404
// +------------------------------------------------------------------------------------------------------+
404
// +------------------------------------------------------------------------------------------------------+
405
// GESTION de l'ÉQUIPE, d'un ÉQUIPIER et d'un CONTACT
405
// GESTION de l'ÉQUIPE, d'un ÉQUIPIER et d'un CONTACT
406
 
406
 
407
function team_liste(&$un_herbier)
407
function team_liste(&$un_herbier)
408
{
408
{
409
    $retour = '';
409
    $retour = '';
410
    
410
    
411
    $requete =  'SELECT HERBIERS_STAFF.* '.
411
    $requete =  'SELECT HERBIERS_STAFF.* '.
412
                'from HERBIERS_STAFF, HERBIERS_ont_un_staff, HERBIERS_ORGANISATION '.
412
                'from HERBIERS_STAFF, HERBIERS_ont_un_staff, HERBIERS_ORGANISATION '.
413
                'WHERE HERBIERS_ORGANISATION.ID_ORG = '.$un_herbier->organisation->getId().' '.
413
                'WHERE HERBIERS_ORGANISATION.ID_ORG = '.$un_herbier->organisation->getId().' '.
414
                'AND HERBIERS_ont_un_staff.ID_ORG = HERBIERS_ORGANISATION.ID_ORG '.
414
                'AND HERBIERS_ont_un_staff.ID_ORG = HERBIERS_ORGANISATION.ID_ORG '.
415
                'AND HERBIERS_STAFF.ID_STAFF = HERBIERS_ont_un_staff.ID_STAFF';
415
                'AND HERBIERS_STAFF.ID_STAFF = HERBIERS_ont_un_staff.ID_STAFF';
416
    
416
    
417
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
417
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
418
    if (mysql_num_rows($resultat) == 0) {
418
    if (mysql_num_rows($resultat) == 0) {
419
        $retour .= '<p class="hba_attention">'.'Aucune équipe renseignée !'.'</p>'."\n";
419
        $retour .= '<p class="hba_attention">'.'Aucune équipe renseignée !'.'</p>'."\n";
420
        return $retour;
420
        return $retour;
421
    }
421
    }
422
    $retour .= '<div class="hba_liste_equipe">'."\n";
422
    $retour .= '<div class="hba_liste_equipe">'."\n";
423
    $retour .= '<table>'."\n";
423
    $retour .= '<table>'."\n";
424
    $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n";
424
    $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n";
425
    $retour .= '<tbody>'."\n";
425
    $retour .= '<tbody>'."\n";
426
    while ($ligne = mysql_fetch_object($resultat)) {
426
    while ($ligne = mysql_fetch_object($resultat)) {
427
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td>'.$ligne->NOM.'</td><td>'.$ligne->PRENOM.'</td>'."\n";
427
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td>'.$ligne->NOM.'</td><td>'.$ligne->PRENOM.'</td>'."\n";
428
        $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, MOD_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'">'.
428
        $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, MOD_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'">'.
429
                    'modifier'.'</a></td>'."\n";
429
                    'modifier'.'</a></td>'."\n";
430
        
430
        
431
        if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
431
        if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
432
            $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, SUPPR_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'" '.
432
            $retour .=  '<td><a href="'.sprintf($un_herbier->url_action_org_equipe, SUPPR_STAFF, $un_herbier->organisation->getId(), $ligne->ID_STAFF).'" '.
433
                        ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer : '.$ligne->NOM.' '.$ligne->PRENOM.' ?'.'\');">'.
433
                        ' onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer : '.$ligne->NOM.' '.$ligne->PRENOM.' ?'.'\');">'.
434
                        'supprimer'.'</a></td>'."\n";
434
                        'supprimer'.'</a></td>'."\n";
435
        }
435
        }
436
        $retour .= '</tr>'."\n";
436
        $retour .= '</tr>'."\n";
437
    }
437
    }
438
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
438
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
439
    
439
    
440
    return $retour;
440
    return $retour;
441
}
441
}
442
 
442
 
443
function nouv_team(&$un_herbier)
443
function nouv_team(&$un_herbier)
444
{
444
{
445
    $retour = '<h1>'.'Ajout d\'un membre'.'</h1>'."\n";
445
    $retour = '<h1>'.'Ajout d\'un membre'.'</h1>'."\n";
446
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
446
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
447
    form_team($form, $un_herbier);
447
    form_team($form, $un_herbier);
448
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUV_TEAM_V, $un_herbier->organisation->getId()))."\n";
448
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUV_TEAM_V, $un_herbier->organisation->getId()))."\n";
449
    $form->finalise('form_team');
449
    $form->finalise('form_team');
450
    return $retour;
450
    return $retour;
451
}
451
}
452
 
452
 
453
function nouv_team_v(&$un_herbier)
453
function nouv_team_v(&$un_herbier)
454
{
454
{
455
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
455
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
456
    $form = $form->acquerir('HERBIERS_STAFF');
456
    $form = $form->acquerir('HERBIERS_STAFF');
457
    $un_herbier->organisation->insererMembreEquipe($form->insertMySQL());
457
    $un_herbier->organisation->insererMembreEquipe($form->insertMySQL());
458
}
458
}
459
 
459
 
460
function form_team(&$form , &$un_herbier)
460
function form_team(&$form , &$un_herbier)
461
{
461
{
462
    // Définition des styles
462
    // Définition des styles
463
    $form->style_general = 'hba_formulaire';
463
    $form->style_general = 'hba_formulaire';
464
    $form->style_label = 'hba_label';
464
    $form->style_label = 'hba_label';
465
    $form->style_button = 'hba_bouton';
465
    $form->style_button = 'hba_bouton';
466
    $form->style_commentaire = 'hba_commentaire';
466
    $form->style_commentaire = 'hba_commentaire';
467
    $form->style_radiocheckbox = 'hba_radio';
467
    $form->style_radiocheckbox = 'hba_radio';
468
    
468
    
469
    // Propose par defaut l'adresse de l'organisation
469
    // Propose par defaut l'adresse de l'organisation
470
    $requete =    'SELECT ADRESS_LINE, TOWN, ZIP '.
470
    $requete =    'SELECT ADRESS_LINE, TOWN, ZIP '.
471
                'FROM HERBIERS_ORGANISATION '.
471
                'FROM HERBIERS_ORGANISATION '.
472
                'WHERE ID_ORG = '.$un_herbier->organisation->getId();
472
                'WHERE ID_ORG = '.$un_herbier->organisation->getId();
473
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
473
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
474
    $ligne = mysql_fetch_object($resultat);
474
    $ligne = mysql_fetch_object($resultat);
475
    
475
    
476
    $form->addChamps('NOM', 'Nom : ');
476
    $form->addChamps('NOM', 'Nom : ');
477
    $form->addChamps('PRENOM', 'Prénom : ');
477
    $form->addChamps('PRENOM', 'Prénom : ');
478
    $form->addChamps('ADRESSE1', 'Adresse : ', $ligne->ADRESS_LINE);
478
    $form->addChamps('ADRESSE1', 'Adresse : ', $ligne->ADRESS_LINE);
479
    $form->addChamps('ADRESSE2', 'Adresse : ');
479
    $form->addChamps('ADRESSE2', 'Adresse : ');
480
    $form->addChamps('CP', 'Code postal : ', $ligne->ZIP);
480
    $form->addChamps('CP', 'Code postal : ', $ligne->ZIP);
481
    $form->addChamps('VILLE', 'Ville : ', $ligne->TOWN);
481
    $form->addChamps('VILLE', 'Ville : ', $ligne->TOWN);
482
    $form->addChamps('MAIL', 'email : ');
482
    $form->addChamps('MAIL', 'email : ');
483
    $form->addChamps('TEL', 'Tél : ');
483
    $form->addChamps('TEL', 'Tél : ');
484
    $form->addChamps('FAX', 'Fax : ');
484
    $form->addChamps('FAX', 'Fax : ');
485
    $form->addChamps('FONCTION', 'Fonction : ');
485
    $form->addChamps('FONCTION', 'Fonction : ');
486
    $form->radioEnum('CONTACT', 'La personne est-elle contact ? : ','non');
486
    $form->radioEnum('CONTACT', 'La personne est-elle contact ? : ','non');
487
    // Gestion des métadonnées
487
    // Gestion des métadonnées
488
	gererMetaForm(&$form, &$un_herbier);
488
	gererMetaForm(&$form, &$un_herbier);
489
        
489
        
490
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
490
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
491
        $form->submit('Valider');
491
        $form->submit('Valider');
492
    }
492
    }
493
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
493
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
494
}
494
}
495
 
495
 
496
function suppr_staff(&$un_herbier)
496
function suppr_staff(&$un_herbier)
497
{
497
{
498
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
498
    $requete =  'DELETE FROM HERBIERS_ont_un_staff '.
499
                'WHERE ID_STAFF = '.$un_herbier->equipe->getId().' '.
499
                'WHERE ID_STAFF = '.$un_herbier->equipe->getId().' '.
500
                'AND ID_ORG = '.$un_herbier->organisation->getId();
500
                'AND ID_ORG = '.$un_herbier->organisation->getId();
501
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
501
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
502
    // Verification que la fiche de herbiers_staff ai encore une utilite
502
    // Verification que la fiche de herbiers_staff ai encore une utilite
503
    $requete = 'SELECT ID_STAFF FROM HERBIERS_ont_un_staff WHERE ID_STAFF = '.$un_herbier->equipe->getId();
503
    $requete = 'SELECT ID_STAFF FROM HERBIERS_ont_un_staff WHERE ID_STAFF = '.$un_herbier->equipe->getId();
504
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
504
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
505
    // le membre n'est plus dans aucun herbier, on le supprime
505
    // le membre n'est plus dans aucun herbier, on le supprime
506
    if (mysql_num_rows($resultat) == 0) {
506
    if (mysql_num_rows($resultat) == 0) {
507
        $requete = 'DELETE FROM HERBIERS_STAFF WHERE ID_STAFF = '.$un_herbier->equipe->getId();
507
        $requete = 'DELETE FROM HERBIERS_STAFF WHERE ID_STAFF = '.$un_herbier->equipe->getId();
508
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
508
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
509
    }
509
    }
510
}
510
}
511
 
511
 
512
function mod_staff(&$un_herbier)
512
function mod_staff(&$un_herbier)
513
{
513
{
514
    // Initialisation de variables
514
    // Initialisation de variables
515
    $id_equipe = $un_herbier->equipe->getId();
515
    $id_equipe = $un_herbier->equipe->getId();
516
    $id_org = $un_herbier->organisation->getId();
516
    $id_org = $un_herbier->organisation->getId();
517
    
517
    
518
    // Création du formulaire de modification
518
    // Création du formulaire de modification
519
    $retour = '<h1>'.'Modification d\'un membre de l\'équipe'.'</h1>'."\n";
519
    $retour = '<h1>'.'Modification d\'un membre de l\'équipe'.'</h1>'."\n";
520
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF', 'MOD', $id_equipe, 'ID_STAFF');
520
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF', 'MOD', $id_equipe, 'ID_STAFF');
521
    form_team($form, $un_herbier);
521
    form_team($form, $un_herbier);
522
    $url = sprintf($un_herbier->getUrlActionOrgEquipe(), MOD_STAFF_V, $id_org, $id_equipe);
522
    $url = sprintf($un_herbier->getUrlActionOrgEquipe(), MOD_STAFF_V, $id_org, $id_equipe);
523
    $retour .= $form->printForm($url);
523
    $retour .= $form->printForm($url);
524
    $form->finalise('form_staff');
524
    $form->finalise('form_staff');
525
    return $retour;
525
    return $retour;
526
}
526
}
527
 
527
 
528
function mod_staff_v(&$un_herbier)
528
function mod_staff_v(&$un_herbier)
529
{
529
{
530
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
530
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_STAFF');
531
    $form = $form->acquerir('HERBIERS_STAFF');
531
    $form = $form->acquerir('HERBIERS_STAFF');
532
    $form->updateMySQL('ID_STAFF', $un_herbier->equipe->getId());
532
    $form->updateMySQL('ID_STAFF', $un_herbier->equipe->getId());
533
}
533
}
534
 
534
 
535
// +------------------------------------------------------------------------------------------------------+
535
// +------------------------------------------------------------------------------------------------------+
536
// GESTION des COLLECTIONS
536
// GESTION des COLLECTIONS
537
 
537
 
538
function liste_coll(&$un_herbier)
538
function liste_coll(&$un_herbier)
539
{
539
{
540
    // Initialisation de variables
540
    // Initialisation de variables
541
    $retour = '';
541
    $retour = '';
542
    $id_action = $un_herbier->getAction();
542
    $id_action = $un_herbier->getAction();
543
    $id_org = $un_herbier->organisation->getId();
543
    $id_org = $un_herbier->organisation->getId();
544
    $id_coll = null;
544
    $id_coll = null;
545
    if (is_object($un_herbier->getCollection())) {
545
    if (is_object($un_herbier->getCollection())) {
546
        $id_coll = $un_herbier->collection->getId();
546
        $id_coll = $un_herbier->collection->getId();
547
    }
547
    }
548
    
548
    
549
    $requete =  'SELECT NOM_COLLECTION,ID '.
549
    $requete =  'SELECT NOM_COLLECTION,ID '.
550
                'FROM HERBIERS_COLLECTION '.
550
                'FROM HERBIERS_COLLECTION '.
551
                'WHERE PARENT_ID = '.$id_org;
551
                'WHERE PARENT_ID = '.$id_org;
552
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
552
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
553
    
553
    
554
    if (mysql_num_rows($resultat) == 0) {
554
    if (mysql_num_rows($resultat) == 0) {
555
        $retour .= '<p class="hba_attention">'.'Aucune collection renseignée !'.'</p>'."\n";
555
        $retour .= '<p class="hba_attention">'.'Aucune collection renseignée !'.'</p>'."\n";
556
        return $retour;
556
        return $retour;
557
    }
557
    }
558
    $retour .=  '<div class="hba_liste_collection">'."\n".
558
    $retour .=  '<div class="hba_liste_collection">'."\n".
559
                '<table>'."\n".
559
                '<table>'."\n".
560
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th colspan="3">'.'Actions'.'</th></tr></thead>'."\n".
560
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th colspan="3">'.'Actions'.'</th></tr></thead>'."\n".
561
                '<tbody>'."\n";
561
                '<tbody>'."\n";
562
    while ($ligne = mysql_fetch_object($resultat)) {
562
    while ($ligne = mysql_fetch_object($resultat)) {
563
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
563
        $retour .= '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
564
        $requete_indic =    'SELECT ID_INDIC '.
564
        $requete_indic =    'SELECT ID_INDIC '.
565
                            'FROM HERBIERS_INDIC '.
565
                            'FROM HERBIERS_INDIC '.
566
                            'WHERE ID = '.$ligne->ID;
566
                            'WHERE ID = '.$ligne->ID;
567
        $resultat_indic = mysql_query($requete_indic) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_indic));
567
        $resultat_indic = mysql_query($requete_indic) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_indic));
568
        if (mysql_num_rows($resultat_indic) > 0) {
568
        if (mysql_num_rows($resultat_indic) > 0) {
569
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
569
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
570
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
570
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
571
                            '</a>'."\n";
571
                            '</a>'."\n";
572
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $ligne->ID).'">'."\n".
572
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $ligne->ID).'">'."\n".
573
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
573
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
574
                            '</a>'."\n";
574
                            '</a>'."\n";
575
            if ($id_coll == $ligne->ID) {
575
            if ($id_coll == $ligne->ID) {
576
                switch ($id_action) {
576
                switch ($id_action) {
577
                    case HBA_ACTION_COLL_DEROULER :
577
                    case HBA_ACTION_COLL_DEROULER :
578
                    case SUPPR_NOTE :
578
                    case SUPPR_NOTE :
579
                    case MOD_NOTE :
579
                    case MOD_NOTE :
580
                    case MOD_NOTE_V :
580
                    case MOD_NOTE_V :
581
                        $retour .= $xhtml_fermer;
581
                        $retour .= $xhtml_fermer;
582
                    break;
582
                    break;
583
                    default :
583
                    default :
584
                        $retour .= $xhtml_ouvrir;
584
                        $retour .= $xhtml_ouvrir;
585
                }
585
                }
586
            } else {
586
            } else {
587
                $retour .= $xhtml_ouvrir;
587
                $retour .= $xhtml_ouvrir;
588
            }
588
            }
589
        }
589
        }
590
        $retour .= '</td><td>';
590
        $retour .= '</td><td>';
591
        $retour .= $ligne->NOM_COLLECTION.'</td>';
591
        $retour .= $ligne->NOM_COLLECTION.'</td>';
592
        $retour .=  '<td><a href="'.
592
        $retour .=  '<td><a href="'.
593
                    sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC, $id_org, $ligne->ID).
593
                    sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC, $id_org, $ligne->ID).
594
                    '">'.'modifier'.'</a></td>'."\n";
594
                    '">'.'modifier'.'</a></td>'."\n";
595
        if ($id_org != HBA_EXEMPLE_ID) {
595
        if ($id_org != HBA_EXEMPLE_ID) {
596
            $retour .=  '<td><a href="'.
596
            $retour .=  '<td><a href="'.
597
                        sprintf($un_herbier->getUrlActionOrgColl(), SUPPR_COLL, $id_org, $ligne->ID).
597
                        sprintf($un_herbier->getUrlActionOrgColl(), SUPPR_COLL, $id_org, $ligne->ID).
598
                        '" onclick="javascript:return confirm(\''.'Étes vous sûr de vouloir supprimer cette collection ?'.'\');">'.
598
                        '" onclick="javascript:return confirm(\''.'Étes vous sûr de vouloir supprimer cette collection ?'.'\');">'.
599
                        'supprimer'.'</a>&nbsp;</td>'."\n";
599
                        'supprimer'.'</a>&nbsp;</td>'."\n";
600
        }
600
        }
601
        $retour .=  '<td><a href="'.
601
        $retour .=  '<td><a href="'.
602
                    sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC, $id_org, $ligne->ID).
602
                    sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC, $id_org, $ligne->ID).
603
                    '">'.'ajouter note'.'</a></td>'."\n";
603
                    '">'.'ajouter note'.'</a></td>'."\n";
604
        $retour .= '</tr>';
604
        $retour .= '</tr>';
605
        
605
        
606
        switch ($id_action) {
606
        switch ($id_action) {
607
            case HBA_ACTION_COLL_DEROULER :
607
            case HBA_ACTION_COLL_DEROULER :
608
            case SUPPR_NOTE :
608
            case SUPPR_NOTE :
609
            case MOD_NOTE :
609
            case MOD_NOTE :
610
            case MOD_NOTE_V :
610
            case MOD_NOTE_V :
611
                if ($id_coll == $ligne->ID) {
611
                if ($id_coll == $ligne->ID) {
612
                    $retour .= '<tr class="hba_liste_note"><td colspan="5">'.liste_indic($un_herbier).'</td></tr>'."\n";
612
                    $retour .= '<tr class="hba_liste_note"><td colspan="5">'.liste_indic($un_herbier).'</td></tr>'."\n";
613
                }
613
                }
614
                break;
614
                break;
615
        }
615
        }
616
    }
616
    }
617
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>';
617
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>';
618
    
618
    
619
    return $retour;
619
    return $retour;
620
}
620
}
621
 
621
 
622
function nouv_coll(&$un_herbier)
622
function nouv_coll(&$un_herbier)
623
{
623
{
624
    $retour = '<h1>'.'Ajout d\'une collection'.'</h1>'."\n";
624
    $retour = '<h1>'.'Ajout d\'une collection'.'</h1>'."\n";
625
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
625
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
626
    $form->style_general = 'insInputForm';
626
    $form->style_general = 'insInputForm';
627
    form_herb_2($form, $un_herbier);
627
    form_herb_2($form, $un_herbier);
628
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUVEAU_HERB4, $un_herbier->organisation->getId()))."\n";//, null, 'liste'
628
    $retour .= $form->printForm(sprintf($un_herbier->url_action_org, NOUVEAU_HERB4, $un_herbier->organisation->getId()))."\n";//, null, 'liste'
629
    $form->finalise('form_2');
629
    $form->finalise('form_2');
630
    return $retour;
630
    return $retour;
631
}
631
}
632
 
632
 
633
function form_herb_2(&$form, &$un_herbier)
633
function form_herb_2(&$form, &$un_herbier)
634
{
634
{
635
    // Définition des styles
635
    // Définition des styles
636
    $form->style_general = 'hba_formulaire';
636
    $form->style_general = 'hba_formulaire';
637
    $form->style_label = 'hba_label';
637
    $form->style_label = 'hba_label';
638
    $form->style_button = 'hba_bouton';
638
    $form->style_button = 'hba_bouton';
639
    $form->style_commentaire = 'hba_commentaire';
639
    $form->style_commentaire = 'hba_commentaire';
640
    $form->style_radiocheckbox = 'hba_radio';
640
    $form->style_radiocheckbox = 'hba_radio';
641
    
641
    
642
    // Choix des champs
642
    // Choix des champs
643
    $form->addChamps('NOM_COLLECTION', 'Nom de la collection : ');
643
    $form->addChamps('NOM_COLLECTION', 'Nom de la collection : ');
644
    $form->addChamps('COLLECTION_CODE', 'Sigle d\'usage de la collection : ');
644
    $form->addChamps('COLLECTION_CODE', 'Sigle d\'usage de la collection : ');
645
    $form->addChamps('DESCRIPTION', 'Description générale : ');
645
    $form->addChamps('DESCRIPTION', 'Description générale : ');
646
    $form->radioFromTable('STATUT par HERBIERS_COLL_STATUT', 1, 'Statut de la collection : ');
646
    $form->radioFromTable('STATUT par HERBIERS_COLL_STATUT', 1, 'Statut de la collection : ');
-
 
647
    $form->addCommentaire('<strong>Notes sur les collecteurs</strong>');
647
    $form->addCommentaire('Les collecteurs doivent être séparés par un retour à la ligne (entrée)');
648
    $form->addCommentaire('Les collecteurs doivent être séparés par un retour à la ligne (entrée).');
-
 
649
    $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...]');
-
 
650
    $form->addCommentaire('Exemple : AARONSOHN, Aaron (2ème jeux après AAR) {?-1919} [IL,1905;PS,1906]');
-
 
651
    $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>. '.
-
 
652
    		'Pour les données inconnues, un point d\'interrogation. '.
-
 
653
    		'Pour les dates, indiquer seulement l\'année sinon utiliser le format : jj/mm/aaaa');
648
    $form->addChamps('COLLECTEURS', 'Collecteurs : ');
654
    $form->addChamps('COLLECTEURS', 'Collecteurs : ');
649
    $form->addCommentaire('<b>Dates extrêmes de récolte des spécimens</b>');
655
    $form->addCommentaire('<b>Dates extrêmes de récolte des spécimens</b>');
650
    $form->addCommentaire('Les dates doivent être saisies selon le format jj-mm-année, par ex: 05-06-1956');
656
    $form->addCommentaire('Les dates doivent être saisies selon le format jj-mm-année, par ex: 05-06-1956');
651
    $form->addCommentaire('Laisser en blanc la date de fin si la collection est encore alimentée');
657
    $form->addCommentaire('Laisser en blanc la date de fin si la collection est encore alimentée');
652
    
658
    
653
    // Les dates de début et fin de récolte
659
    // Les dates de début et fin de récolte
654
    $form->addChamps('DATE_DEBUT', 'Date extrême de récolte des spécimens (début) : ', '', 'text');
660
    $form->addChamps('DATE_DEBUT', 'Date extrême de récolte des spécimens (début) : ', '', 'text');
655
    $form->radioFromTable('DATE_DEBUT_CARAC par HERBIERS_DATE_DEBUT_CARAC', '', 'Caractériser la date de début : ');
661
    $form->radioFromTable('DATE_DEBUT_CARAC par HERBIERS_DATE_DEBUT_CARAC', '', 'Caractériser la date de début : ');
656
    $form->addChamps('DATE_FIN', 'Date extrême de récolte des spécimens (fin) : ');
662
    $form->addChamps('DATE_FIN', 'Date extrême de récolte des spécimens (fin) : ');
657
    $form->radioFromTable('DATE_FIN_CARAC par HERBIERS_DATE_FIN_CARAC', '', 'Caractériser la date de fin : ');
663
    $form->radioFromTable('DATE_FIN_CARAC par HERBIERS_DATE_FIN_CARAC', '', 'Caractériser la date de fin : ');
658
    
664
    
659
    // L'url de la collection
665
    // L'url de la collection
660
    $form->addChamps('URL', 'URL vers le site de la collection (optionnel) : ');
666
    $form->addChamps('URL', 'URL vers le site de la collection (optionnel) : ');
661
    
667
    
662
    // Types, spécimens et dénombrement
668
    // Types, spécimens et dénombrement
663
    $radio = array('0', 'indéterminé', '1', 'non', '2', 'oui');
669
    $radio = array('0', 'indéterminé', '1', 'non', '2', 'oui');
664
    $form->radio('INCLUDED_TYPE', $radio, 'Y-a-t\'il des échantillons-types : ');
670
    $form->radio('INCLUDED_TYPE', $radio, 'Y-a-t\'il des échantillons-types : ');
665
    $form->addCommentaire('<b>Mode de conservation des spécimens :</b>');
671
    $form->addCommentaire('<b>Mode de conservation des spécimens :</b>');
666
    $form->checkboxFromTable('HERBIERS_COLLECTION par HERBIERS_ont_pres et HERBIERS_PRES', 'Cocher les cases : ', '','LIGNE', 'ID', 'ID_PRES', 'ID_PRES');
672
    $form->checkboxFromTable('HERBIERS_COLLECTION par HERBIERS_ont_pres et HERBIERS_PRES', 'Cocher les cases : ', '','LIGNE', 'ID', 'ID_PRES', 'ID_PRES');
667
    $form->addChamps('NUM_SPECIMENS', 'Nombre de spécimens : ');
673
    $form->addChamps('NUM_SPECIMENS', 'Nombre de spécimens : ');
668
    $form->radioFromTable('PREC_SPECIMENS par HERBIERS_DENOMBREMENT_CARAC_SP', '', 'Caractériser le dénombrement');
674
    $form->radioFromTable('PREC_SPECIMENS par HERBIERS_DENOMBREMENT_CARAC_SP', '', 'Caractériser le dénombrement');
669
    $form->addChamps('NUM_SPECIES', 'Nombre d\'espèces : ');
675
    $form->addChamps('NUM_SPECIES', 'Nombre d\'espèces : ');
670
    $form->radioFromTable('PREC_SPECIES par HERBIERS_DENOMBREMENT_CARAC_SC', '', 'Caractériser le dénombrement');
676
    $form->radioFromTable('PREC_SPECIES par HERBIERS_DENOMBREMENT_CARAC_SC', '', 'Caractériser le dénombrement');
671
    
677
    
672
    // État de la collection
678
    // État de la collection
673
    $form->addCommentaire('État de la collection : de 1 (= inconnu) à 4 (= excellent, parfait)');
679
    $form->addCommentaire('État de la collection : de 1 (= inconnu) à 4 (= excellent, parfait)');
674
    $form->radioEnum('ETAT_SPECIMENS', 'État des spécimens : ');
680
    $form->radioEnum('ETAT_SPECIMENS', 'État des spécimens : ');
675
    $form->radioEnum('ETAT_CLASSEMENT', 'État du classement : ');
681
    $form->radioEnum('ETAT_CLASSEMENT', 'État du classement : ');
676
    $form->radioEnum('ETAT_PRESENTATION', 'État de la présentation : ');
682
    $form->radioEnum('ETAT_PRESENTATION', 'État de la présentation : ');
677
    $form->addCommentaire('<br />');
683
    $form->addCommentaire('<br />');
678
    
684
    
679
    // Classement
685
    // Classement
680
    $form->addChamps('MODE_CLASSEMENT', 'Méthode de classement : ');
686
    $form->addChamps('MODE_CLASSEMENT', 'Méthode de classement : ');
681
    
687
    
682
    // Documentation
688
    // Documentation
683
    $form->addCommentaire(  '<h2>'.'Informations sur la documentation disponible :'.'</h2>'.
689
    $form->addCommentaire(  '<h2>'.'Informations sur la documentation disponible :'.'</h2>'.
684
                            '<ul>'."\n".
690
                            '<ul>'."\n".
685
                            '<li>'.'documents associés à la collection (publications directement liées comme Flores, '.
691
                            '<li>'.'documents associés à la collection (publications directement liées comme Flores, '.
686
                            'documents in&eacute;dits tels que dessins, aquarelles, carnets de notes de terrain...)'.'</li>'.
692
                            'documents in&eacute;dits tels que dessins, aquarelles, carnets de notes de terrain...)'.'</li>'.
687
                            '<li>'.'documents sur la collection ou les collecteurs (publications relatant '.
693
                            '<li>'.'documents sur la collection ou les collecteurs (publications relatant '.
688
                            'l\'acquisition, notices nécrologiques et/ou biographiques...)'.'</li>'.
694
                            'l\'acquisition, notices nécrologiques et/ou biographiques...)'.'</li>'.
689
                            '</ul>'."\n"
695
                            '</ul>'."\n"
690
                        );
696
                        );
691
    $form->addChamps('DOC_STATE', 'État de la documentation : ');
697
    $form->addChamps('DOC_STATE', 'État de la documentation : ');
692
    $form->addChamps('PERCENT_DATABASED', '% de la documentation en base de données : ');
698
    $form->addChamps('PERCENT_DATABASED', '% de la documentation en base de données : ');
693
	// Gestion des métadonnées
699
	// Gestion des métadonnées
694
	gererMetaForm(&$form, &$un_herbier); 
700
	gererMetaForm(&$form, &$un_herbier); 
695
    
701
    
696
    
702
    
697
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
703
    if ($un_herbier->organisation->getId() != HBA_EXEMPLE_ID) {
698
        $form->submit('Valider');
704
        $form->submit('Valider');
699
    }
705
    }
700
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
706
    $form->annuler('Annuler', sprintf($un_herbier->url_action_org, MOD_HERB, $un_herbier->organisation->getId()));
701
}
707
}
702
 
708
 
703
function nouveau_herb4(&$un_herbier)
709
function nouveau_herb4(&$un_herbier)
704
{
710
{
705
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], '');
711
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], '');
706
    $form = $form->acquerir('HERBIERS_COLLECTION');
712
    $form = $form->acquerir('HERBIERS_COLLECTION');
707
    $form->insertMySQL('PARENT_ID = '.$un_herbier->organisation->getId());
713
    $form->insertMySQL('PARENT_ID = '.$un_herbier->organisation->getId());
708
}
714
}
709
 
715
 
710
function mod_desc(&$un_herbier)
716
function mod_desc(&$un_herbier)
711
{
717
{
712
    // Intitialisation de variables
718
    // Intitialisation de variables
713
    $id_coll = $un_herbier->collection->getId();
719
    $id_coll = $un_herbier->collection->getId();
714
    $id_org = $un_herbier->organisation->getId();
720
    $id_org = $un_herbier->organisation->getId();
715
    
721
    
716
    // Création du formulaire de modification
722
    // Création du formulaire de modification
717
    $retour = '<h1>'.'Modification d\'une collection'.'</h1>'."\n";
723
    $retour = '<h1>'.'Modification d\'une collection'.'</h1>'."\n";
718
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION', 'MOD', $id_coll, 'ID');
724
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION', 'MOD', $id_coll, 'ID');
719
    form_herb_2($form, $un_herbier);
725
    form_herb_2($form, $un_herbier);
720
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC_V, $id_org, $id_coll));
726
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), MOD_DESC_V, $id_org, $id_coll));
721
    $form->finalise('un_form');
727
    $form->finalise('un_form');
722
    
728
    
723
    return $retour;
729
    return $retour;
724
}
730
}
725
 
731
 
726
function mod_desc_v(&$un_herbier)
732
function mod_desc_v(&$un_herbier)
727
{
733
{
728
    // Intitialisation de variables
734
    // Intitialisation de variables
729
    $id_coll = $un_herbier->collection->getId();
735
    $id_coll = $un_herbier->collection->getId();
730
    
736
    
731
    // Insertion des infos après vérification
737
    // Insertion des infos après vérification
732
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
738
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_COLLECTION');
733
    $form = $form->acquerir('HERBIERS_COLLECTION');
739
    $form = $form->acquerir('HERBIERS_COLLECTION');
734
    $form->updateMySQL('ID', $id_coll);
740
    $form->updateMySQL('ID', $id_coll);
735
}
741
}
736
 
742
 
737
function suppr_coll(&$un_herbier, $id_coll_param = null)
743
function suppr_coll(&$un_herbier, $id_coll_param = null)
738
{
744
{
739
    // Initialisation de variables
745
    // Initialisation de variables
740
    // Si l'identifiant de la collection est passé comme argument de la fonction
746
    // Si l'identifiant de la collection est passé comme argument de la fonction
741
    if (!is_null($id_coll_param)) {
747
    if (!is_null($id_coll_param)) {
742
        $id_coll = $id_coll_param;
748
        $id_coll = $id_coll_param;
743
    } else {
749
    } else {
744
        $id_coll = $un_herbier->collection->getId();
750
        $id_coll = $un_herbier->collection->getId();
745
    }
751
    }
746
    
752
    
747
    $requete =  'DELETE FROM HERBIERS_COLLECTION '.
753
    $requete =  'DELETE FROM HERBIERS_COLLECTION '.
748
                'WHERE ID = '.$id_coll;
754
                'WHERE ID = '.$id_coll;
749
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
755
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
750
    $requete =  'SELECT ID_INDIC '.
756
    $requete =  'SELECT ID_INDIC '.
751
                'FROM HERBIERS_INDIC '.
757
                'FROM HERBIERS_INDIC '.
752
                'WHERE ID = '.$id_coll;
758
                'WHERE ID = '.$id_coll;
753
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
759
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
754
    while ($ligne = mysql_fetch_object($resultat)) {
760
    while ($ligne = mysql_fetch_object($resultat)) {
755
        suppr_note($un_herbier, $ligne->ID_INDIC);
761
        suppr_note($un_herbier, $ligne->ID_INDIC);
756
    }
762
    }
757
}
763
}
758
 
764
 
759
// +------------------------------------------------------------------------------------------------------+
765
// +------------------------------------------------------------------------------------------------------+
760
// GESTION des NOTES
766
// GESTION des NOTES
761
 
767
 
762
function liste_indic(&$un_herbier)
768
function liste_indic(&$un_herbier)
763
{
769
{
764
    // Initialisation des variables
770
    // Initialisation des variables
765
    $id_org = $un_herbier->organisation->getId();
771
    $id_org = $un_herbier->organisation->getId();
766
    $id_coll = $un_herbier->collection->getId();
772
    $id_coll = $un_herbier->collection->getId();
767
    
773
    
768
    $requete =  'SELECT ID_INDIC, TXT_INDIC '.
774
    $requete =  'SELECT ID_INDIC, TXT_INDIC '.
769
                'FROM HERBIERS_INDIC WHERE ID = '.$id_coll;
775
                'FROM HERBIERS_INDIC WHERE ID = '.$id_coll;
770
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
776
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
771
    
777
    
772
    $retour =   '<div class="hba_liste_note">'."\n".
778
    $retour =   '<div class="hba_liste_note">'."\n".
773
                '<table>'."\n";
779
                '<table>'."\n";
774
    $num_row = mysql_num_rows($resultat);
780
    $num_row = mysql_num_rows($resultat);
775
    $compteur = 0;
781
    $compteur = 0;
776
    while ($row = mysql_fetch_object($resultat)) {
782
    while ($row = mysql_fetch_object($resultat)) {
777
        $compteur++;
783
        $compteur++;
778
        $retour .= '<tr class="hb_arborescence"><td>';
784
        $retour .= '<tr class="hb_arborescence"><td>';
779
        if ($compteur == $num_row) {
785
        if ($compteur == $num_row) {
780
            $retour .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
786
            $retour .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
781
        } else {
787
        } else {
782
            $retour .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
788
            $retour .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
783
        }
789
        }
784
        $retour .= '</td><td>';
790
        $retour .= '</td><td>';
785
        if ($txt_court = raccourcirTexte($row->TXT_INDIC, HBA_LONGUEUR_NOTE_TXT)) {
791
        if ($txt_court = raccourcirTexte($row->TXT_INDIC, HBA_LONGUEUR_NOTE_TXT)) {
786
            $retour .= '<abbr title="'.$row->TXT_INDIC.'">'.$txt_court.'</abbr>';
792
            $retour .= '<abbr title="'.$row->TXT_INDIC.'">'.$txt_court.'</abbr>';
787
        } else {
793
        } else {
788
            $retour .= $row->TXT_INDIC;
794
            $retour .= $row->TXT_INDIC;
789
        }
795
        }
790
        $retour .= '</td>'."\n";
796
        $retour .= '</td>'."\n";
791
        $retour .= '<td><a href="'.
797
        $retour .= '<td><a href="'.
792
                    sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE, $id_org, $id_coll, $row->ID_INDIC).
798
                    sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE, $id_org, $id_coll, $row->ID_INDIC).
793
                    '">'.'modifier'.'</a></td>'."\n";
799
                    '">'.'modifier'.'</a></td>'."\n";
794
        if ($id_org != HBA_EXEMPLE_ID) {
800
        if ($id_org != HBA_EXEMPLE_ID) {
795
            $retour .=  '<td><a href="'.
801
            $retour .=  '<td><a href="'.
796
                        sprintf($un_herbier->getUrlActionOrgCollNote(), SUPPR_NOTE, $id_org, $id_coll, $row->ID_INDIC).'" '.
802
                        sprintf($un_herbier->getUrlActionOrgCollNote(), SUPPR_NOTE, $id_org, $id_coll, $row->ID_INDIC).'" '.
797
                        'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette note ?'.'\');"'.
803
                        'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer cette note ?'.'\');"'.
798
                        '>'.'supprimer'.'</a></td></tr>'."\n";
804
                        '>'.'supprimer'.'</a></td></tr>'."\n";
799
        }
805
        }
800
    }
806
    }
801
    $retour .= '</table>'."\n".'</div>'."\n";
807
    $retour .= '</table>'."\n".'</div>'."\n";
802
    return $retour;
808
    return $retour;
803
}
809
}
804
 
810
 
805
function nouv_indic(&$un_herbier)
811
function nouv_indic(&$un_herbier)
806
{
812
{
807
    // Initialisation des variables
813
    // Initialisation des variables
808
    $id_org = $un_herbier->organisation->getId();
814
    $id_org = $un_herbier->organisation->getId();
809
    $id_coll = $un_herbier->collection->getId();
815
    $id_coll = $un_herbier->collection->getId();
810
    
816
    
811
    $retour = '<h1>'.'Ajout d\'une note'.'</h1>'."\n";
817
    $retour = '<h1>'.'Ajout d\'une note'.'</h1>'."\n";
812
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
818
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
813
    form_indic($form, $un_herbier);
819
    form_indic($form, $un_herbier);
814
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC_V, $id_org, $id_coll));
820
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgColl(), NOUV_INDIC_V, $id_org, $id_coll));
815
    $form->finalise('form_indic');
821
    $form->finalise('form_indic');
816
    return $retour;
822
    return $retour;
817
}
823
}
818
 
824
 
819
function form_indic(&$form, &$un_herbier)
825
function form_indic(&$form, &$un_herbier)
820
{
826
{
821
    // Initialisation des variables
827
    // Initialisation des variables
822
    $id_org = $un_herbier->organisation->getId();
828
    $id_org = $un_herbier->organisation->getId();
823
    $id_coll = $un_herbier->collection->getId();
829
    $id_coll = $un_herbier->collection->getId();
824
    
830
    
825
    // Définition des styles
831
    // Définition des styles
826
    $form->style_general = 'hba_formulaire';
832
    $form->style_general = 'hba_formulaire';
827
    $form->style_label = 'hba_label';
833
    $form->style_label = 'hba_label';
828
    $form->style_button = 'hba_bouton';
834
    $form->style_button = 'hba_bouton';
829
    $form->style_commentaire = 'hba_commentaire';
835
    $form->style_commentaire = 'hba_commentaire';
830
    $form->style_radiocheckbox = 'hba_radio';
836
    $form->style_radiocheckbox = 'hba_radio';
831
    
837
    
832
    $form->addChamps('TXT_INDIC', 'Texte de la note : ');
838
    $form->addChamps('TXT_INDIC', 'Texte de la note : ');
833
    $form->addChamps('REM_INDIC', 'Remarque : ');
839
    $form->addChamps('REM_INDIC', 'Remarque : ');
834
    $form->checkboxFromTable(   'HERBIERS_INDIC par HERBIERS_A_UN_TYPE et HERBIERS_TYPE', 
840
    $form->checkboxFromTable(   'HERBIERS_INDIC par HERBIERS_A_UN_TYPE et HERBIERS_TYPE', 
835
                                'Cocher les cases : ', '', 'LIGNE', 'ID_INDIC', 'ID_TYPE', 'ID_TYPE');
841
                                'Cocher les cases : ', '', 'LIGNE', 'ID_INDIC', 'ID_TYPE', 'ID_TYPE');
836
	
842
	
837
    $form->submit('Valider');
843
    $form->submit('Valider');
838
    $form->annuler('Annuler', sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $id_coll));
844
    $form->annuler('Annuler', sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_COLL_DEROULER, $id_org, $id_coll));
839
}
845
}
840
 
846
 
841
function nouv_indic_v(&$un_herbier)
847
function nouv_indic_v(&$un_herbier)
842
{
848
{
843
    // Initialisation des variables
849
    // Initialisation des variables
844
    $id_coll = $un_herbier->collection->getId();
850
    $id_coll = $un_herbier->collection->getId();
845
    $id_utilisateur = $un_herbier->utilisateur->getId();
851
    $id_utilisateur = $un_herbier->utilisateur->getId();
846
    
852
    
847
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
853
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
848
    $form = $form->acquerir('HERBIERS_INDIC');
854
    $form = $form->acquerir('HERBIERS_INDIC');
849
    $id_note = $form->insertMySQL('ID = '.$id_coll.', MAJ_INDIC = UNIX_TIMESTAMP()');
855
    $id_note = $form->insertMySQL('ID = '.$id_coll.', MAJ_INDIC = UNIX_TIMESTAMP()');
850
    
856
    
851
    // Insertion dans la table des historiques des indications
857
    // Insertion dans la table des historiques des indications
852
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES ("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.' )';
858
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES ("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.' )';
853
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
859
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
854
}
860
}
855
 
861
 
856
function mod_note(&$un_herbier)
862
function mod_note(&$un_herbier)
857
{
863
{
858
    // Initialisation des variables
864
    // Initialisation des variables
859
    $id_org = $un_herbier->organisation->getId();
865
    $id_org = $un_herbier->organisation->getId();
860
    $id_coll = $un_herbier->collection->getId();
866
    $id_coll = $un_herbier->collection->getId();
861
    $id_note = $un_herbier->note->getId();
867
    $id_note = $un_herbier->note->getId();
862
    
868
    
863
    $retour = '<h1>'.'Modification d\'une note'.'</h1>'."\n";
869
    $retour = '<h1>'.'Modification d\'une note'.'</h1>'."\n";
864
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC', 'MOD', $id_note, 'ID_INDIC') ;
870
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC', 'MOD', $id_note, 'ID_INDIC') ;
865
    form_indic($form, $un_herbier);
871
    form_indic($form, $un_herbier);
866
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE_V, $id_org, $id_coll, $id_note));
872
    $retour .= $form->printForm(sprintf($un_herbier->getUrlActionOrgCollNote(), MOD_NOTE_V, $id_org, $id_coll, $id_note));
867
    $form->finalise('form_indic');
873
    $form->finalise('form_indic');
868
    return $retour;
874
    return $retour;
869
}
875
}
870
 
876
 
871
function mod_note_v(&$un_herbier)
877
function mod_note_v(&$un_herbier)
872
{
878
{
873
    // Initialisation des variables
879
    // Initialisation des variables
874
    $id_note = $un_herbier->note->getId();
880
    $id_note = $un_herbier->note->getId();
875
    $id_utilisateur = $un_herbier->utilisateur->getId();
881
    $id_utilisateur = $un_herbier->utilisateur->getId();
876
    
882
    
877
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
883
    $form = new formFromTable($GLOBALS['_HERBIER_']['bdd'], 'HERBIERS_INDIC');
878
    $form = $form->acquerir('HERBIERS_INDIC');
884
    $form = $form->acquerir('HERBIERS_INDIC');
879
    $form->updateMySQL('ID_INDIC', $id_note, 'MAJ_INDIC = UNIX_TIMESTAMP()');
885
    $form->updateMySQL('ID_INDIC', $id_note, 'MAJ_INDIC = UNIX_TIMESTAMP()');
880
    // Insertion dans la table des historiques des indications
886
    // Insertion dans la table des historiques des indications
881
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.')';
887
    $requete = 'INSERT INTO HERBIERS_INDIC_HISTORIQUE VALUES("", '.$id_note.', UNIX_TIMESTAMP(), '.$id_utilisateur.')';
882
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
888
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
883
}
889
}
884
 
890
 
885
function suppr_note(&$un_herbier, $id_note_param = null)
891
function suppr_note(&$un_herbier, $id_note_param = null)
886
{
892
{
887
    // Initialisation de variables
893
    // Initialisation de variables
888
    // Si l'identifiant de la note est passé comme argument de la fonction
894
    // Si l'identifiant de la note est passé comme argument de la fonction
889
    if (!is_null($id_note_param)) {
895
    if (!is_null($id_note_param)) {
890
        $id_note = $id_note_param;
896
        $id_note = $id_note_param;
891
    } else {
897
    } else {
892
        $id_note = $un_herbier->note->getId();
898
        $id_note = $un_herbier->note->getId();
893
    }
899
    }
894
    
900
    
895
    $requete =  'DELETE FROM HERBIERS_INDIC '.
901
    $requete =  'DELETE FROM HERBIERS_INDIC '.
896
                'WHERE ID_INDIC = '.$id_note;
902
                'WHERE ID_INDIC = '.$id_note;
897
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
903
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
898
    
904
    
899
    $requete =  'DELETE FROM HERBIERS_A_UN_TYPE '.
905
    $requete =  'DELETE FROM HERBIERS_A_UN_TYPE '.
900
                'WHERE ID_INDIC = '.$id_note;
906
                'WHERE ID_INDIC = '.$id_note;
901
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
907
    mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
902
}
908
}
903
 
909
 
904
// +------------------------------------------------------------------------------------------------------+
910
// +------------------------------------------------------------------------------------------------------+
905
// GESTION des CORRESPONDANTS
911
// GESTION des CORRESPONDANTS
906
// renvoie le code html d'une liste de correspondant
912
// renvoie le code html d'une liste de correspondant
907
function liste_corr(&$un_herbier)
913
function liste_corr(&$un_herbier)
908
{
914
{
909
    // Initialisation de variables
915
    // Initialisation de variables
910
    $retour = '';
916
    $retour = '';
911
    $id_action = $un_herbier->getAction();
917
    $id_action = $un_herbier->getAction();
912
    
918
    
913
    $id_cor = null;
919
    $id_cor = null;
914
    if (is_object($un_herbier->getCorrespondant())) {
920
    if (is_object($un_herbier->getCorrespondant())) {
915
        $id_cor = $un_herbier->correspondant->getId();
921
        $id_cor = $un_herbier->correspondant->getId();
916
    }
922
    }
917
    
923
    
918
    $retour .= '<h1 class="hba_titre">'.'Liste des correspondants régionaux'.'</h1>'."\n";
924
    $retour .= '<h1 class="hba_titre">'.'Liste des correspondants régionaux'.'</h1>'."\n";
919
    
925
    
920
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
926
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
921
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.EFLORE_DROIT_POSSEDER '.
927
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.EFLORE_DROIT_POSSEDER '.
922
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = EDP_ID_UTILISATEUR '.
928
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = EDP_ID_UTILISATEUR '.
923
                'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.' ASC';
929
                'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.' ASC';
924
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
930
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
925
    if (mysql_num_rows($resultat) == 0) {
931
    if (mysql_num_rows($resultat) == 0) {
926
        $retour .= '<p class="hba_attention">'.'Aucun correspondant inscrit !'.'</p>'."\n";
932
        $retour .= '<p class="hba_attention">'.'Aucun correspondant inscrit !'.'</p>'."\n";
927
        return $retour;
933
        return $retour;
928
    }
934
    }
929
    
935
    
930
    $liste_inst = '';
936
    $liste_inst = '';
931
    $retour .=  '<div class="hba_liste_correspondant">'."\n".
937
    $retour .=  '<div class="hba_liste_correspondant">'."\n".
932
                '<table>'."\n".
938
                '<table>'."\n".
933
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n".
939
                '<thead><tr><th colspan="2">'.'Nom'.'</th><th>'.'Prénom'.'</th><th colspan="2">'.'Actions'.'</th></tr></thead>'."\n".
934
                '<tbody>'."\n";
940
                '<tbody>'."\n";
935
    while ($ligne = mysql_fetch_object($resultat)) {
941
    while ($ligne = mysql_fetch_object($resultat)) {
936
        // Recherche des institutions dont ils ont la responsabilité
942
        // Recherche des institutions dont ils ont la responsabilité
937
        $requete_inst = 'SELECT INSTITUTION_NAME '.
943
        $requete_inst = 'SELECT INSTITUTION_NAME '.
938
                        'FROM '.HB_BDD_NOM.'.HERBIERS_ORGANISATION, '.HB_BDD_NOM.'.HERBIERS_ADMINISTRER '.
944
                        'FROM '.HB_BDD_NOM.'.HERBIERS_ORGANISATION, '.HB_BDD_NOM.'.HERBIERS_ADMINISTRER '.
939
                        'WHERE HA_ID_ANNUAIRE = '.$ligne->U_ID.' '.
945
                        'WHERE HA_ID_ANNUAIRE = '.$ligne->U_ID.' '.
940
                        'AND HA_ID_ORG = ID_ORG '.
946
                        'AND HA_ID_ORG = ID_ORG '.
941
                        'ORDER BY INSTITUTION_NAME ASC';
947
                        'ORDER BY INSTITUTION_NAME ASC';
942
        $resultat_inst = mysql_query($requete_inst) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_inst));
948
        $resultat_inst = mysql_query($requete_inst) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_inst));
943
        
949
        
944
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td id="hba_correspondant_'.$ligne->U_ID.'" class="hb_plier_deplier">';
950
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td id="hba_correspondant_'.$ligne->U_ID.'" class="hb_plier_deplier">';
945
        if (mysql_num_rows($resultat_inst) > 0) {
951
        if (mysql_num_rows($resultat_inst) > 0) {
946
            $nbre_ligne = mysql_num_rows($resultat_inst);
952
            $nbre_ligne = mysql_num_rows($resultat_inst);
947
            $compteur = 0;
953
            $compteur = 0;
948
            $liste_inst = '<table>'."\n";
954
            $liste_inst = '<table>'."\n";
949
            while ($ligne_inst = mysql_fetch_object($resultat_inst)) {
955
            while ($ligne_inst = mysql_fetch_object($resultat_inst)) {
950
                $compteur++;
956
                $compteur++;
951
                $liste_inst .= '<tr class="hb_arborescence"><td>';
957
                $liste_inst .= '<tr class="hb_arborescence"><td>';
952
                if ($compteur == $nbre_ligne) {
958
                if ($compteur == $nbre_ligne) {
953
                    $liste_inst .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
959
                    $liste_inst .= '<img src="'.HB_IMG_ARBO_FIN.'" alt="|_" />';
954
                } else {
960
                } else {
955
                    $liste_inst .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
961
                    $liste_inst .= '<img src="'.HB_IMG_ARBO.'" alt="|-" />';
956
                }
962
                }
957
                $liste_inst .= '</td><td>'.$ligne_inst->INSTITUTION_NAME.'</td></tr>'."\n";
963
                $liste_inst .= '</td><td>'.$ligne_inst->INSTITUTION_NAME.'</td></tr>'."\n";
958
            }
964
            }
959
            $liste_inst .= '</table>'."\n";
965
            $liste_inst .= '</table>'."\n";
960
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_ANNULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
966
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_ANNULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
961
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
967
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
962
                            '</a>'."\n";
968
                            '</a>'."\n";
963
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_COR_DEROULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
969
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionCor(), HBA_ACTION_COR_DEROULER, $ligne->U_ID, $ligne->U_ID).'">'."\n".
964
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
970
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
965
                            '</a>'."\n";
971
                            '</a>'."\n";
966
            if ($id_cor == $ligne->U_ID) {
972
            if ($id_cor == $ligne->U_ID) {
967
                switch ($id_action) {
973
                switch ($id_action) {
968
                    case HBA_ACTION_COR_DEROULER :
974
                    case HBA_ACTION_COR_DEROULER :
969
                        $retour .= $xhtml_fermer;
975
                        $retour .= $xhtml_fermer;
970
                    break;
976
                    break;
971
                    default :
977
                    default :
972
                        $retour .= $xhtml_ouvrir;
978
                        $retour .= $xhtml_ouvrir;
973
                }
979
                }
974
            } else {
980
            } else {
975
                $retour .= $xhtml_ouvrir;
981
                $retour .= $xhtml_ouvrir;
976
            }
982
            }
977
        } else {
983
        } else {
978
            $retour .= '&nbsp;';
984
            $retour .= '&nbsp;';
979
        }
985
        }
980
        $retour .= '</td>';
986
        $retour .= '</td>';
981
        $retour .= '<td>'.$ligne->U_NAME.'</td>';
987
        $retour .= '<td>'.$ligne->U_NAME.'</td>';
982
        $retour .= '<td>'.$ligne->U_SURNAME.'</td>';
988
        $retour .= '<td>'.$ligne->U_SURNAME.'</td>';
983
        $retour .=  '<td><a href="'.sprintf($un_herbier->getUrlActionCor(), SUPPR_CORR, $ligne->U_ID, $ligne->U_ID).'" '.
989
        $retour .=  '<td><a href="'.sprintf($un_herbier->getUrlActionCor(), SUPPR_CORR, $ligne->U_ID, $ligne->U_ID).'" '.
984
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce correspondant ?'.'\');"'.
990
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce correspondant ?'.'\');"'.
985
                    '>'.'supprimer'.'</a></td></tr>'."\n";
991
                    '>'.'supprimer'.'</a></td></tr>'."\n";
986
        
992
        
987
        switch ($id_action) {
993
        switch ($id_action) {
988
            case HBA_ACTION_COR_DEROULER :
994
            case HBA_ACTION_COR_DEROULER :
989
                if ($id_cor == $ligne->U_ID) {
995
                if ($id_cor == $ligne->U_ID) {
990
                    $retour .= '<tr class="hba_liste_organisation"><td colspan="4">'.$liste_inst.'</td></tr>'."\n";
996
                    $retour .= '<tr class="hba_liste_organisation"><td colspan="4">'.$liste_inst.'</td></tr>'."\n";
991
                }
997
                }
992
                break;
998
                break;
993
        }
999
        }
994
    }
1000
    }
995
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
1001
    $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
996
    return $retour;
1002
    return $retour;
997
}
1003
}
998
 
1004
 
999
function nouveau_corr_v(&$un_herbier)
1005
function nouveau_corr_v(&$un_herbier)
1000
{
1006
{
1001
    $id_cor = $un_herbier->correspondant->getId();
1007
    $id_cor = $un_herbier->correspondant->getId();
1002
    
1008
    
1003
    $requete =  'SELECT EDP_ID_DROIT '.
1009
    $requete =  'SELECT EDP_ID_DROIT '.
1004
                'FROM EFLORE_DROIT_POSSEDER '.
1010
                'FROM EFLORE_DROIT_POSSEDER '.
1005
                'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
1011
                'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
1006
                'AND EDP_ID_PROJET = 1 '.
1012
                'AND EDP_ID_PROJET = 1 '.
1007
                'AND EDP_ID_DROIT < 3';
1013
                'AND EDP_ID_DROIT < 3';
1008
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1014
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1009
    if (mysql_num_rows($resultat) == 0) {
1015
    if (mysql_num_rows($resultat) == 0) {
1010
        $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
1016
        $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
1011
                    'SET EDP_ID_DROIT = 2, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_cor;
1017
                    'SET EDP_ID_DROIT = 2, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_cor;
1012
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1018
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1013
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
1019
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
1014
    } else {
1020
    } else {
1015
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme correspondant régional'.'</p>'."\n";
1021
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme correspondant régional'.'</p>'."\n";
1016
    }
1022
    }
1017
    return $retour;
1023
    return $retour;
1018
}
1024
}
1019
 
1025
 
1020
function suppr_corr(&$un_herbier)
1026
function suppr_corr(&$un_herbier)
1021
{
1027
{
1022
    // Initialisation des variables
1028
    // Initialisation des variables
1023
    $id_cor = $un_herbier->correspondant->getId();
1029
    $id_cor = $un_herbier->correspondant->getId();
1024
    
1030
    
1025
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
1031
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
1026
                'FROM EFLORE_DROIT_POSSEDER '.
1032
                'FROM EFLORE_DROIT_POSSEDER '.
1027
                'WHERE EDP_ID_PROJET = 1 '.
1033
                'WHERE EDP_ID_PROJET = 1 '.
1028
                'AND EDP_ID_UTILISATEUR = '.$id_cor;
1034
                'AND EDP_ID_UTILISATEUR = '.$id_cor;
1029
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1035
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1030
    if (mysql_num_rows($resultat) != 0) {
1036
    if (mysql_num_rows($resultat) != 0) {
1031
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
1037
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
1032
                    'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
1038
                    'WHERE EDP_ID_UTILISATEUR = '.$id_cor.' '.
1033
                    'AND EDP_ID_PROJET = 1';
1039
                    'AND EDP_ID_PROJET = 1';
1034
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1040
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1035
        $retour = '<p class="hba_information">'.'Le correspondant a été supprimé de la base'.'</p>'."\n";
1041
        $retour = '<p class="hba_information">'.'Le correspondant a été supprimé de la base'.'</p>'."\n";
1036
    } else {
1042
    } else {
1037
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un correspondant régional'.'</p>'."\n";
1043
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un correspondant régional'.'</p>'."\n";
1038
    }
1044
    }
1039
    return $retour;
1045
    return $retour;
1040
}
1046
}
1041
 
1047
 
1042
// +------------------------------------------------------------------------------------------------------+
1048
// +------------------------------------------------------------------------------------------------------+
1043
// GESTION des RÉDACTEURS
1049
// GESTION des RÉDACTEURS
1044
 
1050
 
1045
// renvoie le code html d'une liste de rédacteur
1051
// renvoie le code html d'une liste de rédacteur
1046
function liste_red(&$un_herbier)
1052
function liste_red(&$un_herbier)
1047
{
1053
{
1048
    $retour = '';
1054
    $retour = '';
1049
    $retour .= '<h1 class="hba_titre">'.'Liste de vos rédacteurs'.'</h1>'."\n";
1055
    $retour .= '<h1 class="hba_titre">'.'Liste de vos rédacteurs'.'</h1>'."\n";
1050
    
1056
    
1051
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
1057
    $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.' '.
1052
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
1058
                'FROM '.HB_BDD_TAB_ANNUAIRE.', '.HB_BDD_NOM.'.HERBIERS_COORDONNE '.
1053
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = HC_ID_REDACTEUR '.
1059
                'WHERE '.HB_BDD_TAB_ANNUAIRE_CHP_ID.' = HC_ID_REDACTEUR '.
1054
                'AND HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId();
1060
                'AND HC_ID_COORDINATEUR = '.$un_herbier->utilisateur->getId();
1055
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1061
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1056
    if (mysql_num_rows($resultat) == 0) {
1062
    if (mysql_num_rows($resultat) == 0) {
1057
        $retour .= '<p class="hba_attention">'.'Aucun rédacteur inscrit !'.'</p>'."\n";
1063
        $retour .= '<p class="hba_attention">'.'Aucun rédacteur inscrit !'.'</p>'."\n";
1058
        return $retour;
1064
        return $retour;
1059
    }
1065
    }
1060
    $retour .=  '<div class="hba_liste_redacteur">'."\n".
1066
    $retour .=  '<div class="hba_liste_redacteur">'."\n".
1061
                '<table>';
1067
                '<table>';
1062
    while ($ligne = mysql_fetch_object($resultat)) {
1068
    while ($ligne = mysql_fetch_object($resultat)) {
1063
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
1069
        $retour .=  '<tr class="'.color_alterne(&$flag).'"><td class="hb_plier_deplier">';
1064
        /*
1070
        /*
1065
        if (mysql_num_rows($resultat_indic) > 0) {
1071
        if (mysql_num_rows($resultat_indic) > 0) {
1066
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
1072
            $xhtml_fermer = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), MOD_HERB, $id_org, $ligne->ID).'">'."\n".
1067
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
1073
                            '<img class="'.HB_CLASS_IMG_FERMER.'" src="'.HB_IMG_FERMER.'" alt="fermer" />'."\n".
1068
                            '</a>'."\n";
1074
                            '</a>'."\n";
1069
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_RED_DEROULER, $id_org, $ligne->ID).'">'."\n".
1075
            $xhtml_ouvrir = '<a href="'.sprintf($un_herbier->getUrlActionOrgColl(), HBA_ACTION_RED_DEROULER, $id_org, $ligne->ID).'">'."\n".
1070
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
1076
                            '<img class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="dérouler" />'."\n".
1071
                            '</a>'."\n";
1077
                            '</a>'."\n";
1072
            if ($id_coll == $ligne->ID) {
1078
            if ($id_coll == $ligne->ID) {
1073
                switch ($id_action) {
1079
                switch ($id_action) {
1074
                    case HBA_ACTION_RED_DEROULER :
1080
                    case HBA_ACTION_RED_DEROULER :
1075
                        $retour .= $xhtml_fermer;
1081
                        $retour .= $xhtml_fermer;
1076
                    break;
1082
                    break;
1077
                    default :
1083
                    default :
1078
                        $retour .= $xhtml_ouvrir;
1084
                        $retour .= $xhtml_ouvrir;
1079
                }
1085
                }
1080
            } else {
1086
            } else {
1081
                $retour .= $xhtml_ouvrir;
1087
                $retour .= $xhtml_ouvrir;
1082
            }
1088
            }
1083
        }
1089
        }
1084
        */
1090
        */
1085
        $retour .=  '</td><td>'.$ligne->U_NAME.'</td>'.
1091
        $retour .=  '</td><td>'.$ligne->U_NAME.'</td>'.
1086
                    '<td>'.$ligne->U_SURNAME.'</td>'."\n".
1092
                    '<td>'.$ligne->U_SURNAME.'</td>'."\n".
1087
                    '<td><a href="'.sprintf($un_herbier->getUrlActionRed(), SUPPR_RED, $ligne->U_ID).'" '.
1093
                    '<td><a href="'.sprintf($un_herbier->getUrlActionRed(), SUPPR_RED, $ligne->U_ID).'" '.
1088
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce rédacteur ?'.'\');">'.
1094
                    'onclick="javascript:return confirm(\''.'Êtes-vous sûr de vouloir supprimer ce rédacteur ?'.'\');">'.
1089
                    'supprimer'.
1095
                    'supprimer'.
1090
                    '</a></td>'.
1096
                    '</a></td>'.
1091
                    '</tr>'."\n";
1097
                    '</tr>'."\n";
1092
    }
1098
    }
1093
    $retour .= '</table>'."\n".'</div>'."\n";
1099
    $retour .= '</table>'."\n".'</div>'."\n";
1094
    
1100
    
1095
    return $retour;
1101
    return $retour;
1096
}
1102
}
1097
 
1103
 
1098
function nouveau_red_v(&$un_herbier)
1104
function nouveau_red_v(&$un_herbier)
1099
{
1105
{
1100
    $id_red = $un_herbier->redacteur->getId();
1106
    $id_red = $un_herbier->redacteur->getId();
1101
    $id_utilisateur = $un_herbier->utilisateur->getId();
1107
    $id_utilisateur = $un_herbier->utilisateur->getId();
1102
    
1108
    
1103
    $requete =  'SELECT HERBIERS_COORDONNE.HC_ID_REDACTEUR '.
1109
    $requete =  'SELECT HERBIERS_COORDONNE.HC_ID_REDACTEUR '.
1104
                'FROM HERBIERS_COORDONNE, EFLORE_DROIT_POSSEDER '.
1110
                'FROM HERBIERS_COORDONNE, EFLORE_DROIT_POSSEDER '.
1105
                'WHERE HC_ID_REDACTEUR = '.$id_red.' '.
1111
                'WHERE HC_ID_REDACTEUR = '.$id_red.' '.
1106
                'AND HC_ID_COORDINATEUR = EDP_ID_UTILISATEUR '.
1112
                'AND HC_ID_COORDINATEUR = EDP_ID_UTILISATEUR '.
1107
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_UTILISATEUR = '.$id_utilisateur.' '.
1113
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_UTILISATEUR = '.$id_utilisateur.' '.
1108
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_DROIT < 3 '.
1114
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_DROIT < 3 '.
1109
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_PROJET = 1';
1115
                'AND EFLORE_DROIT_POSSEDER.EDP_ID_PROJET = 1';
1110
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1116
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1111
    if (mysql_num_rows($resultat) == 0) {
1117
    if (mysql_num_rows($resultat) == 0) {
1112
        $requete =  'INSERT INTO HERBIERS_COORDONNE '.
1118
        $requete =  'INSERT INTO HERBIERS_COORDONNE '.
1113
                    'SET HC_ID_REDACTEUR = '.$id_red.', HC_ID_COORDINATEUR = '.$id_utilisateur;
1119
                    'SET HC_ID_REDACTEUR = '.$id_red.', HC_ID_COORDINATEUR = '.$id_utilisateur;
1114
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1120
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1115
        
1121
        
1116
        // Insertion du rédacteur dans EFLORE_DROIT_POSSEDER, s'il n'y est pas déjà
1122
        // Insertion du rédacteur dans EFLORE_DROIT_POSSEDER, s'il n'y est pas déjà
1117
        $requete =  'SELECT * '.
1123
        $requete =  'SELECT * '.
1118
                    'FROM EFLORE_DROIT_POSSEDER '.
1124
                    'FROM EFLORE_DROIT_POSSEDER '.
1119
                    'WHERE EDP_ID_PROJET = 1 '.
1125
                    'WHERE EDP_ID_PROJET = 1 '.
1120
                    'AND EDP_ID_UTILISATEUR = '.$id_red;
1126
                    'AND EDP_ID_UTILISATEUR = '.$id_red;
1121
        $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1127
        $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1122
        
1128
        
1123
        // Si le rédacteur n'existe pas on l'insere avec le droit 3 (modération ou ici rédacteur)
1129
        // Si le rédacteur n'existe pas on l'insere avec le droit 3 (modération ou ici rédacteur)
1124
        if (mysql_num_rows($resultat) == 0) {
1130
        if (mysql_num_rows($resultat) == 0) {
1125
            $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
1131
            $requete =  'INSERT INTO EFLORE_DROIT_POSSEDER '.
1126
                        'SET EDP_ID_DROIT = 3, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_red;
1132
                        'SET EDP_ID_DROIT = 3, EDP_ID_PROJET = 1, EDP_ID_UTILISATEUR = '.$id_red;
1127
            mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1133
            mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1128
        }
1134
        }
1129
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
1135
        $retour = '<p class="hba_information">'.'Le correspondant a été ajouté'.'</p>'."\n";
1130
    } else {
1136
    } else {
1131
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme rédacteur'.'</p>'."\n";
1137
        $retour = '<p class="hba_attention">'.'L\'utilisateur est déjà inscrit comme rédacteur'.'</p>'."\n";
1132
    }
1138
    }
1133
    return $retour;
1139
    return $retour;
1134
}
1140
}
1135
 
1141
 
1136
function suppr_red(&$un_herbier)
1142
function suppr_red(&$un_herbier)
1137
{
1143
{
1138
    // Initialisation des variables
1144
    // Initialisation des variables
1139
    $id_red = $un_herbier->redacteur->getId();
1145
    $id_red = $un_herbier->redacteur->getId();
1140
    $id_utilisateur = $un_herbier->utilisateur->getId();
1146
    $id_utilisateur = $un_herbier->utilisateur->getId();
1141
    
1147
    
1142
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
1148
    $requete =  'SELECT EDP_ID_UTILISATEUR '.
1143
                'FROM EFLORE_DROIT_POSSEDER '.
1149
                'FROM EFLORE_DROIT_POSSEDER '.
1144
                'WHERE EDP_ID_PROJET = 1 '.
1150
                'WHERE EDP_ID_PROJET = 1 '.
1145
                'AND EDP_ID_UTILISATEUR = '.$id_red.' '.
1151
                'AND EDP_ID_UTILISATEUR = '.$id_red.' '.
1146
                'AND EDP_ID_DROIT = 3';
1152
                'AND EDP_ID_DROIT = 3';
1147
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1153
    $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1148
    if (mysql_num_rows($resultat) != 0) {
1154
    if (mysql_num_rows($resultat) != 0) {
1149
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
1155
        $requete =  'DELETE FROM EFLORE_DROIT_POSSEDER '.
1150
                    'WHERE EDP_ID_UTILISATEUR = '.$id_red.' '.
1156
                    'WHERE EDP_ID_UTILISATEUR = '.$id_red.' '.
1151
                    'AND EDP_ID_PROJET = 1';
1157
                    'AND EDP_ID_PROJET = 1';
1152
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1158
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1153
        $requete =  'DELETE FROM HERBIERS_COORDONNE '.
1159
        $requete =  'DELETE FROM HERBIERS_COORDONNE '.
1154
                    'WHERE HC_ID_REDACTEUR = '.$id_red;
1160
                    'WHERE HC_ID_REDACTEUR = '.$id_red;
1155
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1161
        mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
1156
        $retour = '<p class="hba_information">'.'Le rédacteur a été supprimé de la base'.'</p>'."\n";
1162
        $retour = '<p class="hba_information">'.'Le rédacteur a été supprimé de la base'.'</p>'."\n";
1157
    } else {
1163
    } else {
1158
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un rédacteur'.'</p>'."\n";
1164
        $retour = '<p class="hba_attention">'.'L\'utilisateur n\'était pas un rédacteur'.'</p>'."\n";
1159
    }
1165
    }
1160
    return $retour;
1166
    return $retour;
1161
}
1167
}
1162
 
1168
 
1163
// +------------------------------------------------------------------------------------------------------+
1169
// +------------------------------------------------------------------------------------------------------+
1164
// GESTION des AIDES
1170
// GESTION des AIDES
1165
 
1171
 
1166
function fournirAideInscription()
1172
function fournirAideInscription()
1167
{
1173
{
1168
    $retour =  '<h1>'.'Interface d\'administration de la base de données des herbiers de France'.'</h1>'."\n".
1174
    $retour =  '<h1>'.'Interface d\'administration de la base de données des herbiers de France'.'</h1>'."\n".
1169
                '<p class="hba_aide">'.
1175
                '<p class="hba_aide">'.
1170
                'Vous n\'êtes pas inscrit comme '.'<strong>'.'correspondant régional'.'</strong>'.' ou '.
1176
                'Vous n\'êtes pas inscrit comme '.'<strong>'.'correspondant régional'.'</strong>'.' ou '.
1171
                '<strong>'.'rédacteur'.'</strong>'.'. '.'<br />'.
1177
                '<strong>'.'rédacteur'.'</strong>'.'. '.'<br />'.
1172
                'Si vous souhaitez participer activement au projet d\'inventaire des herbiers de France, vous '.
1178
                'Si vous souhaitez participer activement au projet d\'inventaire des herbiers de France, vous '.
1173
                'pouvez envoyer un courriel à :'.
1179
                'pouvez envoyer un courriel à :'.
1174
                '</p>'."\n".
1180
                '</p>'."\n".
1175
                '<ul class="hba_aide">'."\n".
1181
                '<ul class="hba_aide">'."\n".
1176
                '<li><a href="mailto:mathezf@wanadoo.fr">'.'Joël MATHEZ'.'</a>'.' ou à '.
1182
                '<li><a href="mailto:mathezf@wanadoo.fr">'.'Joël MATHEZ'.'</a>'.' ou à '.
1177
                '<a href="mailto:pasch@isem.univ-montp2.fr">'.'P.A. Schäfer'.'</a>'.
1183
                '<a href="mailto:pasch@isem.univ-montp2.fr">'.'P.A. Schäfer'.'</a>'.
1178
                ' : pour des questions sur le contenu'.'</li>'."\n".
1184
                ' : pour des questions sur le contenu'.'</li>'."\n".
1179
                '<li><a href="mailto:jpm@tela-botanica.org">'.'Jean-Pascal MILCENT'.'</a>'.
1185
                '<li><a href="mailto:jpm@tela-botanica.org">'.'Jean-Pascal MILCENT'.'</a>'.
1180
                ' : pour obtenir un droit d\'accès'.'</li>'."\n".
1186
                ' : pour obtenir un droit d\'accès'.'</li>'."\n".
1181
                '</ul>'."\n";
1187
                '</ul>'."\n";
1182
    return $retour;
1188
    return $retour;
1183
}
1189
}
1184
 
1190
 
1185
function fournirAideAccueil()
1191
function fournirAideAccueil()
1186
{
1192
{
1187
    $retour =   '<p class="hba_aide">'.
1193
    $retour =   '<p class="hba_aide">'.
1188
                'Vous devriez voir, ci-contre, un "cartouche" contenant des '.'<emphasis>'.'informations'.'</emphasis>'.
1194
                'Vous devriez voir, ci-contre, un "cartouche" contenant des '.'<emphasis>'.'informations'.'</emphasis>'.
1189
                ' sur votre compte utilisateur (nom, droit d\'accès...)'.
1195
                ' sur votre compte utilisateur (nom, droit d\'accès...)'.
1190
                'ainsi qu\'un '.'<emphasis>'.'menu'.'</emphasis>'.' qui vous permet d\'accèder aux différents '.
1196
                'ainsi qu\'un '.'<emphasis>'.'menu'.'</emphasis>'.' qui vous permet d\'accèder aux différents '.
1191
                'formulaires de saisi composant l\'interface d\'admnistration des herbiers.'.
1197
                'formulaires de saisi composant l\'interface d\'admnistration des herbiers.'.
1192
                '</p>'."\n".
1198
                '</p>'."\n".
1193
                '<p class="hba_aide">'.
1199
                '<p class="hba_aide">'.
1194
                'La saisie d\'une nouvelle collection commence par la saisie d\'une structure accueillant '.
1200
                'La saisie d\'une nouvelle collection commence par la saisie d\'une structure accueillant '.
1195
                'la ou les collections.'.'<br />'.
1201
                'la ou les collections.'.'<br />'.
1196
                'Pour ce faire, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
1202
                'Pour ce faire, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
1197
                'dans le cartouche.'.
1203
                'dans le cartouche.'.
1198
                '</p>'."\n";
1204
                '</p>'."\n";
1199
    return $retour;
1205
    return $retour;
1200
}
1206
}
1201
 
1207
 
1202
function fournirAideAccueilOrganisation()
1208
function fournirAideAccueilOrganisation()
1203
{
1209
{
1204
    $retour =  '<p class="hba_aide">'.
1210
    $retour =  '<p class="hba_aide">'.
1205
                'Pour <b>créer</b> une institution, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
1211
                'Pour <b>créer</b> une institution, il vous faut cliquez sur le lien "Ajouter une institution (herbier)" présent '.
1206
                'dans le cartouche ci-contre.'.'<br />'.
1212
                'dans le cartouche ci-contre.'.'<br />'.
1207
                'Pour <b>éditer</b> une institution existante, son équipe et ses collections, cliquez sur le lien '.
1213
                'Pour <b>éditer</b> une institution existante, son équipe et ses collections, cliquez sur le lien '.
1208
                '<b>modifier</b> situé sur la même ligne que l\'institution que vous avez choisie.'.'<br />'.
1214
                '<b>modifier</b> situé sur la même ligne que l\'institution que vous avez choisie.'.'<br />'.
1209
                'Vous pouvez également la supprimer en cliquant sur le lien <b>supprimer</b>.'.
1215
                'Vous pouvez également la supprimer en cliquant sur le lien <b>supprimer</b>.'.
1210
                '</p>'."\n";
1216
                '</p>'."\n";
1211
    return $retour;
1217
    return $retour;
1212
}
1218
}
1213
 
1219
 
1214
function fournirAideOrganisation()
1220
function fournirAideOrganisation()
1215
{
1221
{
1216
    $retour =  '<p class="hba_aide">'.
1222
    $retour =  '<p class="hba_aide">'.
1217
                'Le "cartouche" contenant le menu vous propose maintenant de :'.
1223
                'Le "cartouche" contenant le menu vous propose maintenant de :'.
1218
                '</p>'."\n".
1224
                '</p>'."\n".
1219
                '<ul class="hba_aide">'."\n".
1225
                '<ul class="hba_aide">'."\n".
1220
                '<li><strong>'.'Modifier'.'</strong>'.' les renseignements concernant l\'institution '.'<strong>'.
1226
                '<li><strong>'.'Modifier'.'</strong>'.' les renseignements concernant l\'institution '.'<strong>'.
1221
                '->'.'Modifier l\'institution'.'</strong></li>'."\n".
1227
                '->'.'Modifier l\'institution'.'</strong></li>'."\n".
1222
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les membres travaillant dans l\'institution '.
1228
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les membres travaillant dans l\'institution '.
1223
                'ou dans le cas de petites structures pour indiquer qui est le contact.'.'<strong>'.
1229
                'ou dans le cas de petites structures pour indiquer qui est le contact.'.'<strong>'.
1224
                '->'.'Ajouter un membre à l\'équipe</strong></li>'."\n".
1230
                '->'.'Ajouter un membre à l\'équipe</strong></li>'."\n".
1225
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les collections possédées par l\'institution'.'<strong>'.
1231
                '<li><strong>'.'Ajouter'.'</strong>'.' des informations sur les collections possédées par l\'institution'.'<strong>'.
1226
                '->'.'Ajouter une collection'.'</strong></li>'."\n".
1232
                '->'.'Ajouter une collection'.'</strong></li>'."\n".
1227
                '</ul>'."\n";
1233
                '</ul>'."\n";
1228
    return $retour;
1234
    return $retour;
1229
}
1235
}
1230
 
1236
 
1231
function fournirAideEquipe()
1237
function fournirAideEquipe()
1232
{
1238
{
1233
    $retour =   '<p class="hba_aide">'.
1239
    $retour =   '<p class="hba_aide">'.
1234
                'Pour une institution donnée, on peut ajouter autant de <b>membres d\'équipe (et/ou contacts)</b> '.
1240
                'Pour une institution donnée, on peut ajouter autant de <b>membres d\'équipe (et/ou contacts)</b> '.
1235
                'que nécessaire.'.'<br />'.
1241
                'que nécessaire.'.'<br />'.
1236
                'Cliquez sur le lien <b>modifier</b> situé sur la même ligne que le membre de l\'équipe que vous avez '.
1242
                'Cliquez sur le lien <b>modifier</b> situé sur la même ligne que le membre de l\'équipe que vous avez '.
1237
                'choisie, pour mettre à jour ses informations.'.'<br />'.
1243
                'choisie, pour mettre à jour ses informations.'.'<br />'.
1238
                'Vous pouvez également le supprimer en cliquant sur le lien <b>supprimer</b>.'.
1244
                'Vous pouvez également le supprimer en cliquant sur le lien <b>supprimer</b>.'.
1239
                '</p>'."\n";
1245
                '</p>'."\n";
1240
    return $retour;
1246
    return $retour;
1241
}
1247
}
1242
 
1248
 
1243
 
1249
 
1244
function fournirAideCollection()
1250
function fournirAideCollection()
1245
{
1251
{
1246
    $retour =   '<p class="hba_aide">'.
1252
    $retour =   '<p class="hba_aide">'.
1247
                'Pour une collection donnée, on peut ajouter autant de <b>notes (compléments '.
1253
                'Pour une collection donnée, on peut ajouter autant de <b>notes (compléments '.
1248
                'd\'information)</b> que nécessaire. Lorsqu\'une collection contient des compléments '.
1254
                'd\'information)</b> que nécessaire. Lorsqu\'une collection contient des compléments '.
1249
                'd\'information, un <b>+</b> apparait à gauche de son nom, on peut les éditer en '.
1255
                'd\'information, un <b>+</b> apparait à gauche de son nom, on peut les éditer en '.
1250
                'cliquant dessus.'.
1256
                'cliquant dessus.'.
1251
                '</p>'."\n";
1257
                '</p>'."\n";
1252
    return $retour;
1258
    return $retour;
1253
}
1259
}
1254
 
1260
 
1255
function fournirAideParcourirAnnuaire()
1261
function fournirAideParcourirAnnuaire()
1256
{
1262
{
1257
    $retour =   '<p class="hba_aide">'.
1263
    $retour =   '<p class="hba_aide">'.
1258
                'Cliquez sur une lettre pour afficher la liste des inscrits au site Tela Botanica dont le nom '.
1264
                'Cliquez sur une lettre pour afficher la liste des inscrits au site Tela Botanica dont le nom '.
1259
                'débute par cette lettre.'.
1265
                'débute par cette lettre.'.
1260
                '</p>'."\n";
1266
                '</p>'."\n";
1261
    return $retour;
1267
    return $retour;
1262
}
1268
}
1263
 
1269
 
1264
// +------------------------------------------------------------------------------------------------------+
1270
// +------------------------------------------------------------------------------------------------------+
1265
// FONCTIONS COMMUNES
1271
// FONCTIONS COMMUNES
1266
 
1272
 
1267
// verifie une valeur et affiche du texte en cons&eacute;quence
1273
// verifie une valeur et affiche du texte en cons&eacute;quence
1268
function checkvalue($prose, $value = '')
1274
function checkvalue($prose, $value = '')
1269
{
1275
{
1270
    if ($value == '') {
1276
    if ($value == '') {
1271
        $retour = '<h1>'.$prose.'</h1>'."\n";
1277
        $retour = '<h1>'.$prose.'</h1>'."\n";
1272
        $retour .= '<input type="submit" value="'.'Recommencer'.'" onclick="javascript:history.go(-1);" />'."\n";
1278
        $retour .= '<input type="submit" value="'.'Recommencer'.'" onclick="javascript:history.go(-1);" />'."\n";
1273
        return $retour;
1279
        return $retour;
1274
        }
1280
        }
1275
    return false ;
1281
    return false ;
1276
}
1282
}
1277
 
1283
 
1278
function color_alterne(&$flag)
1284
function color_alterne(&$flag)
1279
{
1285
{
1280
    if ($flag) {
1286
    if ($flag) {
1281
        $flag = FALSE;
1287
        $flag = FALSE;
1282
        return 'pair';
1288
        return 'pair';
1283
    } else {
1289
    } else {
1284
        $flag = TRUE;
1290
        $flag = TRUE;
1285
        return 'impair';
1291
        return 'impair';
1286
    }
1292
    }
1287
}
1293
}
1288
 
1294
 
1289
/** Fonction checkZip() - Teste un code postal français.
1295
/** Fonction checkZip() - Teste un code postal français.
1290
*
1296
*
1291
* L'expression régulière ^[0-9]{5}$ est utilisée pour vérifier
1297
* L'expression régulière ^[0-9]{5}$ est utilisée pour vérifier
1292
* que nous avons à faire à un code postal français.
1298
* que nous avons à faire à un code postal français.
1293
*
1299
*
1294
* @param  string  Le code postal à tester.
1300
* @param  string  Le code postal à tester.
1295
* @return boolean retourne vrai si code postal est valide.
1301
* @return boolean retourne vrai si code postal est valide.
1296
*/
1302
*/
1297
function checkZip($code)
1303
function checkZip($code)
1298
{
1304
{
1299
    if (ereg('^[0-9]{5}$', $code, $match)){
1305
    if (ereg('^[0-9]{5}$', $code, $match)){
1300
        return TRUE;
1306
        return TRUE;
1301
    } else {
1307
    } else {
1302
        return FALSE;
1308
        return FALSE;
1303
    }
1309
    }
1304
}
1310
}
1305
 
1311
 
1306
/** Fonction raccourcirTexte() - Raccourci un texte.
1312
/** Fonction raccourcirTexte() - Raccourci un texte.
1307
*
1313
*
1308
* Renvoie le $texte coupe a la $taille indique avec 3 point de suspension.
1314
* Renvoie le $texte coupe a la $taille indique avec 3 point de suspension.
1309
* Si le texte est plus court que $taille, il n'est pas modifie
1315
* Si le texte est plus court que $taille, il n'est pas modifie
1310
*
1316
*
1311
* @param  string le texte à raccourcir.
1317
* @param  string le texte à raccourcir.
1312
* @param  integer le nombre de caractère maximum du texte raccourci.
1318
* @param  integer le nombre de caractère maximum du texte raccourci.
1313
* @param  boolean mettre FALSE pour ne pas afficher de points de suspenssion.
1319
* @param  boolean mettre FALSE pour ne pas afficher de points de suspenssion.
1314
* @return mixed retourne le texte abrégé ou FALSE.
1320
* @return mixed retourne le texte abrégé ou FALSE.
1315
*/
1321
*/
1316
function raccourcirTexte($texte, $taille = null, $bool_suspenssion = TRUE) {
1322
function raccourcirTexte($texte, $taille = null, $bool_suspenssion = TRUE) {
1317
    if (!is_null($taille) && strlen($texte) > $taille) {
1323
    if (!is_null($taille) && strlen($texte) > $taille) {
1318
        if ($bool_suspenssion) {
1324
        if ($bool_suspenssion) {
1319
            return substr($texte, 0, $taille - 3).'...';
1325
            return substr($texte, 0, $taille - 3).'...';
1320
        } else {
1326
        } else {
1321
            return substr($texte, 0, $taille);
1327
            return substr($texte, 0, $taille);
1322
        }
1328
        }
1323
    }
1329
    }
1324
    return FALSE;
1330
    return FALSE;
1325
}
1331
}
1326
 
1332
 
1327
function parcourrirAnnu(&$un_herbier, $id_action)
1333
function parcourrirAnnu(&$un_herbier, $id_action)
1328
{
1334
{
1329
    // Initialisation de variables
1335
    // Initialisation de variables
1330
    $db =& $GLOBALS['_HERBIER_']['bdd'];
1336
    $db =& $GLOBALS['_HERBIER_']['bdd'];
1331
    $retour = '';
1337
    $retour = '';
1332
    
1338
    
1333
    if (NOUVEAU_CORR) {
1339
    if (NOUVEAU_CORR) {
1334
        $retour .= '<h1>'.'Inscription d\'un correspondant'.'</h1>'."\n";
1340
        $retour .= '<h1>'.'Inscription d\'un correspondant'.'</h1>'."\n";
1335
    } elseif (NOUVEAU_RED) {
1341
    } elseif (NOUVEAU_RED) {
1336
        $retour .= '<h1>'.'Inscription d\'un rédacteur'.'</h1>'."\n";
1342
        $retour .= '<h1>'.'Inscription d\'un rédacteur'.'</h1>'."\n";
1337
    }
1343
    }
1338
    $retour .= fournirAideParcourirAnnuaire();
1344
    $retour .= fournirAideParcourirAnnuaire();
1339
    $retour .= '<p class="hba_alphabet">';
1345
    $retour .= '<p class="hba_alphabet">';
1340
    // Ecrire toutes les lettres avec un lien
1346
    // Ecrire toutes les lettres avec un lien
1341
    for ($i = 65 ; $i < 91 ; $i++) {
1347
    for ($i = 65 ; $i < 91 ; $i++) {
1342
        $retour .= '<a href="'.sprintf(HB_URL_COURANTE_ADMIN_ACTION_LETTRE, $un_herbier->getAction(), chr($i));
1348
        $retour .= '<a href="'.sprintf(HB_URL_COURANTE_ADMIN_ACTION_LETTRE, $un_herbier->getAction(), chr($i));
1343
        $retour .= '">'.chr($i).'</a>'."\n";
1349
        $retour .= '">'.chr($i).'</a>'."\n";
1344
    }
1350
    }
1345
    $retour .= '</p>';
1351
    $retour .= '</p>';
1346
    
1352
    
1347
    // si une lettre est selectionne
1353
    // si une lettre est selectionne
1348
    if (!empty($_REQUEST['lettre'])) {
1354
    if (!empty($_REQUEST['lettre'])) {
1349
        $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.', '.
1355
        $requete =  'SELECT '.HB_BDD_TAB_ANNUAIRE_CHP_NOM.', '.HB_BDD_TAB_ANNUAIRE_CHP_PRENOM.', '.
1350
                    HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_MAIL.' '.
1356
                    HB_BDD_TAB_ANNUAIRE_CHP_ID.', '.HB_BDD_TAB_ANNUAIRE_CHP_MAIL.' '.
1351
                    'FROM '.HB_BDD_TAB_ANNUAIRE.' '.
1357
                    'FROM '.HB_BDD_TAB_ANNUAIRE.' '.
1352
                    'WHERE ';
1358
                    'WHERE ';
1353
        if ($_REQUEST['lettre'] != 'tous') {
1359
        if ($_REQUEST['lettre'] != 'tous') {
1354
            $requete .= HB_BDD_TAB_ANNUAIRE_CHP_NOM.' LIKE "'.$_REQUEST['lettre'].'%" ';
1360
            $requete .= HB_BDD_TAB_ANNUAIRE_CHP_NOM.' LIKE "'.$_REQUEST['lettre'].'%" ';
1355
        }
1361
        }
1356
        $requete .= 'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM;
1362
        $requete .= 'ORDER BY '.HB_BDD_TAB_ANNUAIRE_CHP_NOM;
1357
        $resultat = $db->query($requete);
1363
        $resultat = $db->query($requete);
1358
        if (DB::isError($resultat)) {
1364
        if (DB::isError($resultat)) {
1359
            die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete, $resultat->getDebugInfo()));
1365
            die(BOG_afficherErreurSql(__FILE__, __LINE__, $resultat->getMessage(), $requete, $resultat->getDebugInfo()));
1360
        }
1366
        }
1361
        if ($resultat->numRows() != 0) {
1367
        if ($resultat->numRows() != 0) {
1362
            // Pour chaque nom, inscription des infos
1368
            // Pour chaque nom, inscription des infos
1363
            $retour .= '<h1>'.' Inscrits dont le nom débute par : '.$_REQUEST['lettre'].'</h1>'."\n";
1369
            $retour .= '<h1>'.' Inscrits dont le nom débute par : '.$_REQUEST['lettre'].'</h1>'."\n";
1364
            $retour .= '<div class="hba_liste_inscrit">'."\n";
1370
            $retour .= '<div class="hba_liste_inscrit">'."\n";
1365
            $retour .= '<table id="hba_table_annuaire">'."\n";
1371
            $retour .= '<table id="hba_table_annuaire">'."\n";
1366
            $retour .= '<colgroup><col width="30%" /><col width="30%" /><col width="30%" /><col width="10%" /></colgroup>'."\n";
1372
            $retour .= '<colgroup><col width="30%" /><col width="30%" /><col width="30%" /><col width="10%" /></colgroup>'."\n";
1367
            $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th>'.'Courriel'.'</th><th>'.'Action'.'</th></tr></thead>'."\n";
1373
            $retour .= '<thead><tr><th>'.'Nom'.'</th><th>'.'Prénom'.'</th><th>'.'Courriel'.'</th><th>'.'Action'.'</th></tr></thead>'."\n";
1368
            $retour .= '<tbody>'."\n";
1374
            $retour .= '<tbody>'."\n";
1369
            $pair = true;
1375
            $pair = true;
1370
            while ($row = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
1376
            while ($row = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
1371
                $retour .= '<tr ';
1377
                $retour .= '<tr ';
1372
                if ($pair) {
1378
                if ($pair) {
1373
                    $retour .= 'class="impair"';
1379
                    $retour .= 'class="impair"';
1374
                    $pair = false ;
1380
                    $pair = false ;
1375
                } else {
1381
                } else {
1376
                    $retour .= 'class="pair"';
1382
                    $retour .= 'class="pair"';
1377
                    $pair = true;
1383
                    $pair = true;
1378
                }
1384
                }
1379
                $retour .= '>';
1385
                $retour .= '>';
1380
                $retour .=  '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_NOM].'</td>'.
1386
                $retour .=  '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_NOM].'</td>'.
1381
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_PRENOM].'</td>'.
1387
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_PRENOM].'</td>'.
1382
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_MAIL].'</td>'."\n";
1388
                            '<td>'.$row[HB_BDD_TAB_ANNUAIRE_CHP_MAIL].'</td>'."\n";
1383
                if ($un_herbier->getAction() == NOUVEAU_CORR) {
1389
                if ($un_herbier->getAction() == NOUVEAU_CORR) {
1384
                    $retour .= '<td><a href="'.
1390
                    $retour .= '<td><a href="'.
1385
                                sprintf($un_herbier->getUrlActionCor(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID], $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
1391
                                sprintf($un_herbier->getUrlActionCor(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID], $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
1386
                                '">'.'inscrire'.'</a></td>'."\n";
1392
                                '">'.'inscrire'.'</a></td>'."\n";
1387
                } elseif ($un_herbier->getAction() == NOUV_RED) {
1393
                } elseif ($un_herbier->getAction() == NOUV_RED) {
1388
                    $retour .=  '<td><a href="'.
1394
                    $retour .=  '<td><a href="'.
1389
                                sprintf($un_herbier->getUrlActionRed(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
1395
                                sprintf($un_herbier->getUrlActionRed(), $id_action, $row[HB_BDD_TAB_ANNUAIRE_CHP_ID]).
1390
                                '">'.'inscrire'.'</a></td>'."\n";
1396
                                '">'.'inscrire'.'</a></td>'."\n";
1391
                }
1397
                }
1392
                $retour .= '</tr>'."\n";
1398
                $retour .= '</tr>'."\n";
1393
            }
1399
            }
1394
            $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
1400
            $retour .= '</tbody>'."\n".'</table>'."\n".'</div>'."\n";
1395
        } else {
1401
        } else {
1396
            $retour .= '<p class="hba_attention">'.'Aucun inscrit!'.'</p>'."\n";
1402
            $retour .= '<p class="hba_attention">'.'Aucun inscrit!'.'</p>'."\n";
1397
        }
1403
        }
1398
    }
1404
    }
1399
    return $retour;
1405
    return $retour;
1400
}
1406
}
1401
 
1407
 
1402
function gererMetaForm(&$form, &$herbier)
1408
function gererMetaForm(&$form, &$herbier)
1403
{
1409
{
1404
	// Pour écraser ces valeurs même en modification nous métons temporairement le mode à vide. 
1410
	// Pour écraser ces valeurs même en modification nous métons temporairement le mode à vide. 
1405
    $mode = '';
1411
    $mode = '';
1406
    if ($form->mode == 'MOD') {
1412
    if ($form->mode == 'MOD') {
1407
    	$form->mode = '';
1413
    	$form->mode = '';
1408
    	$mode = 'MOD';
1414
    	$mode = 'MOD';
1409
    }
1415
    }
1410
    $form->addChamps('DATE_DERNIERE_MODIF', '', date('Y-m-j H:i:s', time()), $type = 'hidden');
1416
    $form->addChamps('DATE_DERNIERE_MODIF', '', date('Y-m-j H:i:s', time()), $type = 'hidden');
1411
    $form->addChamps('CE_MODIFIER_PAR', '',  $herbier->utilisateur->getId(), $type = 'hidden');
1417
    $form->addChamps('CE_MODIFIER_PAR', '',  $herbier->utilisateur->getId(), $type = 'hidden');
1412
    $form->mode = $mode;
1418
    $form->mode = $mode;
1413
}
1419
}
1414
// +------------------------------------------------------------------------------------------------------+
1420
// +------------------------------------------------------------------------------------------------------+
1415
 
1421
 
1416
/* +--Fin du code ----------------------------------------------------------------------------------------+
1422
/* +--Fin du code ----------------------------------------------------------------------------------------+
1417
*
1423
*
1418
* $Log: not supported by cvs2svn $
1424
* $Log: not supported by cvs2svn $
-
 
1425
* Revision 1.4  2007-02-02 14:59:16  jp_milcent
-
 
1426
* Agrandissement du champ "Collecteurs".
-
 
1427
*
1419
* Revision 1.3  2006/10/31 15:06:44  jp_milcent
1428
* Revision 1.3  2006/10/31 15:06:44  jp_milcent
1420
* Fin de gestion des flux rss.
1429
* Fin de gestion des flux rss.
1421
*
1430
*
1422
* Revision 1.2  2006/10/30 18:57:46  jp_milcent
1431
* Revision 1.2  2006/10/30 18:57:46  jp_milcent
1423
* Ajout de champs pour les flux rss.
1432
* Ajout de champs pour les flux rss.
1424
*
1433
*
1425
* Revision 1.1  2005/11/23 10:32:32  jp_milcent
1434
* Revision 1.1  2005/11/23 10:32:32  jp_milcent
1426
* Ajout au dépot de l'application Herbiers.
1435
* Ajout au dépot de l'application Herbiers.
1427
* Elle doit à terme migrer dans eFlore.
1436
* Elle doit à terme migrer dans eFlore.
1428
*
1437
*
1429
* Revision 1.5  2005/06/09 17:31:42  jpm
1438
* Revision 1.5  2005/06/09 17:31:42  jpm
1430
* Affichage en permanence dans le menu du lien vers l'accueil.
1439
* Affichage en permanence dans le menu du lien vers l'accueil.
1431
*
1440
*
1432
* Revision 1.4  2005/06/07 15:30:44  jpm
1441
* Revision 1.4  2005/06/07 15:30:44  jpm
1433
* Modid esthetique.
1442
* Modid esthetique.
1434
*
1443
*
1435
* Revision 1.3  2005/06/02 17:53:37  jpm
1444
* Revision 1.3  2005/06/02 17:53:37  jpm
1436
* Modification de l'affichage du menu.
1445
* Modification de l'affichage du menu.
1437
*
1446
*
1438
* Revision 1.2  2005/05/18 07:30:13  jpm
1447
* Revision 1.2  2005/05/18 07:30:13  jpm
1439
* Correction des bogues et derniers réglages avant mise en ligne du site v4.
1448
* Correction des bogues et derniers réglages avant mise en ligne du site v4.
1440
*
1449
*
1441
* Revision 1.1  2005/04/06 13:33:40  jpm
1450
* Revision 1.1  2005/04/06 13:33:40  jpm
1442
* Ajout du fichier contenant les fonctions réalisant la mise en page et la gestion des données.
1451
* Ajout du fichier contenant les fonctions réalisant la mise en page et la gestion des données.
1443
* Cela devrait normalement être divisé en un modèle et une vue...
1452
* Cela devrait normalement être divisé en un modèle et une vue...
1444
*
1453
*
1445
*
1454
*
1446
* +-- Fin du code ----------------------------------------------------------------------------------------+
1455
* +-- Fin du code ----------------------------------------------------------------------------------------+
1447
*/
1456
*/
1448
?>
1457
?>