Subversion Repositories Applications.projet

Rev

Rev 401 | Rev 428 | 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
// +------------------------------------------------------------------------------------------------------+
400 raphael 22
// CVS : $Id: resume.php,v 1.13 2007-08-28 10:33:50 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
400 raphael 34
*@version       $Revision: 1.13 $
2 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
// RAPPEL IMPORTANT
294 alexandre_ 43
// On se situe dans la methode run() de la classe projetControleur
2 ddelon 44
//
45
 
133 alexandre_ 46
$retour = '';
294 alexandre_ 47
$loggue = false;
2 ddelon 48
 
294 alexandre_ 49
// creation de l'objet projet courant
208 neiluj 50
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
51
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
2 ddelon 52
$projet = new projet ($this->_db, $this->_id_projet) ;
294 alexandre_ 53
 
2 ddelon 54
 
294 alexandre_ 55
/** Bloc resume avec lien resume */
56
$resume = $projet->getResume();
57
$bouton_resume = '';
58
$bouton_s_inscrire_au_projet = '';
59
 
60
 
61
$lien_inscription = '';
62
// recuperation de la liste des documents associes
97 alexandre_ 63
$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
64
						PROJET_CHEMIN_ICONES, $this->_id_projet) ;
2 ddelon 65
 
294 alexandre_ 66
// creation de la vue liste de document, on nettoie l'url
2 ddelon 67
//$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
68
include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;
113 alexandre_ 69
include_once (PROJET_CHEMIN_CLASSES.'ezmlmAccessObject.class.php') ;
2 ddelon 70
$vue_liste_document = new HTML_listeDocuments($this->_url, false, '', $this->_auth) ;
294 alexandre_ 71
$bouton_deposer_doc = '';
72
// reglage de parametres de la vue
2 ddelon 73
$vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
74
$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
75
 
294 alexandre_ 76
$bouton_poster = '';
77
$bouton_desinscription_projet = '';
2 ddelon 78
 
294 alexandre_ 79
// verification des droits de l'utilisateur
2 ddelon 80
$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
81
 
82
if ($this->_auth->getAuth()) {
294 alexandre_ 83
	$loggue = true;
130 alexandre_ 84
	$droits = PROJET_DROIT_AUCUN;
2 ddelon 85
    $participant = new participe($this->_db) ;
86
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
87
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
150 alexandre_ 88
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
89
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
2 ddelon 90
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
91
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
92
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
93
    if ($isAdm) $isCoord = true ;
94
 
400 raphael 95
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
96
$projet->getListesAssociees();
97
foreach ($projet->_listes_associes as $info_liste) {
98
    $inscription_liste = new inscription_liste($this->_db) ;
99
    if ($inscription_liste->getStatutInscrit($info_liste->getId(),  $this->_auth) == 0) {
100
        $action_inscription = PROJET_ACTION_INSCRIPTION_LISTE ;
101
        $label_inscription = 'S\'inscrire &agrave; la liste' ;
102
    } else {
103
        // L'action envoyer un mail
104
        $action_inscription = PROJET_ENVOYER_UN_MAIL ;
105
        $label_inscription = PROJET_ECRIRE_LISTE ;
106
    }
107
}
294 alexandre_ 108
 
109
    switch ($participant->getStatut($id_u, $this->_id_projet))
110
    {
111
    	case PROJET_DROIT_AUCUN :
112
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
113
    		$lien_inscription = $this->_url->getURL();
114
    		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
115
    		$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
116
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
117
    		$lien_inscription = $this->_url->getURL();
118
    		$label_url_inscription = 'S\'inscrire &agrave; ce projet';
119
 
120
    	break;
121
    	case PROJET_DROIT_CONTRIBUTEUR :
122
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
123
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
124
			$bouton_deposer_doc .= '<br style="clear:both" />';
125
 
126
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
127
			$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
128
			$bouton_desinscription_projet .= '<br style="clear:both" />';
129
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
130
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
131
    	break;
132
    	case PROJET_DROIT_COORDINATEUR || PROJET_DROIT_ADMINISTRATEUR :
133
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
134
			$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
135
			$bouton_resume .= '<br style="clear:both" />';
136
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
137
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
138
			$bouton_deposer_doc .= '<br style="clear:both" />';
139
 
140
			if ($projet->avoirListe()) {
141
				$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
142
            	$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
143
 
144
			}
145
 
146
    	break;
147
    	case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
148
    		GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
149
			GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
150
				'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
151
				'element = $(\'projet_lien_login\');'."\n".
152
				'element.addEvent(
153
					\'click\', function() {
154
						fx.start({
155
							\'height\' : \'320px\'
156
						})
157
					}
158
				)});');
159
			$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
160
			$lien_login = '#';
161
    	break;
162
    }
163
    $bouton_poster .= '<br style="clear:both" />';
164
 
2 ddelon 165
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
166
    // si participant, on ajoute le champs visibilite
167
 
168
    if ($statut !='' || $isAdm) {
169
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
97 alexandre_ 170
        $visible = true ;
171
    } else {
172
 	   $visible = false ;
2 ddelon 173
    }
294 alexandre_ 174
	// recuperation de la liste des documents associes
97 alexandre_ 175
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
176
						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
177
 
178
 
294 alexandre_ 179
    // si chef de projet ou si proprietaire d'au moins 1 document
2 ddelon 180
    $proprietaire_un_document = false ;
181
 
182
    foreach ($liste_documents as $document) {
183
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
184
            $proprietaire_un_document = true ;
185
            $droits = PROJET_DROIT_PROPRIETAIRE ;
186
        }
187
    }
188
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
189
        array_push ($entete_liste, PROJET_ACTION) ;
190
    }
191
} else {
192
    $droits = PROJET_DROIT_AUCUN ;
294 alexandre_ 193
    // recuperation de la liste des documents associes
97 alexandre_ 194
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
195
						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
294 alexandre_ 196
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
197
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
198
 
199
	GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
200
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
201
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
202
			'animatedcollapse.init();' ."\n");
203
	$lien_login = '#';
2 ddelon 204
}
205
if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
206
 
207
$vue_liste_document->construitEntete($entete_liste) ;
208
$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $this->_db) ;
209
 
210
$wiki_res = '' ;
294 alexandre_ 211
// Les wikinis associes au projet
2 ddelon 212
if ($projet->getWikini()) {
49 ddelon 213
	$url = $GLOBALS['_GEN_commun']['url'] ;
214
 
70 alexandre_ 215
	$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
216
	$link=$this->_url->getURL();
81 alexandre_ 217
 
88 alexandre_ 218
    $wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$projet->getWikini().')' ;
2 ddelon 219
    $wiki_res .= '</div>' ;
401 raphael 220
}
221
// ou, le cas échéant et si un espace internet existe déjà sur /wikini/
222
// celui-ci est proposé
223
elseif (strpos($projet->getEspaceInternet(), "http://www.tela-botanica.org/wikini/") === 0) {
403 raphael 224
    $wiki_res .= '<div><a href="'.$projet->getEspaceInternet().'">'.$projet->getEspaceInternet().'</a></div>'."\n";
401 raphael 225
}
226
else {
2 ddelon 227
    $wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n" ;
228
}
229
// On charge les listes de discussion du projet
294 alexandre_ 230
// Pour le moment seul ezmlm est supportee
2 ddelon 231
 
232
$projet->getListesAssociees();
233
$sortie_liste = '' ;
234
 
294 alexandre_ 235
 
2 ddelon 236
$liste_ext_res = '' ;
237
if ($projet->avoirListe()) {
238
    ob_start() ;
208 neiluj 239
    include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
2 ddelon 240
    foreach ($projet->_listes_associes as $info_liste) {
241
        $liste = new ezmlm_php() ;
400 raphael 242
        // Param�trage de la liste
2 ddelon 243
 
244
        $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
245
 
246
        $liste->listname = $info_liste->getNom() ;
247
        $liste->listdomain = $info_liste->getDomaine();
248
 
249
        if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
250
            $liste->set_action($GLOBALS['action']) ;
251
            $liste->set_actionargs($GLOBALS['actionargs']) ;
252
        } else {
253
            $liste->set_action('list_info') ;
254
        }
255
        $liste->sendheaders	= false;
256
        $liste->sendbody        = false;
257
        $liste->sendfooters    = false;
258
        $liste->forcehref = $this->_url->getURL() ;
259
 
260
 
261
 
262
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
263
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
264
            switch ($liste->action) {
265
                case "list_info":
113 alexandre_ 266
                    $this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
267
        		    $xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
268
            									$info_liste->getNom(), $GLOBALS['lang'],
269
            									$this->_url->getURL()) ;
270
 
271
                    $xml_parser->reset() ;
272
					$xml_parser->setAction ('derniers_messages');
273
                    $xml_parser->load();
274
                    ob_start ();
275
                    $xml_parser->parse() ;
276
                    $derniers_messages = ob_get_contents() ;
277
                    ob_end_clean();
278
                    echo $derniers_messages ;
2 ddelon 279
                    break;
280
            }
281
        } else {
282
            print PROJET_MESSAGE_LISTE_PRIVEE;
283
        }
284
            $sortie_liste = ob_get_contents() ;
285
            ob_end_clean() ;
286
    }
287
}
288
 
294 alexandre_ 289
// Site internet associe
2 ddelon 290
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
291
if ($projet->getEspaceInternet() != '') {
294 alexandre_ 292
    $sortie_web .= '<a href="'.$projet->getEspaceInternet().'">'.$projet->getEspaceInternet().'</a>'."\n" ;
2 ddelon 293
} else {
294
    $sortie_web .= PROJET_PAS_DE_SITE ;
295
}
296
 
297
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
298
$listes_ext = new liste_externe ($this->_db) ;
299
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
300
 
301
if (count ($tableau_liste) != 0) {
302
    $liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
303
    for ($i = 0; $i < count ($tableau_liste); $i++) {
304
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
400 raphael 305
        //$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
306
        //$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
2 ddelon 307
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
400 raphael 308
        //$liste_ext_res .= '<br />'."\n" ;
2 ddelon 309
    }
294 alexandre_ 310
    $avoir_liste_externe = true;
311
} else {
312
	$avoir_liste_externe = false;
2 ddelon 313
}
294 alexandre_ 314
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
2 ddelon 315
 
294 alexandre_ 316
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre();
317
ob_start();
318
include_once PROJET_CHEMIN_APPLI.'/squelettes/resume.tpl.html';
2 ddelon 319
 
294 alexandre_ 320
$retour .= ob_get_contents();
321
ob_end_clean();
322
/* +--Fin du code ----------------------------------------------------------------------------------------+
323
*
400 raphael 324
* $Log$
294 alexandre_ 325
*
326
* +-- Fin du code ----------------------------------------------------------------------------------------+
327
*/
2 ddelon 328
 
401 raphael 329
?>