Subversion Repositories Applications.projet

Rev

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

Rev 337 Rev 341
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.48 2008-09-15 07:41:16 alexandre_tb Exp $
23
// CVS : $Id: projetControleur.class.php,v 1.49 2008-09-16 14:10:20 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.48 $
36
*@version       $Revision: 1.49 $
37
// +------------------------------------------------------------------------------------------------------+
37
// +------------------------------------------------------------------------------------------------------+
38
*/
38
*/
Line 39... Line 39...
39
 
39
 
40
// +------------------------------------------------------------------------------------------------------+
40
// +------------------------------------------------------------------------------------------------------+
Line 119... Line 119...
119
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
119
define ('PROJET_NOTIFICATION_DEMANDE_INSCRIPTION', 1);
120
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
120
define ('PROJET_NOTIFICATION_ACCEPTATION_INSCRIPTION', 2);
121
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet 
121
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet 
122
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
122
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
123
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
123
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
-
 
124
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD', 6);
Line 124... Line 125...
124
 
125
 
125
/**
126
/**
126
 * class projetControleur
127
 * class projetControleur
127
 * Cette classe sert a lancer les diverses applications du module projet, en
128
 * Cette classe sert a lancer les diverses applications du module projet, en
Line 1368... Line 1369...
1368
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1369
            include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
1369
            $desinscription= new inscription_liste($this->_db) ;
1370
            $desinscription= new inscription_liste($this->_db) ;
1370
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1371
            $desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
1371
        }
1372
        }
1372
        $this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
1373
        $this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
-
 
1374
        
-
 
1375
        // On verifie si l utilisateur est le dernier coordinateur
-
 
1376
        // auquel cas on previent les administrateurs
-
 
1377
        if ($participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db)) {
-
 
1378
        	$coord = $participant->getCoordinateurs($this->_id_projet);
-
 
1379
        	if (count($coord) == 0) {
-
 
1380
        		$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $utilisateur);
-
 
1381
        	}
-
 
1382
        }
-
 
1383
        // 
1373
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
1384
        include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
1374
        $liste_ext = new liste_externe($this->_db);
1385
        $liste_ext = new liste_externe($this->_db);
1375
		$listes = $liste_ext->getListesAssociees($this->_id_projet);
1386
		$listes = $liste_ext->getListesAssociees($this->_id_projet);
1376
		$info_liste = $liste_ext->getInfoListe($listes[0]);
-
 
-
 
1387
		
1377
		$msg = '';
1388
		$msg = '';
1378
		if (count ($listes) != 0) {
1389
		if (count ($listes) != 0) {
-
 
1390
			$info_liste = $liste_ext->getInfoListe($listes[0]);
1379
			$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
1391
			$msg = 'Pensez si vous le souhaitez à vous d&eacute;sinscrire de la liste de discussion, h&eacute;berg&eacute;e par Yahoo Groupes.';
1380
			$msg .= ' Vous pouvez le faire en <a href="mailto:';
1392
			$msg .= ' Vous pouvez le faire en <a href="mailto:';
1381
			$msg .= $info_liste->AGO_A_MAILDESA.'">cliquez ici</a>';
1393
			$msg .= $info_liste->AGO_A_MAILDESA.'">cliquez ici</a>';
1382
		}
1394
		}
1383
        if ($this->_presentation != 'arbre') {
1395
        if ($this->_presentation != 'arbre') {
Line 1595... Line 1607...
1595
        ) ;
1607
        ) ;
1596
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1608
        return '<p class="erreur">'.$messageErreur[$valeur].'</p>' ;
1597
    } // end of member function messageErreur
1609
    } // end of member function messageErreur
Line 1598... Line 1610...
1598
	
1610
	
-
 
1611
	/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
1599
	/** 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
1600
	 * 
1613
	 *  envoyee aux administrateurs
1601
	 * 
1614
	 * 
Line 1602... Line 1615...
1602
	 */
1615
	 */
Line 1620... Line 1633...
1620
			break;
1633
			break;
1621
			case PROJET_NOTIFICATION_NOUVEAU_DOC:
1634
			case PROJET_NOTIFICATION_NOUVEAU_DOC:
1622
				$sujet = PROJET_TEMPLATE_NOUVEAU_DOC_SUJET;
1635
				$sujet = PROJET_TEMPLATE_NOUVEAU_DOC_SUJET;
1623
				$corps = PROJET_TEMPLATE_NOUVEAU_DOC_CORPS;
1636
				$corps = PROJET_TEMPLATE_NOUVEAU_DOC_CORPS;
1624
			break;
1637
			break;
-
 
1638
			case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD:
-
 
1639
				$sujet = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET;
-
 
1640
				$corps = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS;
-
 
1641
			break;
Line 1625... Line 1642...
1625
	
1642
	
Line 1626... Line 1643...
1626
		}
1643
		}
1627
		
1644
		
Line 1631... Line 1648...
1631
		$participant = new participe($this->_db) ;
1648
		$participant = new participe($this->_db) ;
1632
		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
1649
		$tableau_coordinateur = $participant->getCoordinateurs($this->_id_projet) ;
Line 1633... Line 1650...
1633
		
1650
		
Line 1634... Line -...
1634
		$objet_mail =& Mail::factory('smtp');
-
 
1635
		
-
 
1636
		
1651
		$objet_mail =& Mail::factory('smtp');
Line 1637... Line 1652...
1637
		
1652
		
1638
		$modele = new projetTemplate($GLOBALS['projet_db']);
1653
		$modele = new projetTemplate($GLOBALS['projet_db']);
Line 1653... Line 1668...
1653
        $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1668
        $entetes['Date'] = date ('D, M j G:i:s \C\E\S\T Y') ;
1654
        $entetes['Message-ID'] = md5(time()) ;
1669
        $entetes['Message-ID'] = md5(time()) ;
1655
        $entetes['reply-to'] = $this->_auth->getUserName();
1670
        $entetes['reply-to'] = $this->_auth->getUserName();
1656
        $entetes['Content-Type'] = 'text/plain' ;
1671
        $entetes['Content-Type'] = 'text/plain' ;
Line -... Line 1672...
-
 
1672
        
-
 
1673
        // 2 cas : 1. il reste des coordinateurs ou notification pour administrateur
-
 
1674
        // 2. plus de coordinateur ou notification pour administrateur
1657
        
1675
        if (count ($tableau_coordinateur) != 0 && $notification != PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD) {
1658
		foreach ($tableau_coordinateur as $coordinateur) {
1676
			foreach ($tableau_coordinateur as $coordinateur) {
-
 
1677
				$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
-
 
1678
				
-
 
1679
			}
Line -... Line 1680...
-
 
1680
			// On enleve la virgule finale
-
 
1681
			
-
 
1682
			$entetes['To'] = substr ($entetes['To'], 0, -1);
-
 
1683
	
-
 
1684
			// on envoie le mail
-
 
1685
			$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
-
 
1687
        	$tableau_administrateur = $participant->getAdministrateurs();
-
 
1688
        	trigger_error(print_r($tableau_administrateur, true));
-
 
1689
        	foreach ($tableau_administrateur as $administrateur) {
1659
			$entetes['To'] .= $coordinateur[3].',';	// Le champs 3 est le mail
1690
				$entetes['To'] .= $administrateur[3].',';	// Le champs 3 est le mail
1660
			
1691
				
1661
		}
1692
			}
1662
		// On enleve la virgule finale
1693
			// On enleve la virgule finale
1663
		
1694
			
1664
		$entetes['To'] = substr ($entetes['To'], 0, -1);
1695
			$entetes['To'] = substr ($entetes['To'], 0, -1);
1665
 
1696
	
-
 
1697
			// on envoie le mail
1666
		// on envoie le mail
1698
			$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
Line 1667... Line 1699...
1667
		$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
1699
        }
Line 1685... Line 1717...
1685
	}
1717
	}
1686
}
1718
}
1687
/* +--Fin du code ----------------------------------------------------------------------------------------+
1719
/* +--Fin du code ----------------------------------------------------------------------------------------+
1688
*
1720
*
1689
* $Log: not supported by cvs2svn $
1721
* $Log: not supported by cvs2svn $
-
 
1722
* Revision 1.48  2008-09-15 07:41:16  alexandre_tb
-
 
1723
* ajout de HTML_TableFragmenteur
-
 
1724
*
1690
* Revision 1.47  2008-09-01 14:38:00  alexandre_tb
1725
* Revision 1.47  2008-09-01 14:38:00  alexandre_tb
1691
* correction de bug inscription projet
1726
* correction de bug inscription projet
1692
*
1727
*
1693
* Revision 1.46  2008-08-28 14:48:54  alexandre_tb
1728
* Revision 1.46  2008-08-28 14:48:54  alexandre_tb
1694
* encodage et suppression d une methode inutile
1729
* encodage et suppression d une methode inutile