Subversion Repositories Applications.projet

Rev

Rev 33 | Rev 41 | 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
// +------------------------------------------------------------------------------------------------------+
39 alexandre_ 22
// CVS : $Id: forums.php,v 1.4 2005-10-14 08:58:20 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
39 alexandre_ 34
*@version       $Revision: 1.4 $
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";
39 alexandre_ 106
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL);
107
            print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
2 ddelon 108
 
109
            print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
110
            $info = new ezmlm_threads();
111
            if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
112
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
113
            $info->forcehref = $this->_url->getURL();
114
            $info->listdir = $liste->listdir ;
115
            $info->listname = $info_liste->getNom();
116
            $info->listdomain = $info_liste->getDomaine() ;
117
            if (!$info->listmessages()) {
118
                if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
119
            }
120
 
121
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
122
 
123
            // On teste si l'on vient d'une réponse à un email, si oui
124
            // on modifie $liste->action pour renvoyer le message auquelon vient de répondre
125
            if (isset($_POST['messageid'])) {
126
                $liste->action = 'show_msg' ;
127
            }
128
            switch ($liste->action) {
129
                case "show_msg":
130
                    if (count($liste->actionargs) < 2) {
131
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
132
                    }
133
                    $show_msg = new ezmlm_msgdisplay();
134
                    $show_msg->listdir = $liste->listdir ;
135
                    $show_msg->forcehref = $this->_url->getURL();
136
                    $show_msg->listname = $info_liste->getNom() ;
137
                    $show_msg->_auth = & $this->_auth ;
138
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
139
                    // On appelle la fonction qui affiche un fichier
140
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
141
                    $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
142
                    break;
143
 
144
                case "list_info":
145
                    $info = new ezmlm_listinfo();
146
 
147
                    if (!$info) print 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
148
                    $info->forcehref = $this->_url->getURL();
149
                    $info->listdir = $liste->listdir ;
150
                    $info->listname = $info_liste->getNom();
151
                    $info->listdomain = $info_liste->getDomaine() ;
152
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
153
                    if (!$info->show_recentmsgs()) {
154
                        echo 'Pas de message dans cette liste' ;
155
                    }
156
                    break;
157
                case "show_threads":
158
                    $threads = new ezmlm_threads();
159
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
160
                    $threads->forcehref = $this->_url->getURL() ;
161
                    $threads->listdir = $liste->listdir ;
162
                    $threads->listname = $info_liste->getNom() ;
163
                    $threads->listdomain = $info_liste->getDomaine() ;
164
                    $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
165
                    $threads->load($liste->actionargs[0]);
166
                    break;
167
                case "show_author_msgs" :
168
                    $author = new ezmlm_author();
169
                    $author->listdir = $liste->listdir ;
170
                    $author->listname = $info_liste->getNom() ;
171
                    $author->listdomain = $info_liste->getDomaine() ;
172
                    $author->forcehref = $this->_url->getURL() ;
173
                    $author->display($liste->actionargs[0]);
174
                    break;
175
                break ;
176
                case 'show_month' :
177
                    $info = new ezmlm_listinfo();
178
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
179
                    $info->forcehref = $this->_url->getURL();
180
                    $info->listdir = $liste->listdir ;
181
                    $info->listname = $info_liste->getNom();
182
                    $info->listdomain = $info_liste->getDomaine() ;
183
                    echo '[ '.$info->makelink('action=show_threads&amp;actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;
184
                    print'<h2>'.PROJET_MESSAGE_DU_MOIS.$GLOBALS['mois'][((int)substr($liste->actionargs[0],4,2) / 1)-1] .', ' .
185
                                                                substr($liste->actionargs[0],0,4). '</h2>'."\n" ;
186
                    if (!$info->show_month($liste->actionargs[0])) {
187
                        echo 'Pas de message dans cette liste' ;
188
                    }
189
                break;
190
                case 'repondre' :
191
                    if (count($liste->actionargs) < 2) {
192
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
193
                    }
194
                    $repondre = new ezmlm_repondre();
195
                    $repondre->listdir = $liste->listdir ;
196
                    $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
197
                    $repondre->forcehref = $this->_url->getURL();
198
                    $repondre->listname = $info_liste->getNom() ;
199
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
200
                    // On appelle la fonction qui affiche un fichier
201
                    print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
202
                    $repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
203
                    break;
204
            }
205
 
206
        } else {
207
            print PROJET_MESSAGE_LISTE_PRIVEE ;
208
        }
209
        $sortie_liste = ob_get_contents() ;
210
        ob_end_clean() ;
211
    }
212
}
213
 
214
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
215
$listes_ext = new liste_externe ($this->_db) ;
216
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
217
 
218
if (count ($tableau_liste) != 0) {
219
    //$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
220
    for ($i = 0; $i < count ($tableau_liste); $i++) {
221
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
222
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
223
        $liste_ext_res .= '<br />'."\n" ;
224
    }
225
}
226
 
227
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
33 alexandre_ 228
$retour .= $inscription_laius ;
2 ddelon 229
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
33 alexandre_ 230
 
2 ddelon 231
$retour .= $sortie_liste ;
232
$retour .= $liste_ext_res ;
233
?>