Subversion Repositories eFlore/Archives.herbiers

Rev

Details | 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.                                                                        |
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
// +------------------------------------------------------------------------------------------------------+
24
// CVS : $Id: hb_indic.class.php,v 1.1 2005-11-23 10:32:32 jp_milcent Exp $
25
/**
26
* Classe H_indic
27
*
28
* Classe permettant de récupérer les données concernant les indic de la base de données.
29
*
30
*@package Herbier
31
*@subpackage Classes
32
//Auteur original :
33
*@author        Alexandre GRANIER <alexandre@tela-botanica.org>
34
//Autres auteurs :
35
*@author        Jean-Pascal MILCENT <jpm@clapas.org>
36
*@copyright     Tela-Botanica 2000-2005
37
*@version       $Revision: 1.1 $ $Date: 2005-11-23 10:32:32 $
38
// +------------------------------------------------------------------------------------------------------+
39
*/
40
 
41
// +------------------------------------------------------------------------------------------------------+
42
// |                                            ENTETE du PROGRAMME                                       |
43
// +------------------------------------------------------------------------------------------------------+
44
 
45
// +------------------------------------------------------------------------------------------------------+
46
// |                                            CORPS du PROGRAMME                                        |
47
// +------------------------------------------------------------------------------------------------------+
48
/**
49
*  Classe H_indic()
50
*
51
* Contient la structure nécessaire pour
52
* représenter une table HERBIERS_INDIC.
53
*/
54
class H_indic {
55
    var $id;
56
    var $type_indic;
57
    var $indic_hist;
58
 
59
    /**
60
    *  Constructeur de H_indic
61
    *
62
    *  @param    aucun
63
    *  @return    void
64
    *  @access    public
65
    */
66
    function H_indic($id_note = null)
67
    {
68
        if (!is_null($id_note)) {
69
            $this->setId($id_note);
70
        }
71
        $this->type_indic = array();
72
        $this->indic_hist = array();
73
    }
74
 
75
    /** Accesseur getId() - Retourner l'id de la note.
76
    *
77
    * @return integer l'identifiant de la note.
78
    * @access public
79
    */
80
    function getId()
81
    {
82
        return $this->id;
83
    }
84
    /** Accesseur setId() - Attribuer un id à la note.
85
    *
86
    * @param integer l'identifiant de la note.
87
    * @return void l'identifiant est ajouté à l'objet.
88
    * @access public
89
    */
90
    function setId($id)
91
    {
92
        $this->id = $id;
93
    }
94
 
95
    /**
96
    *  Méthode getFromSQL() - Initialise objet H_indic
97
    *
98
    *  Initialise un objet H_indic dont les propriétés
99
    *  contiennent l'information rataché à une indic
100
    *  caractérisé par son $id (un entier positif) qui correspond
101
    *  à la clé primaire ID_INDIC de la table HERBIERS_INDIC
102
    *
103
    * @param int la clé primaire de la table HERBIERS_INDIC
104
    * @return void
105
    * @access public
106
    */
107
    function getFromSQL($id) {
108
        $requete =  'SELECT * '.
109
                    'FROM HERBIERS_INDIC '.
110
                    'WHERE ID_INDIC = '.$id;
111
        $resultat = mysql_query($requete) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete));
112
        $ligne = mysql_fetch_object($resultat);
113
        foreach (get_object_vars($ligne) as $cle => $valeur) {
114
            $this->$cle = $valeur;
115
        }
116
 
117
        $requete_02 =   'SELECT ID_TYPE '.
118
                        'FROM HERBIERS_A_UN_TYPE '.
119
                        'WHERE HERBIERS_A_UN_TYPE.ID_INDIC = '.$id;
120
        $resultat_02 = mysql_query($requete_02) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_02));
121
        while ($ligne_02 = mysql_fetch_object($resultat_02)) {
122
            $temp_indic_label = new H_type();
123
            $this->type_indic[] = $temp_indic_label->getFromSQL($ligne_02->ID_TYPE);
124
        }
125
 
126
        $requete_indic_hist =   'SELECT ID_INDIC '.
127
                                'FROM HERBIERS_INDIC_HISTORIQUE '.
128
                                'WHERE ID_INDIC = '.$id.' '.
129
                                'LIMIT 0,1';
130
        $resultat_indic_hist = mysql_query($requete_indic_hist) or die(BOG_afficherErreurSql(__FILE__, __LINE__, mysql_error(), $requete_indic_hist));
131
        while ($ligne_indic_hist = mysql_fetch_object($resultat_indic_hist)) {
132
            $temp_indic_hist = new H_indic_hist();
133
            $this->indic_hist[] = $temp_indic_hist->getFromSQL($ligne_indic_hist->ID_INDIC);
134
        }
135
        unset($temp_indic_label);
136
        unset($temp_indic_hist);
137
        return H_Herbier::remplacerEsperluette($this);
138
    }
139
}
140
 
141
// +------------------------------------------------------------------------------------------------------+
142
// |                                            PIED du PROGRAMME                                         |
143
// +------------------------------------------------------------------------------------------------------+
144
 
145
 
146
/* +--Fin du code ----------------------------------------------------------------------------------------+
147
*
148
* $Log: not supported by cvs2svn $
149
* Revision 1.3  2005/04/06 13:29:17  jpm
150
* Ajout et modifications des objets représentant la base de données Herbier.
151
*
152
* Revision 1.2  2005/03/09 15:57:33  jpm
153
* Modification de la forme.
154
*
155
*
156
* +-- Fin du code ----------------------------------------------------------------------------------------+
157
*/
158
?>