Subversion Repositories Applications.projet

Rev

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

Rev 347 Rev 389
Line 69... Line 69...
69
define ('PROJET_ENVOYER_UN_MAIL', 13) ;
69
define ('PROJET_ENVOYER_UN_MAIL', 13) ;
70
define ('PROJET_ENVOYER_UN_MAIL_V', 14) ;
70
define ('PROJET_ENVOYER_UN_MAIL_V', 14) ;
71
define ('PROJET_ACTION_MODIFIER_V', 15) ;
71
define ('PROJET_ACTION_MODIFIER_V', 15) ;
72
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
72
define ('PROJET_ACTION_NOUVELLE_LISTE', 16) ;
73
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
73
define ('PROJET_ACTION_NOUVELLE_LISTE_V', 17) ;
-
 
74
define ('PROJET_ACTION_MODIFIER_LISTE', 19) ;
-
 
75
define ('PROJET_ACTION_MODIFIER_LISTE_V', 20) ;
74
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
76
define ('PROJET_ACTION_S_INSCRIRE', 21) ;
75
define ('PROJET_ACTION_CREER_WIKI', 22) ;
77
define ('PROJET_ACTION_CREER_WIKI', 22) ;
76
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
78
define ('PROJET_ACTION_SUPPRIMER_WIKI', 23) ;
77
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
79
define ('PROJET_ACTION_CREER_WIKI_V', 24) ;
78
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
80
define ('PROJET_ACTION_SUPPRIMER_LISTE', 25) ;
Line 113... Line 115...
113
 
115
 
114
/** Constante pour les notifications
116
/** Constante pour les notifications
115
 * Messages envoyes par la systeme pour prevenir
117
 * Messages envoyes par la systeme pour prevenir
116
 * les utilisateurs de certaines action
118
 * les utilisateurs de certaines action
117
 */
119
 */
118
 
120
 
119
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
121
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
120
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
122
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
121
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet 
123
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet
122
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
124
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
123
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
125
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
Line 124... Line 126...
124
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD', 6);
126
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD', 6);
Line 204... Line 206...
204
	/**
206
	/**
205
     * parametre pour gere l appel a un service en rapport avec ajax
207
     * parametre pour gere l appel a un service en rapport avec ajax
206
     * @access private
208
     * @access private
207
     */
209
     */
208
	var $_service ;
210
	var $_service ;
209
	
211
 
210
    /**
212
    /**
211
     * Methode principale de la classe. Elle permet d'appeler les methodes du modules
213
     * Methode principale de la classe. Elle permet d'appeler les methodes du modules
212
     * projet en fonction de l'action.
214
     * projet en fonction de l'action.
213
     *
215
     *
214
     * @return string
216
     * @return string
215
     * @access public
217
     * @access public
216
     */
218
     */
Line 217... Line 219...
217
 
219
 
218
 
220
 
219
	
221
 
220
    function run( )
222
    function run( )
221
    {
223
    {
222
        // On teste en premier la presence d un appel vers un service
224
        // On teste en premier la presence d un appel vers un service
223
        if ($this->_service != '') {
225
        if ($this->_service != '') {
224
        	if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
226
        	if (file_exists(PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php')) {
225
                return include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
227
                return include_once PROJET_CHEMIN_APPLI.'services/'.$this->_service.'.php' ;
226
            }
228
            }
227
        }
229
        }
228
        
230
 
229
        if ($this->_action == '') {
231
        if ($this->_action == '') {
Line 230... Line 232...
230
            return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
232
            return $this->messageErreur(PROJETCONTROLEUR_ACTION_INVALIDE) ;
Line 296... Line 298...
296
            case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
298
            case PROJET_ACTION_NOUVELLE_LISTE : $retour .= $this->formulaireListe(PROJET_ACTION_NOUVELLE_LISTE) ;
297
            break ;
299
            break ;
298
            case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
300
            case PROJET_ACTION_NOUVELLE_LISTE_V : $retour .= $this->nouvelleListeValidation() ;
299
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
301
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
300
            break ;
302
            break ;
-
 
303
           	case PROJET_ACTION_MODIFIER_LISTE : $retour .= $this->formulaireModificationListe($this->_id_projet) ;
-
 
304
            break ;
-
 
305
            case PROJET_ACTION_MODIFIER_LISTE_V : $retour .= $this->modifierListeValidation($this->_id_projet) ;
-
 
306
                $this->_action = PROJET_ACTION_VOIR_FORUM ;
-
 
307
            break ;
301
            case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
308
            case PROJET_ACTION_SUPPRIMER_LISTE : $retour .= $this->supprimerListe() ;
302
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
309
                $this->_action = PROJET_ACTION_VOIR_RESUME ;
303
            break ;
310
            break ;
304
            case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
311
            case PROJET_MODIFIER_DESCRIPTION : $retour .= $this->formulaireProjet(PROJET_MODIFIER_DESCRIPTION_V) ;
305
            break ;
312
            break ;
Line 406... Line 413...
406
      // Les entetes des tableaux
413
      // Les entetes des tableaux
407
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
414
        $tableau_label_statut_action = array (PROJET_GERER, PROJET_GERER, PROJET_GERER_FICHIER, PROJET_VOIR_FICHIER, "---") ;
Line 408... Line 415...
408
 
415
 
409
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
416
        $auth = $this->_auth->getAuth() ;                       // Pour raccourcir le code
410
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
417
        $id_u = $this->_auth->getAuthData(PROJET_CHAMPS_ID) ;   // --------------
411
		
418
 
412
		return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
419
		return include_once PROJET_CHEMIN_APPLI.'presentation/'.$this->_presentation.'.php' ;
413
		
420
 
Line 414... Line 421...
414
    }
421
    }
415
 
422
 
416
    /**
423
    /**
Line 466... Line 473...
466
            $res .= $label_statut.'</h2>'."\n" ;
473
            $res .= $label_statut.'</h2>'."\n" ;
Line 467... Line 474...
467
 
474
 
468
        } else {
475
        } else {
469
            if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
476
            if ($this->_id_projet != '') $res .= '<h2>'.$label_statut.'</h2>'."\n" ;
470
        }
477
        }
471
        
478
 
472
        if ($this->_id_projet != '') {
479
        if ($this->_id_projet != '') {
473
        	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
480
        	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
474
        	$projet = new projet ($this->_db, $this->_id_projet) ;
481
        	$projet = new projet ($this->_db, $this->_id_projet) ;
475
			// Participant
482
			// Participant
476
			if (!$isEnAttente) {
483
			if (!$isEnAttente) {
477
				$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
484
				$res .= '<ul id ="projet_groupe_niv1"><li class="projet_niv1">'.PROJET_CONTRIBUTEUR ;
478
				$res .= '<ul id="projet_groupe_niv2_con">' ;
485
				$res .= '<ul id="projet_groupe_niv2_con">' ;
479
			}		
486
			}
480
	        if ($isCoord || $isContri) {
487
	        if ($isCoord || $isContri) {
481
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
488
	        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_DESINSCRIPTION_PROJET) ;
482
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
489
	        	$res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_SE_DESINSCRIRE."</a></li>\n" ;
483
	        } else {
490
	        } else {
Line 489... Line 496...
489
	        if ($isCoord || $isAdm) {
496
	        if ($isCoord || $isAdm) {
490
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
497
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_VOIR_PARTICIPANT) ;
491
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
498
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_GESTION_UTILISATEUR."</a></li>\n" ;
492
	        }
499
	        }
493
	        $res .= '</ul></li>' ;
500
	        $res .= '</ul></li>' ;
494
	        
501
 
495
	        //document
502
	        //document
496
	        if ($isContri || $isCoord || $isAdm) {
503
	        if ($isContri || $isCoord || $isAdm) {
497
		        
504
 
498
		        // On ajoute l id d un repertoire s il existe
505
		        // On ajoute l id d un repertoire s il existe
499
		        if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
506
		        if (isset($this->_id_repertoire)) $this->_url->addQueryString ('id_repertoire', $this->_id_repertoire);
500
		        $res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
507
		        $res .= '<li class="projet_niv2">'.PROJET_DOCUMENT ;
501
		        // L'action "Mettre un fichier en ligne"
508
		        // L'action "Mettre un fichier en ligne"
502
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
509
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_FICHIER) ;
503
		        $res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
510
		        $res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_METTRE_FICHIER."</a></li>\n" ;
504
		
511
 
505
		        // L'action creer un repertoire
512
		        // L'action creer un repertoire
506
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
513
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU_REPERTOIRE) ;
507
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
514
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_CREER_REP."</a></li>\n" ;
508
				$res .= '</ul></li>' ;
515
				$res .= '</ul></li>' ;
509
	        
516
 
510
	        	$this->_url->removeQueryString('id_repertoire');
517
	        	$this->_url->removeQueryString('id_repertoire');
511
				// Forum 
518
				// Forum
512
				$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
519
				$res .= '<li class="projet_niv1">'.PROJET_FORUM ;
513
				$res .= '<ul id="projet_groupe_niv2_for">' ;
520
				$res .= '<ul id="projet_groupe_niv2_for">' ;
514
				if ($projet->avoirListe()) {
521
				if ($projet->avoirListe()) {
515
					
522
 
516
					// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
523
					// On verifie si l'utilisateur est inscrit ou non a la liste et on ajoute le lien
517
		            //$projet->getListesAssociees();
524
		            //$projet->getListesAssociees();
518
		
525
 
519
		            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
526
		            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php';
520
		            include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
527
		            include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
521
		            foreach ($projet->_listes_associes as $info_liste) {
528
		            foreach ($projet->_listes_associes as $info_liste) {
522
						
529
 
523
						$listes_ext = new liste_externe ($this->_db) ;
530
						$listes_ext = new liste_externe ($this->_db) ;
524
						$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
531
						$tableau_liste = $listes_ext->getListesAssociees($this->_id_projet) ;
525
						if (count ($tableau_liste) == 0) {
532
						if (count ($tableau_liste) == 0) {
526
			                $inscription_liste = new inscription_liste($this->_db) ;
533
			                $inscription_liste = new inscription_liste($this->_db) ;
527
			                if ($inscription_liste->getStatutInscrit($info_liste->getId(),  $this->_auth) == 0) {
534
			                if ($inscription_liste->getStatutInscrit($info_liste->getId(),  $this->_auth) == 0) {
Line 543... Line 550...
543
		                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
550
		                $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_SUPPRIMER_LISTE) ;
544
		                $texte_liste = PROJET_SUPPRIMER_LISTE ;
551
		                $texte_liste = PROJET_SUPPRIMER_LISTE ;
545
		                $onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
552
		                $onclic = ' onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_LISTE_CONFIRMATION.'\');"' ;
546
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
553
		                $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"'.$onclic.'>'.$texte_liste.'</a></li>'."\n" ;
547
		            }
554
		            }
548
		            
555
 
549
				} else {
556
				} else {
550
					if ($isAdm || $isCoord) {
557
					if ($isAdm || $isCoord) {
551
			        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
558
			        	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_NOUVELLE_LISTE) ;
552
		                $texte_liste = PROJET_CREER_LISTE ;
559
		                $texte_liste = PROJET_CREER_LISTE ;
553
		                $onclic = '' ;
560
		                $onclic = '' ;
Line 555... Line 562...
555
					}
562
					}
556
				}
563
				}
557
				if ($isAdm) {
564
				if ($isAdm) {
558
					$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
565
					$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_REFERENCER_LISTE) ;
559
			        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
566
			        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_REFERENCER_LISTE.'</a></li>'."\n" ;
560
					
567
 
561
				}
568
				}
562
				$res .= '</ul></li>' ;
569
				$res .= '</ul></li>' ;
563
	        }
570
	        }
564
			// Gestion projet
571
			// Gestion projet
565
			if ($isCoord || $isAdm) {
572
			if ($isCoord || $isAdm) {
Line 567... Line 574...
567
				$res .= '<ul id="projet_group_niv2_ges">' ;
574
				$res .= '<ul id="projet_group_niv2_ges">' ;
568
				// L'action modifier les proprietes du projet
575
				// L'action modifier les proprietes du projet
569
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
576
	            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_DESCRIPTION) ;
570
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
577
	            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_MODIFIER_PROPRIETES."</a></li>\n" ;
571
	            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
578
	            if ($isAdm || (PROJET_UTILISATEURS_COORD && $isCoord)) {
-
 
579
 
-
 
580
		            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_MODIFIER_LISTE) ;
-
 
581
		            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'"> Modifier la visibilité de la liste </a></li>'."\n" ;
-
 
582
		            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
-
 
583
 
572
		            $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
584
		            $this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
573
		            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
585
		            $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
574
		            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
586
		            $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
575
		            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
587
		            $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
576
		            
588
 
577
		                // L'action supprimer le projet
589
		                // L'action supprimer le projet
578
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
590
                    $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_SUPPRESSION_PROJET) ;
579
                    $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
591
                    $this->_url->addQueryString(PROJET_VARIABLE_ID_PROJET, $this->_id_projet) ;
580
                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
592
                    $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'" onclick="javascript:return confirm(\''.PROJET_SUPPRIMER_PROJET_CONFIRMATION.'\');">'
581
                                .PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
593
                                .PROJET_SUPPRIMER_LE_PROJET."</a></li>\n" ;
582
		        }
594
		        }
583
	            $res .= '</ul></li>' ;
595
	            $res .= '</ul></li>' ;
584
			}
596
			}
585
			
597
 
586
			// Wikini
598
			// Wikini
587
			if ($isAdm) {
599
			if ($isAdm) {
588
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
600
				$res .= '<li class="projet_niv1">'.PROJET_WIKINI ;
589
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
601
	           	$this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_CREER_WIKI) ;
590
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
602
	           	$res .= '<ul><li class="projet_niv2"><a href="'.$this->_url->getURL()."\">".PROJET_CREER_WIKI."</a></li>\n" ;
Line 600... Line 612...
600
      			$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
612
      			$this->_url->removeQueryString (PROJET_VARIABLE_ID_PROJET) ;
601
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
613
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_NOUVEAU) ;
602
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
614
		        $res .= '<li class="projet_niv2"><a href="'.$this->_url->getURL().'">'.PROJET_NOUVEAU_PROJET.'</a></li>'."\n" ;
603
		        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
615
		        $this->_url->removeQueryString(PROJET_VARIABLE_ACTION) ;
604
		        $res .= '</ul></li>' ;
616
		        $res .= '</ul></li>' ;
605
        	}	
617
        	}
606
        }
618
        }
607
        $res .= '</ul>' ;
619
        $res .= '</ul>' ;
608
        $res .= "</div>\n" ;
620
        $res .= "</div>\n" ;
609
        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
621
        $this->_url->removeQueryString (PROJET_VARIABLE_ACTION) ;
610
        $vues = array (PROJET_ACTION_VOIR_RESUME, PROJET_ACTION_VOIR_DESCRIPTION, PROJET_ACTION_VOIR_WIKINI, PROJET_ACTION_VOIR_FORUM, PROJET_ACTION_VOIR_PARTICIPANT);
622
        $vues = array (PROJET_ACTION_VOIR_RESUME, PROJET_ACTION_VOIR_DESCRIPTION, PROJET_ACTION_VOIR_WIKINI, PROJET_ACTION_VOIR_FORUM, PROJET_ACTION_VOIR_PARTICIPANT);
Line 621... Line 633...
621
    function formulaireProjet($action)
633
    function formulaireProjet($action)
622
    {
634
    {
623
	    	if (!$this->_auth->getAuth()) {
635
	    	if (!$this->_auth->getAuth()) {
624
	    		return PROJET_TEXTE_NON_IDENTIFIE;
636
	    		return PROJET_TEXTE_NON_IDENTIFIE;
625
	    	}
637
	    	}
626
	    	
638
 
627
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
639
	    	if (fileperms(PROJET_CHEMIN_FICHIER) & 0x0002) {
628
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
640
		        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, $action) ;
629
		        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
641
		        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireProjet.class.php' ;
630
		        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
642
		        $formulaire_projet = new HTML_formulaireProjet('formulaire_projet', 'post',str_replace ("&amp;", "&", $this->_url->getURL())) ;
631
		        $tableau_type = '' ;
643
		        $tableau_type = '' ;
632
		        if (PROJET_UTILISE_TYPE) {
644
		        if (PROJET_UTILISE_TYPE) {
633
		            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
645
		            include_once PROJET_CHEMIN_CLASSES.'projet_type.class.php' ;
634
		            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
646
		            $tableau_type = projet_type::getTousLesTypes($this->_db) ;
635
		        }
647
		        }
636
		        
648
 
637
		        /** recuperation des themes */
649
		        /** recuperation des themes */
638
		        include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
650
		        include_once PROJET_CHEMIN_CLASSES.'projet_theme.class.php';
639
		        $tableau_theme = projet_theme::getTousLesThemes($this->_db);
651
		        $tableau_theme = projet_theme::getTousLesThemes($this->_db);
640
		        
652
 
641
		        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
653
		        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
642
		        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
654
		        $formulaire_projet->construitFormulaire(projet::getTousLesProjets($this->_db), $tableau_type, $tableau_theme);
643
		        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
655
		        if ($action == PROJET_MODIFIER_DESCRIPTION_V) {
644
		            $projet = new projet($this->_db, $this->_id_projet) ;
656
		            $projet = new projet($this->_db, $this->_id_projet) ;
645
		            
657
 
646
		            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
658
		            $valeurs_par_defaut = array (   'projet_titre' => $projet->getTitre(),
647
		                                            'projet_description' => $projet->getDescription(),
659
		                                            'projet_description' => $projet->getDescription(),
648
		                                            'projet_asso' => $projet->getIdPere(),
660
		                                            'projet_asso' => $projet->getIdPere(),
649
		                                            'projet_wikini' => $projet->getWikini(),
661
		                                            'projet_wikini' => $projet->getWikini(),
650
		                                            'projet_resume' => $projet->getResume(),
662
		                                            'projet_resume' => $projet->getResume(),
651
		                                            'projet_espace_internet' => $projet->getEspaceInternet(),
663
		                                            'projet_espace_internet' => $projet->getEspaceInternet(),
652
		                                            'projet_type'=> $projet->getType(),
664
		                                            'projet_type'=> $projet->getType(),
653
		                                            'projet_moderation' => $projet->isModere(),
665
		                                            'projet_moderation' => $projet->isModere(),
654
		                                        ) ;
666
		                                        ) ;
655
					
667
 
656
		            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
668
		            $formulaire_projet->setDefaults($valeurs_par_defaut) ;
657
		            $themes = $projet->getThemes();
669
		            $themes = $projet->getThemes();
658
		            foreach ($themes as $cle => $valeur) {
670
		            foreach ($themes as $cle => $valeur) {
659
		            	$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
671
		            	$element = $formulaire_projet->getElement('projet_theme['.$cle.']');
660
		            	if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
672
		            	if (PEAR::isError($element)) return $element->getMessage().' projet_theme['.$cle.']';
661
		            	$element->setChecked(true);
673
		            	$element->setChecked(true);
662
		            }
674
		            }
663
		        } else {
675
		        } else {
664
		        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;	
676
		        	$formulaire_projet->setDefaults (array ('projet_moderation'=> '0')) ;
665
		        }
677
		        }
666
		        $res = PROJET_PROPOSER_PROJET ;
678
		        $res = PROJET_PROPOSER_PROJET ;
667
		        return $res . $formulaire_projet->toHTML() ;
679
		        return $res . $formulaire_projet->toHTML() ;
668
	    	} else {
680
	    	} else {
669
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
681
	    		return 'Veuillez r&eacute;gler les permissions en &eacute;criture sur '.PROJET_CHEMIN_FICHIER ;
Line 804... Line 816...
804
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
816
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
805
        $projet = new projet ($this->_db, $this->_id_projet) ;
817
        $projet = new projet ($this->_db, $this->_id_projet) ;
806
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
818
        $document = new document($this->_id_document, $this->_db, PROJET_CHEMIN_FICHIER) ;
807
        $document->suppression() ;
819
        $document->suppression() ;
808
        $document->suppressionSQL() ;
820
        $document->suppressionSQL() ;
809
        
821
 
810
        // On verifie s il reste des documents associes au projet et si non on met 
822
        // On verifie s il reste des documents associes au projet et si non on met
811
        // a jour projet.p_avoir_document
823
        // a jour projet.p_avoir_document
812
        if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false); 
824
        if (count ($projet->getListesDocuments(PROJET_CHEMIN_FICHIER)) == 0) $projet->setAvoirDocument(false);
813
        
825
 
814
        $this->_url->removeQueryString(PROJET_VARIABLE_ID_DOCUMENT);
826
        $this->_url->removeQueryString(PROJET_VARIABLE_ID_DOCUMENT);
815
        return ;
827
        return ;
Line 816... Line 828...
816
 
828
 
Line 867... Line 879...
867
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
879
            $chemin_upload = $document->calculeCheminUploaded($projet->getNomRepertoire()) ;
868
			//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
880
			//$GLOBALS['log'] .= '<br>chemin_upload: '.$chemin_upload.'<br>';
869
			//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
881
			//$GLOBALS['log'] .= 'projet->getRepertoire() : '.$projet->getNomRepertoire().'<br>';
870
			$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
882
			$id_document = SQL_obtenirNouveauId($this->_db, 'projet_documents', 'pd_id') ;
871
			$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
883
			$nouveau_nom = $document->genereNouveauNom($projet->getNomRepertoire(), $_FILES['fichier']['name'], $id_document);
872
			
884
 
873
            if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
885
            if (!$document->upload (PROJET_CHEMIN_FICHIER.$chemin_upload.'/'.$nouveau_nom)) {
874
                return 'Echec de l\'upload<br />'.
886
                return 'Echec de l\'upload<br />'.
875
                		'Fichier source : '. $_FILES['fichier']['name'];
887
                		'Fichier source : '. $_FILES['fichier']['name'];
876
                		'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
888
                		'Fichier destination : '.PROJET_CHEMIN_FICHIER.$projet->getNomRepertoire().'/'.$chemin_upload.'/'.$nouveau_nom ;
877
            }
889
            }
Line 878... Line 890...
878
 
890
 
879
            $document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
891
            $document->enregistrerSQL($formulaire_document->getSubmitValues(), $nouveau_nom);
880
            // On place a 1 la colonne p_avoir_document
892
            // On place a 1 la colonne p_avoir_document
881
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
893
            if (!$projet->avoirDocument()) $projet->setAvoirDocument(true);
882
            
894
 
883
            // On ajoute une information de session
895
            // On ajoute une information de session
884
            $_SESSION['formulaire_document'] = 'valide';
896
            $_SESSION['formulaire_document'] = 'valide';
885
            
897
 
886
            // Pour notification coordinateur
898
            // Pour notification coordinateur
887
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
899
            include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
888
        	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
900
        	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
889
							'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
901
							'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
890
							'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
902
							'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
891
            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
903
            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
892
            $this->notifierCoordinateurs(PROJET_NOTIFICATION_NOUVEAU_DOC, $utilisateur);
904
            $this->notifierCoordinateurs(PROJET_NOTIFICATION_NOUVEAU_DOC, $utilisateur);
Line 1033... Line 1045...
1033
     * @access public
1045
     * @access public
1034
     */
1046
     */
1035
    function envoyerUnMailFormulaire( )
1047
    function envoyerUnMailFormulaire( )
1036
    {
1048
    {
1037
    	if (!$this->_auth->getAuth()) {
1049
    	if (!$this->_auth->getAuth()) {
1038
    		return PROJET_LISTE_PROJET;	
1050
    		return PROJET_LISTE_PROJET;
1039
    	}
1051
    	}
1040
    	if (isset($_SESSION['formulaire_mail'])) {
1052
    	if (isset($_SESSION['formulaire_mail'])) {
1041
            unset ($_SESSION['formulaire_mail']) ;
1053
            unset ($_SESSION['formulaire_mail']) ;
1042
        }
1054
        }
1043
        $res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
1055
        $res = '<h1>'.PROJET_ECRIRE_LISTE.'</h1>'."\n" ;
Line 1058... Line 1070...
1058
    {
1070
    {
1059
        // Verifications
1071
        // Verifications
1060
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1072
        if (isset($_SESSION['formulaire_mail']) && $_SESSION['formulaire_mail'] == 'valide') {
1061
            return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1073
            return include_once PROJET_CHEMIN_APPLI.'actions/forums.php' ;
1062
        }
1074
        }
1063
        
1075
 
1064
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1076
        $this->_url->addQueryString (PROJET_VARIABLE_ACTION, PROJET_ENVOYER_UN_MAIL_V );
1065
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1077
        include_once PROJET_CHEMIN_CLASSES.'HTML_formulaireMail.class.php' ;
1066
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1078
        $formulaire_mail = new HTML_formulaireMail('formulaire_mail', 'post', preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1067
        $formulaire_mail->construitFormulaire() ;
1079
        $formulaire_mail->construitFormulaire() ;
1068
        if ($formulaire_mail->validate()) {
1080
        if ($formulaire_mail->validate()) {
Line 1109... Line 1121...
1109
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1121
        $formulaire_liste = new HTML_formulaireListe('formulaire_liste', 'post',preg_replace ("/&amp;/", "&", $this->_url->getURL())) ;
1110
        $formulaire_liste->construitFormulaire() ;
1122
        $formulaire_liste->construitFormulaire() ;
1111
        $formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
1123
        $formulaire_liste->setDefaults(array('domaine_liste' => PROJET_DOMAINE_LISTE)) ;
1112
        $formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
1124
        $formulaire_liste->updateElementAttr('domaine_liste', array('readonly' => 'readonly')) ;
1113
        return $res.$formulaire_liste->toHTML() ;
1125
        return $res.$formulaire_liste->toHTML() ;
1114
    } 
1126
    }
-
 
1127
 
-
 
1128
    function formulaireModificationListe($id_projet) {
-
 
1129
 
-
 
1130
    	include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
-
 
1131
		$projet = new projet ($this->_db, $this->_id_projet) ;
-
 
1132
 
-
 
1133
		$projet->getListesAssociees();
-
 
1134
		//var_dump($projet);
-
 
1135
		$liste_visible = $projet->_listes_associes[0]->getVisibilite();
-
 
1136
 
-
 
1137
    	$res = '<h1> Modification de la visibilité de la liste </h1><br />'."\n" ;
-
 
1138
        $this->_url->addQueryString(PROJET_VARIABLE_ACTION, PROJET_ACTION_MODIFIER_LISTE_V) ;
-
 
1139
        $res .= '<form action="'.$this->_url->getURL().'" method="post">'.
-
 
1140
        '<label for="liste_visible">Visibilité de la liste </label><input type="checkbox" name="liste_visible" id="liste_visible"';
-
 
1141
		if($liste_visible == 1) {
-
 
1142
			$res .= ' checked="checked" ';
-
 
1143
		}
-
 
1144
 		$res .= ' /> <br /><br />'.
-
 
1145
        '<input type="submit" value="valider" /> '.
-
 
1146
        '</form>';
-
 
1147
 
-
 
1148
		return $res;
-
 
1149
    }
Line 1115... Line 1150...
1115
 
1150
 
1116
    /**
1151
    /**
1117
     * Transmet au serveur la demande de creation d'une nouvelle liste.
1152
     * Transmet au serveur la demande de creation d'une nouvelle liste.
1118
     *
1153
     *
Line 1161... Line 1196...
1161
        } else {
1196
        } else {
1162
            return $formulaire_liste->toHTML() ;
1197
            return $formulaire_liste->toHTML() ;
1163
        }
1198
        }
1164
    } // end of member function nouvelleListeValidation
1199
    } // end of member function nouvelleListeValidation
Line -... Line 1200...
-
 
1200
 
-
 
1201
    function modifierListeValidation($id_projet) {
-
 
1202
 
-
 
1203
        if(isset($_POST['liste_visible'])) {
-
 
1204
			$visibilite = true;
-
 
1205
        } else {
-
 
1206
        	$visibilite = false;
-
 
1207
        }
-
 
1208
 
-
 
1209
		$projet->getListesAssociees();
-
 
1210
		$id_liste = $projet->_listes_associes[0]->getId();
-
 
1211
		$projet->majSQLVisibilite($id_projet,$visibilite);
-
 
1212
 
-
 
1213
		return true;
-
 
1214
    }
1165
 
1215
 
1166
    /**
1216
    /**
1167
     * Supprime la liste de discussion associee au projet
1217
     * Supprime la liste de discussion associee au projet
1168
     *
1218
     *
1169
     * @return void
1219
     * @return void
Line 1220... Line 1270...
1220
 
1270
 
1221
        // Si le projet n'a pas de liste, on inscrit directement
1271
        // Si le projet n'a pas de liste, on inscrit directement
1222
        if (isset ($this->_id_projet)) {
1272
        if (isset ($this->_id_projet)) {
1223
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1273
            include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1224
            $participant = new participe($this->_db) ;
1274
            $participant = new participe($this->_db) ;
1225
			
1275
 
1226
			// On controle si la liste est externe (yahoo) auquel cas on ne presente pas l inscription
1276
			// On controle si la liste est externe (yahoo) auquel cas on ne presente pas l inscription
1227
			include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1277
			include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php' ;
1228
			$liste_ext = new liste_externe($this->_db);
1278
			$liste_ext = new liste_externe($this->_db);
1229
			$listes = $liste_ext->getListesAssociees($this->_id_projet);
1279
			$listes = $liste_ext->getListesAssociees($this->_id_projet);
Line 1238... Line 1288...
1238
			}
1288
			}
1239
            if (!$projet->avoirListe() || $avoir_liste_externe) {
1289
            if (!$projet->avoirListe() || $avoir_liste_externe) {
1240
            	if ($projet->isModere()) {
1290
            	if ($projet->isModere()) {
1241
                	$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1291
                	$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1242
            	} else {
1292
            	} else {
1243
            		$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;     		 
1293
            		$participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1244
            		$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
1294
            		$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte'.$msg.'</p>';
1245
            	}
1295
            	}
1246
            	$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
1296
            	$message_retour = '<p class="information">Votre inscription a bien &eacute;t&eacute; prise en compte. '.$msg.'</p>';
1247
    			include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1297
    			include_once PROJET_CHEMIN_APPLI.'actions/resume.php' ;
1248
    			return $retour;
1298
    			return $retour;
1249
            }
1299
            }
1250
        }
1300
        }
1251
        if (isset($_POST['valider_inscription_projet'])) {
1301
        if (isset($_POST['valider_inscription_projet'])) {
1252
            if (isset($_POST['radio_inscription_liste'])) {
1302
            if (isset($_POST['radio_inscription_liste'])) {
1253
            	include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1303
            	include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1254
            	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
1304
            	$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
1255
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1305
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1256
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1306
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1257
	            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1307
	            $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1258
            
1308
 
1259
            	if (!$projet->isModere()) {
1309
            	if (!$projet->isModere()) {
1260
	                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1310
	                $participant->setStatut(2, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1261
	                
1311
 
1262
	                if ($_POST['radio_inscription_liste'] == 2) {
1312
	                if ($_POST['radio_inscription_liste'] == 2) {
1263
		                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1313
		                include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1264
		                $projet->getListesAssociees() ;
1314
		                $projet->getListesAssociees() ;
1265
		                $inscription_liste = new inscription_liste($this->_db) ;
1315
		                $inscription_liste = new inscription_liste($this->_db) ;
1266
		                $inscription_liste->inscrireUtilisateur( $utilisateur,
1316
		                $inscription_liste->inscrireUtilisateur( $utilisateur,
Line 1268... Line 1318...
1268
	                                                        $_POST['radio_inscription_liste']) ;
1318
	                                                        $_POST['radio_inscription_liste']) ;
1269
	                }
1319
	                }
1270
                    $this->notifierCoordinateurs(PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE, $utilisateur);
1320
                    $this->notifierCoordinateurs(PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE, $utilisateur);
1271
            	} else {
1321
            	} else {
1272
            		$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1322
            		$participant->setStatut(3, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1273
            		
1323
 
1274
            		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DEMANDE_INSCRIPTION, $utilisateur);
1324
            		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DEMANDE_INSCRIPTION, $utilisateur);
1275
            	}
1325
            	}
1276
            }
1326
            }
Line 1277... Line 1327...
1277
 
1327
 
Line 1350... Line 1400...
1350
    function desinscriptionProjet( )
1400
    function desinscriptionProjet( )
1351
    {
1401
    {
1352
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1402
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
1353
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1403
        include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
1354
        $participant = new participe($this->_db) ;
1404
        $participant = new participe($this->_db) ;
1355
		$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID, 
1405
		$utilisateur = new annuaire($this->_db, array('identifiant' => PROJET_CHAMPS_ID,
1356
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1406
								'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE,
1357
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1407
								'nom'=> PROJET_CHAMPS_NOM, 'prenom' => PROJET_CHAMPS_PRENOM)) ;
1358
	    $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1408
	    $utilisateur->setId($this->_auth->getAuthData(PROJET_CHAMPS_ID)) ;
1359
	    
1409
 
1360
        // Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
1410
        // Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
1361
        $participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1411
        $participant->setStatut(4, $this->_auth->getAuthData (PROJET_CHAMPS_ID), $this->_id_projet) ;
1362
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1412
        include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1363
        $projet = new projet ($this->_db, $this->_id_projet) ;
1413
        $projet = new projet ($this->_db, $this->_id_projet) ;
1364
        $projet->getListesAssociees() ;
1414
        $projet->getListesAssociees() ;
Line 1369... Line 1419...
1369
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1419
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1370
            $desinscription= new inscription_liste($this->_db) ;
1420
            $desinscription= new inscription_liste($this->_db) ;
1371
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1421
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1372
        }
1422
        }
1373
        $this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
1423
        $this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
1374
        
1424
 
1375
        // On verifie si l utilisateur est le dernier coordinateur
1425
        // On verifie si l utilisateur est le dernier coordinateur
1376
        // auquel cas on previent les administrateurs
1426
        // auquel cas on previent les administrateurs
1377
        if ($participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db)) {
1427
        if ($participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db)) {
1378
        	$coord = $participant->getCoordinateurs($this->_id_projet);
1428
        	$coord = $participant->getCoordinateurs($this->_id_projet);
1379
        	if (count($coord) == 0) {
1429
        	if (count($coord) == 0) {
1380
        		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $utilisateur);
1430
        		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $utilisateur);
1381
        	}
1431
        	}
1382
        }
1432
        }
1383
        // 
1433
        //
1384
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
1434
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
1385
        $liste_ext = new liste_externe($this->_db);
1435
        $liste_ext = new liste_externe($this->_db);
1386
		$listes = $liste_ext->getListesAssociees($this->_id_projet);
1436
		$listes = $liste_ext->getListesAssociees($this->_id_projet);
1387
		
1437
 
1388
		$msg = '';
1438
		$msg = '';
1389
		if (count ($listes) != 0) {
1439
		if (count ($listes) != 0) {
1390
			$info_liste = $liste_ext->getInfoListe($listes[0]);
1440
			$info_liste = $liste_ext->getInfoListe($listes[0]);
1391
			$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
1441
			$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
1392
			$msg .= ' Vous pouvez le faire en <a href="mailto:';
1442
			$msg .= ' Vous pouvez le faire en <a href="mailto:';
Line 1578... Line 1628...
1578
       $this->_prive = 1 ;
1628
       $this->_prive = 1 ;
1579
    } // end of member function exclure
1629
    } // end of member function exclure
Line 1580... Line 1630...
1580
 
1630
 
1581
	/**
1631
	/**
1582
	 * 	retourne une variable locale si la variable $_GET existe
1632
	 * 	retourne une variable locale si la variable $_GET existe
1583
	 *  
1633
	 *
1584
	 */
1634
	 */
1585
	function traiterVariableGet($var, $valeur_par_defaut ='') {
1635
	function traiterVariableGet($var, $valeur_par_defaut ='') {
1586
		if (isset($_GET[$var]) && $_GET[$var] != '') {
1636
		if (isset($_GET[$var]) && $_GET[$var] != '') {
1587
			return $_GET[$var];
1637
			return $_GET[$var];
Line 1605... Line 1655...
1605
                    PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
1655
                    PROJETCONTROLEUR_PAS_DE_DOCUMENT_SELECTIONNE => 'Pas de fichier s&eacute;lectionn&eacute;',
1606
                    PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
1656
                    PROJETCONTROLEUR_ERREUR_CREATION_REPERTOIRE => 'Impossible de cr&eacute;er le r&eacute;pertoire'
1607
        ) ;
1657
        ) ;
1608
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1658
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1609
    } // end of member function messageErreur
1659
    } // end of member function messageErreur
1610
	
1660
 
1611
	/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
1661
	/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
1612
	 *  Lorsqu un projet n a plus de coordinateur, la notification est
1662
	 *  Lorsqu un projet n a plus de coordinateur, la notification est
1613
	 *  envoyee aux administrateurs
1663
	 *  envoyee aux administrateurs
1614
	 * 
1664
	 *
1615
	 */
1665
	 */
Line 1616... Line 1666...
1616
 
1666
 
1617
	function notifierCoordinateurs ($notification, $utilisateur) {
1667
	function notifierCoordinateurs ($notification, $utilisateur) {
1618
		
1668
 
1619
		include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php';
1669
		include_once PROJET_CHEMIN_CLASSES.'projetTemplate.class.php';
1620
		
1670
 
1621
		switch ($notification) {
1671
		switch ($notification) {
1622
			case PROJET_NOTIFICATION_DEMANDE_INSCRIPTION : 
1672
			case PROJET_NOTIFICATION_DEMANDE_INSCRIPTION :
1623
				$sujet = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET;
1673
				$sujet = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_SUJET;
1624
				$corps = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS;
1674
				$corps = PROJET_TEMPLATE_DEMANDE_INSCRIPTION_CORPS;
1625
			break;
1675
			break;
1626
			case PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE :
1676
			case PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE :
Line 1637... Line 1687...
1637
			break;
1687
			break;
1638
			case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD:
1688
			case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD:
1639
				$sujet = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET;
1689
				$sujet = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET;
1640
				$corps = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS;
1690
				$corps = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS;
1641
			break;
1691
			break;
1642
	
1692
 
1643
		}
1693
		}
1644
		
1694
 
1645
		include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1695
		include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
1646
        $projet = new projet ($this->_db, $this->_id_projet) ;
1696
        $projet = new projet ($this->_db, $this->_id_projet) ;
1647
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
1697
        include_once PROJET_CHEMIN_CLASSES.'participe.class.php';
1648
		$participant = new participe($this->_db) ;
1698
		$participant = new participe($this->_db) ;
1649
		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
1699
		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
1650
		
1700
 
1651
		$objet_mail =& Mail::factory('smtp');
1701
		$objet_mail =& Mail::factory('smtp');
1652
		
1702
 
1653
		$modele = new projetTemplate($GLOBALS['projet_db']);
1703
		$modele = new projetTemplate($GLOBALS['projet_db']);
Line 1654... Line 1704...
1654
 
1704
 
1655
		$sujet_mail = $modele->getTemplate($sujet, PROJET_LANGUE_DEFAUT);
1705
		$sujet_mail = $modele->getTemplate($sujet, PROJET_LANGUE_DEFAUT);
1656
		$corps_mail = $modele->getTemplate($corps, PROJET_LANGUE_DEFAUT);
1706
		$corps_mail = $modele->getTemplate($corps, PROJET_LANGUE_DEFAUT);
1657
		
1707
 
1658
	    if (PEAR::isError($sujet_mail)) $sujet_mail->raiseError ($sujet_mail->getMessage().'<br />'.$sujet_mail->getDebugInfo());
1708
	    if (PEAR::isError($sujet_mail)) $sujet_mail->raiseError ($sujet_mail->getMessage().'<br />'.$sujet_mail->getDebugInfo());
1659
	    
1709
 
1660
	    $corps_mail = str_replace ('{nom}', $utilisateur->getInfo( 'nom'), $corps_mail);
1710
	    $corps_mail = str_replace ('{nom}', $utilisateur->getInfo( 'nom'), $corps_mail);
1661
	    $corps_mail = str_replace ('{prenom}', $utilisateur->getInfo( 'prenom'), $corps_mail);
1711
	    $corps_mail = str_replace ('{prenom}', $utilisateur->getInfo( 'prenom'), $corps_mail);
1662
	    $corps_mail = str_replace ('{nom_projet}', $projet->getTitre(), $corps_mail);
1712
	    $corps_mail = str_replace ('{nom_projet}', $projet->getTitre(), $corps_mail);
1663
	    $corps_mail = str_replace ('{lien}', str_replace ('&amp;', '&', $this->_url->getURL()), $corps_mail);
1713
	    $corps_mail = str_replace ('{lien}', str_replace ('&amp;', '&', $this->_url->getURL()), $corps_mail);
1664
		
1714
 
1665
		$entetes['From'] = PROJET_MAIL_ADMINISTRATEUR;
1715
		$entetes['From'] = PROJET_MAIL_ADMINISTRATEUR;
1666
        $entetes['To'] = '';
1716
        $entetes['To'] = '';
1667
        $entetes['Subject'] = trim ($sujet_mail) ;  // le trim est necessaire pour enlever d eventuels retour-chariot qui foutent el l air le message 
1717
        $entetes['Subject'] = trim ($sujet_mail) ;  // le trim est necessaire pour enlever d eventuels retour-chariot qui foutent el l air le message
1668
        $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1718
        $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1669
        $entetes['Message-ID'] = md5(time()) ;
1719
        $entetes['Message-ID'] = md5(time()) ;
1670
        $entetes['reply-to'] = $this->_auth->getUserName();
1720
        $entetes['reply-to'] = $this->_auth->getUserName();
1671
        $entetes['Content-Type'] = 'text/plain' ;
1721
        $entetes['Content-Type'] = 'text/plain' ;
1672
        
1722
 
1673
        // 2 cas : 1. il reste des coordinateurs ou notification pour administrateur
1723
        // 2 cas : 1. il reste des coordinateurs ou notification pour administrateur
1674
        // 2. plus de coordinateur ou notification pour administrateur
1724
        // 2. plus de coordinateur ou notification pour administrateur
1675
        if (count ($tableau_coordinateur) != 0 && $notification != PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD) {
1725
        if (count ($tableau_coordinateur) != 0 && $notification != PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD) {
1676
			foreach ($tableau_coordinateur as $coordinateur) {
1726
			foreach ($tableau_coordinateur as $coordinateur) {
1677
				$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
1727
				$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
1678
				
1728
 
1679
			}
1729
			}
1680
			// On enleve la virgule finale
1730
			// On enleve la virgule finale
1681
			
1731
 
1682
			$entetes['To'] = substr ($entetes['To'], 0, -1);
1732
			$entetes['To'] = substr ($entetes['To'], 0, -1);
1683
	
1733
 
1684
			// on envoie le mail
1734
			// on envoie le mail
1685
			$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1735
			$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1686
        } else {  // Pour le cas ou il n y a plus de coordinateur, on envoie un message aux administrateurs
1736
        } else {  // Pour le cas ou il n y a plus de coordinateur, on envoie un message aux administrateurs
1687
        	$tableau_administrateur = $participant->getAdministrateurs();
1737
        	$tableau_administrateur = $participant->getAdministrateurs();
1688
        	trigger_error(print_r($tableau_administrateur, true));
1738
        	trigger_error(print_r($tableau_administrateur, true));
1689
        	foreach ($tableau_administrateur as $administrateur) {
1739
        	foreach ($tableau_administrateur as $administrateur) {
1690
				$entetes['To'] .= $administrateur[3].',';	// Le champs 3 est le mail
1740
				$entetes['To'] .= $administrateur[3].',';	// Le champs 3 est le mail
1691
				
1741
 
1692
			}
1742
			}
1693
			// On enleve la virgule finale
1743
			// On enleve la virgule finale
1694
			
1744
 
1695
			$entetes['To'] = substr ($entetes['To'], 0, -1);
1745
			$entetes['To'] = substr ($entetes['To'], 0, -1);
1696
	
1746
 
1697
			// on envoie le mail
1747
			// on envoie le mail
1698
			$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1748
			$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1699
        }
1749
        }
Line 1700... Line 1750...
1700
	}
1750
	}
Line 1701... Line 1751...
1701
 
1751
 
1702
 
1752
 
1703
} // end of projetControleur
1753
} // end of projetControleur
1704
 
1754
 
1705
class bouton {
1755
class bouton {
1706
	static function toHTML($lien, $label, $id, $class='projet_bouton_action') {
1756
	static function toHTML($lien, $label, $id, $class='projet_bouton_action') {
1707
		
1757
 
1708
		if ($lien != '#') {
1758
		if ($lien != '#') {
1709
			$balise_a_debut = '<a href="'.$lien.'"'.($id == 'cross'? ' onclick="javascript:return confirm(\''.$label.' ?\');"':'').'>';
1759
			$balise_a_debut = '<a href="'.$lien.'"'.($id == 'cross'? ' onclick="javascript:return confirm(\''.$label.' ?\');"':'').'>';
1710
			$balise_a_fin = '</a>';	
1760
			$balise_a_fin = '</a>';
1711
		} else {
1761
		} else {