Subversion Repositories Applications.projet

Rev

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