Subversion Repositories eFlore/Archives.herbiers

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 jp_milcent 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This file is part of Herbier - Consultation.                                                         |
9
// |                                                                                                      |
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                                 |
12
// | the Free Software Foundation; either version 2 of the License, or                                    |
13
// | (at your option) any later version.                                                                  |
14
// |                                                                                                      |
15
// | Foobar is distributed in the hope that it will be useful,                                            |
16
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
17
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                        |
18
// | GNU General Public License for more details.                                                         |
19
// |                                                                                                      |
20
// | You should have received a copy of the GNU General Public License                                    |
21
// | along with Foobar; if not, write to the Free Software                                                |
22
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
23
// +------------------------------------------------------------------------------------------------------+
22 jp_milcent 24
// CVS : $Id: hbc_info_collection.inc.php,v 1.2 2007-08-27 15:56:50 jp_milcent Exp $
2 jp_milcent 25
/**
26
* Application fournissant des informations sur les collections
27
*
28
* Fournit des informations sur une collection enregistrée dans la base de données.
29
*
30
*@package Herbier-Consultation
31
//Auteur original :
32
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
33
//Autres auteurs :
34
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
35
*@copyright     Tela-Botanica 2000-2005
22 jp_milcent 36
*@version       $Revision: 1.2 $ $Date: 2007-08-27 15:56:50 $
2 jp_milcent 37
// +------------------------------------------------------------------------------------------------------+
38
*/
39
 
40
// +------------------------------------------------------------------------------------------------------+
41
// |                                            ENTETE du PROGRAMME                                       |
42
// +------------------------------------------------------------------------------------------------------+
43
// Stockage du fichier javascript nécessaire pour ouvri-fermer les infos.
44
GEN_stockerFichierScript('herbiers', HB_CHEMIN_SCRIPTS.'hb_ouvrir_fermer.js');
45
 
46
// Initialisation des variables:
47
global $id_org;
48
 
49
// +------------------------------------------------------------------------------------------------------+
50
// |                                            CORPS du PROGRAMME                                        |
51
// +------------------------------------------------------------------------------------------------------+
52
// Si le visiteur est connecté et qu'il a des droits sur l'édition d'un herbier, on met $estEditeur à true
53
if ($GLOBALS['_GEN_commun']['pear_auth']->getAuth()) {
54
    // Si le visiteur est connecté, on regarde si l'herbier visité lui appartient
55
    // auquel on ajoutera des menus d'éditions rapide
56
    $query_auth =   'SELECT EDP_ID_DROIT '.
57
                    'FROM EFLORE_DROIT_POSSEDER '.
58
                    'WHERE ( EDP_ID_PROJET = 1 '.
59
                    'AND EDP_ID_UTILISATEUR = '.$GLOBALS['_HERBIER_']['auth']->getAuthData(HB_BDD_TAB_ANNUAIRE_CHP_ID).' '.
60
                    'AND EDP_ID_DROIT = 1)';
61
 
62
    $result_auth = mysql_query($query_auth) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_auth));
63
    if (mysql_num_rows($result_auth) != 0) {
64
        $estEditeur = true;
65
    } else {
66
        $req_administrer =  'SELECT HA_ID_ANNUAIRE '.
67
                            'FROM HERBIERS_ADMINISTRER '.
68
                            'WHERE HA_ID_ANNUAIRE = '.$GLOBALS['_HERBIER_']['auth']->getAuthData(HB_BDD_TAB_ANNUAIRE_CHP_ID);
69
        $res_administrer = mysql_query($req_administrer) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $req_administrer));
70
        if (mysql_num_rows($res_administrer) != 0) {
71
            $estEditeur = true;
72
        } else {
73
            $estEditeur = false;
74
        }
75
    }
76
    mysql_free_result($result_auth);
77
} else {
78
    $estEditeur = false;
79
}
80
 
81
// Création d'un objet H_organisation et récupération des informations afférentes
82
$herb = new H_organisation();
83
$herb->getFromSQL($id_org);
84
 
85
// Entête
86
$sortie .= '<h1>'.$herb->INSTITUTION_NAME.'</h1>'."\n";
87
// On affiche la source des données cad soit IH soit le nom de la personne qui a saisi.
88
$sortie .= '<p class="hb_source_donnee">'.'Source des données : ';
89
if ($herb->SOURCE_DES_DONNEES != '') {
90
    $sortie .= $herb->SOURCE_DES_DONNEES;
91
} else {
92
    $sortie .= $herb->U_NAME.' '.$herb->U_SURNAME;
93
}
94
$sortie .= '</p>'."\n";
95
 
22 jp_milcent 96
// 1. l'Aide
97
$sortie .= '<p class="hb_aide">'.'<script type="text/javascript">afficherAide();</script>'.'</p>'."\n";
2 jp_milcent 98
 
99
// 2. les collections
100
if (is_array($herb->collections) && count($herb->collections) != 0) {
101
    $sortie .= '<h2>'.'Les collections'.'</h2>'."\n";
102
 
103
    // Une boucle sur l'ensemble des collections
104
    for ($i = 0; $i < count($herb->collections); $i++) {
105
        $sortie .= '<div id="el'.$i.'Parent" class="parent">'."\n".
106
                '<a href="#" onclick="expandBase(\'el'.$i.'\', true); return false;">'."\n".
22 jp_milcent 107
                '<img id="el'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'."\n".
2 jp_milcent 108
                '</a>'."\n".
109
                '<h3 class="hb_titre_en_ligne">'.$herb->collections[$i]->NOM_COLLECTION;
110
        if ($estEditeur) {
111
            $sortie .=  ' <a class="hb_edition_rapide" href="'.
112
                        sprintf(HB_URL_COURANTE_ADMIN_ACTION_ORG_COLL, MOD_DESC, $id_org, $herb->collections[$i]->ID).
113
                        '">'.
114
                        '(Édition rapide)'.
115
                        '</a></h3>'."\n";
116
        } else {
117
            $sortie .=  '</h3>'."\n";
118
        }
119
        $sortie .=  '</div>'."\n";
120
        $sortie .= '<div id="el'.$i.'Child" class="child">'."\n";
121
        $sortie .= '<dl class="hb_affichage_tabulaire">'."\n";
122
        if ($herb->collections[$i]->COLLECTION_CODE) {
123
            $sortie .=  '<dt>'.'Code de la collection : '.'</dt>'.
124
                        '<dd>'.$herb->collections[$i]->COLLECTION_CODE.'</dd>'."\n";
125
        }
126
        if ($herb->collections[$i]->DESCRIPTION) {
127
            $sortie .=  '<dt>'.'Description : '.'</dt>'.
128
                        '<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->DESCRIPTION).'</dd>'."\n";
129
        }
130
        if ($herb->collections[$i]->LABEL) {
131
            $sortie .=  '<dt>'.'Statut de la collection : '.'</dt>'.
132
                        '<dd>'.$herb->collections[$i]->LABEL.'</dd>'."\n";
133
        }
134
        if ($herb->collections[$i]->DATE_DEBUT&& $herb->collections[$i]->DATE_DEBUT != '0000-00-00') {
135
            $sortie .=  '<dt>'.'Début de récolte : '.'</dt>'.
136
                        '<dd>'.$herb->collections[$i]->LABEL_DATE_DEBUT_CARAC.' '.
137
                        $herb->collections[$i]->DATE_DEBUT.'</dd>'."\n";
138
        }
139
        if ($herb->collections[$i]->DATE_FIN && $herb->collections[$i]->DATE_FIN != "0000-00-00") {
140
            $sortie .=  '<dt>'.'Fin de récolte : '.'</dt>'.
141
                        '<dd>'.$herb->collections[$i]->LABEL_DATE_FIN_CARAC.' '.
142
                        $herb->collections[$i]->DATE_FIN.'</dd>'."\n";
143
        }
144
        if ($herb->collections[$i]->included_type) {
145
            $sortie .=  '<dt>'.'Échantillons-types : '.'</dt>'.
146
                        '<dd>'.$herb->collections[$i]->included_type.'</dd>'."\n";
147
        }
148
        if (count($herb->collections[$i]->preservation_method) != 0) {
149
            $sortie .= '<dt>'.'Méthode de préservation : '.'</dt>'."\n";
150
            $sortie .= '<dd><ul>';
151
            for ($j = 0; $j < count($herb->collections[$i]->preservation_method); $j++) {
152
                $sortie .= '<li>'.$herb->collections[$i]->preservation_method[$j].'</li>'."\n";
153
            }
154
            $sortie .= '</ul></dd>'."\n";
155
        }
156
        if ($herb->collections[$i]->NUM_SPECIMENS) {
157
            $sortie .=  '<dt>'.'Nombre de spécimens : '.'</dt>'.
158
                        '<dd>'.$herb->collections[$i]->NUM_SPECIMENS ;
159
            if ($herb->collections[$i]->PREC_SPECIMENS == 'ESTI') {
160
                $sortie .= ' <span class="hb_estimation">'.'(estimation)'.'</span>';
161
            }
162
            $sortie .= '</dd>'."\n";
163
        }
164
        if ($herb->collections[$i]->NUM_SPECIES) {
165
            $sortie .=  '<dt>'.'Nombre d\'espèces : '.'</dt>'.
166
                        '<dd>'.$herb->collections[$i]->NUM_SPECIES;
167
            if ($herb->collections[$i]->PREC_SPECIES == 'ESTI') {
168
                $sortie .= ' <span class="hb_estimation">'.'(estimation)'.'</span>';
169
            }
170
            $sortie .= '</dd>'."\n";
171
        }
172
        if ($herb->collections[$i]->URL != '') {
173
            $sortie .=  '<dt>'.'Site : '.'</dt>'.
174
                        '<dd><a href="'.$herb->collections[$i]->URL.'">'.$herb->collections[$i]->URL.'</a></dd>'."\n";
175
        }
176
 
177
        // Les différents états de la collection
178
        if ($herb->collections[$i]->ETAT_SPECIMENS) {
179
            $sortie .=  '<dt>'.'État des spécimens : '.'</dt>'.
180
                        '<dd>'.$herb->collections[$i]->ETAT_SPECIMENS.'</dd>'."\n";
181
        }
182
        if ($herb->collections[$i]->ETAT_CLASSEMENT) {
183
            $sortie .=  '<dt>'.'État du classement : '.'</dt>'.
184
                        '<dd>'.$herb->collections[$i]->ETAT_CLASSEMENT.'</dd>'."\n";
185
        }
186
        if ($herb->collections[$i]->ETAT_PRESENTATION) {
187
            $sortie .=  '<dt>'.'État de la présentation : '.'</dt>'.
188
                        '<dd>'.$herb->collections[$i]->ETAT_PRESENTATION.'</dd>'."\n";
189
        }
190
        if ($herb->collections[$i]->MODE_CLASSEMENT != '') {
191
            $sortie .=  '<dt>'.'Méthode de classement : '.'</dt>'.
192
                        '<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->MODE_CLASSEMENT).'</dd>'."\n";
193
        }
194
        if ($herb->collections[$i]->DOC_STATE != '') {
195
            $sortie .=  '<dt>'.'État de la documentation : '.'</dt>'.
196
                        '<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->DOC_STATE).'</dd>'."\n";
197
        }
198
        $sortie .= '</dl>'."\n";
199
 
200
        // Les collecteurs
201
        if (isset($herb->collections[$i]->COLLECTEURS) && $herb->collections[$i]->COLLECTEURS != '') {
202
            $tableau_collecteur = preg_split("/\r\n/", $herb->collections[$i]->COLLECTEURS, -1, PREG_SPLIT_NO_EMPTY);
203
            $sortie .=  '<div id="elcollecteur'.$i.'Parent" class="parent">'."\n".
204
                        '<a href="#" onclick="expandBase(\'elcollecteur'.$i.'\', true); return false;">'."\n".
22 jp_milcent 205
                        '<img id="elcollecteur'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'."\n".
2 jp_milcent 206
                        '</a>'."\n".
207
                        '<h3 class="hb_titre_en_ligne">'.'Les collecteurs - '.count($tableau_collecteur).'</h3>'."\n".
208
                        '</div>'."\n";
209
            $sortie .= '<div id="elcollecteur'.$i.'Child" class="child">'."\n";
210
            $sortie .= '<table border="1" cellspacing="0" width="100%">'."\n";
211
            $compteur_auteur = 0;
212
            for ($ligne = 1; $ligne <= ceil(count($tableau_collecteur) / 3); $ligne++) {
213
                $sortie .= '<tr>';
214
                for ($col = 1 ; $col < 4 ; $col++) {
215
                    if (isset($tableau_collecteur[$compteur_auteur]) && $tableau_collecteur[$compteur_auteur] != '') {
216
                        $sortie .= '<td>'.$tableau_collecteur[$compteur_auteur].'</td>';
217
                        $compteur_auteur++;
218
                    }
219
                }
220
                $sortie .= '</tr>'."\n";
221
            }
222
            $sortie .= '</table>'."\n";
223
            $sortie .= '</div>'."\n";
224
        }
225
 
226
        // Les indications supplémentaires
227
        if (is_array($herb->collections[$i]->indic) && count($herb->collections[$i]->indic) != 0) {
228
            $sortie .=  '<div id="elindic'.$i.'Parent" class="parent">'.
229
                        '<a href="#" onclick="expandBase(\'elindic'.$i.'\', true); return false;">'.
22 jp_milcent 230
                        '<img id="elindic'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'.
2 jp_milcent 231
                        '</a>'.
232
                        '<h3 class="hb_titre_en_ligne">'.'Compléments d\'information'.'</h3>'.
233
                        '</div>'."\n";
234
            $sortie .= '<div id="elindic'.$i.'Child" class="child">'."\n";
235
            $sortie .= '<dl>'."\n";
236
            //$sortie .= '<dt>Débogage</dt><dd><pre>'.print_r($herb->collections[$i], true).'</pre></dd>'."\n";
237
            for ($k = 0; $k < count($herb->collections[$i]->indic); $k++) {
238
                if (isset($herb->collections[$i]->indic[$k]->type_indic) && count($herb->collections[$i]->indic[$k]->type_indic) != 0) {
239
                    $sortie .= '<dt>';
240
                    for ($l = 0; $l < count($herb->collections[$i]->indic[$k]->type_indic); $l++) {
241
                        $sortie .= $herb->collections[$i]->indic[$k]->type_indic[$l]->LABEL_TYPE;
242
                        if ($l < count($herb->collections[$i]->indic[$k]->type_indic) - 1) {
243
                            $sortie .= ' - ';
244
                        }
245
                    }
246
                    if ($estEditeur) {
247
                        $sortie .=  ' <a class="hb_edition_rapide" href="'.
248
                                    sprintf(HB_URL_COURANTE_ADMIN_ACTION_ORG_NOTE, MOD_NOTE, $id_org, $herb->collections[$i]->indic[$k]->ID_INDIC).
249
                                    '">'.
250
                                    '(Édition rapide)'.
251
                                    '</a>'."\n";
252
                    }
253
                    $sortie .= '</dt>'."\n";
254
                }
255
                if ($herb->collections[$i]->indic[$k]->TXT_INDIC) {
256
                    $sortie .= '<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->indic[$k]->TXT_INDIC).'</dd>'."\n";
257
                }
258
                if ($herb->collections[$i]->indic[$k]->REM_INDIC) {
259
                    $sortie .= '<dd><i>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->indic[$k]->REM_INDIC).'</i></dd>'."\n";
260
                }
261
 
262
                // Affichage de l'historique des modifications des notes
263
                if (isset($herb->collections[$i]->indic[$k]->indic_hist) && (count($herb->collections[$i]->indic[$k]->indic_hist) != 0)) {
264
                    for ($l = 0; $l < count($herb->collections[$i]->indic[$k]->indic_hist); $l++) {
265
                        if ($herb->collections[$i]->indic[$k]->indic_hist[$l]->DATE_INDIC != '') {
266
                            $sortie .= '<dd>';
267
                            if ($l) {
268
                                $sortie .= 'Modifié le '.'<i>';
269
                            } else {
270
                                $sortie .= 'Dernière modification le '.'<i>';
271
                            }
272
                            $sortie .=  $herb->collections[$i]->indic[$k]->indic_hist[$l]->DATE_INDIC.', par '
273
                                        .$herb->collections[$i]->indic[$k]->indic_hist[$l]->ID_INDICATEUR.'</i></dd>'."\n";
274
                        }
275
                    }
276
                }
277
            }
278
            $sortie .= '</dl>'."\n";
279
            $sortie .= '</div>'."\n";
280
        }
281
        // une ligne vide entre chaque collection
282
        $sortie .= '<hr class="hb_ligne" />'."\n";
283
        $sortie .= '</div>'."\n";
284
    }
285
}
286
// +------------------------------------------------------------------------------------------------------+
287
// |                                            PIED du PROGRAMME                                         |
288
// +------------------------------------------------------------------------------------------------------+
289
 
290
 
291
/* +--Fin du code ----------------------------------------------------------------------------------------+
292
*
293
* $Log: not supported by cvs2svn $
22 jp_milcent 294
* Revision 1.1  2005-11-23 10:32:32  jp_milcent
295
* Ajout au dépot de l'application Herbiers.
296
* Elle doit à terme migrer dans eFlore.
297
*
2 jp_milcent 298
* Revision 1.3  2005/03/30 09:48:58  jpm
299
* Début gestion des raccourcis vers l'administration.
300
*
301
* Revision 1.2  2005/03/09 15:55:02  jpm
302
* Correction bogue d'affichage quand donnée vide.
303
*
304
* Revision 1.1  2005/03/08 13:49:17  jpm
305
* Ajout de l'application de consultation sous forme de moteur de recherche.
306
*
307
*
308
* +-- Fin du code ----------------------------------------------------------------------------------------+
309
*/
310
?>