Subversion Repositories Applications.projet

Rev

Rev 444 | Go to most recent revision | 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
    		$lien_inscription = $this->_url->getURL();
117
    		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
118
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
119
    		$lien_inscription = $this->_url->getURL();
120
 
121
    	break;
122
    	case PROJET_DROIT_CONTRIBUTEUR :
123
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
124
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
125
			$bouton_deposer_doc .= '<br style="clear:both" />';
126
 
127
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
128
			$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
129
			$bouton_desinscription_projet .= '<br style="clear:both" />';
130
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
131
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
132
    	break;
133
    	case PROJET_DROIT_COORDINATEUR || PROJET_DROIT_ADMINISTRATEUR :
134
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
135
			$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
136
			$bouton_resume .= '<br style="clear:both" />';
137
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
138
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
139
			$bouton_deposer_doc .= '<br style="clear:both" />';
140
 
141
			if ($projet->avoirListe()) {
142
				$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
143
            	$bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
144
 
145
			}
146
 
147
    	break;
148
    	case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
149
    		GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
150
			GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
151
				'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
152
				'element = $(\'projet_lien_login\');'."\n".
153
				'element.addEvent(
154
					\'click\', function() {
155
						fx.start({
156
							\'height\' : \'320px\'
157
						})
158
					}
159
				)});');
160
			$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
161
			$lien_login = '#';
162
    	break;
163
    }
164
    $bouton_poster .= '<br style="clear:both" />';
165
 
166
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
167
    // si participant, on ajoute le champs visibilite
168
 
169
    if ($statut !='' || $isAdm) {
170
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
171
        $visible = true ;
172
    } else {
173
 	   $visible = false ;
174
    }
175
	// recuperation de la liste des documents associes
176
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
177
						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
178
 
179
 
180
    // si chef de projet ou si proprietaire d'au moins 1 document
181
    $proprietaire_un_document = false ;
182
 
183
    foreach ($liste_documents as $document) {
184
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
185
            $proprietaire_un_document = true ;
186
            $droits = PROJET_DROIT_PROPRIETAIRE ;
187
        }
188
    }
189
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
190
        array_push ($entete_liste, PROJET_ACTION) ;
191
    }
192
} else {
193
    $droits = PROJET_DROIT_AUCUN ;
194
    // recuperation de la liste des documents associes
195
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
196
						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
197
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
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 = '#';
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 = '' ;
211
// Les wikinis associes au projet
212
if ($wiki = $projet->getWikini()) {
444 mathias 213
	if (strpos($wiki, "http://www.tela-botanica.org/wikini/") === 0) {// Si le wiki, ne peut pas �tre int�gr�
431 mathias 214
		$wiki_res .= '<div style="line-height: 2em;">'.sprintf(PROJET_WIKINI_PAS_REDIR, $wiki).'</div>'."\n";
215
	} else {
216
		$url = $GLOBALS['_GEN_commun']['url'] ;
217
		$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
218
		$link = $this->_url->getURL();
219
		$wiki_res .= '<div><a href="'.$link.'">'.PROJET_ALLER_SUR_WIKINI.'</a> ('.$wiki.')</div>';
220
	}
221
} else {
222
	$wiki_res .= '<div>'.PROJET_WIKINI_PAS.'</div>'."\n";
223
}
224
// On charge les listes de discussion du projet
225
// Pour le moment seul ezmlm est supportee
226
 
227
$projet->getListesAssociees();
228
$sortie_liste = '' ;
229
 
230
 
231
$liste_ext_res = '' ;
232
if ($projet->avoirListe()) {
233
    ob_start() ;
234
    include_once PROJET_CHEMIN_CLASSES_LISTES.'ezmlm.php' ;
235
    foreach ($projet->_listes_associes as $info_liste) {
236
        $liste = new ezmlm_php() ;
237
        // Param�trage de la liste
238
 
239
        $liste->listdir = PROJET_CHEMIN_LISTES.$info_liste->getDomaine().'/'.$info_liste->getNom();
240
 
241
        $liste->listname = $info_liste->getNom() ;
242
        $liste->listdomain = $info_liste->getDomaine();
243
 
244
        if (isset ($GLOBALS['action']) && $GLOBALS['action'] != '') {
245
            $liste->set_action($GLOBALS['action']) ;
246
            $liste->set_actionargs($GLOBALS['actionargs']) ;
247
        } else {
248
            $liste->set_action('list_info') ;
249
        }
250
        $liste->sendheaders	= false;
251
        $liste->sendbody        = false;
252
        $liste->sendfooters    = false;
253
        $liste->forcehref = $this->_url->getURL() ;
254
 
255
 
256
 
257
        if ($info_liste->isPublic() || $droits <= PROJET_DROIT_CONTRIBUTEUR) {
258
            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
259
            switch ($liste->action) {
260
                case "list_info":
261
                    $this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
262
        		    $xml_parser = &new ezmlmAccessObject('calendrier_messages', $info_liste->getDomaine(),
263
            									$info_liste->getNom(), $GLOBALS['lang'],
264
            									$this->_url->getURL()) ;
265
 
266
                    $xml_parser->reset() ;
267
					$xml_parser->setAction ('derniers_messages');
268
                    $xml_parser->load();
269
                    ob_start ();
270
                    $xml_parser->parse() ;
271
                    $derniers_messages = ob_get_contents() ;
272
                    ob_end_clean();
273
                    echo $derniers_messages ;
274
                    break;
275
            }
276
        } else {
277
            print PROJET_MESSAGE_LISTE_PRIVEE;
278
        }
279
            $sortie_liste = ob_get_contents() ;
280
            ob_end_clean() ;
281
    }
282
}
283
 
284
// Site internet associe
285
$sortie_web = '<h2>'.PROJET_ESPACE_INTERNET.'</h2>'."\n" ;
286
if ($projet->getEspaceInternet() != '') {
287
    $sortie_web .= '<a href="'.$projet->getEspaceInternet().'">'.$projet->getEspaceInternet().'</a>'."\n" ;
288
} else {
289
    $sortie_web .= PROJET_PAS_DE_SITE ;
290
}
291
 
292
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
293
$listes_ext = new liste_externe ($this->_db) ;
294
$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
295
 
296
if (count ($tableau_liste) != 0) {
297
    $liste_ext_res .= '<h2>'.PROJET_LISTES_ASSOCIEES.'</h2>'."\n" ;
298
    for ($i = 0; $i < count ($tableau_liste); $i++) {
299
        $info_liste = $listes_ext->getInfoListe($tableau_liste[$i]) ;
300
        //$liste_ext_res .= '<h2>'.$info_liste->AGO_A_NOMGRPLG.'</h2>'."\n" ;
301
        //$liste_ext_res .= '<p>'.$info_liste->AGO_A_RESUMLG.'</p>'."\n" ;
302
        $liste_ext_res .= '<p><a href="'.$info_liste->AGO_A_URLGRP.'" target="_blank">'.$info_liste->AGO_A_URLGRP.'</a></p>'."\n" ;
303
        //$liste_ext_res .= '<br />'."\n" ;
304
    }
305
    $avoir_liste_externe = true;
306
} else {
307
	$avoir_liste_externe = false;
308
}
309
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
310
 
311
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre();
312
ob_start();
313
include_once PROJET_CHEMIN_APPLI.'/squelettes/resume.tpl.html';
314
 
315
$retour .= ob_get_contents();
316
ob_end_clean();
317
/* +--Fin du code ----------------------------------------------------------------------------------------+
318
*
319
* $Log$
320
*
321
* +-- Fin du code ----------------------------------------------------------------------------------------+
322
*/
323
 
324
?>