Commit 1fd4ab5e authored by Bertrand Gauthier's avatar Bertrand Gauthier
Browse files

Permettre la réutilisation du PageDeCouverturePdfExporter : plus d'injection...

Permettre la réutilisation du PageDeCouverturePdfExporter : plus d'injection du template et css propres à la PDC de thèse dans la factory
parent 11ad207f
Loading
Loading
Loading
Loading
+2 −2
Changes for config/autoload/global.php: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -16,9 +16,9 @@ return [
        'page_de_couverture' => [
            'template' => [
                // template .phtml
                'phtml_file_path' => APPLICATION_DIR . '/module/Application/src/Application/Service/PageDeCouverture/pagedecouverture.phtml',
                'phtml_file_path' => APPLICATION_DIR . '/module/Application/view/application/these/page-de-couverture/pagedecouverture.phtml',
                // feuille de styles
                'css_file_path' => APPLICATION_DIR . '/module/Application/src/Application/Service/PageDeCouverture/pagedecouverture.css',
                'css_file_path' => APPLICATION_DIR . '/module/Application/view/application/these/page-de-couverture/pagedecouverture.css',
            ],
        ],
        // Options pour le test d'archivabilité
+2 −2
Changes for config/autoload/local.php.dist: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -8,9 +8,9 @@ return [
        'page_de_couverture' => [
            'template' => [
                // template .phtml
                'phtml_file_path' => APPLICATION_DIR . '/module/Application/src/Application/Service/PageDeCouverture/pagedecouverture.phtml',
                'phtml_file_path' => APPLICATION_DIR . '/module/Application/view/application/these/page-de-couverture/pagedecouverture.phtml',
                // feuille de styles
                'css_file_path' => APPLICATION_DIR . '/module/Application/src/Application/Service/PageDeCouverture/pagedecouverture.css',
                'css_file_path' => APPLICATION_DIR . '/module/Application/view/application/these/page-de-couverture/pagedecouverture.css',
            ],
        ],
        'archivabilite' => [
+19 −2
Changes for module/Application/src/Application/Service/FichierThese/FichierTheseServiceFactory.php: 19 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -33,7 +33,6 @@ class FichierTheseServiceFactory
         * @var RetraitementService $retraitementService
         * @var EtablissementService $etablissementService
         * @var NotifierService $notifierService
         * @var PageDeCouverturePdfExporter $pdcPdfExporter
         */
        $fichierService = $container->get(FichierService::class);
        $fileService = $container->get(FileService::class);
@@ -42,7 +41,7 @@ class FichierTheseServiceFactory
        $retraitementService = $container->get('RetraitementService');
        $etablissementService = $container->get('EtablissementService');
        $notifierService = $container->get(NotifierService::class);
        $pdcPdfExporter = $container->get(PageDeCouverturePdfExporter::class);
        $pdcPdfExporter = $this->createPageDeCouverturePdfExporter($container);

        $service = new FichierTheseService();

@@ -59,6 +58,24 @@ class FichierTheseServiceFactory
        return $service;
    }

    private function createPageDeCouverturePdfExporter(ContainerInterface $container): PageDeCouverturePdfExporter
    {
        $config = $container->get('Config');

        $pdcConfig = $config['sygal']['page_de_couverture'];
        $templateConfig = $pdcConfig['template'];
        $templateFilePath = $templateConfig['phtml_file_path'];
        $cssFilePath = $templateConfig['css_file_path'];

        /** @var PageDeCouverturePdfExporter $pdcPdfExporter */
        $pdcPdfExporter = $container->get(PageDeCouverturePdfExporter::class);
        $pdcPdfExporter
            ->setTemplateFilePath($templateFilePath)
            ->setCssFilePath($cssFilePath);

        return $pdcPdfExporter;
    }

    private function createFichierCinesValidator(ContainerInterface $container): FichierCinesValidator
    {
        /** @var \Application\Command\TestArchivabiliteShellCommand $command */
+1 −1
Changes for module/Application/src/Application/Service/PageDeCouverture/PageDeCouverturePdfExporter.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -16,7 +16,7 @@ class PageDeCouverturePdfExporter extends PdfExporter
    /**
     * @var string
     */
    private $cssFilePath = __DIR__ . '/page-unicaen.css';
    private $cssFilePath = __DIR__ . '/pagedecouverture.css';

    /**
     * @var array
+1 −14
Changes for module/Application/src/Application/Service/PageDeCouverture/PageDeCouverturePdfExporterFactory.php: 1 added line, 14 removed lines.
Original line number Diff line number Diff line
@@ -12,22 +12,9 @@ class PageDeCouverturePdfExporterFactory implements FactoryInterface
     */
    public function __invoke(ContainerInterface $container, $requestedName, array $options = null)
    {
        $config = $container->get('Config');

        /** @var \Zend\View\Renderer\PhpRenderer $renderer */
        $renderer = $container->get('ViewRenderer');

        $pdcConfig = $config['sygal']['page_de_couverture'];

        $templateConfig = $pdcConfig['template'];
        $templateFilePath = $templateConfig['phtml_file_path'];
        $cssFilePath = $templateConfig['css_file_path'];

        $exporter = new PageDeCouverturePdfExporter($renderer, 'A4');
        $exporter
            ->setTemplateFilePath($templateFilePath)
            ->setCssFilePath($cssFilePath);

        return $exporter;
        return new PageDeCouverturePdfExporter($renderer, 'A4');
    }
}
 No newline at end of file
Loading