448 |
ddelon |
1 |
<?php
|
|
|
2 |
/*vim: set expandtab tabstop=4 shiftwidth=4: */
|
|
|
3 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
4 |
// | PHP version 4.1 |
|
|
|
5 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
6 |
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org) |
|
|
|
7 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
8 |
// | This library is free software; you can redistribute it and/or |
|
|
|
9 |
// | modify it under the terms of the GNU General Public |
|
|
|
10 |
// | License as published by the Free Software Foundation; either |
|
|
|
11 |
// | version 2.1 of the License, or (at your option) any later version. |
|
|
|
12 |
// | |
|
|
|
13 |
// | This library is distributed in the hope that it will be useful, |
|
|
|
14 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
|
|
15 |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
|
|
16 |
// | General Public License for more details. |
|
|
|
17 |
// | |
|
|
|
18 |
// | You should have received a copy of the GNU General Public |
|
|
|
19 |
// | License along with this library; if not, write to the Free Software |
|
|
|
20 |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
|
|
21 |
// +------------------------------------------------------------------------------------------------------+
|
480 |
ddelon |
22 |
// CVS : $Id: annuaire.class.php,v 1.4 2005-09-28 16:12:15 ddelon Exp $
|
448 |
ddelon |
23 |
/**
|
|
|
24 |
* Application annuaire
|
|
|
25 |
*
|
|
|
26 |
* La classe annuaire
|
|
|
27 |
*
|
|
|
28 |
*@package annuaire
|
|
|
29 |
//Auteur original :
|
|
|
30 |
*@author Alexandre Granier <alexandre@tela-botanica.org>
|
|
|
31 |
//Autres auteurs :
|
|
|
32 |
*@author Aucun
|
|
|
33 |
*@copyright Tela-Botanica 2000-2004
|
480 |
ddelon |
34 |
*@version $Revision: 1.4 $
|
448 |
ddelon |
35 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
36 |
*/
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
40 |
// | ENTETE du PROGRAMME |
|
|
|
41 |
// +------------------------------------------------------------------------------------------------------+
|
|
|
42 |
|
|
|
43 |
include_once 'PEAR.php' ;
|
|
|
44 |
|
|
|
45 |
/**
|
|
|
46 |
* class annuaire
|
|
|
47 |
*
|
|
|
48 |
*/
|
|
|
49 |
class annuaire extends PEAR
|
|
|
50 |
{
|
|
|
51 |
|
|
|
52 |
/*** Attributes: ***/
|
|
|
53 |
|
|
|
54 |
/**
|
|
|
55 |
*
|
|
|
56 |
* @access private
|
|
|
57 |
*/
|
|
|
58 |
var $_db;
|
|
|
59 |
/**
|
|
|
60 |
*
|
|
|
61 |
* @access private
|
|
|
62 |
*/
|
|
|
63 |
var $_id_utilisateur;
|
|
|
64 |
/**
|
|
|
65 |
* Tableau contenant les noms des champs
|
|
|
66 |
* @access private
|
|
|
67 |
*/
|
|
|
68 |
var $_champs_base;
|
|
|
69 |
|
|
|
70 |
/**
|
|
|
71 |
*
|
|
|
72 |
*
|
|
|
73 |
* @param int objetDB Une ressource PEAR::DB
|
|
|
74 |
* @param Array param un tableau indiquant les noms des champs dans la base. 'nom' => 'CHAMPS_NOM',
|
|
|
75 |
'prenom' => .. 'date_inscription' => .. 'identifiant' => ... 'ville' => ...
|
|
|
76 |
'pays' => ...
|
|
|
77 |
* @return void
|
|
|
78 |
* @access public
|
|
|
79 |
*/
|
|
|
80 |
function annuaire( &$objetDB, $param )
|
|
|
81 |
{
|
|
|
82 |
$this->_db = $objetDB ;
|
|
|
83 |
$this->_champs_base = $param ;
|
|
|
84 |
} // end of member function annuaire
|
|
|
85 |
|
|
|
86 |
/**
|
|
|
87 |
* Spécifie l'identifiant d'un utilisateur ou plusieurs utilisateurs
|
|
|
88 |
*
|
|
|
89 |
* @param mixed id_utilisateur L'identifiant d'un utilisateur
|
|
|
90 |
* @return void
|
|
|
91 |
* @access public
|
|
|
92 |
*/
|
|
|
93 |
function setId( $id_utilisateur )
|
|
|
94 |
{
|
|
|
95 |
$this->_id_utilisateur = $id_utilisateur ;
|
|
|
96 |
} // end of member function setId
|
|
|
97 |
|
|
|
98 |
/**
|
|
|
99 |
* Renvoie l'info de l'utilisateur courant. Sans paramètre, renvoie un tableau avec
|
|
|
100 |
* tous les champs.
|
|
|
101 |
*
|
|
|
102 |
* @param string parametre Un paramètre de l'objet : - 'nom', 'prenom' ....
|
|
|
103 |
* @return void
|
|
|
104 |
* @access public
|
|
|
105 |
*/
|
|
|
106 |
function getInfo( $parametre )
|
|
|
107 |
{
|
|
|
108 |
$requete = 'select '.$this->_champs_base[$parametre].
|
|
|
109 |
' from '.$this->_champs_base['table'].
|
|
|
110 |
' where '.$this->_champs_base['identifiant'].'='.$this->_id_utilisateur ;
|
480 |
ddelon |
111 |
$resultat = $GLOBALS['projet_db']->query($requete) ;
|
448 |
ddelon |
112 |
if (DB::isError($resultat)) {
|
|
|
113 |
echo 'erreur '.$resultat->getMessage() ;
|
|
|
114 |
}
|
|
|
115 |
$ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC) ;
|
|
|
116 |
return $ligne[$this->_champs_base[$parametre]] ;
|
|
|
117 |
} // end of member function getInfo
|
|
|
118 |
|
|
|
119 |
/**
|
|
|
120 |
* Renvoie la liste de tous el inscris ou celle dont le champs passé en paramètre
|
|
|
121 |
* ressemble à la valeur souhaité. Ex : $maliste->getListe (array('nom' => '%toto'))
|
|
|
122 |
* ; renvoie la liste des adhérents dont le nom commence par toto.
|
|
|
123 |
*
|
|
|
124 |
* @param Array param Un tableau du type 'nom' => 'chaine'
|
|
|
125 |
* @return void
|
|
|
126 |
* @access public
|
|
|
127 |
*/
|
|
|
128 |
function getListe( $param )
|
|
|
129 |
{
|
|
|
130 |
|
|
|
131 |
} // end of member function getListe
|
|
|
132 |
|
|
|
133 |
/**
|
|
|
134 |
* Renvoie la liste des inscrits dont le nom commence par lettre
|
|
|
135 |
*
|
|
|
136 |
* @param char lettre La lettre
|
|
|
137 |
* @return void
|
|
|
138 |
* @access public
|
|
|
139 |
*/
|
|
|
140 |
function getListeAlphabetique( $lettre )
|
|
|
141 |
{
|
|
|
142 |
|
|
|
143 |
} // end of member function getListeAlphabetique
|
|
|
144 |
|
|
|
145 |
|
|
|
146 |
|
|
|
147 |
|
|
|
148 |
|
|
|
149 |
} // end of annuaire
|
|
|
150 |
?>
|