//Autres auteurs : *@author Aucun *@copyright Tela-Botanica 2000-2004 *@version $Revision: 1.1 $ // +------------------------------------------------------------------------------------------------------+ */ // +------------------------------------------------------------------------------------------------------+ // | ENTETE du PROGRAMME | // +------------------------------------------------------------------------------------------------------+ define ('PROJET_VARIABLE_MODE_AFFICHAGE', 'projet_affichage'); define ('PROJET_VARIABLE_TRI', 'projet_tri'); define ('PROJET_VARIABLE_ORDRE_TRI', 'projet_ordre_tri'); define ('PROJET_VARIABLE_THEME', 'theme'); if (PROJET_UTILISE_TYPE && $this->_type != '') { $projetListe = projet::getProjetDuType($this->_type, $this->_db) ; if ($this->_presentation == 'arbre')array_push ($projetListe, projet::getProjetRacine($this->_db)) ; } else { // Un tableau de tous les projets dans $projetListe //$projetListe = projet::getTousLesProjets($this->_db, $this->_projet_exclu) ; } $_SESSION['_PROJET_']['motif_recherche'] = ''; $url = $this->_url->getURL(); $loggue = $this->_auth->getAuth(); // Verification sur l ordre de tri et mise en place // du tri par defaut sur le titre $valeur_acceptable_tri = array ('p_titre', 'ps_pourcent', 'ps_nombre_inscrit', 'ps_doc_derniere_semaine', 'psu_id_statut'); // Securite if (isset($_GET[PROJET_VARIABLE_TRI]) && $_GET[PROJET_VARIABLE_TRI] != '' && in_array($_GET[PROJET_VARIABLE_TRI], $valeur_acceptable_tri)) { $tri = $_GET[PROJET_VARIABLE_TRI]; } else { $tri = 'p_titre'; } $valeur_acceptable_ordre_tri = array ('asc', 'desc'); // securite if (isset($_GET[PROJET_VARIABLE_ORDRE_TRI]) && $_GET[PROJET_VARIABLE_ORDRE_TRI] != '' && in_array ($_GET[PROJET_VARIABLE_ORDRE_TRI], $valeur_acceptable_ordre_tri)) { $ordre_tri = $_GET[PROJET_VARIABLE_ORDRE_TRI]; } else { $ordre_tri = ''; } // variable de session pour se rappeler des choix du visiteur if (!isset ($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && isset($_SESSION['_PROJET_']['projet_affichage']) && ($_SESSION['_PROJET_']['projet_affichage'] == 'simple' || $_SESSION['_PROJET_']['projet_affichage'] == 'expert')) { $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] = $_SESSION['_PROJET_']['projet_affichage']; } if (isset($_GET[PROJET_VARIABLE_MODE_AFFICHAGE]) && $_GET[PROJET_VARIABLE_MODE_AFFICHAGE] != '') { $_SESSION['_PROJET_']['projet_affichage'] = $_GET[PROJET_VARIABLE_MODE_AFFICHAGE]; if ($_SESSION['_PROJET_']['projet_affichage'] == 'expert') { $this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'simple'); $lien_interface_simple = '[Affichage simple]'; $this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert'); $lien_interface_expert = ''; } else { $_SESSION['_PROJET_']['projet_affichage'] = 'simple'; $this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert'); $lien_interface_simple = ''; $lien_interface_expert = '[Affichage expert]'; } } else { $_SESSION['_PROJET_']['projet_affichage'] = 'simple'; $this->_url->addQueryString (PROJET_VARIABLE_MODE_AFFICHAGE, 'expert'); $lien_interface_simple = ''; $lien_interface_expert = '[Affichage expert]'; } if ($_SESSION['_PROJET_']['projet_affichage'] != 'expert') { $ordre_tri = 'desc'; $tri = 'ps_pourcent'; } /** Affichage des themes de projets */ $requete_type = 'SELECT count( p_id ) AS nbe, pt_label_theme,pt_id_theme FROM projet, projet_avoir_theme, projet_theme WHERE p_id = pat_id_projet AND pat_id_theme = pt_id_theme and p_en_dormance=0 GROUP BY pt_id_theme'; $resultat_type = $GLOBALS['projet_db']->query($requete_type); if (DB::isError($resultat_type)) return $resultat_type->getMessage(); $tableau_theme = array(); $requete_nb_pj = 'select count(*) as nb from projet'; $nombre_total_projet = $GLOBALS['projet_db']->getOne($requete_nb_pj); // On ajoute le theme tous $tableau_theme[0]['label'] = 'Tous les projets'; $tableau_theme[0]['id'] = 0; $tableau_theme[0]['nombre_projet'] = $nombre_total_projet; $this->_url->removeQueryString(PROJET_VARIABLE_MODE_AFFICHAGE); $tableau_theme[0]['lien'] = $this->_url->getURL(); // Et le theme en dormance $requete_dormance = 'select count(p_id) as nb_p_dorman from projet where p_en_dormance=1'; $nb_p_dormant = $GLOBALS['projet_db']->getOne($requete_dormance); while ($ligne_type = $resultat_type->fetchRow(DB_FETCHMODE_OBJECT)) { $tableau_theme[$ligne_type->pt_id_theme]['label'] = $ligne_type->pt_label_theme; $tableau_theme[$ligne_type->pt_id_theme]['id'] = $ligne_type->pt_id_theme; $tableau_theme[$ligne_type->pt_id_theme]['nombre_projet'] = $ligne_type->nbe; $this->_url->addQueryString(PROJET_VARIABLE_THEME, $ligne_type->pt_id_theme); $tableau_theme[$ligne_type->pt_id_theme]['lien'] = $this->_url->getURL(); } $tableau_theme[9]['label'] = 'En dormance'; $tableau_theme[9]['id'] = 9; $tableau_theme[9]['nombre_projet'] = $nb_p_dormant; $this->_url->addQueryString(PROJET_VARIABLE_THEME, 9); $tableau_theme[9]['lien'] = $this->_url->getURL(); $this->_url->removeQueryString(PROJET_VARIABLE_THEME); // Contruction de la requete, soit avec le moteur de recherche // soit la liste des projets if (isset($_GET['projet_recherche']) && $_GET['projet_recherche'] != '') { $_SESSION['_PROJET_']['motif_recherche'] = $_GET['projet_recherche']; include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche.class.php'; include_once 'papyrus/applettes/moteur_recherche/bibliotheque/more_recherche_projet.class.php'; $moteur = new More_Recherche($_SESSION['_PROJET_']['motif_recherche']); $recherche_projet = new More_Recherche_Projet($_SESSION['_PROJET_']['motif_recherche']); $moteur->ajouterRecherche($recherche_projet); $resultats = $moteur->rechercherMotif(); // $chaine_id_projet contient une liste d identifiant separer par une virgule if (!empty($resultats)) { $chaine_id_projet = ''; foreach ($resultats as $projet) { $chaine_id_projet .= $projet['id'].','; } $chaine_id_projet = substr($chaine_id_projet, 0, -1); $where_recherche = ' where p_id in ('.$chaine_id_projet.')'; $valeur_projet_recherche = $_GET['projet_recherche']; } } else { $where_recherche = ''; $valeur_projet_recherche = ''; } $select = ''; $from_recherche = ''; if (isset($_GET[PROJET_VARIABLE_THEME])) { $from_recherche = ' left join projet_avoir_theme on pat_id_projet=p_id left join projet_theme on pat_id_theme=pt_id_theme'; $where_recherche = ' where pat_id_theme='.$this->_db->escapeSimple($_GET[PROJET_VARIABLE_THEME]); $theme_selectionne = $_GET[PROJET_VARIABLE_THEME]; } else { $theme_selectionne = 0; } if ($this->_auth->getAuth()) { /** on recherche egalement le statut si l utilisateur est loggue */ // On recherche les projets auquels l utilisateur participe include_once PROJET_CHEMIN_CLASSES.'participe.class.php'; $participant = new participe ($this->_db); $tableau_projet = $participant->getInformationsUtilisateurs($this->_auth->getAuthData(PROJET_CHAMPS_ID)); $chaine_id_projet = ''; if (count ($tableau_projet) == 0) { return '
Vous n\'êtes inscrit à aucun projet
'; } foreach ($tableau_projet as $projet) { $chaine_id_projet .= $projet[3].','; } $chaine_id_projet = substr($chaine_id_projet, 0, -1); $where_recherche .= ' where p_id in ('.$chaine_id_projet.')'; $from_recherche .= ' left join projet_statut_utilisateurs on psu_id_projet=p_id and psu_id_utilisateur='.$this->_db->escapeSimple($this->_auth->getAuthData(PROJET_CHAMPS_ID)). ' left join projet_statut on psu_id_statut=ps_id_statut'; $select = 'psu_id_statut, ps_statut_nom,'; } $requete = 'select '.$select.'p_id, p_titre, p_resume, pl_id_liste, plle_id_liste, p_avoir_document, ps_nombre_inscrit, ps_pourcent,'. ' p_wikini, ps_doc_derniere_semaine, p_avoir_document, ps_nombre_inscrit_derniere_semaine, '. ' ps_nombre_membre_yahoo, ps_msg_derniere_semaine, ps_modifwiki_derniere_semaine, p_en_dormance from'. ' projet left join projet_lien_liste on p_id=pl_id_projet'. ' left join projet_lien_liste_externe on p_id=plle_id_projet'. ' left join projet_statistiques on p_id=ps_ce_projet and ps_dernier=1'. $from_recherche. $where_recherche. ' group by p_id order by '.$tri.' '.$ordre_tri ; if ($ordre_tri == '') { $ordre_tri = 'desc'; } $resultat = $this->_db->query($requete) ; if (DB::isError($resultat)) { return ("Echec de la requete
' ;
$this->_url->removeQueryString ('act');
$this->_url->removeQueryString ('wiki');
} else {
$wiki_rss = '-' ;
}
$tableau_donnees[$ligne->p_id]['wikini_rss'] = $wiki_rss;
$this->_url->addQueryString ('act', PROJET_ACTION_VOIR_PARTICIPANT);
$participant = 'voir' ;
$tableau_donnees[$ligne->p_id]['lien_participants'] = $this->_url->getURL();
if ($ligne->ps_nombre_inscrit_derniere_semaine != 0) {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '( + '.$ligne->ps_nombre_inscrit_derniere_semaine.' )';
} else {
$tableau_donnees[$ligne->p_id]['ps_nombre_inscrit_derniere_semaine'] = '';
}
$ligne_projet = array ( '', $titre, $forum, // le nom du projet
$wiki_res, $wiki_rss,$document, $participant);
$this->_url->removeQueryString(PROJET_VARIABLE_ACTION);
array_push ($liste_projet, $ligne_projet) ;
if ($loggue) {
switch ($ligne->psu_id_statut) {
case 1 : $icone_statut = 'etoile_rouge';
$tableau_donnees[$ligne->p_id]['id_statut'] = 3;
break;
case 2 : $icone_statut = 'etoile_verte';
$tableau_donnees[$ligne->p_id]['id_statut'] = 2;
break;
case 3 : $icone_statut = 'etoile_grise';
$tableau_donnees[$ligne->p_id]['id_statut'] = 1;
break;
default :
$tableau_donnees[$ligne->p_id]['statut_icone'] = '';
$tableau_donnees[$ligne->p_id]['id_statut'] = 0;
$icone_statut = false;
}
if ($icone_statut) {
$tableau_donnees[$ligne->p_id]['statut_icone'] = '