Subversion Repositories Applications.projet

Rev

Rev 48 | Rev 249 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
48 ddelon 1
<?php
2 ddelon 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
208 neiluj 22
// CVS : $Id: participants.php,v 1.6 2007-04-19 15:34:35 neiluj Exp $
2 ddelon 23
/**
24
* Application projet
25
*
26
* Action participants
27
*
28
*@package projet
29
//Auteur original :
30
*@author        Alexandre Granier <alexandre@tela-botanica.org>
31
//Autres auteurs :
32
*@author        Aucun
33
*@copyright     Tela-Botanica 2000-2005
208 neiluj 34
*@version       $Revision: 1.6 $
2 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
// RAPPEL IMPORTANT
43
// On se situe dans la méthode run() de la classe projetControleur
44
//
45
 
48 ddelon 46
include_once PROJET_CHEMIN_CLASSES.'HTML_listeParticipants.class.php' ;
11 alexandre_ 47
 
2 ddelon 48
$res = '' ;
208 neiluj 49
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
50
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
2 ddelon 51
$projet = new projet ($this->_db, $this->_id_projet) ;
52
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
53
$titre = '<h2>'.PROJET_LISTE_PARTICIPANT.'</h2>'."\n" ;
54
$participants = new participe($this->_db) ;
55
 
56
// On teste ici s'il y a une mise à jour de statut
57
if (isset($_REQUEST['statut'])) {
58
    $participants->setStatut($_REQUEST['statut'], $_GET['id_utilisateur'], $this->_id_projet) ;
59
    $projet->getListesAssociees() ;
60
    if ($projet->avoirListe()) {
61
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
62
        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
63
        $annuaire->setId($_GET['id_utilisateur']) ;
64
        include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
65
        $desinscription= new inscription_liste($this->_db) ;
66
        $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
67
    }
68
}
69
 
208 neiluj 70
// Ce qui suit doit être amàliorà pour sortir la requête sur l'annuaire
2 ddelon 71
// On teste s'il y a un ajout d'utilisateur voir HTML_listeParticipants
72
if (isset($_POST['mail_utilisateur'])) {
73
    $requete = 'select '.PROJET_CHAMPS_ID.' from '.PROJET_ANNUAIRE.' where '.PROJET_CHAMPS_MAIL.'="'.$_POST['mail_utilisateur'].'"';
74
    $resultat = $this->_db->query ($requete) ;
75
    if (DB::isError ($resultat)) {
76
        die ('Echec de la requete : '.$requete.'<br />'.$resultat->getMessage()) ;
77
    }
78
    if (!$resultat->numRows()) {
79
        $msg = PROJET_MAIL_ABSENT;
80
    } else {
81
        $ligne = $resultat->fetchRow(DB_FETCHMODE_ASSOC) ;
82
        // Le statut 2 est le statut participant
83
        $participants->setStatut(2, $ligne[PROJET_CHAMPS_ID], $this->_id_projet) ;
84
    }
85
}
86
 
87
if ($this->_auth->getAuth()) {
88
    $statut = participe::getStatutSurProjetCourant($this->_auth->getAuthData(PROJET_CHAMPS_ID),  $this->_id_projet, $this->_db) ;
89
    if ($statut == 2) $droits = PROJET_DROIT_CONTRIBUTEUR ;
90
    if ($statut == 1) $droits = PROJET_DROIT_COORDINATEUR ;
91
    if ($statut == 4) $droits = PROJET_DROIT_AUCUN ;
92
    if (participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) $droits = PROJET_DROIT_ADMINISTRATEUR  ;
93
    $HTML_listeParticipants = new HTML_listeParticipants(true) ;
94
    if ($droits <= PROJET_DROIT_COORDINATEUR) $HTML_listeParticipants->setModeModification() ;
95
    // Mise en place de l'url
96
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
97
    $HTML_listeParticipants->setURL($this->_url) ;
98
    // Construction de l'entete
99
    $entete = array (PROJET_NOM, PROJET_PRENOM) ;
100
 
101
 
102
    array_push ($entete, PROJET_MAIL) ;
103
 
104
    $info_utilisateur = $participants->getInscrits($this->_id_projet, $droits) ;
105
    array_push ($entete, PROJET_DATE_INSCRIPTION, PROJET_STATUT) ;
106
    $HTML_listeParticipants->construitEntete($entete) ;
107
 
108
    $HTML_listeParticipants->construitListe($info_utilisateur, statut::getTousLesStatuts(PROJET_STATUT_SAUF_ADM, $this->_db)) ;
109
 
110
    $res = $HTML_listeParticipants->toHTML() ;
111
 
112
    if ($droits <= PROJET_DROIT_COORDINATEUR || participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db)) {
113
        $res .= PROJET_NOUVEAU_UTILISATEUR_LAIUS ;
114
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'."\n" ;
115
        if (isset ($msg) && $msg != '') {
116
            $res .= '<div>'.$msg.'</div>' ;
117
        }
118
        $res .= '<input type="text" name="mail_utilisateur" size="32" />' ;
119
        $res .= '<input type="submit" value="'.PROJET_NOUVEAU_UTILISATEUR.'" />'."\n" ;
120
        $res .= '</form>'."\n" ;
121
    }
122
} else {
123
    $res .= '<p>'.PROJET_TEXTE_PARTICIPANT_NON_IDENTIFIE.'</p>'."\n" ;
124
}
125
$retour .= $titre.$res ;
126
 
127
 
128
?>