New file |
0,0 → 1,306 |
<?php |
/*vim: set expandtab tabstop=4 shiftwidth=4: */ |
// +------------------------------------------------------------------------------------------------------+ |
// | PHP version 4.1 | |
// +------------------------------------------------------------------------------------------------------+ |
// | Copyright (C) 2005 Tela Botanica (accueil@tela-botanica.org) | |
// +------------------------------------------------------------------------------------------------------+ |
// | This file is part of Herbier - Consultation. | |
// | | |
// | Foobar is free software; you can redistribute it and/or modify | |
// | it under the terms of the GNU General Public License as published by | |
// | the Free Software Foundation; either version 2 of the License, or | |
// | (at your option) any later version. | |
// | | |
// | Foobar is distributed in the hope that it will be useful, | |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
// | GNU General Public License for more details. | |
// | | |
// | You should have received a copy of the GNU General Public License | |
// | along with Foobar; if not, write to the Free Software | |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
// +------------------------------------------------------------------------------------------------------+ |
// CVS : $Id: hbc_info_collection.inc.php,v 1.1 2005-11-23 10:32:32 jp_milcent Exp $ |
/** |
* Application fournissant des informations sur les collections |
* |
* Fournit des informations sur une collection enregistrée dans la base de données. |
* |
*@package Herbier-Consultation |
//Auteur original : |
*@author Alexandre GRANIER <alexandre@tela-botanica.org> |
//Autres auteurs : |
*@author Jean-Pascal MILCENT <jpm@clapas.org> |
*@copyright Tela-Botanica 2000-2005 |
*@version $Revision: 1.1 $ $Date: 2005-11-23 10:32:32 $ |
// +------------------------------------------------------------------------------------------------------+ |
*/ |
|
// +------------------------------------------------------------------------------------------------------+ |
// | ENTETE du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// Stockage du fichier javascript nécessaire pour ouvri-fermer les infos. |
GEN_stockerFichierScript('herbiers', HB_CHEMIN_SCRIPTS.'hb_ouvrir_fermer.js'); |
|
// Initialisation des variables: |
global $id_org; |
|
// +------------------------------------------------------------------------------------------------------+ |
// | CORPS du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
// Si le visiteur est connecté et qu'il a des droits sur l'édition d'un herbier, on met $estEditeur à true |
if ($GLOBALS['_GEN_commun']['pear_auth']->getAuth()) { |
// Si le visiteur est connecté, on regarde si l'herbier visité lui appartient |
// auquel on ajoutera des menus d'éditions rapide |
$query_auth = 'SELECT EDP_ID_DROIT '. |
'FROM EFLORE_DROIT_POSSEDER '. |
'WHERE ( EDP_ID_PROJET = 1 '. |
'AND EDP_ID_UTILISATEUR = '.$GLOBALS['_HERBIER_']['auth']->getAuthData(HB_BDD_TAB_ANNUAIRE_CHP_ID).' '. |
'AND EDP_ID_DROIT = 1)'; |
|
$result_auth = mysql_query($query_auth) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $query_auth)); |
if (mysql_num_rows($result_auth) != 0) { |
$estEditeur = true; |
} else { |
$req_administrer = 'SELECT HA_ID_ANNUAIRE '. |
'FROM HERBIERS_ADMINISTRER '. |
'WHERE HA_ID_ANNUAIRE = '.$GLOBALS['_HERBIER_']['auth']->getAuthData(HB_BDD_TAB_ANNUAIRE_CHP_ID); |
$res_administrer = mysql_query($req_administrer) or die (BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $req_administrer)); |
if (mysql_num_rows($res_administrer) != 0) { |
$estEditeur = true; |
} else { |
$estEditeur = false; |
} |
} |
mysql_free_result($result_auth); |
} else { |
$estEditeur = false; |
} |
|
// Création d'un objet H_organisation et récupération des informations afférentes |
$herb = new H_organisation(); |
$herb->getFromSQL($id_org); |
|
// Entête |
$sortie .= '<h1>'.$herb->INSTITUTION_NAME.'</h1>'."\n"; |
// On affiche la source des données cad soit IH soit le nom de la personne qui a saisi. |
$sortie .= '<p class="hb_source_donnee">'.'Source des données : '; |
if ($herb->SOURCE_DES_DONNEES != '') { |
$sortie .= $herb->SOURCE_DES_DONNEES; |
} else { |
$sortie .= $herb->U_NAME.' '.$herb->U_SURNAME; |
} |
$sortie .= '</p>'."\n"; |
|
// 1. les renseignements administratifs |
$sortie .= '<p class="hb_menu">'.'</p>'."\n";//lien_retour('herbiers') |
|
// 2. les collections |
if (is_array($herb->collections) && count($herb->collections) != 0) { |
$sortie .= '<h2>'.'Les collections'.'</h2>'."\n"; |
|
// Une boucle sur l'ensemble des collections |
for ($i = 0; $i < count($herb->collections); $i++) { |
$sortie .= '<div id="el'.$i.'Parent" class="parent">'."\n". |
'<a href="#" onclick="expandBase(\'el'.$i.'\', true); return false;">'."\n". |
'<img name="imEx" id="el'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'."\n". |
'</a>'."\n". |
'<h3 class="hb_titre_en_ligne">'.$herb->collections[$i]->NOM_COLLECTION; |
if ($estEditeur) { |
$sortie .= ' <a class="hb_edition_rapide" href="'. |
sprintf(HB_URL_COURANTE_ADMIN_ACTION_ORG_COLL, MOD_DESC, $id_org, $herb->collections[$i]->ID). |
'">'. |
'(Édition rapide)'. |
'</a></h3>'."\n"; |
} else { |
$sortie .= '</h3>'."\n"; |
} |
$sortie .= '</div>'."\n"; |
$sortie .= '<div id="el'.$i.'Child" class="child">'."\n"; |
$sortie .= '<dl class="hb_affichage_tabulaire">'."\n"; |
if ($herb->collections[$i]->COLLECTION_CODE) { |
$sortie .= '<dt>'.'Code de la collection : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->COLLECTION_CODE.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->DESCRIPTION) { |
$sortie .= '<dt>'.'Description : '.'</dt>'. |
'<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->DESCRIPTION).'</dd>'."\n"; |
} |
if ($herb->collections[$i]->LABEL) { |
$sortie .= '<dt>'.'Statut de la collection : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->LABEL.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->DATE_DEBUT&& $herb->collections[$i]->DATE_DEBUT != '0000-00-00') { |
$sortie .= '<dt>'.'Début de récolte : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->LABEL_DATE_DEBUT_CARAC.' '. |
$herb->collections[$i]->DATE_DEBUT.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->DATE_FIN && $herb->collections[$i]->DATE_FIN != "0000-00-00") { |
$sortie .= '<dt>'.'Fin de récolte : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->LABEL_DATE_FIN_CARAC.' '. |
$herb->collections[$i]->DATE_FIN.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->included_type) { |
$sortie .= '<dt>'.'Échantillons-types : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->included_type.'</dd>'."\n"; |
} |
if (count($herb->collections[$i]->preservation_method) != 0) { |
$sortie .= '<dt>'.'Méthode de préservation : '.'</dt>'."\n"; |
$sortie .= '<dd><ul>'; |
for ($j = 0; $j < count($herb->collections[$i]->preservation_method); $j++) { |
$sortie .= '<li>'.$herb->collections[$i]->preservation_method[$j].'</li>'."\n"; |
} |
$sortie .= '</ul></dd>'."\n"; |
} |
if ($herb->collections[$i]->NUM_SPECIMENS) { |
$sortie .= '<dt>'.'Nombre de spécimens : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->NUM_SPECIMENS ; |
if ($herb->collections[$i]->PREC_SPECIMENS == 'ESTI') { |
$sortie .= ' <span class="hb_estimation">'.'(estimation)'.'</span>'; |
} |
$sortie .= '</dd>'."\n"; |
} |
if ($herb->collections[$i]->NUM_SPECIES) { |
$sortie .= '<dt>'.'Nombre d\'espèces : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->NUM_SPECIES; |
if ($herb->collections[$i]->PREC_SPECIES == 'ESTI') { |
$sortie .= ' <span class="hb_estimation">'.'(estimation)'.'</span>'; |
} |
$sortie .= '</dd>'."\n"; |
} |
if ($herb->collections[$i]->URL != '') { |
$sortie .= '<dt>'.'Site : '.'</dt>'. |
'<dd><a href="'.$herb->collections[$i]->URL.'">'.$herb->collections[$i]->URL.'</a></dd>'."\n"; |
} |
|
// Les différents états de la collection |
if ($herb->collections[$i]->ETAT_SPECIMENS) { |
$sortie .= '<dt>'.'État des spécimens : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->ETAT_SPECIMENS.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->ETAT_CLASSEMENT) { |
$sortie .= '<dt>'.'État du classement : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->ETAT_CLASSEMENT.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->ETAT_PRESENTATION) { |
$sortie .= '<dt>'.'État de la présentation : '.'</dt>'. |
'<dd>'.$herb->collections[$i]->ETAT_PRESENTATION.'</dd>'."\n"; |
} |
if ($herb->collections[$i]->MODE_CLASSEMENT != '') { |
$sortie .= '<dt>'.'Méthode de classement : '.'</dt>'. |
'<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->MODE_CLASSEMENT).'</dd>'."\n"; |
} |
if ($herb->collections[$i]->DOC_STATE != '') { |
$sortie .= '<dt>'.'État de la documentation : '.'</dt>'. |
'<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->DOC_STATE).'</dd>'."\n"; |
} |
$sortie .= '</dl>'."\n"; |
|
// Les collecteurs |
if (isset($herb->collections[$i]->COLLECTEURS) && $herb->collections[$i]->COLLECTEURS != '') { |
$tableau_collecteur = preg_split("/\r\n/", $herb->collections[$i]->COLLECTEURS, -1, PREG_SPLIT_NO_EMPTY); |
$sortie .= '<div id="elcollecteur'.$i.'Parent" class="parent">'."\n". |
'<a href="#" onclick="expandBase(\'elcollecteur'.$i.'\', true); return false;">'."\n". |
'<img name="imEx" id="elcollecteur'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'."\n". |
'</a>'."\n". |
'<h3 class="hb_titre_en_ligne">'.'Les collecteurs - '.count($tableau_collecteur).'</h3>'."\n". |
'</div>'."\n"; |
$sortie .= '<div id="elcollecteur'.$i.'Child" class="child">'."\n"; |
$sortie .= '<table border="1" cellspacing="0" width="100%">'."\n"; |
$compteur_auteur = 0; |
for ($ligne = 1; $ligne <= ceil(count($tableau_collecteur) / 3); $ligne++) { |
$sortie .= '<tr>'; |
for ($col = 1 ; $col < 4 ; $col++) { |
if (isset($tableau_collecteur[$compteur_auteur]) && $tableau_collecteur[$compteur_auteur] != '') { |
$sortie .= '<td>'.$tableau_collecteur[$compteur_auteur].'</td>'; |
$compteur_auteur++; |
} |
} |
$sortie .= '</tr>'."\n"; |
} |
$sortie .= '</table>'."\n"; |
$sortie .= '</div>'."\n"; |
} |
|
// Les indications supplémentaires |
if (is_array($herb->collections[$i]->indic) && count($herb->collections[$i]->indic) != 0) { |
$sortie .= '<div id="elindic'.$i.'Parent" class="parent">'. |
'<a href="#" onclick="expandBase(\'elindic'.$i.'\', true); return false;">'. |
'<img name="imEx" id="elindic'.$i.'Img" class="'.HB_CLASS_IMG_ICONE.'" src="'.HB_IMG_OUVRIR.'" alt="+" />'. |
'</a>'. |
'<h3 class="hb_titre_en_ligne">'.'Compléments d\'information'.'</h3>'. |
'</div>'."\n"; |
$sortie .= '<div id="elindic'.$i.'Child" class="child">'."\n"; |
$sortie .= '<dl>'."\n"; |
//$sortie .= '<dt>Débogage</dt><dd><pre>'.print_r($herb->collections[$i], true).'</pre></dd>'."\n"; |
for ($k = 0; $k < count($herb->collections[$i]->indic); $k++) { |
if (isset($herb->collections[$i]->indic[$k]->type_indic) && count($herb->collections[$i]->indic[$k]->type_indic) != 0) { |
$sortie .= '<dt>'; |
for ($l = 0; $l < count($herb->collections[$i]->indic[$k]->type_indic); $l++) { |
$sortie .= $herb->collections[$i]->indic[$k]->type_indic[$l]->LABEL_TYPE; |
if ($l < count($herb->collections[$i]->indic[$k]->type_indic) - 1) { |
$sortie .= ' - '; |
} |
} |
if ($estEditeur) { |
$sortie .= ' <a class="hb_edition_rapide" href="'. |
sprintf(HB_URL_COURANTE_ADMIN_ACTION_ORG_NOTE, MOD_NOTE, $id_org, $herb->collections[$i]->indic[$k]->ID_INDIC). |
'">'. |
'(Édition rapide)'. |
'</a>'."\n"; |
} |
$sortie .= '</dt>'."\n"; |
} |
if ($herb->collections[$i]->indic[$k]->TXT_INDIC) { |
$sortie .= '<dd>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->indic[$k]->TXT_INDIC).'</dd>'."\n"; |
} |
if ($herb->collections[$i]->indic[$k]->REM_INDIC) { |
$sortie .= '<dd><i>'.preg_replace("/\n/", '<br />', $herb->collections[$i]->indic[$k]->REM_INDIC).'</i></dd>'."\n"; |
} |
|
// Affichage de l'historique des modifications des notes |
if (isset($herb->collections[$i]->indic[$k]->indic_hist) && (count($herb->collections[$i]->indic[$k]->indic_hist) != 0)) { |
for ($l = 0; $l < count($herb->collections[$i]->indic[$k]->indic_hist); $l++) { |
if ($herb->collections[$i]->indic[$k]->indic_hist[$l]->DATE_INDIC != '') { |
$sortie .= '<dd>'; |
if ($l) { |
$sortie .= 'Modifié le '.'<i>'; |
} else { |
$sortie .= 'Dernière modification le '.'<i>'; |
} |
$sortie .= $herb->collections[$i]->indic[$k]->indic_hist[$l]->DATE_INDIC.', par ' |
.$herb->collections[$i]->indic[$k]->indic_hist[$l]->ID_INDICATEUR.'</i></dd>'."\n"; |
} |
} |
} |
} |
$sortie .= '</dl>'."\n"; |
$sortie .= '</div>'."\n"; |
} |
// une ligne vide entre chaque collection |
$sortie .= '<hr class="hb_ligne" />'."\n"; |
$sortie .= '</div>'."\n"; |
} |
} |
// +------------------------------------------------------------------------------------------------------+ |
// | PIED du PROGRAMME | |
// +------------------------------------------------------------------------------------------------------+ |
|
|
/* +--Fin du code ----------------------------------------------------------------------------------------+ |
* |
* $Log: not supported by cvs2svn $ |
* Revision 1.3 2005/03/30 09:48:58 jpm |
* Début gestion des raccourcis vers l'administration. |
* |
* Revision 1.2 2005/03/09 15:55:02 jpm |
* Correction bogue d'affichage quand donnée vide. |
* |
* Revision 1.1 2005/03/08 13:49:17 jpm |
* Ajout de l'application de consultation sous forme de moteur de recherche. |
* |
* |
* +-- Fin du code ----------------------------------------------------------------------------------------+ |
*/ |
?> |