Subversion Repositories Applications.papyrus

Rev

Rev 1087 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
448 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
// +------------------------------------------------------------------------------------------------------+
1309 alexandre_ 22
// CVS : $Id: projet.php,v 1.12.2.1 2007-04-11 14:26:34 alexandre_tb Exp $
448 ddelon 23
/**
24
* Application projet
25
*
26
* Fichier d'appel pour papyrus
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-2004
1309 alexandre_ 34
*@version       $Revision: 1.12.2.1 $
448 ddelon 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
include_once 'configuration/projet.config.inc.php' ;
43
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
44
 
45
// Inclusion des styles selon papyrus
46
if (function_exists("GEN_stockerStyleExterne")) {
893 alexandre_ 47
	if (file_exists('client/projet/projet.css')) GEN_stockerStyleExterne('projet','client/projet/projet.css') ;
48
    if (file_exists('client/projet/arbre.css')) GEN_stockerStyleExterne('projet_arbre','client/projet/arbre.css') ;
448 ddelon 49
}
50
 
51
// +------------------------------------------------------------------------------------------------------+
52
// |                                           LISTE des constantes                                       |
53
// +------------------------------------------------------------------------------------------------------+
54
 
55
define ("PROJET_DEFAUT", 1) ;
56
define ("PROJET_VOIR", 2) ;
57
define ('PROJET_MENU_AFFICHER_CONTENU_CORPS', 1) ;
58
// +------------------------------------------------------------------------------------------------------+
59
// |                                           LISTE de FONCTIONS                                         |
60
// +------------------------------------------------------------------------------------------------------+
61
 
62
if (isset($_REQUEST[PROJET_VARIABLE_ID_PROJET])) {
63
    function afficherContenuNavigation () {
64
        $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ID_PROJET, $_REQUEST[PROJET_VARIABLE_ID_PROJET]) ;
65
        if (empty($_REQUEST[PROJET_VARIABLE_ACTION])) {
66
            $_REQUEST[PROJET_VARIABLE_ACTION] = PROJET_ACTION_VOIR_RESUME ;
67
        }
68
        $res = '' ;
893 alexandre_ 69
        if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
448 ddelon 70
            $res .= '<ul class="onglets">';
71
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_RESUME);
832 florian 72
            $res .= '<li id="projet_resume" class="'.cma(PROJET_ACTION_VOIR_RESUME).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_SYNTHESE.'</a></li>';
448 ddelon 73
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DESCRIPTION);
832 florian 74
            $res .= '<li id="projet_description" class="'.cma(PROJET_ACTION_VOIR_DESCRIPTION).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_DESCRIPTION.'</a></li>';
448 ddelon 75
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_WIKINI);
832 florian 76
            $res .= '<li id="projet_wikini" class="'.cma(PROJET_ACTION_VOIR_WIKINI).'"><a href="'.$GLOBALS['url']->getURL().'">'.PROJET_WIKINI.'</a></li>';
448 ddelon 77
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_DOCUMENT) ;
832 florian 78
            $res .= '<li id="projet_documents" class="'.cma(PROJET_ACTION_VOIR_DOCUMENT).'"><a href="'.$GLOBALS['url']->getURL().'">Documents</a></li>';
448 ddelon 79
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_FORUM) ;
832 florian 80
            $res .= '<li id="projet_forum" class="'.cma(PROJET_ACTION_VOIR_FORUM).'"><a href="'.$GLOBALS['url']->getURL().'">Forum</a></li>';
448 ddelon 81
            $GLOBALS['url']->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
832 florian 82
            $res .= '<li id="projet_participants" class="'.cma(PROJET_ACTION_VOIR_PARTICIPANT).'"><a href="'.$GLOBALS['url']->getURL().'">Participants</a></li>';
448 ddelon 83
            $res .= '</ul>';
84
            $GLOBALS['url']->removeQueryString (PROJET_VARIABLE_ACTION) ;
85
        }
504 alexandre_ 86
        if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
552 alexandre_ 87
        	$res = '' ;
504 alexandre_ 88
    	}
448 ddelon 89
        return $res ;
90
    }
91
}
92
 
93
function afficherContenuMenu()
94
{
95
    $sortie  = '';
96
    // on fait de même pour id_projet
97
    $id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] :  '';
98
 
99
       // On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
100
    $action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
101
 
102
    // et pour id_repertoire
103
    $id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
104
 
105
    $controleur = new projetControleur($GLOBALS['projet_db'], $GLOBALS['projet_auth'], $GLOBALS['url']) ;
106
 
1309 alexandre_ 107
    include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
448 ddelon 108
    if ($id_projet != '' && projet::projetExiste($GLOBALS['projet_db'], $id_projet)) {
109
        $controleur->setIdProjet($id_projet) ;
110
    }
111
    if ($id_repertoire != "") {
112
        $controleur->setIdRepertoire($id_repertoire) ;
113
    }
571 alexandre_ 114
    if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
115
        $controleur->setPrive() ;
116
    }
448 ddelon 117
 
118
    // Dans le cas de la présentation par arbre, on met les menus
893 alexandre_ 119
    if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)){
629 alexandre_ 120
 
448 ddelon 121
        $sortie .= $controleur->menuGeneral() ;
122
    }
629 alexandre_ 123
   	if (isset($GLOBALS['_GEN_commun']['info_application']->seulement)) {
124
		$controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
125
	}
126
	if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
127
		// L'action "Mettre un fichier en ligne"
128
        $controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
129
        $res = "<ul><li><a href=\"".$controleur->_url->getURL()."\">".PROJET_METTRE_FICHIER."</a></li>\n" ;
130
 
131
        // L'action créer un répertoire
132
        $controleur->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
133
        $res .= "<li><a href=\"".$controleur->_url->getURL()."\">".PROJET_CREER_REP."</a></li>\n" ;
134
		$res .= '</ul></li>' ;
135
		$sortie .= $res ;
136
	}
514 alexandre_ 137
    // Dans le cas d'un forum simple, on ne met pas les menus
138
    if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
139
        	return ;
140
    }
448 ddelon 141
    return $sortie;
142
}
143
 
144
function afficherContenuCorps() {
145
 
473 alexandre_ 146
 
448 ddelon 147
    // On recherche une action dans la variable $action, s'il n'y a pas, on envoie defaut
148
    $action = isset($_REQUEST[PROJET_VARIABLE_ACTION]) ? $_REQUEST[PROJET_VARIABLE_ACTION] : PROJET_DEFAUT;
149
 
150
    // on fait de même pour id_projet
151
    $id_projet = isset($_REQUEST[PROJET_VARIABLE_ID_PROJET]) ? $_REQUEST[PROJET_VARIABLE_ID_PROJET] : '';
152
 
153
    // et pour id_repertoire
154
    $id_repertoire = isset($_REQUEST['id_repertoire']) ? $_REQUEST['id_repertoire'] : '';
155
 
156
    // et pour id_document
157
    $id_document = isset($_REQUEST['id_document']) ? $_REQUEST['id_document'] : '';
158
 
159
    // On construit le controleur en lui passant en paramètre l'identifiant de connexion à la BD
160
    // l'objet d'authentification et l'url de la page
161
 
162
    $controleur = new projetControleur(&$GLOBALS['projet_db'], &$GLOBALS['projet_auth'], &$GLOBALS['url']) ;
163
    $controleur->setAction ($action) ;
164
 
165
    // On indique au controleur sur quel projet on travaille
166
 
167
    if ($id_projet != "") {
168
        $controleur->setIdProjet($id_projet) ;
169
 
170
    }
171
    if ($id_repertoire != "") {
172
        $controleur->setIdRepertoire($id_repertoire) ;
173
    }
174
    if ($id_document != "") {
175
        $controleur->setIdDocument($id_document) ;
176
    }
177
 
178
    // récupération des paramètres de l'appli
179
    if (isset($GLOBALS['_GEN_commun']['info_application']->presentation)) {
180
        $controleur->setPresentation($GLOBALS['_GEN_commun']['info_application']->presentation) ;
181
    }
473 alexandre_ 182
    if (isset($GLOBALS['_GEN_commun']['info_application']->projet_type)) {
183
        $controleur->setType($GLOBALS['_GEN_commun']['info_application']->projet_type) ;
184
    }
185
    if (isset ($GLOBALS['_GEN_commun']['info_application']->exclure)) {
514 alexandre_ 186
    	$a_exclure = explode (',', $GLOBALS['_GEN_commun']['info_application']->exclure) ;
187
        foreach ($a_exclure as $valeur) $controleur->exclure($valeur) ;
473 alexandre_ 188
    }
504 alexandre_ 189
    if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement_forum)) {
190
        $controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement_forum) ;
552 alexandre_ 191
        // S'il n'y a pas d'action en mode forum, on affiche l'onglet Forum
192
        if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_FORUM) ;
504 alexandre_ 193
    }
571 alexandre_ 194
 
629 alexandre_ 195
    if (isset($GLOBALS['_GEN_commun']['info_application']->telechargement)) {
196
    	if (!isset($_REQUEST[PROJET_VARIABLE_ACTION])) $controleur->setAction (PROJET_ACTION_VOIR_DOCUMENT) ;
197
    }
198
 
571 alexandre_ 199
    if (isset ($GLOBALS['_GEN_commun']['info_application']->seulement)) {
200
        $controleur->setIdProjet($GLOBALS['_GEN_commun']['info_application']->seulement) ;
201
    }
202
 
203
    // Si le parametre prive est passé, les inscriptions sont modérés
204
    // TODO : permettre la demande d'inscription
205
    if (isset ($GLOBALS['_GEN_commun']['info_application']->prive)) {
206
        $controleur->setPrive() ;
207
    }
448 ddelon 208
    $res = $controleur->run() ;
504 alexandre_ 209
 
448 ddelon 210
    return $res ;
211
}
212
 
213
/** cma() calcule menu actif
214
 *
215
 *
216
 * @return
217
 */
218
 
219
function cma ($var) {
220
    $class = $_REQUEST[PROJET_VARIABLE_ACTION] == $var ?  'menu_actif' :  'menu_inactif' ;
221
    return $class ;
222
}
223
/* +--Fin du code ----------------------------------------------------------------------------------------+
224
*
225
* $Log: not supported by cvs2svn $
1309 alexandre_ 226
* Revision 1.12  2006/07/04 09:35:04  alexandre_tb
227
* Simplification du code et ajout de controle
228
*
893 alexandre_ 229
* Revision 1.11  2006/04/28 12:41:28  florian
230
* corrections erreurs chemin
231
*
832 florian 232
* Revision 1.10  2005/12/01 16:38:32  alexandre_tb
233
* ajout de l'action telechargement
234
*
629 alexandre_ 235
* Revision 1.9  2005/11/25 14:48:44  alexandre_tb
236
* ajout de la gestion de la présentation tela
237
*
615 alexandre_ 238
* Revision 1.8  2005/10/25 13:50:13  alexandre_tb
239
* Ajout de la gestion des projets privés
240
*
571 alexandre_ 241
* Revision 1.7  2005/10/17 16:22:28  alexandre_tb
242
* rien
243
*
552 alexandre_ 244
* Revision 1.6  2005/10/06 14:54:06  alexandre_tb
245
* ajout de la gestion du paramètre seulement_forum
246
*
514 alexandre_ 247
* Revision 1.5  2005/10/04 10:06:32  alexandre_tb
248
* ajout du parametre seulement_forum
249
*
504 alexandre_ 250
* Revision 1.4  2005/09/28 16:29:39  ddelon
251
* Merge modification projet
252
*
481 ddelon 253
* Revision 1.3  2005/09/27 16:31:06  alexandre_tb
254
* ??
448 ddelon 255
*
481 ddelon 256
*
448 ddelon 257
* +-- Fin du code ----------------------------------------------------------------------------------------+
258
*/
259
 
260
 
261
?>