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

Nouvelle macro

parent 51ca5bff
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -23,4 +23,6 @@ systemctl reload php8.0-fpm
CREATE UNIQUE INDEX soutenance_proposition_uniq ON soutenance_proposition(these_id) WHERE (histo_destruction is null);
CREATE UNIQUE INDEX soutenance_proposition_uniq_histo ON soutenance_proposition(these_id, histo_destruction) WHERE (histo_destruction is not null);

INSERT INTO unicaen_renderer_macro (code, description, variable_name, methode_name) VALUES
('Url#Enquete', '<p>Ajoute le lien vers l''enquête</p>', 'Url', 'getUrlEnquete');
```
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -206,6 +206,7 @@ class FormationNotificationFactory extends NotificationFactory
            'doctorant' => $inscription->getDoctorant(),
            'formation' => $inscription->getSession()->getFormation(),
            'session'   => $inscription->getSession(),
            'inscription'   => $inscription,
        ];
        $rendu = $this->getRenduService()->generateRenduByTemplateCode(MailTemplates::SESSION_TERMINEE, $vars);
        $mail = $inscription->getDoctorant()->getIndividu()->getEmailPro();
@@ -220,7 +221,6 @@ class FormationNotificationFactory extends NotificationFactory
            ->setSubject($rendu->getSujet())
            ->setBody($rendu->getCorps())
        ;

        return $notif;
    }

+17 −1
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Formation\Service\Url;

use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Formation\Entity\Db\Inscription;
use Formation\Provider\NatureFichier\NatureFichier;
use Laminas\View\Renderer\PhpRenderer;
use Structure\Entity\Db\Etablissement;
@@ -15,9 +16,13 @@ class UrlService {
    use StructureDocumentServiceAwareTrait;

    /** @var PhpRenderer */
    protected $renderer;
    protected PhpRenderer $renderer;
    protected array $variables = [];

    public function setRenderer(PhpRenderer $renderer): void
    {
        $this->renderer = $renderer;
    }
    public function setVariables(array $variables) : void
    {
        $this->variables = $variables;
@@ -43,4 +48,15 @@ class UrlService {
        }
        return '<img src="data:image/png;base64,'. base64_encode($content). '" style="max-width:5cm;"/>';
    }

    /** @noinspection PhpUnused */
    public function getUrlEnquete(): string
    {
        if (!isset($this->vars['inscription'])) throw new RuntimeException("Variable inscription non fournie à [".UrlService::class."]");
        /** @var Inscription $inscription */
        $inscription = $this->vars['inscription'];

        $url = $this->renderer->url('formation/enquete/repondre-questions', ['inscription' => $inscription->getId()], [], true);
        return "<a href='".$url."'>Formulaire d'enquête de retour de formation</a>";
    }
}
 No newline at end of file
+4 −0
Original line number Diff line number Diff line
@@ -3,6 +3,7 @@
namespace Formation\Service\Url;

use Fichier\Service\Fichier\FichierStorageService;
use Laminas\View\Renderer\PhpRenderer;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
@@ -18,13 +19,16 @@ class UrlServiceFactory {
    {
        /**
         * @var FichierStorageService $fichierStorageService
         * @var PhpRenderer $renderer
         * @var StructureDocumentService $structureDocumentService
         */
        $fichierStorageService = $container->get(FichierStorageService::class);
        $renderer = $container->get('ViewRenderer');
        $structureDocumentService = $container->get(StructureDocumentService::class);

        $service = new UrlService();
        $service->setFichierStorageService($fichierStorageService);
        $service->setRenderer($renderer);
        $service->setStructureDocumentService($structureDocumentService);
        return $service;
    }