| 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 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
           | 1634 | 
           alexandre_ | 
           22 | 
           // CVS : $Id: documents.php,v 1.10 2007-10-02 09:24:53 alexandre_tb Exp $
  | 
        
        
           | 448 | 
           ddelon | 
           23 | 
           /**
  | 
        
        
            | 
            | 
           24 | 
           * Application projet
  | 
        
        
            | 
            | 
           25 | 
           *
  | 
        
        
            | 
            | 
           26 | 
           * Action documents
  | 
        
        
            | 
            | 
           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-2005
  | 
        
        
           | 1634 | 
           alexandre_ | 
           34 | 
           *@version       $Revision: 1.10 $
  | 
        
        
           | 448 | 
           ddelon | 
           35 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           36 | 
           */
  | 
        
        
            | 
            | 
           37 | 
              | 
        
        
            | 
            | 
           38 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           39 | 
           // |                                            ENTETE du PROGRAMME                                       |
  | 
        
        
            | 
            | 
           40 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           41 | 
              | 
        
        
            | 
            | 
           42 | 
           // RAPPEL IMPORTANT
  | 
        
        
           | 1631 | 
           alexandre_ | 
           43 | 
           // On se situe dans la methode run() de la classe projetControleur
  | 
        
        
           | 448 | 
           ddelon | 
           44 | 
           //
  | 
        
        
           | 1180 | 
           alexandre_ | 
           45 | 
           if (!isset($retour)) $retour = '';
  | 
        
        
           | 448 | 
           ddelon | 
           46 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           47 | 
           // creation de l'objet projet courant
  | 
        
        
           | 1336 | 
           neiluj | 
           48 | 
           include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
  | 
        
        
           | 448 | 
           ddelon | 
           49 | 
           $projet = new projet ($this->_db, $this->_id_projet) ;
  | 
        
        
            | 
            | 
           50 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           51 | 
           // recuperation de la liste des documents associes
  | 
        
        
           | 448 | 
           ddelon | 
           52 | 
           $liste_documents = $projet->getListesDocuments(PROJET_CHEMIN_FICHIER, PROJET_CHEMIN_ICONES) ;
  | 
        
        
            | 
            | 
           53 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           54 | 
           // creation de la vue liste de document, on nettoie l'url
  | 
        
        
           | 448 | 
           ddelon | 
           55 | 
           //$this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
  | 
        
        
           | 1327 | 
           alexandre_ | 
           56 | 
           include_once PROJET_CHEMIN_CLASSES.'AJAX_arbreDocuments.class.php' ;
  | 
        
        
           | 448 | 
           ddelon | 
           57 | 
              | 
        
        
            | 
            | 
           58 | 
           $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $this->_action) ;
  | 
        
        
            | 
            | 
           59 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           60 | 
           $vue_liste_document = new AJAX_arbreDocuments($this->_url, false, $this->_id_repertoire, $this->_auth) ;
  | 
        
        
           | 448 | 
           ddelon | 
           61 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           62 | 
           // reglage de parametres de la vue
  | 
        
        
           | 448 | 
           ddelon | 
           63 | 
           $vue_liste_document->setAction (array ("couper" => PROJET_ACTION_COUPER, "modifier" => PROJET_ACTION_MODIFIER, "supprimer" => PROJET_SUPPRESSION_FICHIER)) ;
  | 
        
        
            | 
            | 
           64 | 
           $vue_liste_document->setCheminIcones(PROJET_CHEMIN_ICONES) ;
  | 
        
        
            | 
            | 
           65 | 
              | 
        
        
            | 
            | 
           66 | 
           $tableau_navigation = document::getCheminIdRepertoire($this->_id_repertoire, $this->_db) ;
  | 
        
        
            | 
            | 
           67 | 
              | 
        
        
            | 
            | 
           68 | 
           $vue_liste_document->setCheminNavigation ($tableau_navigation) ;
  | 
        
        
            | 
            | 
           69 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           70 | 
           // verification des droits de l'utilisateur
  | 
        
        
           | 448 | 
           ddelon | 
           71 | 
           $entete_liste = array (PROJET_FICHIERS_NOM, PROJET_FICHIERS_TAILLE, PROJET_FICHIERS_PAR, PROJET_FICHIERS_CREE_LE) ;
  | 
        
        
            | 
            | 
           72 | 
              | 
        
        
            | 
            | 
           73 | 
           if ($this->_auth->getAuth()) {
  | 
        
        
           | 1336 | 
           neiluj | 
           74 | 
               include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
  | 
        
        
           | 448 | 
           ddelon | 
           75 | 
               $participant = new participe($this->_db) ;
  | 
        
        
            | 
            | 
           76 | 
               $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
  | 
        
        
           | 1634 | 
           alexandre_ | 
           77 | 
               $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db);
  | 
        
        
            | 
            | 
           78 | 
               if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
  | 
        
        
            | 
            | 
           79 | 
              | 
        
        
           | 448 | 
           ddelon | 
           80 | 
               $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
  | 
        
        
            | 
            | 
           81 | 
               if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
  | 
        
        
            | 
            | 
           82 | 
               $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
  | 
        
        
            | 
            | 
           83 | 
               if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
  | 
        
        
           | 1634 | 
           alexandre_ | 
           84 | 
              | 
        
        
            | 
            | 
           85 | 
              | 
        
        
           | 448 | 
           ddelon | 
           86 | 
               $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
  | 
        
        
            | 
            | 
           87 | 
               // si participant, on ajoute le champs visibilite
  | 
        
        
            | 
            | 
           88 | 
              | 
        
        
            | 
            | 
           89 | 
               if ($statut !='' || $isAdm) {
  | 
        
        
            | 
            | 
           90 | 
                   array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
  | 
        
        
            | 
            | 
           91 | 
               }
  | 
        
        
           | 1327 | 
           alexandre_ | 
           92 | 
               // si chef de projet ou si proprietaire d'au moins 1 document
  | 
        
        
           | 448 | 
           ddelon | 
           93 | 
               $proprietaire_un_document = false ;
  | 
        
        
            | 
            | 
           94 | 
              | 
        
        
            | 
            | 
           95 | 
               foreach ($liste_documents as $document) {
  | 
        
        
           | 1327 | 
           alexandre_ | 
           96 | 
                   if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
  | 
        
        
           | 448 | 
           ddelon | 
           97 | 
                       $proprietaire_un_document = true ;
  | 
        
        
            | 
            | 
           98 | 
                       $droits = PROJET_DROIT_PROPRIETAIRE ;
  | 
        
        
            | 
            | 
           99 | 
                   }
  | 
        
        
            | 
            | 
           100 | 
               }
  | 
        
        
            | 
            | 
           101 | 
               if ($statut > 0 || $proprietaire_un_document) {
  | 
        
        
            | 
            | 
           102 | 
                   array_push ($entete_liste, PROJET_ACTION) ;
  | 
        
        
            | 
            | 
           103 | 
               }
  | 
        
        
            | 
            | 
           104 | 
           } else {
  | 
        
        
            | 
            | 
           105 | 
               $droits = PROJET_DROIT_AUCUN ;
  | 
        
        
            | 
            | 
           106 | 
           }
  | 
        
        
            | 
            | 
           107 | 
           if (!isset($droits)) $droits = PROJET_DROIT_AUCUN ;
  | 
        
        
            | 
            | 
           108 | 
              | 
        
        
            | 
            | 
           109 | 
           $vue_liste_document->construitEntete($entete_liste) ;
  | 
        
        
            | 
            | 
           110 | 
           $vue_liste_document->construitListe ($liste_documents, $droits, '', $this->_db) ;
  | 
        
        
            | 
            | 
           111 | 
              | 
        
        
            | 
            | 
           112 | 
           $retour .= '<h1>'.PROJET_PROJET.' : '.$projet->getTitre()."</h1>" ;
  | 
        
        
            | 
            | 
           113 | 
              | 
        
        
            | 
            | 
           114 | 
           $retour .= '<h2>'.PROJET_DOCUMENT_DU_PROJET.'</h2>'."\n" ;
  | 
        
        
           | 1631 | 
           alexandre_ | 
           115 | 
           // Les liens pour l affichage classique ou arborescent (avec dojo)
  | 
        
        
            | 
            | 
           116 | 
           $this->_url->addQueryString('affichage', 'ajax');
  | 
        
        
            | 
            | 
           117 | 
           $retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_ARBORESCENT.'</a>'."\n";
  | 
        
        
            | 
            | 
           118 | 
           $this->_url->addQueryString('affichage', 'standart');
  | 
        
        
            | 
            | 
           119 | 
           $retour .= '<a href="'.$this->_url->getURL().'">'.PROJET_AFFICHAGE_CLASSIQUE.'</a>'."\n";
  | 
        
        
            | 
            | 
           120 | 
           $this->_url->removeQueryString('affichage');
  | 
        
        
           | 448 | 
           ddelon | 
           121 | 
              | 
        
        
           | 1327 | 
           alexandre_ | 
           122 | 
           $arbre = document::getArbreDocument($this->_id_projet) ;
  | 
        
        
           | 448 | 
           ddelon | 
           123 | 
              | 
        
        
           | 1631 | 
           alexandre_ | 
           124 | 
           $retour .= '<noscript>';
  | 
        
        
            | 
            | 
           125 | 
           $vue_liste_document->setModeAffichage('standart');
  | 
        
        
            | 
            | 
           126 | 
           $retour .= $vue_liste_document->toHTML('', '') ;
  | 
        
        
            | 
            | 
           127 | 
           $retour .= '</noscript>';
  | 
        
        
           | 1327 | 
           alexandre_ | 
           128 | 
              | 
        
        
           | 1631 | 
           alexandre_ | 
           129 | 
           if (!isset ($_SESSION['mode_affichage'])) {
  | 
        
        
            | 
            | 
           130 | 
           	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage']; else $_SESSION['mode_affichage'] = 'ajax';
  | 
        
        
            | 
            | 
           131 | 
           } else {
  | 
        
        
            | 
            | 
           132 | 
           	if (isset($_GET['affichage'])) $_SESSION['mode_affichage'] = $_GET['affichage'];
  | 
        
        
            | 
            | 
           133 | 
           }
  | 
        
        
            | 
            | 
           134 | 
           $vue_liste_document->setModeAffichage($_SESSION['mode_affichage']);
  | 
        
        
           | 1327 | 
           alexandre_ | 
           135 | 
              | 
        
        
           | 1631 | 
           alexandre_ | 
           136 | 
           $retour .= $vue_liste_document->toHTML($projet->getId(), $droits);
  | 
        
        
            | 
            | 
           137 | 
           $this->_url->removeQueryString(PROJET_VARIABLE_SERVICE);
  | 
        
        
           | 448 | 
           ddelon | 
           138 | 
           ?>
  |