Subversion Repositories Applications.projet

Rev

Rev 444 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 444 Rev 447
1
<?php
1
<?php
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
2
/*vim: set expandtab tabstop=4 shiftwidth=4: */ 
3
// +------------------------------------------------------------------------------------------------------+
3
// +------------------------------------------------------------------------------------------------------+
4
// | PHP version 4.1                                                                                      |
4
// | PHP version 4.1                                                                                      |
5
// +------------------------------------------------------------------------------------------------------+
5
// +------------------------------------------------------------------------------------------------------+
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
6
// | Copyright (C) 2004 Tela Botanica (accueil@tela-botanica.org)                                         |
7
// +------------------------------------------------------------------------------------------------------+
7
// +------------------------------------------------------------------------------------------------------+
8
// | This library is free software; you can redistribute it and/or                                        |
8
// | This library is free software; you can redistribute it and/or                                        |
9
// | modify it under the terms of the GNU General Public                                                  |
9
// | modify it under the terms of the GNU General Public                                                  |
10
// | License as published by the Free Software Foundation; either                                         |
10
// | License as published by the Free Software Foundation; either                                         |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
11
// | version 2.1 of the License, or (at your option) any later version.                                   |
12
// |                                                                                                      |
12
// |                                                                                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
13
// | This library is distributed in the hope that it will be useful,                                      |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
14
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                                       |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
15
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU                                    |
16
// | General Public License for more details.                                                             |
16
// | General Public License for more details.                                                             |
17
// |                                                                                                      |
17
// |                                                                                                      |
18
// | You should have received a copy of the GNU General Public                                            |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
22
/**
22
/**
23
* Application projet
23
* Application projet
24
*
24
*
25
* Action description
25
* Action description
26
*
26
*
27
*@package projet
27
*@package projet
28
//Auteur original :
28
//Auteur original :
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
29
*@author        Alexandre Granier <alexandre@tela-botanica.org>
30
//Autres auteurs :
30
//Autres auteurs :
31
*@author        Aucun
31
*@author        Aucun
32
*@copyright     Tela-Botanica 2000-2005
32
*@copyright     Tela-Botanica 2000-2005
33
// +------------------------------------------------------------------------------------------------------+
33
// +------------------------------------------------------------------------------------------------------+
34
*/
34
*/
35
 
35
 
36
// +------------------------------------------------------------------------------------------------------+
36
// +------------------------------------------------------------------------------------------------------+
37
// |                                            ENTETE du PROGRAMME                                       |
37
// |                                            ENTETE du PROGRAMME                                       |
38
// +------------------------------------------------------------------------------------------------------+
38
// +------------------------------------------------------------------------------------------------------+
39
 
39
 
40
// RAPPEL IMPORTANT
40
// RAPPEL IMPORTANT
41
// On se situe dans la methode run() de la classe projetControleur
41
// On se situe dans la methode run() de la classe projetControleur
42
//
42
//
43
 
43
 
44
// creation de l'objet projet courant
44
// creation de l'objet projet courant
45
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
45
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
46
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
46
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
47
$projet = new projet ($this->_db, $this->_id_projet) ;
47
$projet = new projet ($this->_db, $this->_id_projet) ;
-
 
48
 
-
 
49
$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
48
 
50
 
49
// modification meta OpenGraph pour un titre plus sympatoche
51
// modification meta OpenGraph pour un titre plus sympatoche
50
GEN_modifierMetaProperty('og:title', 'Projet : ' . $projet->getTitre());
52
GEN_modifierMetaProperty('og:title', 'Projet : ' . $projet->getTitre());
51
 
53
 
52
if ($this->_auth->getAuth()) {
54
if ($this->_auth->getAuth()) {
53
	$loggue = true;
55
	$loggue = true;
54
	$droits = PROJET_DROIT_AUCUN;
56
	$droits = PROJET_DROIT_AUCUN;
55
    $participant = new participe($this->_db) ;
57
    $participant = new participe($this->_db) ;
56
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
58
    $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
57
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
59
    $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
58
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
60
    $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
59
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
61
    if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
60
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
62
    if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
61
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
63
    $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
62
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
64
    if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
63
    if ($isAdm) $isCoord = true ;
65
    if ($isAdm) $isCoord = true ;
64
 
66
 
65
            
67
            
66
    switch ($participant->getStatut($id_u, $this->_id_projet))
68
    switch ($participant->getStatut($id_u, $this->_id_projet))
67
    {
69
    {
68
    	case PROJET_DROIT_AUCUN : 
70
    	case PROJET_DROIT_AUCUN : 
69
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
71
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
70
    		$lien_inscription = $this->_url->getURL();
72
    		$lien_inscription = $this->_url->getURL();
71
    		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
73
    		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
72
    		$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
-
 
73
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
74
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
74
    		$lien_inscription = $this->_url->getURL();
75
    		$lien_inscription = $this->_url->getURL(); 
75
    		$label_url_inscription = 'S\'inscrire &agrave; ce projet'; 
-
 
76
    		$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
76
    		$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
77
    <a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
77
			<a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
78
  </div>';
78
  </div>';
79
    	break;
79
    	break;
80
    	case PROJET_DROIT_CONTRIBUTEUR : 
80
    	case PROJET_DROIT_CONTRIBUTEUR : 
81
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
81
    		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
82
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
82
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
83
			
83
			
84
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
84
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
85
			$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
85
			$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se d&eacute;sinscrire du projet', 'cross');
86
			
86
			
87
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
87
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
88
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
88
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
89
    	break;
89
    	break;
90
    	case PROJET_DROIT_COORDINATEUR : 
90
    	case PROJET_DROIT_COORDINATEUR : 
91
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
91
    		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
92
			$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
92
			$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
93
			
93
			
94
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
94
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
95
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
95
			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'D&eacute;poser un document', 'document');
96
			
96
			
97
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
97
			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
98
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
98
            $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
99
			
99
			
100
    		
100
    		
101
    	break;
101
    	break;
102
    	case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
102
    	case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
103
    		GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
103
    		GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
104
			GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
104
			GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
105
				'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
105
				'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
106
				'element = $(\'projet_lien_login\');'."\n".
106
				'element = $(\'projet_lien_login\');'."\n".
107
				'element.addEvent(
107
				'element.addEvent(
108
					\'click\', function() {
108
					\'click\', function() {
109
						fx.start({
109
						fx.start({
110
							\'height\' : \'320px\'
110
							\'height\' : \'320px\'
111
						})
111
						})
112
					}
112
					}
113
				)});');
113
				)});');
114
			$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
114
			$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
115
			$lien_login = '#';
115
			$lien_login = '#';
116
    	break;
116
    	break;
117
    }
117
    }
118
    
118
    
119
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
119
    $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
120
    // si participant, on ajoute le champs visibilite
120
    // si participant, on ajoute le champs visibilite
121
    
121
    
122
    if ($statut !='' || $isAdm) {
122
    if ($statut !='' || $isAdm) {
123
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
123
        array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
124
        $visible = true ;
124
        $visible = true ;
125
    } else {
125
    } else {
126
 	   $visible = false ;
126
 	   $visible = false ;
127
    }
127
    }
128
	// recuperation de la liste des documents associes
128
	// recuperation de la liste des documents associes
129
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
129
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
130
						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
130
						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
131
 
131
 
132
    
132
    
133
    // si chef de projet ou si proprietaire d'au moins 1 document
133
    // si chef de projet ou si proprietaire d'au moins 1 document
134
    $proprietaire_un_document = false ;
134
    $proprietaire_un_document = false ;
135
 
135
 
136
    foreach ($liste_documents as $document) {
136
    foreach ($liste_documents as $document) {
137
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
137
        if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
138
            $proprietaire_un_document = true ;
138
            $proprietaire_un_document = true ;
139
            $droits = PROJET_DROIT_PROPRIETAIRE ;
139
            $droits = PROJET_DROIT_PROPRIETAIRE ;
140
        }
140
        }
141
    }
141
    }
142
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
142
    if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
143
        array_push ($entete_liste, PROJET_ACTION) ;
143
        array_push ($entete_liste, PROJET_ACTION) ;
144
    }
144
    }
145
} else {
145
} else {
146
    $droits = PROJET_DROIT_AUCUN ;
146
    $droits = PROJET_DROIT_AUCUN ;
147
    // recuperation de la liste des documents associes
147
    // recuperation de la liste des documents associes
148
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
148
	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER, 
149
						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
149
						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
150
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
150
	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
151
	$label_url_inscription = 'S\'inscrire &agrave; ce projet';
-
 
152
	
151
	
153
	GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
152
	GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
154
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
153
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
155
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
154
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
156
			'animatedcollapse.init();' ."\n");
155
			'animatedcollapse.init();' ."\n");
157
	$lien_login = '#';    
156
	$lien_login = '#';    
158
}
157
}
159
 
158
 
160
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;
159
$GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;
161
 
160
 
162
ob_start();
161
ob_start();
163
include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
162
include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
164
$retour .= ob_get_contents();
163
$retour .= ob_get_contents();
165
ob_end_clean();
164
ob_end_clean();
166
/* +--Fin du code ----------------------------------------------------------------------------------------+
165
/* +--Fin du code ----------------------------------------------------------------------------------------+
167
*
166
*
168
 
167
 
169
*
168
*
170
* +-- Fin du code ----------------------------------------------------------------------------------------+
169
* +-- Fin du code ----------------------------------------------------------------------------------------+
171
*/
170
*/
172
?>
171
?>