Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 2 | Rev 12 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

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