Subversion Repositories Applications.projet

Rev

Rev 77 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
66 alexandre_ 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: liste.php,v 1.1 2005-11-25 14:47:51 alexandre_tb Exp $
23
/**
24
* Application projet
25
*
26
* Fichier de présentation de la liste des projets
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
34
*@version       $Revision: 1.1 $
35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
$titre = '<h1>'.PROJET_LISTE.'</h1>'."\n" ;
43
 
44
// On inclue un fichier local
45
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
46
	include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
47
// On vérifie si l'utilisateur participe à des projets
48
if ($auth) {
49
 
50
    $utilisateur_liste = new inscription_liste($this->_db) ;
51
    // On teste ici s'il y a une mise à jour de statut
52
    if (isset($_POST['statut'])) {
53
        // $_POST['statut'] et $_GET['identifiant_projet'] proviennent du formulaire voir HTML_listeProjet
54
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
55
        $annuaire = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
56
        $annuaire->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
57
        $projet = new projet ($this->_db, $_GET['identifiant_projet']) ;
58
        $projet->getListesAssociees() ;
59
        $utilisateur_liste->modifierTypeInscription($projet->_listes_associes[0],$annuaire, $_POST['statut']) ;
60
    }
61
    if (count($participant->getIdProjetsStatuts($id_u))) {
62
 
63
        $HTML_projetListe = new HTML_listeProjet(true) ;
64
        $entete_liste = array($auth ? PROJET_VOUS_PARTICIPEZ : PROJET_LISTE) ;
65
        if ($auth) array_push ($entete_liste, PROJET_SE_DESINSCRIRE, PROJET_LISTE_DE_DISCUSSION) ;
66
 
67
 
68
        $tableau_resultat = array () ;
69
 
70
        $HTML_projetListe->construitEntete ($entete_liste) ;
71
 
72
        // On construit $tableau_resultat avec une ligne par projet contenant un tableau (titre, statut_nom, id_statut, id_projet)
73
        $statut_liste = new statut_liste($this->_db) ;
74
        $tableau_statut = $statut_liste->getTousLesStatuts() ;
75
 
76
        $statut = '' ;
77
        $i = 0 ;
78
        $HTML_projetListe->setModeModification() ;
79
        $HTML_projetListe->setURL($this->_url) ;
80
        foreach ($projetListe as $projet) {
81
            if (participe::getStatutSurProjetCourant($id_u, $projet->getId(), $this->_db) == 4) continue ;
82
            if ($auth) {
83
                if ($projet->avoirListe()) {
84
                    $projet->getListesAssociees() ;
85
                    $statut = $utilisateur_liste->getStatutInscrit($projet->_listes_associes[0]->getId(), $this->_auth) ;
86
                    //if ($statut == '') $statut = 0 ;
87
                }
88
            }
89
 
90
            $this->_url->addQueryString (PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
91
            $ligne_tableau = array ($projet->getId(), $projet->getResume(),
92
						'<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'
93
						) ;
94
            if ($auth) {
95
                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
96
                array_push ($ligne_tableau, '<a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.
97
                                        PROJET_SE_DESINSCRIRE_CONFIRMATION.'\');">'.PROJET_SE_DESINSCRIRE.'</a>') ;
98
                if ($projet->avoirListe()) {
99
                    array_push ($ligne_tableau, $statut) ;
100
                } else {
101
                    array_push($ligne_tableau, '') ;
102
                }
103
                array_push ($tableau_resultat, $ligne_tableau) ;
104
                $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
105
            }
106
            $statut = '' ;
107
        }
108
        $HTML_projetListe->construitListe ($tableau_resultat, $tableau_statut) ;
109
 
110
 
111
        if ($HTML_projetListe->getRowCount() > 1) {
112
        	$res .= '<p>'.PROJET_PARTICIPER.'</p>';
113
        	$res .= $HTML_projetListe->toHTML() ;
114
        }
115
    } else {
116
        $res .= '<p>'.PROJET_INSCRIT_AUCUN_PROJET.'</p>' ;
117
    }
118
}
119
 
120
// Un texte pour ceux qui ne sont pas identifiés
121
if (!$auth) {
122
    $res .= '<p>'.PROJET_TEXTE_NON_IDENTIFIE.'</p>'."\n" ;
123
}
124
 
125
// Maintenant la liste des projets où l'utilisateur ne participe pas.
126
// Et si pas loggué tous les projets
127
if ($auth) {
128
    $projetNonParticipantListe = $participant -> getProjetsNonParticipant($id_u) ;
129
    // Si certain projet sont à exclure, on les exclu
130
    $projet_a_exclure = array() ;
131
    if (count($this->_projet_exclu)) {
132
    	arsort($this->_projet_exclu) ;
133
        foreach ($this->_projet_exclu as $valeur) {
134
        	for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
135
        		if ($projetNonParticipantListe[$i]->getId() == $valeur)  array_push ($projet_a_exclure, $i);}
136
        }
137
    }
138
    if (PROJET_UTILISE_TYPE && $this->_type != '') {
139
    	for ($i = 0; $i < count($projetNonParticipantListe); $i++) {
140
    		if ($projetNonParticipantListe[$i]->getType() != $this->_type) array_push ($projet_a_exclure, $i) ;
141
    	}
142
   	}
143
 
144
    foreach ($projet_a_exclure as $valeur) {
145
    	unset ($projetNonParticipantListe[$valeur]) ;
146
    }
147
 
148
    $HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
149
    $entete_liste = array (PROJET_LISTE) ;
150
    array_push ($entete_liste, PROJET_S_INSCRIRE) ;
151
 
152
    $HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
153
 
154
    $liste_projet = array() ;
155
    // La liste
156
 
157
    foreach ($projetNonParticipantListe as $projet) {
158
        $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
159
        $ligne_projet = array ($projet->getResume(),
160
                            '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>'      // le nom du projet
161
                                ) ;
162
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE) ;
163
        array_push ($ligne_projet, '<a href="'.$this->_url->getURL().'">'.PROJET_S_INSCRIRE.'</a>') ;
164
 
165
        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
166
        array_push ($liste_projet, $ligne_projet) ;
167
    }
168
    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
169
    $HTML_projetNonParticipantListe->construitListe($liste_projet) ;
170
    if ($HTML_projetNonParticipantListe->getRowCount() > 1) $res .= $HTML_projetNonParticipantListe->toHTML() ;
171
} else {
172
    $projetNonParticipantListe = & $projetListe ;
173
    $HTML_projetNonParticipantListe = new HTML_listeProjet(true) ;
174
    $entete_liste = array (PROJET_LISTE) ;
175
    $HTML_projetNonParticipantListe->construitEntete($entete_liste) ;
176
 
177
    $liste_projet = array() ;
178
    // La liste
179
    foreach ($projetNonParticipantListe as $projet) {
180
        $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $projet->getId()) ;
181
        $ligne_projet = array ( $projet->getResume(),
182
                            '<a href="'.$this->_url->getURL().'">'.$projet->getTitre().'</a>',  // le nom du projet
183
                            ) ;
184
 
185
        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
186
        array_push ($liste_projet, $ligne_projet) ;
187
    }
188
    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
189
    $HTML_projetNonParticipantListe->construitListe($liste_projet) ;
190
    if ($HTML_projetNonParticipantListe->getRowCount() > 1) {
191
		$res .= '<p>'.PROJET_TOUS_LES_PROJETS.'</p>' ;
192
		$res .= $HTML_projetNonParticipantListe->toHTML() ;
193
    }
194
}
195
 
196
return $titre.$res ;
197
 
198
/* +--Fin du code ----------------------------------------------------------------------------------------+
199
*
200
* $Log: not supported by cvs2svn $
201
 
202
*
203
*
204
* +-- Fin du code ----------------------------------------------------------------------------------------+
205
*/
206
 
207
 
208
?>