Subversion Repositories Applications.projet

Rev

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

Rev Author Line No. Line
293 alexandre_ 1
<?php
389 aurelien 2
/*vim: set expandtab tabstop=4 shiftwidth=4: */
293 alexandre_ 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
// +------------------------------------------------------------------------------------------------------+
351 aperonnet 22
// CVS : $Id: tela_ergo.php,v 1.4 2008-10-27 16:54:59 aperonnet Exp $
293 alexandre_ 23
/**
24
* Application projet
25
*
26
* Fichier de presentation de la liste des projets pour Tela Botanica nouvelle version
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
351 aperonnet 34
*@version       $Revision: 1.4 $
293 alexandre_ 35
// +------------------------------------------------------------------------------------------------------+
36
*/
37
 
38
// +------------------------------------------------------------------------------------------------------+
39
// |                                            ENTETE du PROGRAMME                                       |
40
// +------------------------------------------------------------------------------------------------------+
41
 
42
 
43
define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage');
44
define ('PROJET_VARIABLE_TRI', 'projet_tri');
45
define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri');
46
define ('PROJET_VARIABLE_THEME', 'theme');
47
 
48
if (PROJET_UTILISE_TYPE && $this->_type != '') {
49
    $projetListe = projet::getProjetDuType($this->_type, $this->_db) ;
50
    if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ;
51
} else {
52
    // Un tableau de tous les projets dans $projetListe
53
    //$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ;
54
}
55
 
56
$_SESSION['_PROJET_']['motif_recherche'] = '';
57
 
58
$url = $this->_url->getURL();
59
$loggue = $this->_auth->getAuth();
60
 
61
// Verification sur l ordre de tri et mise en place
62
// du tri par defaut sur le titre
63
 
64
$valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut');  // Securite
65
 
66
if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) {
67
	$tri = $_GET[PROJET_VARIABLE_TRI];
389 aurelien 68
 
293 alexandre_ 69
} else {
70
	$tri = 'p_titre';
71
}
72
 
73
$valeur_acceptable_ordre_tri = array ('asc', 'desc');  // securite
74
 
389 aurelien 75
if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != ''
293 alexandre_ 76
			&& in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) {
77
	$ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI];
389 aurelien 78
 
293 alexandre_ 79
} else {
334 alexandre_ 80
	$ordre_tri = '';
293 alexandre_ 81
}
82
 
83
// variable de session pour se rappeler des choix du visiteur
84
if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) {
389 aurelien 85
	$_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage'];
293 alexandre_ 86
}
87
 
88
if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') {
89
	$_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE];
90
	if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
91
		$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple');
92
		$lien_interface_simple = '[<a href="'.$this->_url->getURL().'">Affichage simple</a>]';
93
		$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
94
		$lien_interface_expert = '';
95
	} else {
96
		$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
97
		$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
98
		$lien_interface_simple = '';
99
		$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
100
	}
101
} else {
102
	$_SESSION['_PROJET_']['projet_affichage'] = 'simple';
103
	$this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert');
104
	$lien_interface_simple = '';
105
	$lien_interface_expert = '[<a href="'.$this->_url->getURL().'">Affichage expert</a>]';
106
}
107
 
108
if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') {
109
	$ordre_tri = 'desc';
110
	$tri = 'ps_pourcent';
111
}
112
/** Affichage des themes de projets */
113
$requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme
114
FROM projet, projet_avoir_theme, projet_theme
115
WHERE p_id = pat_id_projet
116
AND pat_id_theme = pt_id_theme and p_en_dormance=0
117
GROUP BY pt_id_theme';
118
 
119
$resultat_type = $GLOBALS['projet_db']->query($requete_type);
120
 
121
if (DB::isError($resultat_type)) return $resultat_type->getMessage();
122
 
123
$tableau_theme = array();
124
 
125
$requete_nb_pj = 'select count(*) as nb from projet';
126
$nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj);
127
 
128
// On ajoute le theme tous
129
$tableau_theme[0]['label'] = 'Tous les projets';
130
$tableau_theme[0]['id'] = 0;
131
$tableau_theme[0]['nombre_projet'] = $nombre_total_projet;
132
$this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE);
133
$tableau_theme[0]['lien'] = $this->_url->getURL();
134
 
135
// Et le theme en dormance
136
$requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1';
137
$nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance);
138
 
139
 
140
 
141
while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) {
142
	$tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme;
143
	$tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme;
144
	$tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe;
145
	$this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme);
146
	$tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL();
147
}
148
$tableau_theme[9]['label'] = 'En dormance';
149
$tableau_theme[9]['id'] = 9;
150
$tableau_theme[9]['nombre_projet'] = $nb_p_dormant;
151
$this->_url->addQueryString(PROJET_VARIABLE_THEME, 9);
152
$tableau_theme[9]['lien'] = $this->_url->getURL();
153
 
154
 
155
$this->_url->removeQueryString(PROJET_VARIABLE_THEME);
156
 
157
// Contruction de la requete, soit avec le moteur de recherche
158
// soit la liste des projets
159
if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') {
160
	$_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche'];
339 alexandre_ 161
	if (!isset($GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'])) $GLOBALS['_MOTEUR_RECHERCHE_']['bd']['papyrus'] = $this->_db;
293 alexandre_ 162
	include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php';
163
	include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php';
389 aurelien 164
 
293 alexandre_ 165
	$moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']);
166
    $recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']);
167
    $moteur->ajouterRecherche($recherche_projet);
168
    $resultats = $moteur->rechercherMotif();
389 aurelien 169
 
293 alexandre_ 170
    // $chaine_id_projet contient une liste d identifiant separer par une virgule
171
    if (!empty($resultats)) {
172
	    $chaine_id_projet = '';
173
	    foreach ($resultats as $projet) {
174
	    	$chaine_id_projet .= $projet['id'].',';
175
	    }
176
	    $chaine_id_projet = substr($chaine_id_projet, 0, -1);
177
		$where_recherche = ' where p_id in ('.$chaine_id_projet.')';
389 aurelien 178
 
293 alexandre_ 179
		$valeur_projet_recherche = $_GET['projet_recherche'];
180
    }
181
} else {
182
	$where_recherche = '';
183
	$valeur_projet_recherche = '';
184
}
185
$select = '';
186
$from_recherche = '';
187
if (isset($_GET[PROJET_VARIABLE_THEME])) {
188
	$from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme';
396 aurelien 189
	$where_recherche = ' where pat_id_theme='.$this->_db->escapeSimple(intval($_GET[PROJET_VARIABLE_THEME]));
293 alexandre_ 190
	$theme_selectionne = $_GET[PROJET_VARIABLE_THEME];
191
} else {
192
	$theme_selectionne = 0;
193
}
194
 
195
if ($this->_auth->getAuth()) {
196
	/** on recherche egalement le statut si l utilisateur est loggue */
389 aurelien 197
 
396 aurelien 198
	$from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.
199
						$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)).
293 alexandre_ 200
						' left join projet_statut on psu_id_statut=ps_id_statut';
201
	$select = 'psu_id_statut, ps_statut_nom,';
202
}
203
$requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'.
204
				' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '.
205
				'  ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'.
206
				' projet left join projet_lien_liste on p_id=pl_id_projet'.
207
				' left join projet_lien_liste_externe on p_id=plle_id_projet'.
208
				' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'.
209
				$from_recherche.
210
				$where_recherche.
211
				' group by p_id order by '.$tri.' '.$ordre_tri ;
212
 
334 alexandre_ 213
if ($ordre_tri == '') $ordre_tri = 'desc';
389 aurelien 214
 
293 alexandre_ 215
$resultat = $this->_db->query($requete) ;
216
if (DB::isError($resultat)) {
217
	return ("Echec de la requete<br />".$resultat->getMessage()."<br />".$resultat->getDebugInfo()) ;
218
}
219
 
220
$nombre_resultat = $resultat->numRows();
221
 
222
/* Si  l utilisateur est loggue, on recherche son statut par rapport aux projets */
223
if ($this->_auth->getAuth()) {
224
	$requete_statut = 'select psu_id_projet, psu_id_statut, ps_statut_nom from projet_statut_utilisateurs, projet_statut'.
396 aurelien 225
						' where ps_id_statut=psu_id_statut and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID));
293 alexandre_ 226
	$resultat_statut = $GLOBALS['projet_db']->query($requete_statut);
227
	while ($ligne_statut = $resultat_statut->fetchRow(DB_FETCHMODE_OBJECT)) {
228
		$tableau_statut[$ligne_statut->psu_id_projet]['id_statut'] = $ligne_statut->psu_id_statut;
229
		$tableau_statut[$ligne_statut->psu_id_projet]['nom_statut'] = $ligne_statut->ps_statut_nom;
230
	}
231
}
232
 
233
include_once PROJET_CHEMIN_BIBLIOTHEQUE_API.'pear/Pager/Pager.php';
234
 
235
while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {
389 aurelien 236
 
293 alexandre_ 237
	// Si le projet est en dormance, on ne l affiche pas dans le mode normal
238
	// Sauf si le theme choisit est "en dormance"
389 aurelien 239
	if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert' && $ligne->p_en_dormance == 1  && $theme_selectionne != 9) {
240
 
293 alexandre_ 241
	} else {
242
		$donnees[] = $ligne;
243
	}
389 aurelien 244
 
293 alexandre_ 245
}
246
 
247
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') $perpage = $nombre_resultat; else $perpage = 20;
248
// Parametre du pager
249
$params = array (
250
	'mode' => 'Sliding',
251
	'perPage' => $perpage,
252
	'delta' => '5',
253
	'linkClass' => 'num_page',
254
	'curPageLinkClassName' => 'page_courante',
255
	'spacesBeforeSeparator' => 0,
256
	'spacesAfterSeparator' => 0,
257
	'separator' => '',
258
	'prevImg' => '&lt;&lt; Page pr&eacute;c&eacute;dente',
259
	'nextImg' => 'Page suivante &gt;&gt;',
389 aurelien 260
	'extraVars' => array ('projet_recherche' => $_SESSION['_PROJET_']['motif_recherche'],
293 alexandre_ 261
					PROJET_VARIABLE_MODE_AFFICHAGE => $_SESSION['_PROJET_']['projet_affichage']),
262
	'itemData' => $donnees
263
	);
264
$pager = & Pager::factory($params);
265
$links = $pager->getLinks();
266
$data  = $pager->getPageData();
267
$nombre_projets = $pager->numItems();
389 aurelien 268
$range = $pager->getOffsetByPageId();
293 alexandre_ 269
 
270
 
271
// On inclue un fichier local
272
if (file_exists(PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php'))
273
	include_once PROJET_CHEMIN_APPLI.'langues/pro_langues_fr.local.inc.php' ;
274
// On verifie si l'utilisateur participe a des projets
275
 
276
$projetNonParticipantListe = & $projetListe ;
277
 
278
 
279
$liste_projet = array() ;
280
// La liste
281
 
282
 
283
$tableau_donnees = array();
284
foreach ($data as $ligne) {
285
    $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $ligne->p_id) ;
286
 
287
    $tableau_donnees[$ligne->p_id]['lien'] = $this->_url->getURL();
288
    $tableau_donnees[$ligne->p_id]['titre'] = $ligne->p_titre;
289
 
290
    $tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_inscrit;
291
 
292
    $tableau_donnees[$ligne->p_id]['resume'] = $ligne->p_resume;
293
    if ($_SESSION['_PROJET_']['projet_affichage'] == 'simple') {
294
	    if ($ligne->ps_pourcent <33) {
295
	    	$tableau_donnees[$ligne->p_id]['activite'] = 'Peu actif';
389 aurelien 296
	    	$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_faible';
293 alexandre_ 297
	    }
298
	    	else if ($ligne->ps_pourcent < 66) {
299
	    		$tableau_donnees[$ligne->p_id]['activite'] = 'Assez actif';
389 aurelien 300
	    		$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_moyenne';
293 alexandre_ 301
	    	}
389 aurelien 302
	    	else if ($ligne->ps_pourcent <= 100) {
293 alexandre_ 303
	    		$tableau_donnees[$ligne->p_id]['activite'] = 'Tr&egrave;s actif';
304
	    		$tableau_donnees[$ligne->p_id]['classe_projet_activite'] = 'projet_activite_elevee';
305
	    	}
306
    } else {
307
    	$tableau_donnees[$ligne->p_id]['activite'] = $ligne->ps_pourcent.'%';
308
    }
309
    $res .= $ligne->p_resume ;
310
    $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
311
    $res .= '(<a href="'.$this->_url->getURL().'">Rejoindre ce projet</a>)'."\n";
389 aurelien 312
 
293 alexandre_ 313
    // Recherche du forum
314
    if ($ligne->pl_id_liste != null && $ligne->plle_id_liste == null) {
315
    	$this->_url->addQueryString('act', PROJET_ACTION_VOIR_FORUM);
316
 
317
	    $forum = '<a href="'.$this->_url->getURL().'"><img src="sites/commun/generique/images/favicones/tela_botanica.png" alt="Tela Botanica" /></a>'."\n";
318
		$res .= $forum;
389 aurelien 319
 
293 alexandre_ 320
    } else {
389 aurelien 321
 
293 alexandre_ 322
		include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
323
		$listes_ext = new liste_externe ($this->_db) ;
324
		if ($ligne->plle_id_liste != null) {
325
			$info_liste = $listes_ext->getInfoListe($ligne->plle_id_liste) ;
389 aurelien 326
 
293 alexandre_ 327
			$forum = '<a href="'.$info_liste->AGO_A_URLGRP.
328
					'"><img src="sites/commun/generique/images/favicones/yahoo.png" alt="Yahoo"/></a>';
329
			$tableau_donnees[$ligne->p_id]['nombre_participants'] = $ligne->ps_nombre_membre_yahoo;
330
		} else {
331
			$forum = '-';
332
		}
333
    }
334
    if ($ligne->ps_msg_derniere_semaine != 0) {
389 aurelien 335
 
293 alexandre_ 336
    	$tableau_donnees[$ligne->p_id]['nombre_message'] = $ligne->ps_msg_derniere_semaine;
337
    } else {
338
    	$tableau_donnees[$ligne->p_id]['nombre_message'] = 0;
339
    }
340
    $tableau_donnees[$ligne->p_id]['forum'] = $forum;
341
    if ($ligne->p_wikini) {
342
		$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
343
		$link=$this->_url->getURL();
344
	    $wiki_res = '<a href="'.$link.'">voir</a>' ;
345
		if ($ligne->ps_modifwiki_derniere_semaine != 0) {
346
			$wiki_res .= ' <span title="Nouvelles contributions cette semaine"> ( +'.$ligne->ps_modifwiki_derniere_semaine.' )</span>';
347
		}
348
	    $this->_url->removeQueryString ('act');
349
	} else {
350
	    $wiki_res = '-' ;
351
	}
352
	$tableau_donnees[$ligne->p_id]['wikini'] = $wiki_res;
353
    $titre= '<a href="'.$this->_url->getURL().'">'.$ligne->p_titre.'</a>';
389 aurelien 354
 
293 alexandre_ 355
    if ($ligne->p_avoir_document != 0) {
356
    	$this->_url->addQueryString('act', PROJET_ACTION_VOIR_DOCUMENT) ;
357
    	$document = '<a href="'.$this->_url->getURL().'">voir</a>' ;
358
    	if ($ligne->ps_doc_derniere_semaine != 0) {
359
    		$document .= ' <span title="Nouveaux documents cette semaine">( + '.$ligne->ps_doc_derniere_semaine.')</span>';
360
    	}
361
    } else {
362
    	$document = '-' ;
363
    }
364
    $tableau_donnees[$ligne->p_id]['document'] = $document;
389 aurelien 365
 
293 alexandre_ 366
   if ($ligne->p_wikini) {
367
		$this->_url->addQueryString ('act',PROJET_ACTION_VOIR_WIKINI);
368
		$link=$this->_url->getURL();
389 aurelien 369
		$url_rss = PROJET_URL_WIKINI.$ligne->p_wikini.'/wakka.php?wiki=DerniersChangementsRss/xml';
370
		//$this->_url->addQueryString('wiki', 'DerniersChangementsRSS/xml');
371
	    $wiki_rss = '<a href="'.$url_rss.'"><img src="sites/commun/generique/images/rss.gif" alt="rss"/></a>' ;
372
	    //$this->_url->removeQueryString ('act');
373
	    //$this->_url->removeQueryString ('wiki');
293 alexandre_ 374
	} else {
375
	    $wiki_rss = '-' ;
376
	}
377
    $tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
389 aurelien 378
 
293 alexandre_ 379
    $this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
380
    $participant = '<a href="'.$this->_url->getURL().'">voir</a>' ;
381
    $tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
382
    if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
389 aurelien 383
    	$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '<span title="Nouveaux inscrits cette semaine">( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )</span>';
293 alexandre_ 384
    } else {
385
    	$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
386
    }
389 aurelien 387
 
293 alexandre_ 388
    $ligne_projet = array ( '', $titre, $forum,  // le nom du projet
389
                        $wiki_res, $wiki_rss,$document, $participant) ;
390
 
391
    $this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
392
    array_push ($liste_projet, $ligne_projet) ;
389 aurelien 393
 
293 alexandre_ 394
    if ($loggue) {
395
	    switch ($ligne->psu_id_statut) {
396
	    	case 1 : $icone_statut = 'etoile_rouge';
397
	    	$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
398
	    	break;
399
	    	case 2 : $icone_statut = 'etoile_verte';
400
	    	$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
401
	    	break;
402
	    	case 3 : $icone_statut = 'etoile_grise';
403
	    	$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
404
	    	break;
405
	    	default :  $tableau_donnees[$ligne->p_id]['statut_icone'] = '';
406
	    	$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
407
	    		$icone_statut = false;
408
	    }
409
	    if ($icone_statut) $tableau_donnees[$ligne->p_id]['statut_icone'] = '<img src="'.PROJET_CHEMIN_ICONES.$icone_statut.'.png" alt="'.$ligne->ps_statut_nom.'" title="'.$ligne->ps_statut_nom.'" />';
389 aurelien 410
 
293 alexandre_ 411
    }
412
    $res .= '</li>'."\n";
413
}
414
$res .= '</ul>'."\n";
415
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
416
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
417
 
418
// Correction bug tri par participant
419
if ($_GET[PROJET_VARIABLE_TRI] == 'ps_nombre_inscrit') {
420
	foreach ($tableau_donnees as $key => $row) {
421
    $nombre_inscrit[$key]  = $row['nombre_participants'];
422
    }
423
    if  ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
424
	array_multisort($nombre_inscrit, $flag, $tableau_donnees);
425
}
426
 
427
// Correction bug tri sur les statuts
428
if ($_GET[PROJET_VARIABLE_TRI] == 'psu_id_statut') {
429
	foreach ($tableau_donnees as $key => $row) {
430
    $id_statut[$key]  = $row['id_statut'];
431
    }
432
    if  ($_GET[PROJET_VARIABLE_ORDRE_TRI] == 'asc') $flag = SORT_ASC ; else $flag = SORT_DESC ;
433
	array_multisort($id_statut, $flag, $tableau_donnees);
434
}
435
 
436
$pair = true;
437
 
438
ob_start();
439
if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') {
440
	GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
441
	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
442
	GEN_stockerCodeScript('animatedcollapse.addDiv(\'legende\', \'fade=1, height="100px"\');' ."\n".
443
			'animatedcollapse.init();' ."\n");
444
	include_once PROJET_CHEMIN_CLASSES.'enteteColonneTriable.class.php';
445
	foreach ($valeur_acceptable_tri as $var_tri) {
446
		$enteteTri[$var_tri] = new enteteColonneTriable($var_tri);
447
		$enteteTri[$var_tri]->setColonneCliquee($tri, PROJET_VARIABLE_TRI);
448
		$enteteTri[$var_tri]->setOrdre($ordre_tri, PROJET_VARIABLE_ORDRE_TRI);
389 aurelien 449
 
293 alexandre_ 450
	}
451
 
452
	$lien_tri_titre = $enteteTri['p_titre']->getLien($this->_url);
453
	$lien_tri_activite = $enteteTri['ps_pourcent']->getLien($this->_url);
454
	$lien_tri_participants = $enteteTri['ps_nombre_inscrit']->getLien($this->_url);
455
	$lien_tri_doc = $enteteTri['ps_doc_derniere_semaine']->getLien($this->_url);
456
	$lien_tri_statut = $enteteTri['psu_id_statut']->getLien($this->_url);
457
	include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet_expert.tpl.html';
458
} else {
459
	include_once PROJET_CHEMIN_APPLI.'/squelettes/liste_projet.tpl.html';
460
}
461
$res = ob_get_contents();
462
ob_end_clean();
463
 
464
 
465
// Nettoyage de l'url
466
$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET);
467
$this->_url->removeQueryString (PROJET_VARIABLE_MODE_AFFICHAGE);
468
$this->_url->removeQueryString (PROJET_VARIABLE_ORDRE_TRI);
469
$this->_url->removeQueryString (PROJET_VARIABLE_TRI);
470
return $res ;
471
 
472
/* +--Fin du code ----------------------------------------------------------------------------------------+
473
*
474
* $Log: not supported by cvs2svn $
351 aperonnet 475
* Revision 1.3  2008-09-16 14:07:40  alexandre_tb
476
* suppression du bug intermittent sur le moteur de recherche
477
*
339 alexandre_ 478
* Revision 1.2  2008-09-01 14:37:15  alexandre_tb
479
* modification du tri par defaut
480
*
334 alexandre_ 481
* Revision 1.1  2008-08-25 15:00:28  alexandre_tb
482
* version initiale
483
*
293 alexandre_ 484
* +-- Fin du code ----------------------------------------------------------------------------------------+
485
*/
396 aurelien 486
?>