Subversion Repositories Applications.projet

Rev

Rev 41 | Rev 69 | 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
// +------------------------------------------------------------------------------------------------------+
46 ddelon 22
// CVS : $Id: forums.php,v 1.6 2005-10-20 10:28:25 ddelon 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
46 ddelon 34
*@version       $Revision: 1.6 $
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 = '' ;
46 ddelon 54
$inscription_laius ='' ;
2 ddelon 55
if ($projet->avoirListe()) {
56
    foreach ($projet->_listes_associes as $info_liste) {
57
        ob_start() ;
58
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
59
        if ($this->_auth->getAuth()) {
60
            $participant = new participe($this->_db) ;
61
 
62
            $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
63
            if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
64
            $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
65
            if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
66
            if ($isAdm) $isCoord = true ;
67
        } else {
68
            $droits = PROJET_DROIT_AUCUN;
69
        }
70
 
33 alexandre_ 71
        // gestion de l'inscription désinscription à la liste
41 alexandre_ 72
        // TODO : la gestion de linscription au résumé
33 alexandre_ 73
        $inscription_liste = new inscription_liste($this->_db) ;
74
        $statut = $inscription_liste->getStatutInscrit( $info_liste->getId(),  $this->_auth ) ;
41 alexandre_ 75
        if ($this->_auth->getAuth()) {
76
	        if ($statut == 2) {
77
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_INSCRIPTION_LISTE);
78
	        	$inscription_laius ='<h2>'.PROJET_VOUS_ETES_INSCRIT.'</h2>'."\n" ;
79
	        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE_LISTE.'</a>'."\n" ;
80
	        } else {
81
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_LISTE);
82
	        	$inscription_laius ='<h2>'.PROJET_VOUS_N_ETES_PAS_INSCRIT.'</h2>'."\n" ;
83
	        	$inscription_laius .= '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>'."\n" ;
84
	        }
33 alexandre_ 85
        }
86
 
2 ddelon 87
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
88
            $liste = new ezmlm_php() ;
89
            // Paramétrage de la liste
90
 
91
            $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
92
            $liste->listname = $info_liste->getNom() ;
93
            $liste->listdomain = $info_liste->getDomaine();
94
 
95
            if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
96
                $liste->set_action($GLOBALS['action']) ;
97
                $liste->set_actionargs($GLOBALS['actionargs']) ;
98
            } else {
99
                $liste->set_action('list_info') ;
100
            }
101
            $liste->sendheaders	= false;
102
            $liste->sendbody        = false;
103
            $liste->sendfooters    = false;
104
            $liste->forcehref = $this->_url->getURL() ;
105
 
106
 
107
            print '<a href="mailto:'.$info_liste->getAdresseEnvoi().'">' . $info_liste->getAdresseEnvoi() ;
108
            print "</a><br />\n";
39 alexandre_ 109
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL);
110
            print '<a href="'.$this->_url->getURL().'">'.PROJET_ECRIRE_LISTE.'</a><br />';
2 ddelon 111
 
112
            print '<h2>'.PROJET_TOUS_LES_MESSAGES.'</h2>'."\n";
113
            $info = new ezmlm_threads();
114
            if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
115
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
116
            $info->forcehref = $this->_url->getURL();
117
            $info->listdir = $liste->listdir ;
118
            $info->listname = $info_liste->getNom();
119
            $info->listdomain = $info_liste->getDomaine() ;
120
            if (!$info->listmessages()) {
121
                if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
122
            }
123
 
124
            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
125
 
126
            // On teste si l'on vient d'une réponse à un email, si oui
127
            // on modifie $liste->action pour renvoyer le message auquelon vient de répondre
128
            if (isset($_POST['messageid'])) {
129
                $liste->action = 'show_msg' ;
130
            }
131
            switch ($liste->action) {
132
                case "show_msg":
133
                    if (count($liste->actionargs) < 2) {
134
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
135
                    }
136
                    $show_msg = new ezmlm_msgdisplay();
137
                    $show_msg->listdir = $liste->listdir ;
138
                    $show_msg->forcehref = $this->_url->getURL();
139
                    $show_msg->listname = $info_liste->getNom() ;
140
                    $show_msg->_auth = & $this->_auth ;
141
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
142
                    // On appelle la fonction qui affiche un fichier
143
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
144
                    $show_msg->display($liste->actionargs[0] . "/" . $liste->actionargs[1]);
145
                    break;
146
 
147
                case "list_info":
148
                    $info = new ezmlm_listinfo();
149
 
150
                    if (!$info) print 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
151
                    $info->forcehref = $this->_url->getURL();
152
                    $info->listdir = $liste->listdir ;
153
                    $info->listname = $info_liste->getNom();
154
                    $info->listdomain = $info_liste->getDomaine() ;
155
                    print'<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
156
                    if (!$info->show_recentmsgs()) {
157
                        echo 'Pas de message dans cette liste' ;
158
                    }
159
                    break;
160
                case "show_threads":
161
                    $threads = new ezmlm_threads();
162
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
163
                    $threads->forcehref = $this->_url->getURL() ;
164
                    $threads->listdir = $liste->listdir ;
165
                    $threads->listname = $info_liste->getNom() ;
166
                    $threads->listdomain = $info_liste->getDomaine() ;
167
                    $threads->tempdir = PROJET_CHEMIN_APPLI.'/tmp' ;
168
                    $threads->load($liste->actionargs[0]);
169
                    break;
170
                case "show_author_msgs" :
171
                    $author = new ezmlm_author();
172
                    $author->listdir = $liste->listdir ;
173
                    $author->listname = $info_liste->getNom() ;
174
                    $author->listdomain = $info_liste->getDomaine() ;
175
                    $author->forcehref = $this->_url->getURL() ;
176
                    $author->display($liste->actionargs[0]);
177
                    break;
178
                break ;
179
                case 'show_month' :
180
                    $info = new ezmlm_listinfo();
181
                    if (!$info) return 'Les fichiers de la liste ne sont pas visible sur le serveur' ;
182
                    $info->forcehref = $this->_url->getURL();
183
                    $info->listdir = $liste->listdir ;
184
                    $info->listname = $info_liste->getNom();
185
                    $info->listdomain = $info_liste->getDomaine() ;
186
                    echo '[ '.$info->makelink('action=show_threads&amp;actionargs[]='.$liste->actionargs[0], 'par fil de discussion').' ]' ;
46 ddelon 187
               //     print'<h2>'.PROJET_MESSAGE_DU_MOIS.$GLOBALS['mois'][((int)substr($liste->actionargs[0],4,2) / 1)-1] .', ' .
2 ddelon 188
                                                                substr($liste->actionargs[0],0,4). '</h2>'."\n" ;
189
                    if (!$info->show_month($liste->actionargs[0])) {
190
                        echo 'Pas de message dans cette liste' ;
191
                    }
192
                break;
193
                case 'repondre' :
194
                    if (count($liste->actionargs) < 2) {
195
                        $liste->error(EZMLM_INVALID_SYNTAX,TRUE);
196
                    }
197
                    $repondre = new ezmlm_repondre();
198
                    $repondre->listdir = $liste->listdir ;
199
                    $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
200
                    $repondre->forcehref = $this->_url->getURL();
201
                    $repondre->listname = $info_liste->getNom() ;
202
                    // actionargs[0] contient le nom du répertoire et actionargs[1] le nom du fichier
203
                    // On appelle la fonction qui affiche un fichier
204
                    print'<h2>'.PROJET_REDIGER_REPONSE.'</h2>'."\n" ;
205
                    $repondre->repondre($liste->actionargs[0] . "/" . $liste->actionargs[1]);
206
                    break;
207
            }
208
 
209
        } else {
210
            print PROJET_MESSAGE_LISTE_PRIVEE ;
211
        }
212
        $sortie_liste = ob_get_contents() ;
213
        ob_end_clean() ;
214
    }
215
}
216
 
217
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
218
$listes_ext = new liste_externe ($this->_db) ;
219
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
220
 
221
if (count ($tableau_liste) != 0) {
222
    //$liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
223
    for ($i = 0; $i < count ($tableau_liste); $i++) {
224
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
225
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
226
        $liste_ext_res .= '<br />'."\n" ;
227
    }
228
}
229
 
230
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
33 alexandre_ 231
$retour .= $inscription_laius ;
2 ddelon 232
$retour .= '<h2>'.PROJET_ADRESSE_ECRIRE.'</h2>'."\n" ;
33 alexandre_ 233
 
2 ddelon 234
$retour .= $sortie_liste ;
235
$retour .= $liste_ext_res ;
236
?>