Loading module/Application/src/Application/Controller/Utilisateur/UtilisateurController.php +4 −4 Changes for module/Application/src/Application/Controller/Utilisateur/UtilisateurController.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ namespace Application\Controller\Utilisateur; use Application\Entity\Db\Role; use Application\Entity\Db\User; use Application\Service\MailService\MailServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use Application\Service\User\UserServiceAwareTrait; use Mailing\Service\Mailing\MailingServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenLdap\Entity\People; Loading @@ -22,7 +22,7 @@ use Zend\View\Model\ViewModel; * @author jean-Philippe Metivier <jean-philippe.metivier at unicaen.fr> */ class UtilisateurController extends AbstractActionController { use MailServiceAwareTrait; use MailingServiceAwareTrait; use RoleServiceAwareTrait; use UserServiceAwareTrait; use EntityManagerAwareTrait; Loading Loading @@ -107,7 +107,7 @@ class UtilisateurController extends AbstractActionController { if ($utilisateur !== null && $role !== null) { $this->getUserService()->addRole($utilisateur, $role); $this->getMailService()->sendChangementRole("ajout", $role, $utilisateur); $this->getMailingService()->notificationChangementRole($utilisateur, $role, "ajout"); } } Loading Loading @@ -137,7 +137,7 @@ class UtilisateurController extends AbstractActionController { if ($utilisateur !== null && $role !== null) { $this->getUserService()->removeRole($utilisateur,$role); $this->getMailService()->sendChangementRole("retrait", $role, $utilisateur); $this->getMailingService()->notificationChangementRole($utilisateur, $role, "retrait"); } } Loading module/Application/src/Application/Controller/Utilisateur/UtilisateurControllerFactory.php +4 −4 Changes for module/Application/src/Application/Controller/Utilisateur/UtilisateurControllerFactory.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Application\Controller\Utilisateur; use Application\Service\MailService\MailService; use Application\Service\Role\RoleService; use Application\Service\User\UserService; use Doctrine\ORM\EntityManager; use Mailing\Service\Mailing\MailingService; use UnicaenLdap\Service\People; use Zend\Mvc\Controller\ControllerManager; Loading @@ -17,20 +17,20 @@ class UtilisateurControllerFactory { * @var RoleService $roleService * @var People $ldapService * @var UserService $userService * @var MailService $mailService * @var MailingService $mailService * @var EntityManager $entityManager */ $roleService = $controllerManager->getServiceLocator()->get(RoleService::class); $ldapService = $controllerManager->getServiceLocator()->get('LdapServicePeople'); $userService = $controllerManager->getServiceLocator()->get(UserService::class); $mailService = $controllerManager->getServiceLocator()->get(MailService::class); $mailService = $controllerManager->getServiceLocator()->get(MailingService::class); /** @var UtilisateurController $controller */ $controller = new UtilisateurController(); $controller->setRoleService($roleService); $controller->setUserService($userService); $controller->setLdapPeopleService($ldapService); $controller->setMailService($mailService); $controller->setMailingService($mailService); return $controller; Loading module/Mailing/src/Mailing/Service/Mailing/MailingService.php +23 −1 Changes for module/Mailing/src/Mailing/Service/Mailing/MailingService.php: 23 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Mailing\Service\Mailing; use Application\Entity\Db\Role; use Application\Entity\Db\User; use DateTime; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; Loading Loading @@ -33,6 +35,26 @@ class MailingService { $this->doNotSend = $doNotSend; } /** * @param User $utilisateur * @param Role $role * @param string $alteration (ajout, retrait) */ public function notificationChangementRole($utilisateur, $role, $alteration) { $mail = $utilisateur->getEmail(); $titre = $alteration . " du rôle ". $role->getRoleId(); $texte = ""; switch($alteration) { case "ajout" : $texte .= "<p>Vous venez de recevoir le rôle de ".$role->getRoleId()." dans l'application PrEECoG.</p>"; break; case "retrait" : $texte .= "<p>Vous venez de perdre le rôle de ".$role->getRoleId()." dans l'application PrEECoG.</p>"; break; } $texte .= "<p>Pour vous connecter à celle-ci, suivez le lien suivant : <a href='".$this->rendererService->url('home', [], ['force_canonical' => true], true)."'>PrEECoG</a></p>."; $this->sendMail($mail, $titre, $texte); } // public function notifierMedecinDirecteurDemande($demande) { // $denomination = $demande->getIdetudiant()->getPrenom() ." ". $demande->getIdetudiant()->getNom(); // $composante = ($demande->getIdcomposante())?$demande->getIdcomposante()->getLibelle():"Non renseignée"; Loading Loading @@ -114,7 +136,7 @@ class MailingService { $message->setSubject($sujet); $texte = "<p>Ce courrier électronique vous a été adressé <strong>automatiquement</strong> par l'application PrEECoG. </p>" . $texte; $texte = "<p><i>Ce courrier électronique vous a été adressé <strong>automatiquement</strong> par l'application PrEECoG. </i></p>" . $texte; if ($this->doNotSend) { $texte .= "<br/><br/><hr/><br/>"; Loading Loading
module/Application/src/Application/Controller/Utilisateur/UtilisateurController.php +4 −4 Changes for module/Application/src/Application/Controller/Utilisateur/UtilisateurController.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -4,9 +4,9 @@ namespace Application\Controller\Utilisateur; use Application\Entity\Db\Role; use Application\Entity\Db\User; use Application\Service\MailService\MailServiceAwareTrait; use Application\Service\Role\RoleServiceAwareTrait; use Application\Service\User\UserServiceAwareTrait; use Mailing\Service\Mailing\MailingServiceAwareTrait; use UnicaenApp\Exception\RuntimeException; use UnicaenApp\Service\EntityManagerAwareTrait; use UnicaenLdap\Entity\People; Loading @@ -22,7 +22,7 @@ use Zend\View\Model\ViewModel; * @author jean-Philippe Metivier <jean-philippe.metivier at unicaen.fr> */ class UtilisateurController extends AbstractActionController { use MailServiceAwareTrait; use MailingServiceAwareTrait; use RoleServiceAwareTrait; use UserServiceAwareTrait; use EntityManagerAwareTrait; Loading Loading @@ -107,7 +107,7 @@ class UtilisateurController extends AbstractActionController { if ($utilisateur !== null && $role !== null) { $this->getUserService()->addRole($utilisateur, $role); $this->getMailService()->sendChangementRole("ajout", $role, $utilisateur); $this->getMailingService()->notificationChangementRole($utilisateur, $role, "ajout"); } } Loading Loading @@ -137,7 +137,7 @@ class UtilisateurController extends AbstractActionController { if ($utilisateur !== null && $role !== null) { $this->getUserService()->removeRole($utilisateur,$role); $this->getMailService()->sendChangementRole("retrait", $role, $utilisateur); $this->getMailingService()->notificationChangementRole($utilisateur, $role, "retrait"); } } Loading
module/Application/src/Application/Controller/Utilisateur/UtilisateurControllerFactory.php +4 −4 Changes for module/Application/src/Application/Controller/Utilisateur/UtilisateurControllerFactory.php: 4 added lines, 4 removed lines. Original line number Diff line number Diff line Loading @@ -2,10 +2,10 @@ namespace Application\Controller\Utilisateur; use Application\Service\MailService\MailService; use Application\Service\Role\RoleService; use Application\Service\User\UserService; use Doctrine\ORM\EntityManager; use Mailing\Service\Mailing\MailingService; use UnicaenLdap\Service\People; use Zend\Mvc\Controller\ControllerManager; Loading @@ -17,20 +17,20 @@ class UtilisateurControllerFactory { * @var RoleService $roleService * @var People $ldapService * @var UserService $userService * @var MailService $mailService * @var MailingService $mailService * @var EntityManager $entityManager */ $roleService = $controllerManager->getServiceLocator()->get(RoleService::class); $ldapService = $controllerManager->getServiceLocator()->get('LdapServicePeople'); $userService = $controllerManager->getServiceLocator()->get(UserService::class); $mailService = $controllerManager->getServiceLocator()->get(MailService::class); $mailService = $controllerManager->getServiceLocator()->get(MailingService::class); /** @var UtilisateurController $controller */ $controller = new UtilisateurController(); $controller->setRoleService($roleService); $controller->setUserService($userService); $controller->setLdapPeopleService($ldapService); $controller->setMailService($mailService); $controller->setMailingService($mailService); return $controller; Loading
module/Mailing/src/Mailing/Service/Mailing/MailingService.php +23 −1 Changes for module/Mailing/src/Mailing/Service/Mailing/MailingService.php: 23 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -2,6 +2,8 @@ namespace Mailing\Service\Mailing; use Application\Entity\Db\Role; use Application\Entity\Db\User; use DateTime; use Doctrine\ORM\NonUniqueResultException; use Doctrine\ORM\OptimisticLockException; Loading Loading @@ -33,6 +35,26 @@ class MailingService { $this->doNotSend = $doNotSend; } /** * @param User $utilisateur * @param Role $role * @param string $alteration (ajout, retrait) */ public function notificationChangementRole($utilisateur, $role, $alteration) { $mail = $utilisateur->getEmail(); $titre = $alteration . " du rôle ". $role->getRoleId(); $texte = ""; switch($alteration) { case "ajout" : $texte .= "<p>Vous venez de recevoir le rôle de ".$role->getRoleId()." dans l'application PrEECoG.</p>"; break; case "retrait" : $texte .= "<p>Vous venez de perdre le rôle de ".$role->getRoleId()." dans l'application PrEECoG.</p>"; break; } $texte .= "<p>Pour vous connecter à celle-ci, suivez le lien suivant : <a href='".$this->rendererService->url('home', [], ['force_canonical' => true], true)."'>PrEECoG</a></p>."; $this->sendMail($mail, $titre, $texte); } // public function notifierMedecinDirecteurDemande($demande) { // $denomination = $demande->getIdetudiant()->getPrenom() ." ". $demande->getIdetudiant()->getNom(); // $composante = ($demande->getIdcomposante())?$demande->getIdcomposante()->getLibelle():"Non renseignée"; Loading Loading @@ -114,7 +136,7 @@ class MailingService { $message->setSubject($sujet); $texte = "<p>Ce courrier électronique vous a été adressé <strong>automatiquement</strong> par l'application PrEECoG. </p>" . $texte; $texte = "<p><i>Ce courrier électronique vous a été adressé <strong>automatiquement</strong> par l'application PrEECoG. </i></p>" . $texte; if ($this->doNotSend) { $texte .= "<br/><br/><hr/><br/>"; Loading