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

Convocation

parent a4d4e594
Loading
Loading
Loading
Loading
+3 −21
Changes for module/Formation/src/Formation/Controller/InscriptionController.php: 3 added lines, 21 removed lines.
Original line number Diff line number Diff line
@@ -9,9 +9,8 @@ use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Fichier\Service\Storage\Adapter\Exception\StorageAdapterException;
use Formation\Entity\Db\Inscription;
use Formation\Provider\NatureFichier\NatureFichier;
use Formation\Service\Exporter\Attestation\AttestationExporter;
use Formation\Service\Exporter\Attestation\AttestationExporterAwareTrait;
use Formation\Service\Exporter\Convocation\ConvocationExporter;
use Formation\Service\Exporter\Convocation\ConvocationExporterAwareTrait;
use Formation\Service\Inscription\InscriptionServiceAwareTrait;
use Formation\Service\Notification\FormationNotificationFactoryAwareTrait;
use Notification\Service\NotifierServiceAwareTrait;
@@ -42,6 +41,7 @@ class InscriptionController extends AbstractController
    use SessionServiceAwareTrait;
    use StructureDocumentServiceAwareTrait;
    use AttestationExporterAwareTrait;
    use ConvocationExporterAwareTrait;

    private ?PhpRenderer $renderer = null;
    public function setRenderer(?PhpRenderer $renderer) { $this->renderer = $renderer; }
@@ -244,28 +244,10 @@ class InscriptionController extends AbstractController
        $inscription = $this->getInscriptionService()->getRepository()->getRequestedInscription($this);
        $session = $inscription->getSession();

        $logos = [];
        try {
            $logos['site'] = $this->fichierStorageService->getFileForLogoStructure($session->getSite()->getStructure());
        } catch (StorageAdapterException $e) {
            $logos['site'] = null;
        }
        if ($comue = $this->etablissementService->fetchEtablissementComue()) {
            try {
                $logos['comue'] = $this->fichierStorageService->getFileForLogoStructure($comue->getStructure());
            } catch (StorageAdapterException $e) {
                $logos['comue'] = null;
            }
        }

        $signature = $this->findSignatureEtablissement($inscription->getDoctorant()->getEtablissement());

        //exporter
        $export = new ConvocationExporter($this->renderer, 'A4');
        $export = $this->convocationExporter;
        $export->setVars([
            'signature' => $signature,
            'inscription' => $inscription,
            'logos' => $logos,
        ]);
        $export->export('SYGAL_convocation_' . $session->getId() . "_" . $inscription->getId() . ".pdf");
    }
+3 −0
Changes for module/Formation/src/Formation/Controller/InscriptionControllerFactory.php: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Formation\Controller;

use Fichier\Service\Fichier\FichierStorageService;
use Formation\Service\Exporter\Attestation\AttestationExporter;
use Formation\Service\Exporter\Convocation\ConvocationExporter;
use Formation\Service\Notification\FormationNotificationFactory;
use Formation\Service\Session\SessionService;
use Psr\Container\ContainerExceptionInterface;
@@ -53,6 +54,7 @@ class InscriptionControllerFactory {
        $sessionService = $container->get(SessionService::class);
        $structureDocumentService = $container->get(StructureDocumentService::class);
        $attestationExporter = $container->get(AttestationExporter::class);
        $convocationExporter = $container->get(ConvocationExporter::class);

        /* @var $renderer PhpRenderer */
        $renderer = $container->get('ViewRenderer');
@@ -72,6 +74,7 @@ class InscriptionControllerFactory {
        /** forms *****************************************************************************************************/
        /** autres*****************************************************************************************************/
        $controller->setAttestationExporter($attestationExporter);
        $controller->setConvocationExporter($convocationExporter);
        $controller->setRenderer($renderer);

        /** @var \Formation\Service\Notification\FormationNotificationFactory $formationNotificationFactory */
+1 −1
Changes for module/Formation/src/Formation/Provider/Template/PdfTemplates.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@ namespace Formation\Provider\Template;

class PdfTemplates {

    const FORMATION_CONVOCATION = "FORMATION_CONVATION";
    const FORMATION_CONVOCATION = "FORMATION_CONVOCATION";
    const FORMATION_ATTESTATION = "FORMATION_ATTESTATION";

}
 No newline at end of file
+6 −3
Changes for module/Formation/src/Formation/Service/Exporter/Attestation/AttestationExporter.php: 6 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@ use Fichier\Service\Fichier\FichierStorageServiceAwareTrait;
use Formation\Entity\Db\Inscription;
use Formation\Provider\Template\PdfTemplates;
use Formation\Service\Url\UrlServiceAwareTrait;
use Structure\Entity\Db\Etablissement;
use Structure\Entity\Db\Structure;
use Structure\Service\Etablissement\EtablissementServiceAwareTrait;
use Structure\Service\Structure\StructureServiceAwareTrait;
use UnicaenPdf\Exporter\PdfExporter as PdfExporter;
use Laminas\View\Renderer\PhpRenderer;
@@ -15,6 +17,7 @@ use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait;

class AttestationExporter extends PdfExporter
{
    use EtablissementServiceAwareTrait;
    use FichierStorageServiceAwareTrait;
    use RenduServiceAwareTrait;
    use StructureServiceAwareTrait;
@@ -56,13 +59,13 @@ class AttestationExporter extends PdfExporter
            'Url' => $urlService,
        ];

        /** @var Structure $comue */
        $comue = $this->getStructureService()->getRepository()->findOneBy(['sigle' => 'NU']);
        /** @var Etablissement $comue */
        $comue = $this->etablissementService->fetchEtablissementComue();
        /** @var Structure $ced */
        $ced = $this->getStructureService()->getRepository()->findOneBy(['sigle' => 'CED']);
        $etab = $doctorant->getEtablissement()->getStructure();
        $logos = [
            "COMUE" => $comue?$this->fichierStorageService->getFileForLogoStructure($comue):null,
            "COMUE" => $comue?$this->fichierStorageService->getFileForLogoStructure($comue->getStructure()):null,
            "CED" =>  $ced?$this->fichierStorageService->getFileForLogoStructure($ced):null,
            "ETAB" => $etab?$this->fichierStorageService->getFileForLogoStructure($etab):null,
        ];
+4 −0
Changes for module/Formation/src/Formation/Service/Exporter/Attestation/AttestationExporterFactory.php: 4 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ use Formation\Service\Url\UrlService;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
use Structure\Service\Etablissement\EtablissementService;
use Structure\Service\Structure\StructureService;
use UnicaenRenderer\Service\Rendu\RenduService;

@@ -19,11 +20,13 @@ class AttestationExporterFactory {
    public function __invoke(ContainerInterface $container) : AttestationExporter
    {
        /**
         * @var EtablissementService $etablissementService
         * @var FichierStorageService $fichierStorageService
         * @var RenduService $renduService
         * @var StructureService $structureService
         * @var UrlService $urlService
         */
        $etablissementService = $container->get(EtablissementService::class);
        $fichierStorageService = $container->get(FichierStorageService::class);
        $renduService = $container->get(RenduService::class);
        $structureService = $container->get(StructureService::class);
@@ -31,6 +34,7 @@ class AttestationExporterFactory {
        $renderer = $container->get('ViewRenderer');

        $exporter = new AttestationExporter($renderer, 'A4');
        $exporter->setEtablissementService($etablissementService);
        $exporter->setFichierStorageService($fichierStorageService);
        $exporter->setRenduService($renduService);
        $exporter->setStructureService($structureService);
Loading