Subversion Repositories Applications.projet

Rev

Rev 447 | Details | Compare with Previous | Last modification | View Log | RSS feed

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