Subversion Repositories Applications.projet

Rev

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