Subversion Repositories Applications.projet

Rev

Rev 276 | Rev 297 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 276 Rev 288
Line 18... Line 18...
18
// | You should have received a copy of the GNU General Public                                            |
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                                  |
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                            |
20
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                            |
21
// +------------------------------------------------------------------------------------------------------+
21
// +------------------------------------------------------------------------------------------------------+
Line 22... Line 22...
22
 
22
 
Line 23... Line 23...
23
// CVS : $Id: projetControleur.class.php,v 1.41 2007-12-04 13:55:07 alexandre_tb Exp $
23
// CVS : $Id: projetControleur.class.php,v 1.42 2008-05-21 14:36:12 alexandre_tb Exp $
24
 
24
 
25
/**
25
/**
26
* Application projet
26
* Application projet
Line 31... Line 31...
31
//Auteur original :
31
//Auteur original :
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
32
*@author        Alexandre Granier <alexandre@tela-botanica.org>
33
//Autres auteurs :
33
//Autres auteurs :
34
*@author        Aucun
34
*@author        Aucun
35
*@copyright     Tela-Botanica 2000-2004
35
*@copyright     Tela-Botanica 2000-2004
36
*@version       $Revision: 1.41 $
36
*@version       $Revision: 1.42 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 567... Line 567...
567
		        }
567
		        }
568
	            $res .= '</ul></li>' ;
568
	            $res .= '</ul></li>' ;
569
			}
569
			}
Line 570... Line 570...
570
			
570
			
571
			// Wikini
571
			// Wikini
572
			if ($isAdm || $isCoord) {
572
			if ($isAdm) {
573
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
573
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
574
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
574
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
575
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
575
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
576
				// L'action choisir un wikini
576
				// L'action choisir un wikini
Line 606... Line 606...
606
	    	if (!$this->_auth->getAuth()) {
606
	    	if (!$this->_auth->getAuth()) {
607
	    		return PROJET_TEXTE_NON_IDENTIFIE;
607
	    		return PROJET_TEXTE_NON_IDENTIFIE;
608
	    	}
608
	    	}
Line 609... Line 609...
609
	    	
609
	    	
610
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
610
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
611
	        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
611
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
612
	        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
612
		        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
613
	        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
613
		        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
614
	        $tableau_type = '' ;
614
		        $tableau_type = '' ;
615
	        if (PROJET_UTILISE_TYPE) {
615
		        if (PROJET_UTILISE_TYPE) {
616
	            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
616
		            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
617
	            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
617
		            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
-
 
618
		        }
-
 
619
		        
-
 
620
		        /** recuperation des themes */
-
 
621
		        include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
-
 
622
		        $tableau_theme = projet_theme::getTousLesThemes($this->_db);
618
	        }
623
		        
619
	        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
624
		        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
620
	        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type) ;
625
		        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
621
	        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
626
		        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
-
 
627
		            $projet = new projet($this->_db, $this->_id_projet) ;
622
	            $projet = new projet($this->_db, $this->_id_projet) ;
628
		            
623
	            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
629
		            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
624
	                                            'projet_description' => $projet->getDescription(),
630
		                                            'projet_description' => $projet->getDescription(),
625
	                                            'projet_asso' => $projet->getIdPere(),
631
		                                            'projet_asso' => $projet->getIdPere(),
626
	                                            'projet_wikini' => $projet->getWikini(),
632
		                                            'projet_wikini' => $projet->getWikini(),
627
	                                            'projet_resume' => $projet->getResume(),
633
		                                            'projet_resume' => $projet->getResume(),
628
	                                            'projet_espace_internet' => $projet->getEspaceInternet(),
634
		                                            'projet_espace_internet' => $projet->getEspaceInternet(),
629
	                                            'projet_type'=> $projet->getType(),
635
		                                            'projet_type'=> $projet->getType(),
630
	                                            'projet_moderation' => $projet->isModere()
636
		                                            'projet_moderation' => $projet->isModere(),
-
 
637
		                                        ) ;
631
	                                        ) ;
638
					
-
 
639
		            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
-
 
640
		            $themes = $projet->getThemes();
-
 
641
		            foreach ($themes as $cle => $valeur) {
-
 
642
		            	$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
-
 
643
		            	if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
-
 
644
		            	$element->setChecked(true);
632
	            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
645
		            }
633
	        } else {
646
		        } else {
634
	        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
647
		        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
635
	        }
648
		        }
636
	        $res = PROJET_PROPOSER_PROJET ;
649
		        $res = PROJET_PROPOSER_PROJET ;
637
	        return $res . $formulaire_projet->toHTML() ;
650
		        return $res . $formulaire_projet->toHTML() ;
638
	    	} else {
651
	    	} else {
639
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
652
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
640
	    	}
653
	    	}
Line 658... Line 671...
658
            $projet = new projet ($this->_db) ;
671
            $projet = new projet ($this->_db) ;
659
            $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
672
            $projet->setCheminRepertoire (PROJET_CHEMIN_FICHIER) ;
660
            if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
673
            if (!$projet->enregistrerSQL($formulaire_projet->getSubmitValues())) {
661
                return 'erreur' ;
674
                return 'erreur' ;
662
            }
675
            }
663
            // On inscrit le déposant du projet en tant que coordinateur
676
            // On inscrit le deposant du projet en tant que coordinateur
664
            if (PROJET_UTILISATEURS_COORD) {
677
            if (PROJET_UTILISATEURS_COORD) {
665
		        // Si le projet n'a pas de liste, on inscrit directement
678
		        // Si le projet n'a pas de liste, on inscrit directement
666
		        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
679
		        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
667
		        $participant = new participe($this->_db) ;
680
		        $participant = new participe($this->_db) ;
668
	            $participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
681
	            $participant->setStatut(1, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $projet->getId()) ;
Line 678... Line 691...
678
     * @return void
691
     * @return void
679
     * @access public
692
     * @access public
680
     */
693
     */
681
    function modifierProjet( )
694
    function modifierProjet( )
682
    {
695
    {
683
        // création de l'objet projet courant
696
        // creation de l'objet projet courant
684
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
697
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
685
        $projet = new projet ($this->_db, $this->_id_projet) ;
698
        $projet = new projet ($this->_db, $this->_id_projet) ;
686
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
699
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_V) ;
687
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
700
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
688
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
701
        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post', str_replace ('&amp;', '&', $this->_url->getURL())) ;
Line 917... Line 930...
917
            $nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
930
            $nom_repertoire = $document->enregistrerSQL($formulaire_repertoire->getSubmitValues(), $projet->getNomRepertoire()) ;
Line 918... Line 931...
918
 
931
 
919
            // La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
932
            // La creation du repertoire sur le disque, chemin / nom_repertoire_projet / id_repertoire
920
            $GLOBALS['log'] = '<br />chemin_upload:'.$chemin_upload.'<br />';
933
            $GLOBALS['log'] = '<br />chemin_upload:'.$chemin_upload.'<br />';
921
            $GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
934
            $GLOBALS['log'] .= '<br />mkdir('.PROJET_CHEMIN_FICHIER.$chemin_upload.$nom_repertoire.')<br />';
Line 922... Line 935...
922
            if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nom_repertoire)) {
935
            if (!mkdir (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.rtrim ($nom_repertoire, '/'))) {
923
 
936
 
924
                $document->suppressionSQL() ;
937
                $document->suppressionSQL() ;
925
                return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
938
                return $this->messageErreur(PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE).'<br />'.
Line 1526... Line 1539...
1526
					$tpl->setVariable('nom_projet', $projet->getTitre()) ;
1539
					$tpl->setVariable('nom_projet', $projet->getTitre()) ;
1527
					$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
1540
					$tpl->setVariable('lien', str_replace ('&amp;', '&', $this->_url->getURL())) ;
Line 1528... Line 1541...
1528
				
1541
				
1529
            		foreach ($tableau_coordinateur as $coordinateur) {
1542
            		foreach ($tableau_coordinateur as $coordinateur) {
-
 
1543
            			$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
1530
            			$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
1544
            			
1531
            		}
1545
            		}
1532
            		// On enleve la virgule finale
-
 
Line -... Line 1546...
-
 
1546
            		// On enleve la virgule finale
-
 
1547
            		
1533
            		$entetes['To'] = substr ($entetes['To'], 0, count ($entetes['To']) - 1);
1548
            		$entetes['To'] = substr ($entetes['To'], 0, -1);
1534
            		
1549
 
1535
            		// on envoie le mail
1550
            		// on envoie le mail
1536
            		$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($tpl->get()));
1551
            		$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($tpl->get()));
Line 1804... Line 1819...
1804
    function setPrive()
1819
    function setPrive()
1805
    {
1820
    {
1806
       $this->_prive = 1 ;
1821
       $this->_prive = 1 ;
1807
    } // end of member function exclure
1822
    } // end of member function exclure
Line -... Line 1823...
-
 
1823
 
-
 
1824
	/**
-
 
1825
	 * 	retourne une variable locale si la variable $_GET existe
-
 
1826
	 *  
-
 
1827
	 */
-
 
1828
	function traiterVariableGet($var, $valeur_par_defaut ='') {
-
 
1829
		if (isset($_GET[$var]) && $_GET[$var] != '') {
-
 
1830
			return $_GET[$var];
-
 
1831
		} else {
-
 
1832
			return $valeur_par_defaut;
1808
 
1833
		}
Line 1809... Line 1834...
1809
 
1834
	}
1810
 
1835
 
1811
    /**
1836
    /**
1812
     * Renvoie un message d'erreur, en fonction du code de l'erreur.
1837
     * Renvoie un message d'erreur, en fonction du code de l'erreur.
Line 1828... Line 1853...
1828
 
1853
 
-
 
1854
 
-
 
1855
 
-
 
1856
 
-
 
1857
} // end of projetControleur
-
 
1858
 
-
 
1859
class bouton {
-
 
1860
	static function toHTML($lien, $label, $id) {
-
 
1861
		return '<div id="bouton_'.$id.'" class="projet_bouton_action">' .
1829
 
1862
				'<a href="'.$lien.'"><img src="'.PROJET_CHEMIN_ICONES.$id.'.png" alt="'.$label.'" />'.$label.'</a></div>';