Subversion Repositories Applications.projet

Rev

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

Rev Author Line No. Line
2 ddelon 1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
19
// | License along with this library; if not, write to the Free Software                                  |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
33 alexandre_ 22
// CVS : $Id: forums.php,v 1.3 2005-10-07 08:29:38 alexandre_tb Exp $
2 ddelon 23
/**
24
* Application projet
25
*
26
* Action forums
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
33 alexandre_ 34
*@version       $Revision: 1.3 $
2 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
33 alexandre_ 42
include_once (PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php') ;
43
include_once (PROJET_CHEMIN_CLASSES.'inscription_liste.class.php') ;
2 ddelon 44
// RAPPEL IMPORTANT
45
// On se situe dans la méthode run() de la classe projetControleur
46
//
47
 
48
 
49
// création de l'objet projet courant
50
$projet = new projet ($this->_db, $this->_id_projet) ;
51
 
52
$liste_ext_res = '' ;
53
$sortie_liste = '' ;
54
if ($projet->avoirListe()) {
55
    foreach ($projet->_listes_associes as $info_liste) {
56
        ob_start() ;
57
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
58
        if ($this->_auth->getAuth()) {
59
            $participant = new participe($this->_db) ;
60
 
61
            $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
62
            if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
63
            $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
64
            if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
65
            if ($isAdm) $isCoord = true ;
66
        } else {
67
            $droits = PROJET_DROIT_AUCUN;
68
        }
69
 
33 alexandre_ 70
        // gestion de l'inscription désinscription à la liste
71
        // TO DO : la gestion de linscription au résumé
72
        $inscription_liste = new inscription_liste($this->_db) ;
73
        $statut = $inscription_liste->getStatutInscrit( $info_liste->getId(),  $this->_auth ) ;
74
        if ($statut == 2) {
75
        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
76
        	$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
77
        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
78
        } else {
79
        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
80
        	$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
81
        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
82
        }
83
 
2 ddelon 84
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
85
            $liste = new ezmlm_php() ;
86
            // Paramétrage de la liste
87
 
88
            $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
89
            $liste->listname = $info_liste->getNom() ;
90
            $liste->listdomain = $info_liste->getDomaine();
91
 
92
            if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
93
                $liste->set_action($GLOBALS['action']) ;
94
                $liste->set_actionargs($GLOBALS['actionargs']) ;
95
            } else {
96
                $liste->set_action('list_info') ;
97
            }
98
            $liste->sendheaders	= false;
99
            $liste->sendbody        = false;
100
            $liste->sendfooters    = false;
101
            $liste->forcehref = $this->_url->getURL() ;
102
 
103
 
104
            print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;
105
            print "</a><br />\n";
106
 
107
            print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
108
            $info = new ezmlm_threads();
109
            if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
110
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
111
            $info->forcehref = $this->_url->getURL();
112
            $info->listdir = $liste->listdir ;
113
            $info->listname = $info_liste->getNom();
114
            $info->listdomain = $info_liste->getDomaine() ;
115
            if (!$info->listmessages()) {
116
                if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
117
            }
118
 
119
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
120
 
121
            // On teste si l'on vient d'une réponse à un email, si oui
122
            // on modifie $liste->action pour renvoyer le message auquelon vient de répondre
123
            if (isset($_POST['messageid'])) {
124
                $liste->action = 'show_msg' ;
125
            }
126
            switch ($liste->action) {
127
                case "show_msg":
128
                    if (count($liste->actionargs) < 2) {
129
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
130
                    }
131
                    $show_msg = new ezmlm_msgdisplay();
132
                    $show_msg->listdir = $liste->listdir ;
133
                    $show_msg->forcehref = $this->_url->getURL();
134
                    $show_msg->listname = $info_liste->getNom() ;
135
                    $show_msg->_auth = & $this->_auth ;
136
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
137
                    // On appelle la fonction qui affiche un fichier
138
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
139
                    $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
140
                    break;
141
 
142
                case "list_info":
143
                    $info = new ezmlm_listinfo();
144
 
145
                    if (!$info) print 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
146
                    $info->forcehref = $this->_url->getURL();
147
                    $info->listdir = $liste->listdir ;
148
                    $info->listname = $info_liste->getNom();
149
                    $info->listdomain = $info_liste->getDomaine() ;
150
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
151
                    if (!$info->show_recentmsgs()) {
152
                        echo 'Pas de message dans cette liste' ;
153
                    }
154
                    break;
155
                case "show_threads":
156
                    $threads = new ezmlm_threads();
157
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
158
                    $threads->forcehref = $this->_url->getURL() ;
159
                    $threads->listdir = $liste->listdir ;
160
                    $threads->listname = $info_liste->getNom() ;
161
                    $threads->listdomain = $info_liste->getDomaine() ;
162
                    $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
163
                    $threads->load($liste->actionargs[0]);
164
                    break;
165
                case "show_author_msgs" :
166
                    $author = new ezmlm_author();
167
                    $author->listdir = $liste->listdir ;
168
                    $author->listname = $info_liste->getNom() ;
169
                    $author->listdomain = $info_liste->getDomaine() ;
170
                    $author->forcehref = $this->_url->getURL() ;
171
                    $author->display($liste->actionargs[0]);
172
                    break;
173
                break ;
174
                case 'show_month' :
175
                    $info = new ezmlm_listinfo();
176
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
177
                    $info->forcehref = $this->_url->getURL();
178
                    $info->listdir = $liste->listdir ;
179
                    $info->listname = $info_liste->getNom();
180
                    $info->listdomain = $info_liste->getDomaine() ;
181
                    echo '[ '.$info->makelink('action=show_threads&amp;actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;
182
                    print'<h2>'.PROJET_MESSAGE_DU_MOIS.$GLOBALS['mois'][((int)substr($liste->actionargs[0],4,2) / 1)-1] .', ' .
183
                                                                substr($liste->actionargs[0],0,4). '</h2>'."\n" ;
184
                    if (!$info->show_month($liste->actionargs[0])) {
185
                        echo 'Pas de message dans cette liste' ;
186
                    }
187
                break;
188
                case 'repondre' :
189
                    if (count($liste->actionargs) < 2) {
190
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
191
                    }
192
                    $repondre = new ezmlm_repondre();
193
                    $repondre->listdir = $liste->listdir ;
194
                    $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
195
                    $repondre->forcehref = $this->_url->getURL();
196
                    $repondre->listname = $info_liste->getNom() ;
197
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
198
                    // On appelle la fonction qui affiche un fichier
199
                    print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
200
                    $repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
201
                    break;
202
            }
203
 
204
        } else {
205
            print PROJET_MESSAGE_LISTE_PRIVEE ;
206
        }
207
        $sortie_liste = ob_get_contents() ;
208
        ob_end_clean() ;
209
    }
210
}
211
 
212
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
213
$listes_ext = new liste_externe ($this->_db) ;
214
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
215
 
216
if (count ($tableau_liste) != 0) {
217
    //$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
218
    for ($i = 0; $i < count ($tableau_liste); $i++) {
219
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
220
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
221
        $liste_ext_res .= '<br />'."\n" ;
222
    }
223
}
224
 
225
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
33 alexandre_ 226
$retour .= $inscription_laius ;
2 ddelon 227
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
33 alexandre_ 228
 
2 ddelon 229
$retour .= $sortie_liste ;
230
$retour .= $liste_ext_res ;
231
?>