| 431 | 
           mathias | 
           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 | 
           /**
  | 
        
        
            | 
            | 
           23 | 
           * Application projet
  | 
        
        
            | 
            | 
           24 | 
           *
  | 
        
        
            | 
            | 
           25 | 
           * Action description
  | 
        
        
            | 
            | 
           26 | 
           *
  | 
        
        
            | 
            | 
           27 | 
           *@package projet
  | 
        
        
            | 
            | 
           28 | 
           //Auteur original :
  | 
        
        
            | 
            | 
           29 | 
           *@author        Alexandre Granier <alexandre@tela-botanica.org>
  | 
        
        
            | 
            | 
           30 | 
           //Autres auteurs :
  | 
        
        
            | 
            | 
           31 | 
           *@author        Aucun
  | 
        
        
            | 
            | 
           32 | 
           *@copyright     Tela-Botanica 2000-2005
  | 
        
        
            | 
            | 
           33 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           34 | 
           */
  | 
        
        
            | 
            | 
           35 | 
              | 
        
        
            | 
            | 
           36 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           37 | 
           // |                                            ENTETE du PROGRAMME                                       |
  | 
        
        
            | 
            | 
           38 | 
           // +------------------------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           39 | 
              | 
        
        
            | 
            | 
           40 | 
           // RAPPEL IMPORTANT
  | 
        
        
            | 
            | 
           41 | 
           // On se situe dans la methode run() de la classe projetControleur
  | 
        
        
            | 
            | 
           42 | 
           //
  | 
        
        
            | 
            | 
           43 | 
              | 
        
        
            | 
            | 
           44 | 
           // creation de l'objet projet courant
  | 
        
        
            | 
            | 
           45 | 
           include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
  | 
        
        
            | 
            | 
           46 | 
           include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
  | 
        
        
            | 
            | 
           47 | 
           $projet = new projet ($this->_db, $this->_id_projet) ;
  | 
        
        
            | 
            | 
           48 | 
              | 
        
        
            | 
            | 
           49 | 
           if ($this->_auth->getAuth()) {
  | 
        
        
            | 
            | 
           50 | 
           	$loggue = true;
  | 
        
        
            | 
            | 
           51 | 
           	$droits = PROJET_DROIT_AUCUN;
  | 
        
        
            | 
            | 
           52 | 
               $participant = new participe($this->_db) ;
  | 
        
        
            | 
            | 
           53 | 
               $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;
  | 
        
        
            | 
            | 
           54 | 
               $isCoord = $participant->isCoordinateur($id_u, $this->_id_projet, $this->_db) ;
  | 
        
        
            | 
            | 
           55 | 
               $isParticipant = $participant->isContributeur($id_u, $this->_id_projet, $this->_db) ;
  | 
        
        
            | 
            | 
           56 | 
               if ($isParticipant) $droits = PROJET_DROIT_CONTRIBUTEUR;
  | 
        
        
            | 
            | 
           57 | 
               if ($isCoord) $droits = PROJET_DROIT_COORDINATEUR ;
  | 
        
        
            | 
            | 
           58 | 
               $isAdm = participe::isAdministrateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_db) ;
  | 
        
        
            | 
            | 
           59 | 
               if ($isAdm) $droits = PROJET_DROIT_ADMINISTRATEUR ;
  | 
        
        
            | 
            | 
           60 | 
               if ($isAdm) $isCoord = true ;
  | 
        
        
            | 
            | 
           61 | 
              | 
        
        
            | 
            | 
           62 | 
              | 
        
        
            | 
            | 
           63 | 
               switch ($participant->getStatut($id_u, $this->_id_projet))
  | 
        
        
            | 
            | 
           64 | 
               {
  | 
        
        
            | 
            | 
           65 | 
               	case PROJET_DROIT_AUCUN :
  | 
        
        
            | 
            | 
           66 | 
               		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
  | 
        
        
            | 
            | 
           67 | 
               		$lien_inscription = $this->_url->getURL();
  | 
        
        
            | 
            | 
           68 | 
               		$laius_inscription = PROJET_VOUS_N_ETES_PAS_INSCRIT;
  | 
        
        
            | 
            | 
           69 | 
               		$label_url_inscription = PROJET_S_INSCRIRE_AU_PROJET;
  | 
        
        
            | 
            | 
           70 | 
               		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_S_INSCRIRE);
  | 
        
        
            | 
            | 
           71 | 
               		$lien_inscription = $this->_url->getURL();
  | 
        
        
            | 
            | 
           72 | 
               		$label_url_inscription = 'S\'inscrire à ce projet';
  | 
        
        
            | 
            | 
           73 | 
               		$bouton_s_inscrire = '<span id="laius_inscription">'.$laius_inscription.'</span> <div id="projet_lien_inscription">
  | 
        
        
            | 
            | 
           74 | 
               <a href="'.$lien_inscription.'">'.$label_url_inscription.'</a>
  | 
        
        
            | 
            | 
           75 | 
             </div>';
  | 
        
        
            | 
            | 
           76 | 
               	break;
  | 
        
        
            | 
            | 
           77 | 
               	case PROJET_DROIT_CONTRIBUTEUR :
  | 
        
        
            | 
            | 
           78 | 
               		$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
  | 
        
        
            | 
            | 
           79 | 
           			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'Déposer un document', 'document');
  | 
        
        
            | 
            | 
           80 | 
              | 
        
        
            | 
            | 
           81 | 
           			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET);
  | 
        
        
            | 
            | 
           82 | 
           			$bouton_desinscription_projet = bouton::toHTML($this->_url->getURL(), 'Se désinscrire du projet', 'cross');
  | 
        
        
            | 
            | 
           83 | 
              | 
        
        
            | 
            | 
           84 | 
           			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
  | 
        
        
            | 
            | 
           85 | 
                       $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
  | 
        
        
            | 
            | 
           86 | 
               	break;
  | 
        
        
            | 
            | 
           87 | 
               	case PROJET_DROIT_COORDINATEUR :
  | 
        
        
            | 
            | 
           88 | 
               		$this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION);
  | 
        
        
            | 
            | 
           89 | 
           			$bouton_resume = bouton::toHTML($this->_url->getURL(), PROJET_MODIFIER_PROPRIETES, 'modifier');
  | 
        
        
            | 
            | 
           90 | 
              | 
        
        
            | 
            | 
           91 | 
           			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER);
  | 
        
        
            | 
            | 
           92 | 
           			$bouton_deposer_doc = bouton::toHTML($this->_url->getURL(), 'Déposer un document', 'document');
  | 
        
        
            | 
            | 
           93 | 
              | 
        
        
            | 
            | 
           94 | 
           			$this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action_inscription);
  | 
        
        
            | 
            | 
           95 | 
                       $bouton_poster = bouton::toHTML($this->_url->getURL(), $label_inscription,'ecrire');
  | 
        
        
            | 
            | 
           96 | 
              | 
        
        
            | 
            | 
           97 | 
              | 
        
        
            | 
            | 
           98 | 
               	break;
  | 
        
        
            | 
            | 
           99 | 
               	case PROJET_DROIT_EN_ATTENTE : $droits = PROJET_DROIT_EN_ATTENTE;
  | 
        
        
            | 
            | 
           100 | 
               		GEN_stockerFichierScript('mootools', 'api/js/mootools/mootools-release-1.11.js');
  | 
        
        
            | 
            | 
           101 | 
           			GEN_stockerCodeScript('window.addEvent(\'domready\', function(){'."\n".
  | 
        
        
            | 
            | 
           102 | 
           				'var fx = new Fx.Styles($(\'projet_lien_login\'), {duration:500, wait:false});' ."\n".
  | 
        
        
            | 
            | 
           103 | 
           				'element = $(\'projet_lien_login\');'."\n".
  | 
        
        
            | 
            | 
           104 | 
           				'element.addEvent(
  | 
        
        
            | 
            | 
           105 | 
           					\'click\', function() {
  | 
        
        
            | 
            | 
           106 | 
           						fx.start({
  | 
        
        
            | 
            | 
           107 | 
           							\'height\' : \'320px\'
  | 
        
        
            | 
            | 
           108 | 
           						})
  | 
        
        
            | 
            | 
           109 | 
           					}
  | 
        
        
            | 
            | 
           110 | 
           				)});');
  | 
        
        
            | 
            | 
           111 | 
           			$laius_inscription_modere = str_replace ('nom_du_projet', $projet->getTitre(), PROJET_LAIUS_INSCRIPTION_MODERE);
  | 
        
        
            | 
            | 
           112 | 
           			$lien_login = '#';
  | 
        
        
            | 
            | 
           113 | 
               	break;
  | 
        
        
            | 
            | 
           114 | 
               }
  | 
        
        
            | 
            | 
           115 | 
              | 
        
        
            | 
            | 
           116 | 
               $statut = participe::getStatutSurProjetCourant ($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db) ;
  | 
        
        
            | 
            | 
           117 | 
               // si participant, on ajoute le champs visibilite
  | 
        
        
            | 
            | 
           118 | 
              | 
        
        
            | 
            | 
           119 | 
               if ($statut !='' || $isAdm) {
  | 
        
        
            | 
            | 
           120 | 
                   array_push ($entete_liste, PROJET_FICHIERS_VISIBILITE) ;
  | 
        
        
            | 
            | 
           121 | 
                   $visible = true ;
  | 
        
        
            | 
            | 
           122 | 
               } else {
  | 
        
        
            | 
            | 
           123 | 
            	   $visible = false ;
  | 
        
        
            | 
            | 
           124 | 
               }
  | 
        
        
            | 
            | 
           125 | 
           	// recuperation de la liste des documents associes
  | 
        
        
            | 
            | 
           126 | 
           	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
  | 
        
        
            | 
            | 
           127 | 
           						PROJET_CHEMIN_ICONES, $this->_id_projet, $visible) ;
  | 
        
        
            | 
            | 
           128 | 
              | 
        
        
            | 
            | 
           129 | 
              | 
        
        
            | 
            | 
           130 | 
               // si chef de projet ou si proprietaire d'au moins 1 document
  | 
        
        
            | 
            | 
           131 | 
               $proprietaire_un_document = false ;
  | 
        
        
            | 
            | 
           132 | 
              | 
        
        
            | 
            | 
           133 | 
               foreach ($liste_documents as $document) {
  | 
        
        
            | 
            | 
           134 | 
                   if ($this->_auth->getAuthData(PROJET_CHAMPS_ID) == $document->_id_proprietaire) {
  | 
        
        
            | 
            | 
           135 | 
                       $proprietaire_un_document = true ;
  | 
        
        
            | 
            | 
           136 | 
                       $droits = PROJET_DROIT_PROPRIETAIRE ;
  | 
        
        
            | 
            | 
           137 | 
                   }
  | 
        
        
            | 
            | 
           138 | 
               }
  | 
        
        
            | 
            | 
           139 | 
               if ($droits <= PROJET_DROIT_COORDINATEUR || $proprietaire_un_document) {
  | 
        
        
            | 
            | 
           140 | 
                   array_push ($entete_liste, PROJET_ACTION) ;
  | 
        
        
            | 
            | 
           141 | 
               }
  | 
        
        
            | 
            | 
           142 | 
           } else {
  | 
        
        
            | 
            | 
           143 | 
               $droits = PROJET_DROIT_AUCUN ;
  | 
        
        
            | 
            | 
           144 | 
               // recuperation de la liste des documents associes
  | 
        
        
            | 
            | 
           145 | 
           	$liste_documents = document::getDocumentsRecents(4, $this->_db, PROJET_CHEMIN_FICHIER,
  | 
        
        
            | 
            | 
           146 | 
           						PROJET_CHEMIN_ICONES, $this->_id_projet, false) ;
  | 
        
        
            | 
            | 
           147 | 
           	$lien_inscription = 'javascript:animatedcollapse.toggle(\'projet_bloc_inscription\');';
  | 
        
        
            | 
            | 
           148 | 
           	$label_url_inscription = 'S\'inscrire à ce projet';
  | 
        
        
            | 
            | 
           149 | 
              | 
        
        
            | 
            | 
           150 | 
           	GEN_stockerFichierScript('jquery', 'api/js/jquery/jquery.js');
  | 
        
        
            | 
            | 
           151 | 
           	GEN_stockerFichierScript('animatedcollapse', 'api/js/jquery/animatedcollapse.js');
  | 
        
        
            | 
            | 
           152 | 
           	GEN_stockerCodeScript('animatedcollapse.addDiv(\'projet_bloc_inscription\', \'fade=1, height="100px"\');' ."\n".
  | 
        
        
            | 
            | 
           153 | 
           			'animatedcollapse.init();' ."\n");
  | 
        
        
            | 
            | 
           154 | 
           	$lien_login = '#';
  | 
        
        
            | 
            | 
           155 | 
           }
  | 
        
        
            | 
            | 
           156 | 
              | 
        
        
            | 
            | 
           157 | 
           $GLOBALS['_PAPYRUS_']['rendu']['TITRE_PAGE'] = $projet->getTitre().' - '.PROJET_DESCRIPTION;
  | 
        
        
            | 
            | 
           158 | 
              | 
        
        
            | 
            | 
           159 | 
           ob_start();
  | 
        
        
            | 
            | 
           160 | 
           include_once PROJET_CHEMIN_APPLI.'/squelettes/description.tpl.html';
  | 
        
        
            | 
            | 
           161 | 
           $retour .= ob_get_contents();
  | 
        
        
            | 
            | 
           162 | 
           ob_end_clean();
  | 
        
        
            | 
            | 
           163 | 
           /* +--Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           164 | 
           *
  | 
        
        
            | 
            | 
           165 | 
              | 
        
        
            | 
            | 
           166 | 
           *
  | 
        
        
            | 
            | 
           167 | 
           * +-- Fin du code ----------------------------------------------------------------------------------------+
  | 
        
        
            | 
            | 
           168 | 
           */
  | 
        
        
           | 2 | 
           ddelon | 
           169 | 
           ?>
  |