Rev 197 | Blame | Last modification | View Log | RSS feed
<?php/* +-----------------------------------------------------------------------+* |projet_derniers_telechargement.php |* +-----------------------------------------------------------------------+* | Copyright (c) 2001 - 2005 Tela Botanica |* +-----------------------------------------------------------------------+* | Affiche les derniers fichiers uploader dans le module projet |* +-----------------------------------------------------------------------+* | Auteur : Alexandre Granier <alexandre@tela-botanica.org> |* +-----------------------------------------------------------------------+* $Id: projet_derniers_telechargements.php,v 1.4 2007-04-19 09:17:35 alexandre_tb Exp $*/// Cette application affiche les derniers documents uploadé dans le module projet// ainsi que tous les documents du module// ===========================================================// Configuration// ===========================================================// Le nombre à afficherdefine ("PROJET_TELECHARGEMENT_NOMBRE", 8) ;//==================== Les labels =======================================define ("PROJET_TELECHARGEMENT_TITRE", "Page de téléchargements rapides") ;define ("PROJET_TELECHARGEMENT_DERNIERS", "Derniers documents mis en ligne") ;define ("PROJET_TELECHARGEMENT_TOUS", "Tous les documents, par projet") ;//=============bibliothèques PEAR ===================================include_once 'HTML/Table.php' ;include_once 'HTML/TreeMenu.php' ;// ========== Bibliothèque Projet ====================================include_once 'configuration/projet.config.inc.php' ;include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;include_once PROJET_CHEMIN_CLASSES.'document.class.php' ;include_once PROJET_CHEMIN_APPLI.'langues/pro_langue_fr.inc.php' ;function afficherContenuCorps() {global $id_projet, $repcourant, $baseURL, $projet ;global $G_ftpHost,$G_ftpUser,$G_ftpPwd,$G_ftpLocal, $PHP_SELF;// à remplacer par un div pour genesia$res = "<h1>".PROJET_TELECHARGEMENT_TITRE."</h1>\n" ;$res .= "<h2>".PROJET_TELECHARGEMENT_DERNIERS."</h2>\n" ;$liste_documents = document::getDocumentsRecents( $nombre = 10, $GLOBALS['projet_db'], PROJET_CHEMIN_FICHIER,PROJET_CHEMIN_ICONES) ;include_once PROJET_CHEMIN_CLASSES.'HTML_Liste.class.php' ;include_once PROJET_CHEMIN_CLASSES.'HTML_listeDocuments.class.php' ;$vue_liste_document = new HTML_listeDocuments($GLOBALS['url'], false, '', $GLOBALS['projet_auth']) ;$vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;$entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;$vue_liste_document->construitEntete($entete_liste) ;$vue_liste_document->construitListe ($liste_documents, $droits, 'ignore_repertoire', $GLOBALS['projet_db']) ;$res .= $vue_liste_document->toHTML() ;$res .= "<h2>".PROJET_TELECHARGEMENT_TOUS."</h2>\n" ;// Création de l'objet TreeMenu//GEN_stockerFichierScript(1, "api/TreeMenu/TreeMenu.js") ;// Les noms des fichiers graphiques$icon = 'folder.gif';$expandedIcon = 'folder-expanded.gif';$i = 0 ;// Requete sur les projets$requete = "SELECT p_titre, p_id FROM projet ORDER BY p_titre" ;$resultat = $GLOBALS['projet_db']->query ($requete) or die ("Echec <br />".mysql_error()."<br />$requete") ;// $menu = new HTML_TreeMenu() ;// $node = new HTML_TreeNode(array('text' => "Les projets de Tela Botanica", 'link' => "", 'icon' => $icon, 'expandedIcon' => $expandedIcon));$noeudProjet = '' ;while ($ligne = $resultat->fetchRow(DB_FETCHMODE_OBJECT)) {$titre = $ligne->p_titre ;// $node_1[$i] = &$node->addItem (new HTML_TreeNode(array('text' => $titre, 'link' => "", 'icon' => $icon, 'expandedIcon' => $expandedIcon)));// projet_fichiers (&$node_1[$i], $ligne->p_id) ;$i++ ;$noeudProjet .= '<div dojoType="TreeNode" title="'.$ligne->p_titre.'" widgetId="projet_'.$ligne->p_id.'" objectId="projet_'.$ligne->p_id.'" isFolder="true"></div>'."\n";}// $menu->addItem($node);// $treeMenu = &new HTML_TreeMenu_DHTML($menu, array('images' => 'api/TreeMenu/images', 'defaultClass' => 'text'));// $res .= "<p>".$treeMenu->toHTML()."</p>\n" ;GEN_stockerFichierScript('dojo', 'api/js/dojo/dojo.js', 'text/javascript');GEN_stockerFichierScript('dojoScriptProjet', PROJET_CHEMIN_APPLI.'js/telechargement.js');//$res .= '<p>' ;$RPCUrl = PROJET_CHEMIN_APPLI.'services/ecouteArbreFichier.php';$res .= '<div dojoType="TreeLoadingController" RPCUrl="'.$RPCUrl.'" widgetId="treeController" DNDController="create"></div><div dojoType="TreeSelector" widgetId="treeSelector"></div><div dojoType="Tree" DNDMode="between" selector="treeSelector" widgetId="bandTree" controller="treeController"><div dojoType="TreeNode" title="Racine" widgetId="rootNode" objectId="root" isFolder="true">'."\n".$noeudProjet.'</div></div>';//$res .= '</p>';return $res ;}/** fonction projet_fichiers() - Remplie un noeud avec les fichiers et répertoires** Le noeud est passé en référence. Ainsi, cette fonction ne retourne rien mais modifie le tableau des* noeuds passé en référence.** return void*/function projet_fichiers ($noeud, $id_rep, $pere = 0){//Récupération de l'identifiant du répertoire courant//La fonction est appelé récursivement quand $pere ne vaut pas null//$id_rep prend donc la valeur de $pere transmise par l'appel précédent de la fonction.// Les noms des fichiers graphiques$icon = 'folder.gif';$expandedIcon = 'folder-expanded.gif';//Requête pour récupérer les noms des répertoires contenus dans le répertoire courant ($id_rep)$queryRep = ' SELECT projet_documents.*'.' FROM projet_documents'.' WHERE projet_documents.pd_pere = '.$pere.' AND projet_documents.pd_visibilite = "public" and pd_ce_projet='.$id_rep.' and pd_ce_type=0'.' ORDER BY projet_documents.pd_nom ASC' ;$resultRep = $GLOBALS['projet_db']->query($queryRep) ;if (DB::isError ($resultRep)) {die ('Echec de la requete : '.$queryRep.'<br />'.$resultRep->getMessage()) ;}//Stockage des informations sur les répertoires contenu dans le répertoire courant pour affichage dans un arbre.//Et appel récursif de la fonction pour examiner le contenu de chaque répertoire du répertoire courant.if ( $resultRep->numRows() != 0 ) {while ( $ligneRep = $resultRep->fetchRow(DB_FETCHMODE_OBJECT) ) {//Stockage des informations sur le répertoire courant$noeud1_1 = &$noeud->addItem(new HTML_TreeNode(array('text' => trim ($ligneRep->pd_nom),'link' => "", 'icon' => $icon,'expandedIcon' => $expandedIcon ) ) );//Appel récursif de fonction couranteprojet_fichiers (&$noeud1_1, $id_rep, $ligneRep->pd_id) ;}}// Requête pour récupérer les fichiers du répertoire courant ($id_rep) et leurs informations$requete_fichiers = 'SELECT projet_documents.*, gen_type_de_fichier.gtf_type_icone'.' FROM projet_documents, gen_type_de_fichier'.' WHERE projet_documents.pd_ce_type= gen_type_de_fichier.gtf_id_type'.' AND projet_documents.pd_visibilite= "public" ' ;if ($pere == 0) {$requete_fichiers .= ' AND projet_documents.pd_ce_projet= '.$id_rep.' and pd_pere=0 and pd_ce_type <> 0' ;} else {$requete_fichiers .= ' AND projet_documents.pd_pere= '.$pere.' and pd_ce_type<>0' ;}$requete_fichiers .= ' ORDER BY projet_documents.pd_nom ASC' ;$resultat_fichiers = $GLOBALS['projet_db']->query($requete_fichiers) ;if (DB::isError ($resultat_fichiers)) {die ('Echec de la requete : '.$requete.'<br />'.$resultat_fichiers->getMessage()) ;}//Stockage des informations sur les fichiers du répertoires courant pour affichage dans un arbreif ( $resultat_fichiers->numRows() != 0 ) {while ( $ligne_fichiers = $resultat_fichiers->fetchRow(DB_FETCHMODE_OBJECT) ) {//Ajout de slash devant les caractères spéciaux et suppression des caractères invisibles en début et fin des noms de fichier.$lien = trim( $ligne_fichiers->pd_nom );$noeud_1_2 = &$noeud->addItem (new HTML_TreeNode (array ("text" => $lien,"link" => PROJET_CHEMIN_FICHIER.$ligne_fichiers->pd_lien,'icon' => $ligne_fichiers->gtf_type_icone,"linkTarget" => "_blank" ))) ;}}}/* +--Fin du code ----------------------------------------------------------------------------------------+** $Log: not supported by cvs2svn $* Revision 1.3 2005/10/06 08:23:48 alexandre_tb* Ajout de commentaires**** +-- Fin du code ----------------------------------------------------------------------------------------+*/?>