| Line 1... | 
            Line -... | 
          
          
            | 1 | 
            <?php
  | 
            - | 
               | 
          
          
            | 2 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 3 | 
            // | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
  | 
            - | 
               | 
          
          
            | 4 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 5 | 
            // | This library is free software; you can redistribute it and/or                                        |
  | 
            - | 
               | 
          
          
            | 6 | 
            // | modify it under the terms of the GNU General Public                                                  |
  | 
            - | 
               | 
          
          
            | 7 | 
            // | License as published by the Free Software Foundation; either                                         |
  | 
            - | 
               | 
          
          
            | 8 | 
            // | version 2.1 of the License, or (at your option) any later version.                                   |
  | 
            - | 
               | 
          
          
            | 9 | 
            // |                                                                                                      |
  | 
            - | 
               | 
          
          
            | 10 | 
            // | This library is distributed in the hope that it will be useful,                                      |
  | 
            - | 
               | 
          
          
            | 11 | 
            // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
  | 
            - | 
               | 
          
          
            | 12 | 
            // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
  | 
            - | 
               | 
          
          
            | 13 | 
            // | General Public License for more details.                                                             |
  | 
            - | 
               | 
          
          
            | 14 | 
            // |                                                                                                      |
  | 
            - | 
               | 
          
          
            | 15 | 
            // | You should have received a copy of the GNU General Public                                            |
  | 
            - | 
               | 
          
          
            | 16 | 
            // | License along with this library; if not, write to the Free Software                                  |
  | 
            - | 
               | 
          
          
            | 17 | 
            // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
  | 
            - | 
               | 
          
          
            | 18 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 19 | 
            // CVS : $Id: participe.class.php,v 1.7 2008-09-16 14:11:31 alexandre_tb Exp $
  | 
            - | 
               | 
          
          
            | 20 | 
            /**
  | 
            - | 
               | 
          
          
            | 21 | 
            * Application projet
  | 
            - | 
               | 
          
          
            | 22 | 
            *
  | 
            - | 
               | 
          
          
            | 23 | 
            * La classe partiicpe assure la jointure entre projet et Auth
  | 
            - | 
               | 
          
          
            | 24 | 
            * Elle se base sur la table projet_statut_utilisateur
  | 
            - | 
               | 
          
          
            | 25 | 
            *
  | 
            - | 
               | 
          
          
            | 26 | 
            *@package projet
  | 
            - | 
               | 
          
          
            | 27 | 
            //Auteur original :
  | 
            - | 
               | 
          
          
            | 28 | 
            *@author        Alexandre Granier <alexandre@tela-botanica.org>
  | 
            - | 
               | 
          
          
            | 29 | 
            //Autres auteurs :
  | 
            - | 
               | 
          
          
            | 30 | 
            *@author        Aucun
  | 
            - | 
               | 
          
          
            | 31 | 
            *@copyright     Tela-Botanica 2000-2004
  | 
            - | 
               | 
          
          
            | 32 | 
            *@version       $Revision: 1.7 $
  | 
            - | 
               | 
          
          
            | 33 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 34 | 
            */
  | 
            - | 
               | 
          
          
            | 35 | 
             
  | 
            - | 
               | 
          
          
            | 36 | 
             
  | 
            - | 
               | 
          
          
            | 37 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 38 | 
            // |                                            ENTETE du PROGRAMME                                       |
  | 
            - | 
               | 
          
          
            | 39 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
            - | 
               | 
          
          
            | 40 | 
             
  | 
            - | 
               | 
          
          
            | 41 | 
             
  | 
            - | 
               | 
          
          
            | 42 | 
            /**
  | 
            - | 
               | 
          
          
            | 43 | 
             * class participe
  | 
            - | 
               | 
          
          
            | 44 | 
             * 
  | 
            - | 
               | 
          
          
            | 45 | 
             */
  | 
            - | 
               | 
          
          
            | 46 | 
            class participe
  | 
            - | 
               | 
          
          
            | 47 | 
            {
  | 
            - | 
               | 
          
          
            | 48 | 
                /*** Attributes: ***/
  | 
            - | 
               | 
          
          
            | 49 | 
             
  | 
            - | 
               | 
          
          
            | 50 | 
                /**
  | 
            - | 
               | 
          
          
            | 51 | 
                 * Date d'inscription au projet de l'utilisateur.
  | 
            - | 
               | 
          
          
            | 52 | 
                 * @access private
  | 
            - | 
               | 
          
          
            | 53 | 
                 */
  | 
            - | 
               | 
          
          
            | 54 | 
                var $_date_inscription;
  | 
            - | 
               | 
          
          
            | 55 | 
                /**
  | 
            - | 
               | 
          
          
            | 56 | 
                 * Statut de l'utilisateur, un entier.
  | 
            - | 
               | 
          
          
            | 57 | 
                 * @access private
  | 
            - | 
               | 
          
          
            | 58 | 
                 */
  | 
            - | 
               | 
          
          
            | 59 | 
                var $_statut;
  | 
            - | 
               | 
          
          
            | 60 | 
                /**
  | 
            - | 
               | 
          
          
            | 61 | 
                 * Connexion à la base de donnée.
  | 
            - | 
               | 
          
          
            | 62 | 
                 * @access private
  | 
            - | 
               | 
          
          
            | 63 | 
                 */
  | 
            - | 
               | 
          
          
            | 64 | 
                var $_db;
  | 
            - | 
               | 
          
          
            | 65 | 
             
  | 
            - | 
               | 
          
          
            | 66 | 
                /**
  | 
            - | 
               | 
          
          
            | 67 | 
                 * Constructeur. Nécessite un objet DB valide connecté à la base contenant les
  | 
            - | 
               | 
          
          
            | 68 | 
                 * tables projets.
  | 
            - | 
               | 
          
          
            | 69 | 
                 *
  | 
            - | 
               | 
          
          
            | 70 | 
                 * @param DB objetDB Un objet PEAR:DB valide.
  | 
            - | 
               | 
          
          
            | 71 | 
                 * @return void
  | 
            - | 
               | 
          
          
            | 72 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 73 | 
                 */
  | 
            - | 
               | 
          
          
            | 74 | 
                function participe( &$objetDB )
  | 
            - | 
               | 
          
          
            | 75 | 
                {
  | 
            - | 
               | 
          
          
            | 76 | 
                    $this->_db = $objetDB ;
  | 
            - | 
               | 
          
          
            | 77 | 
                } // end of member function participe
  | 
            - | 
               | 
          
          
            | 78 | 
             
  | 
            - | 
               | 
          
          
            | 79 | 
                /**
  | 
            - | 
               | 
          
          
            | 80 | 
                 * Renvoie la liste des inscrit à un projet avec leur statut.
  | 
            - | 
               | 
          
          
            | 81 | 
                 *
  | 
            - | 
               | 
          
          
            | 82 | 
                 * @return Array
  | 
            - | 
               | 
          
          
            | 83 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 84 | 
                 */
  | 
            - | 
               | 
          
          
            | 85 | 
                function getInscrits($id_projet, $droits )
  | 
            - | 
               | 
          
          
            | 86 | 
                {
  | 
            - | 
               | 
          
          
            | 87 | 
                    $tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 88 | 
                    
  | 
            - | 
               | 
          
          
            | 89 | 
                    $requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
            - | 
               | 
          
          
            | 90 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
            - | 
               | 
          
          
            | 91 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
            - | 
               | 
          
          
            | 92 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
            - | 
               | 
          
          
            | 93 | 
                                ' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
            - | 
               | 
          
          
            | 94 | 
                                ' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
            - | 
               | 
          
          
            | 95 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 96 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 97 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 98 | 
                    }
  | 
            - | 
               | 
          
          
            | 99 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
            - | 
               | 
          
          
            | 100 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
            - | 
               | 
          
          
            | 101 | 
                        $id = $ligne[0];
  | 
            - | 
               | 
          
          
            | 102 | 
                        $inscrits[$id]['nom'] = $ligne[1];
  | 
            - | 
               | 
          
          
            | 103 | 
                        $inscrits[$id]['prenom'] = $ligne[2];
  | 
            - | 
               | 
          
          
            | 104 | 
                        $inscrits[$id]['mail'] = $ligne[3];
  | 
            - | 
               | 
          
          
            | 105 | 
                        $inscrits[$id]['date'] = $ligne[4];
  | 
            - | 
               | 
          
          
            | 106 | 
                        $inscrits[$id]['id_statut'] = $ligne[5]; 
  | 
            - | 
               | 
          
          
            | 107 | 
                    }
  | 
            - | 
               | 
          
          
            | 108 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 109 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 110 | 
                } // end of member function getInscrits
  | 
            - | 
               | 
          
          
            | 111 | 
             
  | 
            - | 
               | 
          
          
            | 112 | 
                /**
  | 
            - | 
               | 
          
          
            | 113 | 
                 * Renvoie un tableau contenant la liste des identifiants des projets et des statuts
  | 
            - | 
               | 
          
          
            | 114 | 
                 * d'un inscrit. 0 => ['psu_id_utilisateur']          ['psu_id_statut'] 1 => ...
  | 
            - | 
               | 
          
          
            | 115 | 
                 *
  | 
            - | 
               | 
          
          
            | 116 | 
                 * @param int id_utilisateur Un identifiant d'utilisateur pour le champs
  | 
            - | 
               | 
          
          
            | 117 | 
                 * projet_statut_utilisateurs:psu_id_utilisateur
  | 
            - | 
               | 
          
          
            | 118 | 
                 * @return Array
  | 
            - | 
               | 
          
          
            | 119 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 120 | 
                 */
  | 
            - | 
               | 
          
          
            | 121 | 
                function getIdProjetsStatuts( $id_utilisateur )
  | 
            - | 
               | 
          
          
            | 122 | 
                {
  | 
            - | 
               | 
          
          
            | 123 | 
                    $tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 124 | 
                    $requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
  | 
            - | 
               | 
          
          
            | 125 | 
                                " where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur) ;
  | 
            - | 
               | 
          
          
            | 126 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 127 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 128 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 129 | 
                    }
  | 
            - | 
               | 
          
          
            | 130 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
  | 
            - | 
               | 
          
          
            | 131 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
            - | 
               | 
          
          
            | 132 | 
                    }
  | 
            - | 
               | 
          
          
            | 133 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 134 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 135 | 
                } // end of member function getIdProjetsStatuts
  | 
            - | 
               | 
          
          
            | 136 | 
             
  | 
            - | 
               | 
          
          
            | 137 | 
             
  | 
            - | 
               | 
          
          
            | 138 | 
                /**
  | 
            - | 
               | 
          
          
            | 139 | 
                 * Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
  | 
            - | 
               | 
          
          
            | 140 | 
                 * différents projets d'un utilisateur. 0 => ['p_titre']         Le titre du projet 
  | 
            - | 
               | 
          
          
            | 141 | 
                 *         ['ps_label']    Le statut de l'utilisateur 1 => .... (autant que de
  | 
            - | 
               | 
          
          
            | 142 | 
                 * projets)
  | 
            - | 
               | 
          
          
            | 143 | 
                 *
  | 
            - | 
               | 
          
          
            | 144 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur.
  | 
            - | 
               | 
          
          
            | 145 | 
                 * @return Array
  | 
            - | 
               | 
          
          
            | 146 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 147 | 
                 */
  | 
            - | 
               | 
          
          
            | 148 | 
                function getInformationsUtilisateurs( $id_utilisateur )
  | 
            - | 
               | 
          
          
            | 149 | 
                {
  | 
            - | 
               | 
          
          
            | 150 | 
                    $tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 151 | 
                    $requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
  | 
            - | 
               | 
          
          
            | 152 | 
                                " where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur).
  | 
            - | 
               | 
          
          
            | 153 | 
                                " and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
  | 
            - | 
               | 
          
          
            | 154 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 155 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 156 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 157 | 
                    }
  | 
            - | 
               | 
          
          
            | 158 | 
                    while ($ligne = $resultat->fetchRow()) {
  | 
            - | 
               | 
          
          
            | 159 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
            - | 
               | 
          
          
            | 160 | 
                    }
  | 
            - | 
               | 
          
          
            | 161 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 162 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 163 | 
                } // end of member function getInformationsUtilisateurs
  | 
            - | 
               | 
          
          
            | 164 | 
             
  | 
            - | 
               | 
          
          
            | 165 | 
             
  | 
            - | 
               | 
          
          
            | 166 | 
                /**
  | 
            - | 
               | 
          
          
            | 167 | 
                 * Renvoie le statut du projet passé en paramètre.
  | 
            - | 
               | 
          
          
            | 168 | 
                 *
  | 
            - | 
               | 
          
          
            | 169 | 
                 * @param int id_utilisateur 
  | 
            - | 
               | 
          
          
            | 170 | 
                 * @param int id_projet 
  | 
            - | 
               | 
          
          
            | 171 | 
                 * @param int dbObject 
  | 
            - | 
               | 
          
          
            | 172 | 
                 * @return int
  | 
            - | 
               | 
          
          
            | 173 | 
                 * @static
  | 
            - | 
               | 
          
          
            | 174 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 175 | 
                 */
  | 
            - | 
               | 
          
          
            | 176 | 
                function getStatutSurProjetCourant( $id_utilisateur,  $id_projet,  &$dbObject )
  | 
            - | 
               | 
          
          
            | 177 | 
                {
  | 
            - | 
               | 
          
          
            | 178 | 
                    
  | 
            - | 
               | 
          
          
            | 179 | 
                    if (participe::isAdministrateur($id_utilisateur, $dbObject)) return PROJET_DROIT_ADMINISTRATEUR;
  | 
            - | 
               | 
          
          
            | 180 | 
                    $requete = 'select psu_id_statut from projet_statut_utilisateurs'.
  | 
            - | 
               | 
          
          
            | 181 | 
                                ' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet ='.$this->_db->escapeSimple($id_projet) ;
  | 
            - | 
               | 
          
          
            | 182 | 
                    $resultat = $dbObject->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 183 | 
                    if (DB::isError ($resultat)) {
  | 
            - | 
               | 
          
          
            | 184 | 
                        return DB::raiseError('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
  | 
            - | 
               | 
          
          
            | 185 | 
                    }
  | 
            - | 
               | 
          
          
            | 186 | 
                    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
  | 
            - | 
               | 
          
          
            | 187 | 
                    if (!$resultat->numRows()) {
  | 
            - | 
               | 
          
          
            | 188 | 
                        return 4 ;      // Le statut ne participe pas
  | 
            - | 
               | 
          
          
            | 189 | 
                    }
  | 
            - | 
               | 
          
          
            | 190 | 
                    return $ligne->psu_id_statut ;
  | 
            - | 
               | 
          
          
            | 191 | 
                } // end of member function getStatutSurProjetCourant
  | 
            - | 
               | 
          
          
            | 192 | 
             
  | 
            - | 
               | 
          
          
            | 193 | 
                /**
  | 
            - | 
               | 
          
          
            | 194 | 
                 * Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
  | 
            - | 
               | 
          
          
            | 195 | 
                 * est administrateur de l'application projet.
  | 
            - | 
               | 
          
          
            | 196 | 
                 *
  | 
            - | 
               | 
          
          
            | 197 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur.
  | 
            - | 
               | 
          
          
            | 198 | 
                 * @param DB objetDB Un objet PEAR::DB
  | 
            - | 
               | 
          
          
            | 199 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 200 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 201 | 
                 */
  | 
            - | 
               | 
          
          
            | 202 | 
                function isAdministrateur( $id_utilisateur, $objetDB = "" )
  | 
            - | 
               | 
          
          
            | 203 | 
                {
  | 
            - | 
               | 
          
          
            | 204 | 
                    // La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
  | 
            - | 
               | 
          
          
            | 205 | 
                    // pour indiquer un administrateur
  | 
            - | 
               | 
          
          
            | 206 | 
                    $requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur)." ".
  | 
            - | 
               | 
          
          
            | 207 | 
                                " and psu_id_projet=0" ;
  | 
            - | 
               | 
          
          
            | 208 | 
                                
  | 
            - | 
               | 
          
          
            | 209 | 
                    if (is_object ($objetDB)) {
  | 
            - | 
               | 
          
          
            | 210 | 
                        $resultat = $objetDB->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 211 | 
                    } else {
  | 
            - | 
               | 
          
          
            | 212 | 
                        $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 213 | 
                    }
  | 
            - | 
               | 
          
          
            | 214 | 
                    if ($resultat->numRows () != 0) {
  | 
            - | 
               | 
          
          
            | 215 | 
                        return true;
  | 
            - | 
               | 
          
          
            | 216 | 
                    }
  | 
            - | 
               | 
          
          
            | 217 | 
                    return false ;
  | 
            - | 
               | 
          
          
            | 218 | 
                } // end of member function isAdministrateur
  | 
            - | 
               | 
          
          
            | 219 | 
             
  | 
            - | 
               | 
          
          
            | 220 | 
                /**
  | 
            - | 
               | 
          
          
            | 221 | 
                 * Met à jour le statut d'un utilisateur sur un projet
  | 
            - | 
               | 
          
          
            | 222 | 
                 *
  | 
            - | 
               | 
          
          
            | 223 | 
                 * @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
  | 
            - | 
               | 
          
          
            | 224 | 
                 * @param int id_utilisateur Identifiant de l'utilisateur
  | 
            - | 
               | 
          
          
            | 225 | 
                 * @param int id_projet Identifiant du projet
  | 
            - | 
               | 
          
          
            | 226 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 227 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 228 | 
                 */
  | 
            - | 
               | 
          
          
            | 229 | 
                function setStatut( $id_statut,  $id_utilisateur,  $id_projet )
  | 
            - | 
               | 
          
          
            | 230 | 
                {    	
  | 
            - | 
               | 
          
          
            | 231 | 
                    $requete = 'update projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
  | 
            - | 
               | 
          
          
            | 232 | 
                                ' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet='.$this->_db->escapeSimple($id_projet);
  | 
            - | 
               | 
          
          
            | 233 | 
                    
  | 
            - | 
               | 
          
          
            | 234 | 
                    if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
  | 
            - | 
               | 
          
          
            | 235 | 
                        $requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
  | 
            - | 
               | 
          
          
            | 236 | 
                                ', psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).',psu_id_projet='.$this->_db->escapeSimple($id_projet).
  | 
            - | 
               | 
          
          
            | 237 | 
                                ', psu_date_inscription=NOW()';
  | 
            - | 
               | 
          
          
            | 238 | 
                    }
  | 
            - | 
               | 
          
          
            | 239 | 
                    if ($id_statut == 4) {  // Si le statut est ne participe pas, on supprime l'inscrit
  | 
            - | 
               | 
          
          
            | 240 | 
                        $requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).
  | 
            - | 
               | 
          
          
            | 241 | 
                        			' and psu_id_projet='.$this->_db->escapeSimple($id_projet) ;
  | 
            - | 
               | 
          
          
            | 242 | 
                    }
  | 
            - | 
               | 
          
          
            | 243 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 244 | 
                    if (DB::isError ($resultat)) {
  | 
            - | 
               | 
          
          
            | 245 | 
                        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
  | 
            - | 
               | 
          
          
            | 246 | 
                    }
  | 
            - | 
               | 
          
          
            | 247 | 
                    return true ;
  | 
            - | 
               | 
          
          
            | 248 | 
                } // end of member function setStatut
  | 
            - | 
               | 
          
          
            | 249 | 
             
  | 
            - | 
               | 
          
          
            | 250 | 
                /**
  | 
            - | 
               | 
          
          
            | 251 | 
                 * Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
  | 
            - | 
               | 
          
          
            | 252 | 
                 *
  | 
            - | 
               | 
          
          
            | 253 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur
  | 
            - | 
               | 
          
          
            | 254 | 
                 * @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
  | 
            - | 
               | 
          
          
            | 255 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 256 | 
                 * @static
  | 
            - | 
               | 
          
          
            | 257 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 258 | 
                 */
  | 
            - | 
               | 
          
          
            | 259 | 
                function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
  | 
            - | 
               | 
          
          
            | 260 | 
                {
  | 
            - | 
               | 
          
          
            | 261 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
            - | 
               | 
          
          
            | 262 | 
                    $statut = $this->getStatutSurProjetCourant($id_utilisateur,  $id_projet, $objetDB) ;
  | 
            - | 
               | 
          
          
            | 263 | 
                    if ($statut == 1) {
  | 
            - | 
               | 
          
          
            | 264 | 
                        return true;
  | 
            - | 
               | 
          
          
            | 265 | 
                    }
  | 
            - | 
               | 
          
          
            | 266 | 
                    return false ;
  | 
            - | 
               | 
          
          
            | 267 | 
                } // end of member function isCoordinateur
  | 
            - | 
               | 
          
          
            | 268 | 
             
  | 
            - | 
               | 
          
          
            | 269 | 
                /**
  | 
            - | 
               | 
          
          
            | 270 | 
                 * Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
  | 
            - | 
               | 
          
          
            | 271 | 
                 * participe pas.
  | 
            - | 
               | 
          
          
            | 272 | 
                 *
  | 
            - | 
               | 
          
          
            | 273 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur.
  | 
            - | 
               | 
          
          
            | 274 | 
                 * @return Array
  | 
            - | 
               | 
          
          
            | 275 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 276 | 
                 */
  | 
            - | 
               | 
          
          
            | 277 | 
                function getProjetsNonParticipant( $id_utilisateur )
  | 
            - | 
               | 
          
          
            | 278 | 
                {
  | 
            - | 
               | 
          
          
            | 279 | 
                    $tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 280 | 
                    $requete = 'select p_id from projet'.
  | 
            - | 
               | 
          
          
            | 281 | 
                                ' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).')' ;
  | 
            - | 
               | 
          
          
            | 282 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 283 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 284 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 285 | 
                    }
  | 
            - | 
               | 
          
          
            | 286 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
  | 
            - | 
               | 
          
          
            | 287 | 
                        array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
  | 
            - | 
               | 
          
          
            | 288 | 
                    }
  | 
            - | 
               | 
          
          
            | 289 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 290 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 291 | 
                } // end of member function getProjetsNonParticipant
  | 
            - | 
               | 
          
          
            | 292 | 
             
  | 
            - | 
               | 
          
          
            | 293 | 
                /**
  | 
            - | 
               | 
          
          
            | 294 | 
                 * Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
  | 
            - | 
               | 
          
          
            | 295 | 
                 * en paramètre.
  | 
            - | 
               | 
          
          
            | 296 | 
                 *
  | 
            - | 
               | 
          
          
            | 297 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
            - | 
               | 
          
          
            | 298 | 
                 * @param int id_projet L'identifiant du projet
  | 
            - | 
               | 
          
          
            | 299 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 300 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 301 | 
                 */
  | 
            - | 
               | 
          
          
            | 302 | 
                function isObservateur( $id_utilisateur,  $id_projet, &$objetDB )
  | 
            - | 
               | 
          
          
            | 303 | 
                {
  | 
            - | 
               | 
          
          
            | 304 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
            - | 
               | 
          
          
            | 305 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
  | 
            - | 
               | 
          
          
            | 306 | 
                        return true;
  | 
            - | 
               | 
          
          
            | 307 | 
                    }
  | 
            - | 
               | 
          
          
            | 308 | 
                    return false ;
  | 
            - | 
               | 
          
          
            | 309 | 
                } // end of member function isObservateur
  | 
            - | 
               | 
          
          
            | 310 | 
             
  | 
            - | 
               | 
          
          
            | 311 | 
                /**
  | 
            - | 
               | 
          
          
            | 312 | 
                 * Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
  | 
            - | 
               | 
          
          
            | 313 | 
                 * en paramètre.
  | 
            - | 
               | 
          
          
            | 314 | 
                 *
  | 
            - | 
               | 
          
          
            | 315 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
            - | 
               | 
          
          
            | 316 | 
                 * @param int id_projet L'identifiant du projet
  | 
            - | 
               | 
          
          
            | 317 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 318 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 319 | 
                 */
  | 
            - | 
               | 
          
          
            | 320 | 
                function isContributeur( $id_utilisateur,  $id_projet, &$objetDB )
  | 
            - | 
               | 
          
          
            | 321 | 
                {
  | 
            - | 
               | 
          
          
            | 322 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
            - | 
               | 
          
          
            | 323 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false; 
  | 
            - | 
               | 
          
          
            | 324 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
  | 
            - | 
               | 
          
          
            | 325 | 
                        return true;
  | 
            - | 
               | 
          
          
            | 326 | 
                    }
  | 
            - | 
               | 
          
          
            | 327 | 
                    return false ;
  | 
            - | 
               | 
          
          
            | 328 | 
                } // end of member function isObservateur
  | 
            - | 
               | 
          
          
            | 329 | 
             
  | 
            - | 
               | 
          
          
            | 330 | 
                /**
  | 
            - | 
               | 
          
          
            | 331 | 
                 * Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
  | 
            - | 
               | 
          
          
            | 332 | 
                 * en paramètre.
  | 
            - | 
               | 
          
          
            | 333 | 
                 *
  | 
            - | 
               | 
          
          
            | 334 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
            - | 
               | 
          
          
            | 335 | 
                 * @param int id_projet L'identifiant du projet
  | 
            - | 
               | 
          
          
            | 336 | 
                 * @return bool
  | 
            - | 
               | 
          
          
            | 337 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 338 | 
                 */
  | 
            - | 
               | 
          
          
            | 339 | 
                function isEnAttente( $id_utilisateur,  $id_projet, &$objetDB )
  | 
            - | 
               | 
          
          
            | 340 | 
                {
  | 
            - | 
               | 
          
          
            | 341 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
  | 
            - | 
               | 
          
          
            | 342 | 
                        return true;
  | 
            - | 
               | 
          
          
            | 343 | 
                    }
  | 
            - | 
               | 
          
          
            | 344 | 
                    return false ;
  | 
            - | 
               | 
          
          
            | 345 | 
                } // end of member function isObservateur
  | 
            - | 
               | 
          
          
            | 346 | 
             
  | 
            - | 
               | 
          
          
            | 347 | 
            	/**
  | 
            - | 
               | 
          
          
            | 348 | 
                 * Renvoie les infos sur les coordinateurs d'un projet
  | 
            - | 
               | 
          
          
            | 349 | 
                 *
  | 
            - | 
               | 
          
          
            | 350 | 
                 * @param int id_projet L'identifiant du projet
  | 
            - | 
               | 
          
          
            | 351 | 
                 * @return array	Un tableau contenant les infos concernants les coordinateurs du projet
  | 
            - | 
               | 
          
          
            | 352 | 
                 * @access public
  | 
            - | 
               | 
          
          
            | 353 | 
                 */
  | 
            - | 
               | 
          
          
            | 354 | 
                function getCoordinateurs($id_projet)
  | 
            - | 
               | 
          
          
            | 355 | 
                {
  | 
            - | 
               | 
          
          
            | 356 | 
                    $tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 357 | 
                    
  | 
            - | 
               | 
          
          
            | 358 | 
                    $requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
            - | 
               | 
          
          
            | 359 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
            - | 
               | 
          
          
            | 360 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
            - | 
               | 
          
          
            | 361 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
            - | 
               | 
          
          
            | 362 | 
                                ' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
            - | 
               | 
          
          
            | 363 | 
                                ' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
            - | 
               | 
          
          
            | 364 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 365 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 366 | 
                        return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 367 | 
                    }
  | 
            - | 
               | 
          
          
            | 368 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
            - | 
               | 
          
          
            | 369 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
            - | 
               | 
          
          
            | 370 | 
                    }
  | 
            - | 
               | 
          
          
            | 371 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 372 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 373 | 
                } // end of member function getCoordinateurs
  | 
            - | 
               | 
          
          
            | 374 | 
                
  | 
            - | 
               | 
          
          
            | 375 | 
                function getAdministrateurs () {
  | 
            - | 
               | 
          
          
            | 376 | 
                	
  | 
            - | 
               | 
          
          
            | 377 | 
                	$tableau_resultat = array() ;
  | 
            - | 
               | 
          
          
            | 378 | 
                	
  | 
            - | 
               | 
          
          
            | 379 | 
                	$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
            - | 
               | 
          
          
            | 380 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
            - | 
               | 
          
          
            | 381 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
            - | 
               | 
          
          
            | 382 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
            - | 
               | 
          
          
            | 383 | 
                                ' where psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
            - | 
               | 
          
          
            | 384 | 
                                ' and psu_id_statut=ps_id_statut and psu_id_statut=0 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
            - | 
               | 
          
          
            | 385 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
            - | 
               | 
          
          
            | 386 | 
                    if (DB::isError($resultat)) {
  | 
            - | 
               | 
          
          
            | 387 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
            - | 
               | 
          
          
            | 388 | 
                    }
  | 
            - | 
               | 
          
          
            | 389 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
            - | 
               | 
          
          
            | 390 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
            - | 
               | 
          
          
            | 391 | 
                    }
  | 
            - | 
               | 
          
          
            | 392 | 
                    $resultat->free() ;
  | 
            - | 
               | 
          
          
            | 393 | 
                    return $tableau_resultat ;
  | 
            - | 
               | 
          
          
            | 394 | 
                }
  | 
            - | 
               | 
          
          
            | 395 | 
                /** 
  | 
            - | 
               | 
          
          
            | 396 | 
                 * Renvoie la constante de statut d un utilisateur
  | 
            - | 
               | 
          
          
            | 397 | 
                 * 
  | 
            - | 
               | 
          
          
            | 398 | 
                 * define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
  | 
            - | 
               | 
          
          
            | 399 | 
            	 * define ('PROJET_DROIT_COORDINATEUR', 2) ;
  | 
            - | 
               | 
          
          
            | 400 | 
            	 * define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
  | 
            - | 
               | 
          
          
            | 401 | 
            	 * define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
  | 
            - | 
               | 
          
          
            | 402 | 
            	 * define ('PROJET_DROIT_AUCUN', 16) ;
  | 
            - | 
               | 
          
          
            | 403 | 
            	 * define ('PROJET_DROIT_EN_ATTENTE', 32);
  | 
            - | 
               | 
          
          
            | 404 | 
            	 * 
  | 
            - | 
               | 
          
          
            | 405 | 
            	 * @access	public
  | 
            - | 
               | 
          
          
            | 406 | 
            	 * @return int	La constante de statut
  | 
            - | 
               | 
          
          
            | 407 | 
                 */
  | 
            - | 
               | 
          
          
            | 408 | 
                 
  | 
            - | 
               | 
          
          
            | 409 | 
                 function getStatut($id_utilisateur, $id_projet)
  | 
            - | 
               | 
          
          
            | 410 | 
                 {
  | 
            - | 
               | 
          
          
            | 411 | 
                 	$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db);
  | 
            - | 
               | 
          
          
            | 412 | 
                 	switch ($statut) 
  | 
            - | 
               | 
          
          
            | 413 | 
                 	{
  | 
            - | 
               | 
          
          
            | 414 | 
                 		case 0 : return PROJET_DROIT_ADMINISTRATEUR;
  | 
            - | 
               | 
          
          
            | 415 | 
                 		break;
  | 
            - | 
               | 
          
          
            | 416 | 
                 		case 1 : return PROJET_DROIT_COORDINATEUR;
  | 
            - | 
               | 
          
          
            | 417 | 
                 		break;
  | 
            - | 
               | 
          
          
            | 418 | 
                 		case 2 : return PROJET_DROIT_CONTRIBUTEUR;
  | 
            - | 
               | 
          
          
            | 419 | 
                 		break;
  | 
            - | 
               | 
          
          
            | 420 | 
                 		case 3 : return PROJET_DROIT_EN_ATTENTE;
  | 
            - | 
               | 
          
          
            | 421 | 
                 		break;
  | 
            - | 
               | 
          
          
            | 422 | 
                 		default : return PROJET_DROIT_AUCUN;
  | 
            - | 
               | 
          
          
            | 423 | 
                 	}
  | 
            - | 
               | 
          
          
            | 424 | 
                 }
  | 
            - | 
               | 
          
          
            | 425 | 
            } // end of participe
  | 
            - | 
               | 
          
          
            | 426 | 
            ?>
  | 
            - | 
               | 
          
          
            | 427 | 
             | 
            1 | 
            <?php
  | 
          
          
            | - | 
               | 
            2 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            3 | 
            // | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
  | 
          
          
            | - | 
               | 
            4 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            5 | 
            // | This library is free software; you can redistribute it and/or                                        |
  | 
          
          
            | - | 
               | 
            6 | 
            // | modify it under the terms of the GNU General Public                                                  |
  | 
          
          
            | - | 
               | 
            7 | 
            // | License as published by the Free Software Foundation; either                                         |
  | 
          
          
            | - | 
               | 
            8 | 
            // | version 2.1 of the License, or (at your option) any later version.                                   |
  | 
          
          
            | - | 
               | 
            9 | 
            // |                                                                                                      |
  | 
          
          
            | - | 
               | 
            10 | 
            // | This library is distributed in the hope that it will be useful,                                      |
  | 
          
          
            | - | 
               | 
            11 | 
            // | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
  | 
          
          
            | - | 
               | 
            12 | 
            // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
  | 
          
          
            | - | 
               | 
            13 | 
            // | General Public License for more details.                                                             |
  | 
          
          
            | - | 
               | 
            14 | 
            // |                                                                                                      |
  | 
          
          
            | - | 
               | 
            15 | 
            // | You should have received a copy of the GNU General Public                                            |
  | 
          
          
            | - | 
               | 
            16 | 
            // | License along with this library; if not, write to the Free Software                                  |
  | 
          
          
            | - | 
               | 
            17 | 
            // | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
  | 
          
          
            | - | 
               | 
            18 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            19 | 
            // CVS : $Id: participe.class.php,v 1.6 2008-08-25 15:11:56 alexandre_tb Exp $
  | 
          
          
            | - | 
               | 
            20 | 
            /**
  | 
          
          
            | - | 
               | 
            21 | 
            * Application projet
  | 
          
          
            | - | 
               | 
            22 | 
            *
  | 
          
          
            | - | 
               | 
            23 | 
            * La classe partiicpe assure la jointure entre projet et Auth
  | 
          
          
            | - | 
               | 
            24 | 
            * Elle se base sur la table projet_statut_utilisateur
  | 
          
          
            | - | 
               | 
            25 | 
            *
  | 
          
          
            | - | 
               | 
            26 | 
            *@package projet
  | 
          
          
            | - | 
               | 
            27 | 
            //Auteur original :
  | 
          
          
            | - | 
               | 
            28 | 
            *@author        Alexandre Granier <alexandre@tela-botanica.org>
  | 
          
          
            | - | 
               | 
            29 | 
            //Autres auteurs :
  | 
          
          
            | - | 
               | 
            30 | 
            *@author        Aucun
  | 
          
          
            | - | 
               | 
            31 | 
            *@copyright     Tela-Botanica 2000-2004
  | 
          
          
            | - | 
               | 
            32 | 
            *@version       $Revision: 1.6 $
  | 
          
          
            | - | 
               | 
            33 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            34 | 
            */
  | 
          
          
            | - | 
               | 
            35 | 
             
  | 
          
          
            | - | 
               | 
            36 | 
             
  | 
          
          
            | - | 
               | 
            37 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            38 | 
            // |                                            ENTETE du PROGRAMME                                       |
  | 
          
          
            | - | 
               | 
            39 | 
            // +------------------------------------------------------------------------------------------------------+
  | 
          
          
            | - | 
               | 
            40 | 
             
  | 
          
          
            | - | 
               | 
            41 | 
             
  | 
          
          
            | - | 
               | 
            42 | 
            /**
  | 
          
          
            | - | 
               | 
            43 | 
             * class participe
  | 
          
          
            | - | 
               | 
            44 | 
             * 
  | 
          
          
            | - | 
               | 
            45 | 
             */
  | 
          
          
            | - | 
               | 
            46 | 
            class participe
  | 
          
          
            | - | 
               | 
            47 | 
            {
  | 
          
          
            | - | 
               | 
            48 | 
                /*** Attributes: ***/
  | 
          
          
            | - | 
               | 
            49 | 
             
  | 
          
          
            | - | 
               | 
            50 | 
                /**
  | 
          
          
            | - | 
               | 
            51 | 
                 * Date d'inscription au projet de l'utilisateur.
  | 
          
          
            | - | 
               | 
            52 | 
                 * @access private
  | 
          
          
            | - | 
               | 
            53 | 
                 */
  | 
          
          
            | - | 
               | 
            54 | 
                var $_date_inscription;
  | 
          
          
            | - | 
               | 
            55 | 
                /**
  | 
          
          
            | - | 
               | 
            56 | 
                 * Statut de l'utilisateur, un entier.
  | 
          
          
            | - | 
               | 
            57 | 
                 * @access private
  | 
          
          
            | - | 
               | 
            58 | 
                 */
  | 
          
          
            | - | 
               | 
            59 | 
                var $_statut;
  | 
          
          
            | - | 
               | 
            60 | 
                /**
  | 
          
          
            | - | 
               | 
            61 | 
                 * Connexion à la base de donnée.
  | 
          
          
            | - | 
               | 
            62 | 
                 * @access private
  | 
          
          
            | - | 
               | 
            63 | 
                 */
  | 
          
          
            | - | 
               | 
            64 | 
                var $_db;
  | 
          
          
            | - | 
               | 
            65 | 
             
  | 
          
          
            | - | 
               | 
            66 | 
                /**
  | 
          
          
            | - | 
               | 
            67 | 
                 * Constructeur. Nécessite un objet DB valide connecté à la base contenant les
  | 
          
          
            | - | 
               | 
            68 | 
                 * tables projets.
  | 
          
          
            | - | 
               | 
            69 | 
                 *
  | 
          
          
            | - | 
               | 
            70 | 
                 * @param DB objetDB Un objet PEAR:DB valide.
  | 
          
          
            | - | 
               | 
            71 | 
                 * @return void
  | 
          
          
            | - | 
               | 
            72 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            73 | 
                 */
  | 
          
          
            | - | 
               | 
            74 | 
                function participe( &$objetDB )
  | 
          
          
            | - | 
               | 
            75 | 
                {
  | 
          
          
            | - | 
               | 
            76 | 
                    $this->_db = $objetDB ;
  | 
          
          
            | - | 
               | 
            77 | 
                } // end of member function participe
  | 
          
          
            | - | 
               | 
            78 | 
             
  | 
          
          
            | - | 
               | 
            79 | 
                /**
  | 
          
          
            | - | 
               | 
            80 | 
                 * Renvoie la liste des inscrit à un projet avec leur statut.
  | 
          
          
            | - | 
               | 
            81 | 
                 *
  | 
          
          
            | - | 
               | 
            82 | 
                 * @return Array
  | 
          
          
            | - | 
               | 
            83 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            84 | 
                 */
  | 
          
          
            | - | 
               | 
            85 | 
                function getInscrits($id_projet, $droits )
  | 
          
          
            | - | 
               | 
            86 | 
                {
  | 
          
          
            | - | 
               | 
            87 | 
                    $tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            88 | 
                    
  | 
          
          
            | - | 
               | 
            89 | 
                    $requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
          
          
            | - | 
               | 
            90 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
          
          
            | - | 
               | 
            91 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
          
          
            | - | 
               | 
            92 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
          
          
            | - | 
               | 
            93 | 
                                ' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
          
          
            | - | 
               | 
            94 | 
                                ' and psu_id_statut=ps_id_statut order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
          
          
            | - | 
               | 
            95 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            96 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            97 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            98 | 
                    }
  | 
          
          
            | - | 
               | 
            99 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
          
          
            | - | 
               | 
            100 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
          
          
            | - | 
               | 
            101 | 
                        $id = $ligne[0];
  | 
          
          
            | - | 
               | 
            102 | 
                        $inscrits[$id]['nom'] = $ligne[1];
  | 
          
          
            | - | 
               | 
            103 | 
                        $inscrits[$id]['prenom'] = $ligne[2];
  | 
          
          
            | - | 
               | 
            104 | 
                        $inscrits[$id]['mail'] = $ligne[3];
  | 
          
          
            | - | 
               | 
            105 | 
                        $inscrits[$id]['date'] = $ligne[4];
  | 
          
          
            | - | 
               | 
            106 | 
                        $inscrits[$id]['id_statut'] = $ligne[5]; 
  | 
          
          
            | - | 
               | 
            107 | 
                    }
  | 
          
          
            | - | 
               | 
            108 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            109 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            110 | 
                } // end of member function getInscrits
  | 
          
          
            | - | 
               | 
            111 | 
             
  | 
          
          
            | - | 
               | 
            112 | 
                /**
  | 
          
          
            | - | 
               | 
            113 | 
                 * Renvoie un tableau contenant la liste des identifiants des projets et des statuts
  | 
          
          
            | - | 
               | 
            114 | 
                 * d'un inscrit. 0 => ['psu_id_utilisateur']          ['psu_id_statut'] 1 => ...
  | 
          
          
            | - | 
               | 
            115 | 
                 *
  | 
          
          
            | - | 
               | 
            116 | 
                 * @param int id_utilisateur Un identifiant d'utilisateur pour le champs
  | 
          
          
            | - | 
               | 
            117 | 
                 * projet_statut_utilisateurs:psu_id_utilisateur
  | 
          
          
            | - | 
               | 
            118 | 
                 * @return Array
  | 
          
          
            | - | 
               | 
            119 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            120 | 
                 */
  | 
          
          
            | - | 
               | 
            121 | 
                function getIdProjetsStatuts( $id_utilisateur )
  | 
          
          
            | - | 
               | 
            122 | 
                {
  | 
          
          
            | - | 
               | 
            123 | 
                    $tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            124 | 
                    $requete = "select psu_id_utilisateur, psu_id_statut from projet_statut_utilisateurs".
  | 
          
          
            | - | 
               | 
            125 | 
                                " where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur) ;
  | 
          
          
            | - | 
               | 
            126 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            127 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            128 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            129 | 
                    }
  | 
          
          
            | - | 
               | 
            130 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC)) {
  | 
          
          
            | - | 
               | 
            131 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
          
          
            | - | 
               | 
            132 | 
                    }
  | 
          
          
            | - | 
               | 
            133 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            134 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            135 | 
                } // end of member function getIdProjetsStatuts
  | 
          
          
            | - | 
               | 
            136 | 
             
  | 
          
          
            | - | 
               | 
            137 | 
             
  | 
          
          
            | - | 
               | 
            138 | 
                /**
  | 
          
          
            | - | 
               | 
            139 | 
                 * Renvoie un tableau à 2 dimensions avec les informations sur l'inscription aux
  | 
          
          
            | - | 
               | 
            140 | 
                 * différents projets d'un utilisateur. 0 => ['p_titre']         Le titre du projet 
  | 
          
          
            | - | 
               | 
            141 | 
                 *         ['ps_label']    Le statut de l'utilisateur 1 => .... (autant que de
  | 
          
          
            | - | 
               | 
            142 | 
                 * projets)
  | 
          
          
            | - | 
               | 
            143 | 
                 *
  | 
          
          
            | - | 
               | 
            144 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur.
  | 
          
          
            | - | 
               | 
            145 | 
                 * @return Array
  | 
          
          
            | - | 
               | 
            146 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            147 | 
                 */
  | 
          
          
            | - | 
               | 
            148 | 
                function getInformationsUtilisateurs( $id_utilisateur )
  | 
          
          
            | - | 
               | 
            149 | 
                {
  | 
          
          
            | - | 
               | 
            150 | 
                    $tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            151 | 
                    $requete = "select p_titre, ps_statut_nom, psu_id_statut, psu_id_projet from projet_statut_utilisateurs, projet, projet_statut".
  | 
          
          
            | - | 
               | 
            152 | 
                                " where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur).
  | 
          
          
            | - | 
               | 
            153 | 
                                " and psu_id_projet = p_id and psu_id_statut = ps_id_statut" ;
  | 
          
          
            | - | 
               | 
            154 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            155 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            156 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            157 | 
                    }
  | 
          
          
            | - | 
               | 
            158 | 
                    while ($ligne = $resultat->fetchRow()) {
  | 
          
          
            | - | 
               | 
            159 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
          
          
            | - | 
               | 
            160 | 
                    }
  | 
          
          
            | - | 
               | 
            161 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            162 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            163 | 
                } // end of member function getInformationsUtilisateurs
  | 
          
          
            | - | 
               | 
            164 | 
             
  | 
          
          
            | - | 
               | 
            165 | 
             
  | 
          
          
            | - | 
               | 
            166 | 
                /**
  | 
          
          
            | - | 
               | 
            167 | 
                 * Renvoie le statut du projet passé en paramètre.
  | 
          
          
            | - | 
               | 
            168 | 
                 *
  | 
          
          
            | - | 
               | 
            169 | 
                 * @param int id_utilisateur 
  | 
          
          
            | - | 
               | 
            170 | 
                 * @param int id_projet 
  | 
          
          
            | - | 
               | 
            171 | 
                 * @param int dbObject 
  | 
          
          
            | - | 
               | 
            172 | 
                 * @return int
  | 
          
          
            | - | 
               | 
            173 | 
                 * @static
  | 
          
          
            | - | 
               | 
            174 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            175 | 
                 */
  | 
          
          
            | - | 
               | 
            176 | 
                function getStatutSurProjetCourant( $id_utilisateur,  $id_projet,  &$dbObject )
  | 
          
          
            | - | 
               | 
            177 | 
                {
  | 
          
          
            | - | 
               | 
            178 | 
                    
  | 
          
          
            | - | 
               | 
            179 | 
                    if (participe::isAdministrateur($id_utilisateur, $dbObject)) return PROJET_DROIT_ADMINISTRATEUR;
  | 
          
          
            | - | 
               | 
            180 | 
                    $requete = 'select psu_id_statut from projet_statut_utilisateurs'.
  | 
          
          
            | - | 
               | 
            181 | 
                                ' where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet ='.$this->_db->escapeSimple($id_projet) ;
  | 
          
          
            | - | 
               | 
            182 | 
                    $resultat = $dbObject->query ($requete) ;
  | 
          
          
            | - | 
               | 
            183 | 
                    if (DB::isError ($resultat)) {
  | 
          
          
            | - | 
               | 
            184 | 
                        return DB::raiseError('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
  | 
          
          
            | - | 
               | 
            185 | 
                    }
  | 
          
          
            | - | 
               | 
            186 | 
                    $ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT) ;
  | 
          
          
            | - | 
               | 
            187 | 
                    if (!$resultat->numRows()) {
  | 
          
          
            | - | 
               | 
            188 | 
                        return 4 ;      // Le statut ne participe pas
  | 
          
          
            | - | 
               | 
            189 | 
                    }
  | 
          
          
            | - | 
               | 
            190 | 
                    return $ligne->psu_id_statut ;
  | 
          
          
            | - | 
               | 
            191 | 
                } // end of member function getStatutSurProjetCourant
  | 
          
          
            | - | 
               | 
            192 | 
             
  | 
          
          
            | - | 
               | 
            193 | 
                /**
  | 
          
          
            | - | 
               | 
            194 | 
                 * Réalise une requête dans projet_statut_utilisateurs et renvoie true si l'utilisateur
  | 
          
          
            | - | 
               | 
            195 | 
                 * est administrateur de l'application projet.
  | 
          
          
            | - | 
               | 
            196 | 
                 *
  | 
          
          
            | - | 
               | 
            197 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur.
  | 
          
          
            | - | 
               | 
            198 | 
                 * @param DB objetDB Un objet PEAR::DB
  | 
          
          
            | - | 
               | 
            199 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            200 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            201 | 
                 */
  | 
          
          
            | - | 
               | 
            202 | 
                function isAdministrateur( $id_utilisateur, $objetDB = "" )
  | 
          
          
            | - | 
               | 
            203 | 
                {
  | 
          
          
            | - | 
               | 
            204 | 
                    // La table projet_statut_utilisateurs possède une entré avec psu_id_projet = 0
  | 
          
          
            | - | 
               | 
            205 | 
                    // pour indiquer un administrateur
  | 
          
          
            | - | 
               | 
            206 | 
                    $requete = "select psu_id_statut from projet_statut_utilisateurs where psu_id_utilisateur=".$this->_db->escapeSimple($id_utilisateur)." ".
  | 
          
          
            | - | 
               | 
            207 | 
                                " and psu_id_projet=0" ;
  | 
          
          
            | - | 
               | 
            208 | 
                                
  | 
          
          
            | - | 
               | 
            209 | 
                    if (is_object ($objetDB)) {
  | 
          
          
            | - | 
               | 
            210 | 
                        $resultat = $objetDB->query ($requete) ;
  | 
          
          
            | - | 
               | 
            211 | 
                    } else {
  | 
          
          
            | - | 
               | 
            212 | 
                        $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            213 | 
                    }
  | 
          
          
            | - | 
               | 
            214 | 
                    if ($resultat->numRows () != 0) {
  | 
          
          
            | - | 
               | 
            215 | 
                        return true;
  | 
          
          
            | - | 
               | 
            216 | 
                    }
  | 
          
          
            | - | 
               | 
            217 | 
                    return false ;
  | 
          
          
            | - | 
               | 
            218 | 
                } // end of member function isAdministrateur
  | 
          
          
            | - | 
               | 
            219 | 
             
  | 
          
          
            | - | 
               | 
            220 | 
                /**
  | 
          
          
            | - | 
               | 
            221 | 
                 * Met à jour le statut d'un utilisateur sur un projet
  | 
          
          
            | - | 
               | 
            222 | 
                 *
  | 
          
          
            | - | 
               | 
            223 | 
                 * @param int id_statut L'identifiant du statut à ajouter ou mettre à jour
  | 
          
          
            | - | 
               | 
            224 | 
                 * @param int id_utilisateur Identifiant de l'utilisateur
  | 
          
          
            | - | 
               | 
            225 | 
                 * @param int id_projet Identifiant du projet
  | 
          
          
            | - | 
               | 
            226 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            227 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            228 | 
                 */
  | 
          
          
            | - | 
               | 
            229 | 
                function setStatut( $id_statut,  $id_utilisateur,  $id_projet )
  | 
          
          
            | - | 
               | 
            230 | 
                {
  | 
          
          
            | - | 
               | 
            231 | 
                    $requete = 'update projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
  | 
          
          
            | - | 
               | 
            232 | 
                                ' where psu_id_utilisateur='.$id_utilisateur.' and psu_id_projet='.$this->_db->escapeSimple($id_projet);
  | 
          
          
            | - | 
               | 
            233 | 
                    
  | 
          
          
            | - | 
               | 
            234 | 
                    if (participe::getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db) == 4) {
  | 
          
          
            | - | 
               | 
            235 | 
                        $requete = 'insert into projet_statut_utilisateurs set psu_id_statut='.$this->_db->escapeSimple($id_statut).
  | 
          
          
            | - | 
               | 
            236 | 
                                ', psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).',psu_id_projet='.$this->_db->escapeSimple($id_projet).
  | 
          
          
            | - | 
               | 
            237 | 
                                ', psu_date_inscription=NOW()';
  | 
          
          
            | - | 
               | 
            238 | 
                    }
  | 
          
          
            | - | 
               | 
            239 | 
                    if ($id_statut == 4) {  // Si le statut est ne participe pas, on supprime l'inscrit
  | 
          
          
            | - | 
               | 
            240 | 
                        $requete = 'delete from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).' and psu_id_projet='.$this->_db->escapeSimple($id_projet) ;
  | 
          
          
            | - | 
               | 
            241 | 
                    }
  | 
          
          
            | - | 
               | 
            242 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            243 | 
                    if (DB::isError ($resultat)) {
  | 
          
          
            | - | 
               | 
            244 | 
                        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
  | 
          
          
            | - | 
               | 
            245 | 
                    }
  | 
          
          
            | - | 
               | 
            246 | 
                    return true ;
  | 
          
          
            | - | 
               | 
            247 | 
                } // end of member function setStatut
  | 
          
          
            | - | 
               | 
            248 | 
             
  | 
          
          
            | - | 
               | 
            249 | 
                /**
  | 
          
          
            | - | 
               | 
            250 | 
                 * Renvoie vrai si l'utilisateur est coordinateur, faux dans les autres cas
  | 
          
          
            | - | 
               | 
            251 | 
                 *
  | 
          
          
            | - | 
               | 
            252 | 
                 * @param int id_utilisateur L'identifiant d'un utilisateur
  | 
          
          
            | - | 
               | 
            253 | 
                 * @param DB objetDB Optionnel, nécessaire si on appelle cette méthode statiquement
  | 
          
          
            | - | 
               | 
            254 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            255 | 
                 * @static
  | 
          
          
            | - | 
               | 
            256 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            257 | 
                 */
  | 
          
          
            | - | 
               | 
            258 | 
                function isCoordinateur( $id_utilisateur, $id_projet, &$objetDB )
  | 
          
          
            | - | 
               | 
            259 | 
                {
  | 
          
          
            | - | 
               | 
            260 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
          
          
            | - | 
               | 
            261 | 
                    $statut = $this->getStatutSurProjetCourant($id_utilisateur,  $id_projet, $objetDB) ;
  | 
          
          
            | - | 
               | 
            262 | 
                    if ($statut == 1) {
  | 
          
          
            | - | 
               | 
            263 | 
                        return true;
  | 
          
          
            | - | 
               | 
            264 | 
                    }
  | 
          
          
            | - | 
               | 
            265 | 
                    return false ;
  | 
          
          
            | - | 
               | 
            266 | 
                } // end of member function isCoordinateur
  | 
          
          
            | - | 
               | 
            267 | 
             
  | 
          
          
            | - | 
               | 
            268 | 
                /**
  | 
          
          
            | - | 
               | 
            269 | 
                 * Renvoie la liste des projets auquels l'utilisateur passé en paramètre ne
  | 
          
          
            | - | 
               | 
            270 | 
                 * participe pas.
  | 
          
          
            | - | 
               | 
            271 | 
                 *
  | 
          
          
            | - | 
               | 
            272 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur.
  | 
          
          
            | - | 
               | 
            273 | 
                 * @return Array
  | 
          
          
            | - | 
               | 
            274 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            275 | 
                 */
  | 
          
          
            | - | 
               | 
            276 | 
                function getProjetsNonParticipant( $id_utilisateur )
  | 
          
          
            | - | 
               | 
            277 | 
                {
  | 
          
          
            | - | 
               | 
            278 | 
                    $tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            279 | 
                    $requete = 'select p_id from projet'.
  | 
          
          
            | - | 
               | 
            280 | 
                                ' where p_id not in (select psu_id_projet from projet_statut_utilisateurs where psu_id_utilisateur='.$this->_db->escapeSimple($id_utilisateur).')' ;
  | 
          
          
            | - | 
               | 
            281 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            282 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            283 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            284 | 
                    }
  | 
          
          
            | - | 
               | 
            285 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
  | 
          
          
            | - | 
               | 
            286 | 
                        array_push ($tableau_resultat, new projet ($this->_db, $ligne->p_id)) ;
  | 
          
          
            | - | 
               | 
            287 | 
                    }
  | 
          
          
            | - | 
               | 
            288 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            289 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            290 | 
                } // end of member function getProjetsNonParticipant
  | 
          
          
            | - | 
               | 
            291 | 
             
  | 
          
          
            | - | 
               | 
            292 | 
                /**
  | 
          
          
            | - | 
               | 
            293 | 
                 * Renvoie true si l'utilisateur passé en paramètre est observateur du projet passé
  | 
          
          
            | - | 
               | 
            294 | 
                 * en paramètre.
  | 
          
          
            | - | 
               | 
            295 | 
                 *
  | 
          
          
            | - | 
               | 
            296 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
          
          
            | - | 
               | 
            297 | 
                 * @param int id_projet L'identifiant du projet
  | 
          
          
            | - | 
               | 
            298 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            299 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            300 | 
                 */
  | 
          
          
            | - | 
               | 
            301 | 
                function isObservateur( $id_utilisateur,  $id_projet, &$objetDB )
  | 
          
          
            | - | 
               | 
            302 | 
                {
  | 
          
          
            | - | 
               | 
            303 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
          
          
            | - | 
               | 
            304 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
  | 
          
          
            | - | 
               | 
            305 | 
                        return true;
  | 
          
          
            | - | 
               | 
            306 | 
                    }
  | 
          
          
            | - | 
               | 
            307 | 
                    return false ;
  | 
          
          
            | - | 
               | 
            308 | 
                } // end of member function isObservateur
  | 
          
          
            | - | 
               | 
            309 | 
             
  | 
          
          
            | - | 
               | 
            310 | 
                /**
  | 
          
          
            | - | 
               | 
            311 | 
                 * Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
  | 
          
          
            | - | 
               | 
            312 | 
                 * en paramètre.
  | 
          
          
            | - | 
               | 
            313 | 
                 *
  | 
          
          
            | - | 
               | 
            314 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
          
          
            | - | 
               | 
            315 | 
                 * @param int id_projet L'identifiant du projet
  | 
          
          
            | - | 
               | 
            316 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            317 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            318 | 
                 */
  | 
          
          
            | - | 
               | 
            319 | 
                function isContributeur( $id_utilisateur,  $id_projet, &$objetDB )
  | 
          
          
            | - | 
               | 
            320 | 
                {
  | 
          
          
            | - | 
               | 
            321 | 
                    if (!is_object($objetDB)) $objetDB = $this->_db;
  | 
          
          
            | - | 
               | 
            322 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 4) return false; 
  | 
          
          
            | - | 
               | 
            323 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 2) {
  | 
          
          
            | - | 
               | 
            324 | 
                        return true;
  | 
          
          
            | - | 
               | 
            325 | 
                    }
  | 
          
          
            | - | 
               | 
            326 | 
                    return false ;
  | 
          
          
            | - | 
               | 
            327 | 
                } // end of member function isObservateur
  | 
          
          
            | - | 
               | 
            328 | 
             
  | 
          
          
            | - | 
               | 
            329 | 
                /**
  | 
          
          
            | - | 
               | 
            330 | 
                 * Renvoie true si l'utilisateur passé en paramètre est contributeur du projet passé
  | 
          
          
            | - | 
               | 
            331 | 
                 * en paramètre.
  | 
          
          
            | - | 
               | 
            332 | 
                 *
  | 
          
          
            | - | 
               | 
            333 | 
                 * @param int id_utilisateur L'identifiant de l'utilisateur
  | 
          
          
            | - | 
               | 
            334 | 
                 * @param int id_projet L'identifiant du projet
  | 
          
          
            | - | 
               | 
            335 | 
                 * @return bool
  | 
          
          
            | - | 
               | 
            336 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            337 | 
                 */
  | 
          
          
            | - | 
               | 
            338 | 
                function isEnAttente( $id_utilisateur,  $id_projet, &$objetDB )
  | 
          
          
            | - | 
               | 
            339 | 
                {
  | 
          
          
            | - | 
               | 
            340 | 
                    if ($this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $objetDB) == 3) {
  | 
          
          
            | - | 
               | 
            341 | 
                        return true;
  | 
          
          
            | - | 
               | 
            342 | 
                    }
  | 
          
          
            | - | 
               | 
            343 | 
                    return false ;
  | 
          
          
            | - | 
               | 
            344 | 
                } // end of member function isObservateur
  | 
          
          
            | - | 
               | 
            345 | 
             
  | 
          
          
            | - | 
               | 
            346 | 
            	/**
  | 
          
          
            | - | 
               | 
            347 | 
                 * Renvoie les infos sur les coordinateurs d'un projet
  | 
          
          
            | - | 
               | 
            348 | 
                 *
  | 
          
          
            | - | 
               | 
            349 | 
                 * @param int id_projet L'identifiant du projet
  | 
          
          
            | - | 
               | 
            350 | 
                 * @return array	Un tableau contenant les infos concernants les coordinateurs du projet
  | 
          
          
            | - | 
               | 
            351 | 
                 * @access public
  | 
          
          
            | - | 
               | 
            352 | 
                 */
  | 
          
          
            | - | 
               | 
            353 | 
                function getCoordinateurs($id_projet)
  | 
          
          
            | - | 
               | 
            354 | 
                {
  | 
          
          
            | - | 
               | 
            355 | 
                    $tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            356 | 
                    
  | 
          
          
            | - | 
               | 
            357 | 
                    $requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
          
          
            | - | 
               | 
            358 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
          
          
            | - | 
               | 
            359 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
          
          
            | - | 
               | 
            360 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
          
          
            | - | 
               | 
            361 | 
                                ' where psu_id_projet='.$this->_db->escapeSimple($id_projet).' and psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
          
          
            | - | 
               | 
            362 | 
                                ' and psu_id_statut=ps_id_statut and psu_id_statut=1 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
          
          
            | - | 
               | 
            363 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            364 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            365 | 
                        return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            366 | 
                    }
  | 
          
          
            | - | 
               | 
            367 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
          
          
            | - | 
               | 
            368 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
          
          
            | - | 
               | 
            369 | 
                    }
  | 
          
          
            | - | 
               | 
            370 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            371 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            372 | 
                } // end of member function getCoordinateurs
  | 
          
          
            | - | 
               | 
            373 | 
                
  | 
          
          
            | - | 
               | 
            374 | 
                function getAdministrateurs () {
  | 
          
          
            | - | 
               | 
            375 | 
                	
  | 
          
          
            | - | 
               | 
            376 | 
                	$tableau_resultat = array() ;
  | 
          
          
            | - | 
               | 
            377 | 
                	
  | 
          
          
            | - | 
               | 
            378 | 
                	$requete = 'select psu_id_utilisateur,'.PROJET_CHAMPS_NOM.','.PROJET_CHAMPS_PRENOM.',' ;
  | 
          
          
            | - | 
               | 
            379 | 
                    $requete .= PROJET_CHAMPS_MAIL.', ' ;
  | 
          
          
            | - | 
               | 
            380 | 
                    $requete .= 'psu_date_inscription,  ps_id_statut '.
  | 
          
          
            | - | 
               | 
            381 | 
                                ' from projet_statut_utilisateurs, projet_statut,'.PROJET_ANNUAIRE.
  | 
          
          
            | - | 
               | 
            382 | 
                                ' where psu_id_utilisateur='.PROJET_CHAMPS_ID.
  | 
          
          
            | - | 
               | 
            383 | 
                                ' and psu_id_statut=ps_id_statut and psu_id_statut=0 order by ps_id_statut,'.PROJET_CHAMPS_NOM;
  | 
          
          
            | - | 
               | 
            384 | 
                    $resultat = $this->_db->query ($requete) ;
  | 
          
          
            | - | 
               | 
            385 | 
                    if (DB::isError($resultat)) {
  | 
          
          
            | - | 
               | 
            386 | 
                        die ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
  | 
          
          
            | - | 
               | 
            387 | 
                    }
  | 
          
          
            | - | 
               | 
            388 | 
                    while ($ligne = $resultat->fetchRow(DB_FETCHMODE_ORDERED)) {
  | 
          
          
            | - | 
               | 
            389 | 
                        array_push ($tableau_resultat, $ligne) ;
  | 
          
          
            | - | 
               | 
            390 | 
                    }
  | 
          
          
            | - | 
               | 
            391 | 
                    $resultat->free() ;
  | 
          
          
            | - | 
               | 
            392 | 
                    return $tableau_resultat ;
  | 
          
          
            | - | 
               | 
            393 | 
                }
  | 
          
          
            | - | 
               | 
            394 | 
                /** 
  | 
          
          
            | - | 
               | 
            395 | 
                 * Renvoie la constante de statut d un utilisateur
  | 
          
          
            | - | 
               | 
            396 | 
                 * 
  | 
          
          
            | - | 
               | 
            397 | 
                 * define ('PROJET_DROIT_ADMINISTRATEUR', 1) ;
  | 
          
          
            | - | 
               | 
            398 | 
            	 * define ('PROJET_DROIT_COORDINATEUR', 2) ;
  | 
          
          
            | - | 
               | 
            399 | 
            	 * define ('PROJET_DROIT_PROPRIETAIRE', 4) ;
  | 
          
          
            | - | 
               | 
            400 | 
            	 * define ('PROJET_DROIT_CONTRIBUTEUR', 8) ;
  | 
          
          
            | - | 
               | 
            401 | 
            	 * define ('PROJET_DROIT_AUCUN', 16) ;
  | 
          
          
            | - | 
               | 
            402 | 
            	 * define ('PROJET_DROIT_EN_ATTENTE', 32);
  | 
          
          
            | - | 
               | 
            403 | 
            	 * 
  | 
          
          
            | - | 
               | 
            404 | 
            	 * @access	public
  | 
          
          
            | - | 
               | 
            405 | 
            	 * @return int	La constante de statut
  | 
          
          
            | - | 
               | 
            406 | 
                 */
  | 
          
          
            | - | 
               | 
            407 | 
                 
  | 
          
          
            | - | 
               | 
            408 | 
                 function getStatut($id_utilisateur, $id_projet)
  | 
          
          
            | - | 
               | 
            409 | 
                 {
  | 
          
          
            | - | 
               | 
            410 | 
                 	$statut = $this->getStatutSurProjetCourant($id_utilisateur, $id_projet, $this->_db);
  | 
          
          
            | - | 
               | 
            411 | 
                 	switch ($statut) 
  | 
          
          
            | - | 
               | 
            412 | 
                 	{
  | 
          
          
            | - | 
               | 
            413 | 
                 		case 0 : return PROJET_DROIT_ADMINISTRATEUR;
  | 
          
          
            | - | 
               | 
            414 | 
                 		break;
  | 
          
          
            | - | 
               | 
            415 | 
                 		case 1 : return PROJET_DROIT_COORDINATEUR;
  | 
          
          
            | - | 
               | 
            416 | 
                 		break;
  | 
          
          
            | - | 
               | 
            417 | 
                 		case 2 : return PROJET_DROIT_CONTRIBUTEUR;
  | 
          
          
            | - | 
               | 
            418 | 
                 		break;
  | 
          
          
            | - | 
               | 
            419 | 
                 		case 3 : return PROJET_DROIT_EN_ATTENTE;
  | 
          
          
            | - | 
               | 
            420 | 
                 		break;
  | 
          
          
            | - | 
               | 
            421 | 
                 		default : return PROJET_DROIT_AUCUN;
  | 
          
          
            | - | 
               | 
            422 | 
                 	}
  | 
          
          
            | - | 
               | 
            423 | 
                 }
  | 
          
          
            | - | 
               | 
            424 | 
            } // end of participe
  | 
          
          
            | - | 
               | 
            425 | 
            ?>
  | 
          
          
            | - | 
               | 
            426 | 
             |