Subversion Repositories Applications.projet

Compare Revisions

Ignore whitespace Rev 340 → Rev 341

/trunk/classes/projetControleur.class.php
20,7 → 20,7
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
 
// CVS : $Id: projetControleur.class.php,v 1.48 2008-09-15 07:41:16 alexandre_tb Exp $
// CVS : $Id: projetControleur.class.php,v 1.49 2008-09-16 14:10:20 alexandre_tb Exp $
 
/**
* Application projet
33,7 → 33,7
//Autres auteurs :
*@author Aucun
*@copyright Tela-Botanica 2000-2004
*@version $Revision: 1.48 $
*@version $Revision: 1.49 $
// +------------------------------------------------------------------------------------------------------+
*/
 
121,6 → 121,7
define ('PROJET_NOTIFICATION_INSCRIPTION_NOUVELLE', 3); // Pour le coordinateur quand quelqu un s inscrit au projet
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET', 4);
define ('PROJET_NOTIFICATION_NOUVEAU_DOC', 5);
define ('PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD', 6);
 
/**
* class projetControleur
1370,12 → 1371,23
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;
}
$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET, $utilisateur);
// On verifie si l utilisateur est le dernier coordinateur
// auquel cas on previent les administrateurs
if ($participant->isCoordinateur($this->_auth->getAuthData(PROJET_CHAMPS_ID), $this->_id_projet, $this->_db)) {
$coord = $participant->getCoordinateurs($this->_id_projet);
if (count($coord) == 0) {
$this->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $utilisateur);
}
}
//
include_once PROJET_CHEMIN_CLASSES.'liste_externe.class.php';
$liste_ext = new liste_externe($this->_db);
$listes = $liste_ext->getListesAssociees($this->_id_projet);
$info_liste = $liste_ext->getInfoListe($listes[0]);
$msg = '';
if (count ($listes) != 0) {
$info_liste = $liste_ext->getInfoListe($listes[0]);
$msg = 'Pensez si vous le souhaitez à vous désinscrire de la liste de discussion, hébergée par Yahoo Groupes.';
$msg .= ' Vous pouvez le faire en <a href="mailto:';
$msg .= $info_liste->AGO_A_MAILDESA.'">cliquez ici</a>';
1597,8 → 1609,9
} // end of member function messageErreur
/** Envoie de mail pour prevenir les coordinateurs d une action sur le projet
* Lorsqu un projet n a plus de coordinateur, la notification est
* envoyee aux administrateurs
*
*
*/
 
function notifierCoordinateurs ($notification, $utilisateur) {
1622,6 → 1635,10
$sujet = PROJET_TEMPLATE_NOUVEAU_DOC_SUJET;
$corps = PROJET_TEMPLATE_NOUVEAU_DOC_CORPS;
break;
case PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD:
$sujet = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_SUJET;
$corps = PROJET_TEMPLATE_DESINSCRIPTION_DERNIER_COORD_CORPS;
break;
}
1633,8 → 1650,6
$objet_mail =& Mail::factory('smtp');
$modele = new projetTemplate($GLOBALS['projet_db']);
 
$sujet_mail = $modele->getTemplate($sujet, PROJET_LANGUE_DEFAUT);
1655,16 → 1670,33
$entetes['reply-to'] = $this->_auth->getUserName();
$entetes['Content-Type'] = 'text/plain' ;
foreach ($tableau_coordinateur as $coordinateur) {
$entetes['To'] .= $coordinateur[3].','; // Le champs 3 est le mail
// 2 cas : 1. il reste des coordinateurs ou notification pour administrateur
// 2. plus de coordinateur ou notification pour administrateur
if (count ($tableau_coordinateur) != 0 && $notification != PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD) {
foreach ($tableau_coordinateur as $coordinateur) {
$entetes['To'] .= $coordinateur[3].','; // Le champs 3 est le mail
}
// On enleve la virgule finale
}
// On enleve la virgule finale
$entetes['To'] = substr ($entetes['To'], 0, -1);
 
// on envoie le mail
$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
$entetes['To'] = substr ($entetes['To'], 0, -1);
// on envoie le mail
$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
} else { // Pour le cas ou il n y a plus de coordinateur, on envoie un message aux administrateurs
$tableau_administrateur = $participant->getAdministrateurs();
trigger_error(print_r($tableau_administrateur, true));
foreach ($tableau_administrateur as $administrateur) {
$entetes['To'] .= $administrateur[3].','; // Le champs 3 est le mail
}
// On enleve la virgule finale
$entetes['To'] = substr ($entetes['To'], 0, -1);
// on envoie le mail
$objet_mail->send($entetes['To'], $entetes, html_entity_decode ($corps_mail));
}
}
 
 
1687,6 → 1719,9
/* +--Fin du code ----------------------------------------------------------------------------------------+
*
* $Log: not supported by cvs2svn $
* Revision 1.48 2008-09-15 07:41:16 alexandre_tb
* ajout de HTML_TableFragmenteur
*
* Revision 1.47 2008-09-01 14:38:00 alexandre_tb
* correction de bug inscription projet
*
/trunk/projet.desinscription.inc.php
19,7 → 19,7
// | License along with this library; if not, write to the Free Software |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
// +------------------------------------------------------------------------------------------------------+
// CVS : $Id: projet.desinscription.inc.php,v 1.3 2007-06-01 13:57:11 alexandre_tb Exp $
// CVS : $Id: projet.desinscription.inc.php,v 1.4 2008-09-16 14:10:06 alexandre_tb Exp $
/**
* Inscription
*
30,7 → 30,7
//Auteur original :
*@author Alexandre GRANIER <alexandre@tela-botanica.org>
*@copyright Tela-Botanica 2000-2006
*@version $Revision: 1.3 $
*@version $Revision: 1.4 $
// +------------------------------------------------------------------------------------------------------+
*/
 
46,20 → 46,35
include_once 'client/projet/configuration/projet.config.inc.php' ;
include_once PROJET_CHEMIN_CLASSES.'projet.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'participe.class.php' ;
include_once PROJET_CHEMIN_CLASSES.'projetControleur.class.php' ;
$participant = new participe($GLOBALS['ins_db']) ;
 
 
$tableau_projet = projet::getTousLesProjets($GLOBALS['ins_db']) ;
 
// On boucle sur chaque projet et on désinscrit l'utilisateur
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($GLOBALS['ins_db'], array('identifiant' => INS_CHAMPS_ID, 'mail' => INS_CHAMPS_MAIL, 'table' => INS_ANNUAIRE, 'nom' => INS_CHAMPS_NOM,
'prenom' => INS_CHAMPS_PRENOM)) ;
$annuaire->setId($id_utilisateur) ;
// On boucle sur chaque projet et on desinscrit l'utilisateur
foreach ($tableau_projet as $projet) {
// Le statut 4 desinscrit l'utilisateur, dans la méthode setStatut
// On verifie si l utilisateur est le dernier coordinateur
// auquel cas on previent les administrateurs
if ($participant->isCoordinateur($id_utilisateur, $projet->getId(), $GLOBALS['ins_db'])) {
$controleur = new projetControleur($GLOBALS['ins_db'], $GLOBALS['AUTH'], $GLOBALS['ins_url']);
$controleur->setIdProjet($projet->getId());
$coord = $participant->getCoordinateurs($projet->getId());
if (count($coord) == 0) {
$controleur->notifierCoordinateurs(PROJET_NOTIFICATION_DESINSCRIPTION_PROJET_DERNIER_COORD, $annuaire);
}
}
// Le statut 4 desinscrit l'utilisateur, dans la methode setStatut
$participant->setStatut(4, $id_utilisateur, $projet->getId()) ;
$projet->getListesAssociees() ;
if ($projet->avoirListe()) {
include_once PROJET_CHEMIN_CLASSES.'annuaire.class.php' ;
$annuaire = new annuaire($GLOBALS['ins_db'], array('identifiant' => PROJET_CHAMPS_ID, 'mail' => PROJET_CHAMPS_MAIL, 'table' => PROJET_ANNUAIRE)) ;
$annuaire->setId($id_utilisateur) ;
include_once PROJET_CHEMIN_CLASSES.'inscription_liste.class.php' ;
$desinscription= new inscription_liste($GLOBALS['ins_db']) ;
$desinscription->desinscrireUtilisateur($annuaire, $projet->_listes_associes[0]) ;