Loading module/These/config/others/these.config.php +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ use These\Controller\Plugin\Url\UrlThesePluginFactory; use These\Controller\TheseController; use These\Controller\TheseRechercheController; use These\Provider\Privilege\ThesePrivileges; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporter; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporterFactory; use These\Service\These\Factory\TheseSearchServiceFactory; use These\Service\These\Factory\TheseServiceFactory; use These\Service\These\TheseSearchService; Loading Loading @@ -374,6 +376,8 @@ return [ TheseAssertion::class => TheseAssertionFactory::class, TheseEntityAssertion::class => TheseEntityAssertionFactory::class, CoEncadrementsExporter::class => CoEncadrementsExporterFactory::class ], 'aliases' => [ TheseService::class => 'TheseService', Loading module/These/src/These/Controller/CoEncadrantController.php +10 −18 Original line number Diff line number Diff line Loading @@ -23,12 +23,11 @@ use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait; use These\Entity\Db\Acteur; use These\Entity\Db\These; use These\Form\CoEncadrant\RechercherCoEncadrantFormAwareTrait; use These\Provider\Template\PdfTemplates; use These\Service\Acteur\ActeurServiceAwareTrait; use These\Service\CoEncadrant\CoEncadrantServiceAwareTrait; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporterAwareTrait; use These\Service\These\TheseServiceAwareTrait; use UnicaenApp\View\Model\CsvModel; use UnicaenPdf\Exporter\PdfExporter as PdfExporter; use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait; class CoEncadrantController extends AbstractActionController Loading @@ -43,7 +42,7 @@ class CoEncadrantController extends AbstractActionController use EtablissementServiceAwareTrait; use UniteRechercheServiceAwareTrait; use RenduServiceAwareTrait; use CoEncadrementsExporterAwareTrait; private ?PhpRenderer $renderer = null; public function setRenderer(PhpRenderer $renderer): void Loading @@ -58,6 +57,7 @@ class CoEncadrantController extends AbstractActionController /** @see CoEncadrantController::rechercherCoEncadrantAction() */ $form->setUrlCoEncadrant($this->url()->fromRoute('co-encadrant/rechercher-co-encadrant', [], [], true)); $form->setUrlEtablisssement($this->url()->fromRoute('etablissement/rechercher', [], ["query" => []], true)); $form->get('bouton')->setLabel("Afficher l'historique de co-encadrement"); $request = $this->getRequest(); Loading Loading @@ -173,10 +173,6 @@ class CoEncadrantController extends AbstractActionController $coencadrant = $this->getCoEncadrantService()->getRequestedCoEncadrant($this); $theses = $this->getTheseService()->getRepository()->fetchThesesByCoEncadrant($coencadrant->getIndividu()); $vars = [ 'acteur' => $coencadrant, ]; $listing = "<ul>"; foreach ($theses as $these) { //todo macro ou formateur ... Loading Loading @@ -207,18 +203,14 @@ class CoEncadrantController extends AbstractActionController "ETAB" => $logoETAB, ]; $rendu = $this->getRenduService()->generateRenduByTemplateCode(PdfTemplates::COENCADREMENTS_JUSTIFICATIF, $vars); $corps = str_replace("###LISTING_THESE###", $listing, $rendu->getCorps()); $filename = 'justificatif_coencadrement_' . $coencadrant->getIndividu()->getId() . ".pdf"; $export = new PdfExporter(); $export = $this->coEncadrementsExporter; try { $export->getMpdf()->SetMargins(0, 0, 60); //todo passer un header exploitant les logo $export->setHeaderScript('these/pdf/coencadrant-header.phtml', null, $logos); $export->setFooterScript('these/pdf/coencadrant-footer.phtml'); $export->addBodyHtml($corps); $export->setVars([ 'logos' => $logos, 'listing' => $listing, 'acteur' => $coencadrant ]); $filename = 'justificatif_coencadrement_' . $coencadrant->getIndividu()->getId() . ".pdf"; return $export->export($filename); } catch (MpdfException $e) { throw new RuntimeException("Un problème est survenu lors de la génération du PDF", 0 , $e); Loading module/These/src/These/Controller/Factory/CoEncadrantControllerFactory.php +5 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use These\Controller\CoEncadrantController; use These\Form\CoEncadrant\RechercherCoEncadrantForm; use These\Service\Acteur\ActeurService; use These\Service\CoEncadrant\CoEncadrantService; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporter; use These\Service\These\TheseService; use UnicaenRenderer\Service\Rendu\RenduService; Loading Loading @@ -49,6 +50,8 @@ class CoEncadrantControllerFactory $renduService = $container->get(RenduService::class); $theseService = $container->get('TheseService'); $uniteRechercheService = $container->get(UniteRechercheService::class); $coEncadrementsExporter = $container->get(CoEncadrementsExporter::class); /** * @var RechercherCoEncadrantForm $rechercheCoEncadrantForm Loading @@ -70,6 +73,8 @@ class CoEncadrantControllerFactory $controller->setUniteRechercheService($uniteRechercheService); $controller->setRechercherCoEncadrantForm($rechercheCoEncadrantForm); $controller->setRenderer($renderer); $controller->setCoEncadrementsExporter($coEncadrementsExporter); return $controller; } } No newline at end of file module/These/src/These/Service/Exporter/CoEncadrements/CoEncadrementsExporter.php 0 → 100644 +50 −0 Original line number Diff line number Diff line <?php namespace These\Service\Exporter\CoEncadrements; use Application\Service\Role\RoleServiceAwareTrait; use Laminas\View\Renderer\PhpRenderer; use Laminas\View\Resolver\TemplatePathStack; use These\Provider\Template\PdfTemplates; use UnicaenPdf\Exporter\PdfExporter as PdfExporter; use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait; class CoEncadrementsExporter extends PdfExporter { use RenduServiceAwareTrait; use RoleServiceAwareTrait; private $vars; public function setVars(array $vars) { $this->vars = $vars; $this->vars['exporter'] = $this; return $this; } public function __construct(PhpRenderer $renderer = null, $format = 'A4', $orientationPaysage = false, $defaultFontSize = 10) { parent::__construct($renderer, $format, $orientationPaysage, $defaultFontSize); $resolver = $renderer->resolver(); $resolver->attach(new TemplatePathStack(['script_paths' => [__DIR__]])); } public function export($filename = null, $destination = self::DESTINATION_BROWSER, $memoryLimit = null) { $logos = $this->vars['logos']; $listing = $this->vars["listing"]; $vars = [ 'acteur' => $this->vars['acteur'], ]; $rendu = $this->getRenduService()->generateRenduByTemplateCode(PdfTemplates::COENCADREMENTS_JUSTIFICATIF, $vars); $corps = str_replace("###LISTING_THESE###", $listing, $rendu->getCorps()); $this->getMpdf()->SetMargins(0, 0, 60); $this->setHeaderScript("these/pdf/coencadrant-header.phtml", null, $logos); $this->setFooterScript('these/pdf/coencadrant-footer.phtml'); $this->addBodyHtml($corps); return PdfExporter::export($filename, $destination, $memoryLimit); } } No newline at end of file module/These/src/These/Service/Exporter/CoEncadrements/CoEncadrementsExporterAwareTrait.php 0 → 100644 +19 −0 Original line number Diff line number Diff line <?php namespace These\Service\Exporter\CoEncadrements; trait CoEncadrementsExporterAwareTrait { private CoEncadrementsExporter $coEncadrementsExporter; public function getCoEncadrementsExporter(): CoEncadrementsExporter { return $this->coEncadrementsExporter; } public function setCoEncadrementsExporter(CoEncadrementsExporter $coEncadrementsExporter): void { $this->coEncadrementsExporter = $coEncadrementsExporter; } } No newline at end of file Loading
module/These/config/others/these.config.php +4 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,8 @@ use These\Controller\Plugin\Url\UrlThesePluginFactory; use These\Controller\TheseController; use These\Controller\TheseRechercheController; use These\Provider\Privilege\ThesePrivileges; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporter; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporterFactory; use These\Service\These\Factory\TheseSearchServiceFactory; use These\Service\These\Factory\TheseServiceFactory; use These\Service\These\TheseSearchService; Loading Loading @@ -374,6 +376,8 @@ return [ TheseAssertion::class => TheseAssertionFactory::class, TheseEntityAssertion::class => TheseEntityAssertionFactory::class, CoEncadrementsExporter::class => CoEncadrementsExporterFactory::class ], 'aliases' => [ TheseService::class => 'TheseService', Loading
module/These/src/These/Controller/CoEncadrantController.php +10 −18 Original line number Diff line number Diff line Loading @@ -23,12 +23,11 @@ use Structure\Service\UniteRecherche\UniteRechercheServiceAwareTrait; use These\Entity\Db\Acteur; use These\Entity\Db\These; use These\Form\CoEncadrant\RechercherCoEncadrantFormAwareTrait; use These\Provider\Template\PdfTemplates; use These\Service\Acteur\ActeurServiceAwareTrait; use These\Service\CoEncadrant\CoEncadrantServiceAwareTrait; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporterAwareTrait; use These\Service\These\TheseServiceAwareTrait; use UnicaenApp\View\Model\CsvModel; use UnicaenPdf\Exporter\PdfExporter as PdfExporter; use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait; class CoEncadrantController extends AbstractActionController Loading @@ -43,7 +42,7 @@ class CoEncadrantController extends AbstractActionController use EtablissementServiceAwareTrait; use UniteRechercheServiceAwareTrait; use RenduServiceAwareTrait; use CoEncadrementsExporterAwareTrait; private ?PhpRenderer $renderer = null; public function setRenderer(PhpRenderer $renderer): void Loading @@ -58,6 +57,7 @@ class CoEncadrantController extends AbstractActionController /** @see CoEncadrantController::rechercherCoEncadrantAction() */ $form->setUrlCoEncadrant($this->url()->fromRoute('co-encadrant/rechercher-co-encadrant', [], [], true)); $form->setUrlEtablisssement($this->url()->fromRoute('etablissement/rechercher', [], ["query" => []], true)); $form->get('bouton')->setLabel("Afficher l'historique de co-encadrement"); $request = $this->getRequest(); Loading Loading @@ -173,10 +173,6 @@ class CoEncadrantController extends AbstractActionController $coencadrant = $this->getCoEncadrantService()->getRequestedCoEncadrant($this); $theses = $this->getTheseService()->getRepository()->fetchThesesByCoEncadrant($coencadrant->getIndividu()); $vars = [ 'acteur' => $coencadrant, ]; $listing = "<ul>"; foreach ($theses as $these) { //todo macro ou formateur ... Loading Loading @@ -207,18 +203,14 @@ class CoEncadrantController extends AbstractActionController "ETAB" => $logoETAB, ]; $rendu = $this->getRenduService()->generateRenduByTemplateCode(PdfTemplates::COENCADREMENTS_JUSTIFICATIF, $vars); $corps = str_replace("###LISTING_THESE###", $listing, $rendu->getCorps()); $filename = 'justificatif_coencadrement_' . $coencadrant->getIndividu()->getId() . ".pdf"; $export = new PdfExporter(); $export = $this->coEncadrementsExporter; try { $export->getMpdf()->SetMargins(0, 0, 60); //todo passer un header exploitant les logo $export->setHeaderScript('these/pdf/coencadrant-header.phtml', null, $logos); $export->setFooterScript('these/pdf/coencadrant-footer.phtml'); $export->addBodyHtml($corps); $export->setVars([ 'logos' => $logos, 'listing' => $listing, 'acteur' => $coencadrant ]); $filename = 'justificatif_coencadrement_' . $coencadrant->getIndividu()->getId() . ".pdf"; return $export->export($filename); } catch (MpdfException $e) { throw new RuntimeException("Un problème est survenu lors de la génération du PDF", 0 , $e); Loading
module/These/src/These/Controller/Factory/CoEncadrantControllerFactory.php +5 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,7 @@ use These\Controller\CoEncadrantController; use These\Form\CoEncadrant\RechercherCoEncadrantForm; use These\Service\Acteur\ActeurService; use These\Service\CoEncadrant\CoEncadrantService; use These\Service\Exporter\CoEncadrements\CoEncadrementsExporter; use These\Service\These\TheseService; use UnicaenRenderer\Service\Rendu\RenduService; Loading Loading @@ -49,6 +50,8 @@ class CoEncadrantControllerFactory $renduService = $container->get(RenduService::class); $theseService = $container->get('TheseService'); $uniteRechercheService = $container->get(UniteRechercheService::class); $coEncadrementsExporter = $container->get(CoEncadrementsExporter::class); /** * @var RechercherCoEncadrantForm $rechercheCoEncadrantForm Loading @@ -70,6 +73,8 @@ class CoEncadrantControllerFactory $controller->setUniteRechercheService($uniteRechercheService); $controller->setRechercherCoEncadrantForm($rechercheCoEncadrantForm); $controller->setRenderer($renderer); $controller->setCoEncadrementsExporter($coEncadrementsExporter); return $controller; } } No newline at end of file
module/These/src/These/Service/Exporter/CoEncadrements/CoEncadrementsExporter.php 0 → 100644 +50 −0 Original line number Diff line number Diff line <?php namespace These\Service\Exporter\CoEncadrements; use Application\Service\Role\RoleServiceAwareTrait; use Laminas\View\Renderer\PhpRenderer; use Laminas\View\Resolver\TemplatePathStack; use These\Provider\Template\PdfTemplates; use UnicaenPdf\Exporter\PdfExporter as PdfExporter; use UnicaenRenderer\Service\Rendu\RenduServiceAwareTrait; class CoEncadrementsExporter extends PdfExporter { use RenduServiceAwareTrait; use RoleServiceAwareTrait; private $vars; public function setVars(array $vars) { $this->vars = $vars; $this->vars['exporter'] = $this; return $this; } public function __construct(PhpRenderer $renderer = null, $format = 'A4', $orientationPaysage = false, $defaultFontSize = 10) { parent::__construct($renderer, $format, $orientationPaysage, $defaultFontSize); $resolver = $renderer->resolver(); $resolver->attach(new TemplatePathStack(['script_paths' => [__DIR__]])); } public function export($filename = null, $destination = self::DESTINATION_BROWSER, $memoryLimit = null) { $logos = $this->vars['logos']; $listing = $this->vars["listing"]; $vars = [ 'acteur' => $this->vars['acteur'], ]; $rendu = $this->getRenduService()->generateRenduByTemplateCode(PdfTemplates::COENCADREMENTS_JUSTIFICATIF, $vars); $corps = str_replace("###LISTING_THESE###", $listing, $rendu->getCorps()); $this->getMpdf()->SetMargins(0, 0, 60); $this->setHeaderScript("these/pdf/coencadrant-header.phtml", null, $logos); $this->setFooterScript('these/pdf/coencadrant-footer.phtml'); $this->addBodyHtml($corps); return PdfExporter::export($filename, $destination, $memoryLimit); } } No newline at end of file
module/These/src/These/Service/Exporter/CoEncadrements/CoEncadrementsExporterAwareTrait.php 0 → 100644 +19 −0 Original line number Diff line number Diff line <?php namespace These\Service\Exporter\CoEncadrements; trait CoEncadrementsExporterAwareTrait { private CoEncadrementsExporter $coEncadrementsExporter; public function getCoEncadrementsExporter(): CoEncadrementsExporter { return $this->coEncadrementsExporter; } public function setCoEncadrementsExporter(CoEncadrementsExporter $coEncadrementsExporter): void { $this->coEncadrementsExporter = $coEncadrementsExporter; } } No newline at end of file