Commit 1c75975d authored by Jean-Philippe Metivier's avatar Jean-Philippe Metivier
Browse files

Correction interface SyGAL FOrmation

parent cdf52329
Loading
Loading
Loading
Loading
+11 −0
Changes for module/Formation/src/Formation/Entity/Db/Formation.php: 11 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -172,5 +172,16 @@ class Formation implements HistoriqueAwareInterface,
        return $this;
    }

    /** FONCTION POUR MACRO *******************************************************************************************/

    /**
     * @return string
     */
    public function toStringResponsable() : string
    {
        if ($this->getResponsable() === null) return "Aucun responsable de nommé·e pour cette formation";
        return $this->getResponsable()->getNomComplet();
    }


}
 No newline at end of file
+30 −0
Changes for module/Formation/src/Formation/Entity/Db/Session.php: 30 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -315,4 +315,34 @@ class Session implements HistoriqueAwareInterface,
    }

    /** Pour les macros ********************************************************************************/

    /**
     * @return string
     */
    public function getSeancesAsTable() : string
    {
        $seances = $this->getSeances()->toArray();
        $seances = array_filter($seances, function(Seance $a) { return $a->estNonHistorise();});
        usort($seances, function (Seance $a, Seance $b) { return $a->getDebut() > $b->getDebut(); });

        if (empty($seances)) return "Aucune séance d'associée à cette session de formation.";

        $texte  = '<table>';
        $texte .= '<thead><tr>';
        $texte .= '<th> Jour de la séance </th><th> Heure de début </th><th> Heure de fin </th><th> Lieu </th>';
        $texte .= '</tr></thead>';
        $texte .= '<tbody>';
        /** @var Seance $seance */
        foreach ($seances as $seance) {
            $texte .= '<tr>';
            $texte .= '<td>'.$seance->getDebut()->format('d/m/Y').'</td>';
            $texte .= '<td>'.$seance->getDebut()->format('H:i').'</td>';
            $texte .= '<td>'.$seance->getFin()->format('H:i').'</td>';
            $texte .= '<td>'.$seance->getLieu().'</td>';
            $texte .= '</tr>';
        }
        $texte .= '</tbody>';
        $texte .= '</table>';
        return $texte;
    }
}
 No newline at end of file
+1 −0
Changes for module/Formation/src/Formation/Provider/Template/MailTemplates.php: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -5,5 +5,6 @@ namespace Formation\Provider\Template;
class MailTemplates {

    const INSCRIPTION_ENREGISTREE = "FORMATION_INSCRIPTION_ENREGISTREE";
    const INSCRIPTION_LISTE_PRINCIPALE = "FORMATION_INSCRIPTION_LISTE_PRINCIPALE";

}
 No newline at end of file
+16 −7
Changes for module/Formation/src/Formation/Service/Notification/NotificationService.php: 16 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -4,12 +4,15 @@ namespace Formation\Service\Notification;

use Formation\Entity\Db\Inscription;
use Formation\Entity\Db\Session;
use Formation\Provider\Template\MailTemplates;
use Notification\Notification;
use Notification\Service\NotifierService;
use Laminas\View\Helper\Url as UrlHelper;
use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait;

class NotificationService extends NotifierService
{
    use RenduServiceAwareTrait;
    /**
     * @var UrlHelper
     */
@@ -43,19 +46,25 @@ class NotificationService extends NotifierService

    public function triggerInscriptionListePrincipale(Inscription $inscription)
    {
        $vars = [
            'doctorant' => $inscription->getDoctorant(),
            'formation' => $inscription->getSession()->getFormation(),
            'session'   => $inscription->getSession(),
        ];

        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::INSCRIPTION_LISTE_PRINCIPALE, $vars);
        $mail = $inscription->getDoctorant()->getIndividu()->getEmail();
        $libelle = $inscription->getSession()->getFormation()->getLibelle();

        if ($mail !== null) {
            $notif = new Notification();
            $notif
                ->setSubject("Vous êtes sur la liste principale de la formation ".$libelle)
                ->setTo($mail)
                ->setTemplatePath('formation/notification/inscription-principale')
                ->setTemplateVariables([
                    'inscription' => $inscription,
                    'libelle' => $libelle,
                ]);
                ->setSubject($rendu->getSujet())
                ->setBody($rendu->getCorps())
//                ->setTemplatePath('formation/notification/renderer-mail')
//                ->setTemplateVariables([
//                    'corps' => $rendu->getCorps()])
                ;
            $this->trigger($notif);
        }
    }
+12 −2
Changes for module/Formation/src/Formation/Service/Notification/NotificationServiceFactory.php: 12 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -6,6 +6,9 @@ use Application\Service\Notification\NotificationFactory;
use Interop\Container\ContainerInterface;
use Notification\Service\NotifierServiceFactory;
use Laminas\View\Helper\Url as UrlHelper;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface;
use UnicaenRenderer\Service\Rendu\RenduService;

class NotificationServiceFactory extends NotifierServiceFactory
{
@@ -15,11 +18,17 @@ class NotificationServiceFactory extends NotifierServiceFactory
    /**
     * @param ContainerInterface $container
     * @return NotificationService
     * @throws ContainerExceptionInterface
     * @throws NotFoundExceptionInterface
     */
    public function __invoke(ContainerInterface $container)
    public function __invoke(ContainerInterface $container) : NotificationService
    {
        /** @var NotificationService $service */
        /**
         * @var NotificationService $service
         * @var RenduService $renduService
         */
        $service = parent::__invoke($container);
        $renduService = $container->get(RenduService::class);

        /** @var UrlHelper $urlHelper */
        $urlHelper = $container->get('ViewHelperManager')->get('Url');
@@ -29,6 +38,7 @@ class NotificationServiceFactory extends NotifierServiceFactory

        $service->setNotificationFactory($notificationFactory);
        $service->setUrlHelper($urlHelper);
        $service->setRenduService($renduService);

        return $service;
    }
Loading