Subversion Repositories Applications.projet

Rev

Rev 97 | Rev 130 | 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
// +------------------------------------------------------------------------------------------------------+
113 alexandre_ 22
// CVS : $Id: resume.php,v 1.8 2006-06-16 14:18:03 alexandre_tb Exp $
2 ddelon 23
/**
24
* Application projet
25
*
26
* Action resume
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
113 alexandre_ 34
*@version       $Revision: 1.8 $
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
 
46
 
47
// création de l'objet projet courant
48
$projet = new projet ($this->_db, $this->_id_projet) ;
49
 
50
// récupération de la liste des documents associés
97 alexandre_ 51
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
52
						PROJET_CHEMIN_ICONES, $this->_id_projet) ;
2 ddelon 53
 
54
// création de la vue liste de document, on nettoie l'url
55
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
56
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
113 alexandre_ 57
include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
2 ddelon 58
$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;
59
 
60
// réglage de paramètres de la vue
61
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
62
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
63
 
64
 
65
// vérification des droits de l'utilisateur
66
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
67
 
68
if ($this->_auth->getAuth()) {
69
    $participant = new participe($this->_db) ;
70
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
71
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
72
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
73
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
74
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
75
    if ($isAdm) $isCoord = true ;
76
 
77
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
78
    // si participant, on ajoute le champs visibilite
79
 
80
    if ($statut !='' || $isAdm) {
81
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
97 alexandre_ 82
        $visible = true ;
83
    } else {
84
 	   $visible = false ;
2 ddelon 85
    }
97 alexandre_ 86
	// récupération de la liste des documents associés
87
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
88
						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
89
 
90
 
2 ddelon 91
    // si chef de projet ou si propriétaire d'au moins 1 document
92
    $proprietaire_un_document = false ;
93
 
94
    foreach ($liste_documents as $document) {
95
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
96
            $proprietaire_un_document = true ;
97
            $droits = PROJET_DROIT_PROPRIETAIRE ;
98
        }
99
    }
100
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
101
        array_push ($entete_liste, PROJET_ACTION) ;
102
    }
103
} else {
104
    $droits = PROJET_DROIT_AUCUN ;
97 alexandre_ 105
    // récupération de la liste des documents associés
106
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
107
						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
108
 
2 ddelon 109
}
110
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
111
 
112
$vue_liste_document->construitEntete($entete_liste) ;
113
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;
114
 
115
$wiki_res = '' ;
116
// Les wikinis associés au projet
117
if ($projet->getWikini()) {
49 ddelon 118
	$url = $GLOBALS['_GEN_commun']['url'] ;
119
 
70 alexandre_ 120
	$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
121
	$link=$this->_url->getURL();
81 alexandre_ 122
 
88 alexandre_ 123
    $wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$projet->getWikini().')' ;
2 ddelon 124
    $wiki_res .= '</div>' ;
125
} else {
126
    $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
127
}
128
// On charge les listes de discussion du projet
129
// Pour le moment seul ezmlm est supportée
130
 
131
$projet->getListesAssociees();
132
$sortie_liste = '' ;
133
 
134
$liste_ext_res = '' ;
135
if ($projet->avoirListe()) {
136
    ob_start() ;
137
    foreach ($projet->_listes_associes as $info_liste) {
138
        $liste = new ezmlm_php() ;
139
        // Paramétrage de la liste
140
 
141
        $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
142
 
143
        $liste->listname = $info_liste->getNom() ;
144
        $liste->listdomain = $info_liste->getDomaine();
145
 
146
        if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
147
            $liste->set_action($GLOBALS['action']) ;
148
            $liste->set_actionargs($GLOBALS['actionargs']) ;
149
        } else {
150
            $liste->set_action('list_info') ;
151
        }
152
        $liste->sendheaders	= false;
153
        $liste->sendbody        = false;
154
        $liste->sendfooters    = false;
155
        $liste->forcehref = $this->_url->getURL() ;
156
 
157
 
158
 
159
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
160
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
161
            switch ($liste->action) {
162
                case "list_info":
113 alexandre_ 163
                    $this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
164
        		    $xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
165
            									$info_liste->getNom(), $GLOBALS['lang'],
166
            									$this->_url->getURL()) ;
167
 
168
                    $xml_parser->reset() ;
169
					$xml_parser->setAction ('derniers_messages');
170
                    $xml_parser->load();
171
                    ob_start ();
172
                    $xml_parser->parse() ;
173
                    $derniers_messages = ob_get_contents() ;
174
                    ob_end_clean();
175
                    echo $derniers_messages ;
2 ddelon 176
                    break;
177
            }
178
        } else {
179
            print PROJET_MESSAGE_LISTE_PRIVEE;
180
        }
181
            $sortie_liste = ob_get_contents() ;
182
            ob_end_clean() ;
183
    }
184
}
185
 
186
// Site internet associé
187
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
188
if ($projet->getEspaceInternet() != '') {
189
    $sortie_web .= '<a href="'.$projet->getEspaceInternet().'" target="_blank">'.$projet->getEspaceInternet().'</a>'."\n" ;
190
} else {
191
    $sortie_web .= PROJET_PAS_DE_SITE ;
192
}
193
 
194
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
195
$listes_ext = new liste_externe ($this->_db) ;
196
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
197
 
198
if (count ($tableau_liste) != 0) {
199
    $liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
200
    for ($i = 0; $i < count ($tableau_liste); $i++) {
201
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
202
        //$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
203
        //$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
204
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
205
        //$liste_ext_res .= '<br />'."\n" ;
206
    }
207
}
208
 
209
$retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
210
$retour .= '<h2>'.PROJET_RESUME.'</h2>'."\n" ;
211
$retour .= '<div>'.$projet->getResume().'</div>'."\n" ;
212
$retour .= '<h2>'.PROJET_WIKI_ASSOCIE.'</h2>' ;
213
$retour .= $wiki_res ;
214
$retour .= $sortie_web ;
215
$retour .= '<h2>'.PROJET_DERNIERS_MESSAGES.'</h2>'."\n" ;
216
$retour .= $liste_ext_res.$sortie_liste ;
217
$retour .= '<h2>'.PROJET_FICHIERS_RECENTS.'</h2>'."\n" ;
218
$retour .= $vue_liste_document->toHTML() ;
219
//$retour .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
220
//$retour .= $sortie_liste ;
221
 
222
 
223
?>