Subversion Repositories Applications.projet

Rev

Rev 118 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<?php
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
// +------------------------------------------------------------------------------------------------------+
// | PHP version 4.1                                                                                      |
// +------------------------------------------------------------------------------------------------------+
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
// +------------------------------------------------------------------------------------------------------+
// | This library 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.1 of the License, or (at your option) any later version.                                   |
// |                                                                                                      |
// | This library 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 this library; if not, write to the Free Software                                  |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: annuaire.class.php,v 1.5 2006-07-04 09:25:38 alexandre_tb Exp $
/**
* Application annuaire
*
* La classe annuaire
*
*@package annuaire
//Auteur original :
*@author        Alexandre Granier <alexandre@tela-botanica.org>
//Autres auteurs :
*@author        Aucun
*@copyright     Tela-Botanica 2000-2004
*@version       $Revision: 1.5 $
// +------------------------------------------------------------------------------------------------------+
*/


// +------------------------------------------------------------------------------------------------------+
// |                                            ENTETE du PROGRAMME                                       |
// +------------------------------------------------------------------------------------------------------+

include_once 'PEAR.php' ;

/**
 * class annuaire
 * 
 */
class annuaire extends PEAR
{

     /*** Attributes: ***/

    /**
     * 
     * @access private
     */
    var $_db;
    /**
     * 
     * @access private
     */
    var $_id_utilisateur;
    /**
     * Tableau contenant les noms des champs
     * @access private
     */
    var $_champs_base;

    /**
     * 
     *
     * @param int objetDB Une ressource PEAR::DB
     * @param Array param un tableau indiquant les noms des champs dans la base. 'nom' => 'CHAMPS_NOM',
'prenom' => .. 'date_inscription' => .. 'identifiant' => ... 'ville' => ...
'pays' => ...
     * @return void
     * @access public
     */
    function annuaire( &$objetDB,  $param )
    {
        $this->_db = $objetDB ;
        $this->_champs_base = $param ;
    } // end of member function annuaire

    /**
     * Spécifie l'identifiant d'un utilisateur ou plusieurs utilisateurs
     *
     * @param mixed id_utilisateur L'identifiant d'un utilisateur
     * @return void
     * @access public
     */
    function setId( $id_utilisateur )
    {
        $this->_id_utilisateur = $id_utilisateur ;
    } // end of member function setId

    /**
     * Renvoie l'info de l'utilisateur courant. Sans paramètre, renvoie un tableau avec
     * tous les champs.
     *
     * @param string parametre Un paramètre de l'objet : - 'nom', 'prenom' ....
     * @return void
     * @access public
     */
    function getInfo( $parametre )
    {
        $requete = 'select '.$this->_champs_base[$parametre].
                    ' from '.$this->_champs_base['table'].
                    ' where '.$this->_champs_base['identifiant'].'='.$this->_id_utilisateur ;
        $resultat = $GLOBALS['projet_db']->query($requete) ;
        if (DB::isError($resultat)) {
            echo $requete.' erreur '.$resultat->getMessage() ;
        }
        $ligne = $resultat->fetchRow (DB_FETCHMODE_ASSOC) ;
        return $ligne[$this->_champs_base[$parametre]] ;
    } // end of member function getInfo

    /**
     * Renvoie la liste de tous el inscris ou celle dont le champs passé en paramètre
     * ressemble à la valeur souhaité. Ex : $maliste->getListe (array('nom' => '%toto'))
     * ; renvoie la liste des adhérents dont le nom commence par toto.
     *
     * @param Array param Un tableau du type 'nom' => 'chaine'
     * @return void
     * @access public
     */
    function getListe( $param )
    {
        
    } // end of member function getListe

    /**
     * Renvoie la liste des inscrits dont le nom commence par lettre
     *
     * @param char lettre La lettre
     * @return void
     * @access public
     */
    function getListeAlphabetique( $lettre )
    {
        
    } // end of member function getListeAlphabetique





} // end of annuaire
?>