Subversion Repositories eFlore/Archives.herbiers

Compare Revisions

Ignore whitespace Rev 1 → Rev 2

/trunk/bibliotheque/hb_indic.class.php
New file
0,0 → 1,158
<?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. |
// | |
// | 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: hb_indic.class.php,v 1.1 2005-11-23 10:32:32 jp_milcent Exp $
/**
* Classe H_indic
*
* Classe permettant de récupérer les données concernant les indic de la base de données.
*
*@package Herbier
*@subpackage Classes
//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 |
// +------------------------------------------------------------------------------------------------------+
 
// +------------------------------------------------------------------------------------------------------+
// | CORPS du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
/**
* Classe H_indic()
*
* Contient la structure nécessaire pour
* représenter une table HERBIERS_INDIC.
*/
class H_indic {
var $id;
var $type_indic;
var $indic_hist;
 
/**
* Constructeur de H_indic
*
* @param aucun
* @return void
* @access public
*/
function H_indic($id_note = null)
{
if (!is_null($id_note)) {
$this->setId($id_note);
}
$this->type_indic = array();
$this->indic_hist = array();
}
/** Accesseur getId() - Retourner l'id de la note.
*
* @return integer l'identifiant de la note.
* @access public
*/
function getId()
{
return $this->id;
}
/** Accesseur setId() - Attribuer un id à la note.
*
* @param integer l'identifiant de la note.
* @return void l'identifiant est ajouté à l'objet.
* @access public
*/
function setId($id)
{
$this->id = $id;
}
/**
* Méthode getFromSQL() - Initialise objet H_indic
*
* Initialise un objet H_indic dont les propriétés
* contiennent l'information rataché à une indic
* caractérisé par son $id (un entier positif) qui correspond
* à la clé primaire ID_INDIC de la table HERBIERS_INDIC
*
* @param int la clé primaire de la table HERBIERS_INDIC
* @return void
* @access public
*/
function getFromSQL($id) {
$requete = 'SELECT * '.
'FROM HERBIERS_INDIC '.
'WHERE ID_INDIC = '.$id;
$resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
$ligne = mysql_fetch_object($resultat);
foreach (get_object_vars($ligne) as $cle => $valeur) {
$this->$cle = $valeur;
}
$requete_02 = 'SELECT ID_TYPE '.
'FROM HERBIERS_A_UN_TYPE '.
'WHERE HERBIERS_A_UN_TYPE.ID_INDIC = '.$id;
$resultat_02 = mysql_query($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02));
while ($ligne_02 = mysql_fetch_object($resultat_02)) {
$temp_indic_label = new H_type();
$this->type_indic[] = $temp_indic_label->getFromSQL($ligne_02->ID_TYPE);
}
$requete_indic_hist = 'SELECT ID_INDIC '.
'FROM HERBIERS_INDIC_HISTORIQUE '.
'WHERE ID_INDIC = '.$id.' '.
'LIMIT 0,1';
$resultat_indic_hist = mysql_query($requete_indic_hist) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_indic_hist));
while ($ligne_indic_hist = mysql_fetch_object($resultat_indic_hist)) {
$temp_indic_hist = new H_indic_hist();
$this->indic_hist[] = $temp_indic_hist->getFromSQL($ligne_indic_hist->ID_INDIC);
}
unset($temp_indic_label);
unset($temp_indic_hist);
return H_Herbier::remplacerEsperluette($this);
}
}
 
// +------------------------------------------------------------------------------------------------------+
// | PIED du PROGRAMME |
// +------------------------------------------------------------------------------------------------------+
 
 
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.3 2005/04/06 13:29:17 jpm
* Ajout et modifications des objets représentant la base de données Herbier.
*
* Revision 1.2 2005/03/09 15:57:33 jpm
* Modification de la forme.
*
*
* +-- Fin du code ----------------------------------------------------------------------------------------+
*/
?>