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

Début d'export pdf pour les fiches metiers et de poste

parent c3596012
Loading
Loading
Loading
Loading
+12 −0
Original line number Diff line number Diff line
@@ -55,6 +55,7 @@ return [
                        'detruire',
                        'historiser',
                        'restaurer',
                        'export',

                        'editer-libelle',
                        'editer-missions-principales',
@@ -112,6 +113,17 @@ return [
                        ],
                        'may_terminate' => true,
                    ],
                    'export' => [
                        'type'  => Segment::class,
                        'options' => [
                            'route'    => '/export/:id',
                            'defaults' => [
                                'controller' => FicheMetierController::class,
                                'action'     => 'export',
                            ],
                        ],
                        'may_terminate' => true,
                    ],
                    'editer' => [
                        'type'  => Segment::class,
                        'options' => [
+12 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ return [
                        'retirer-fiche-metier',
                        'modifier-fiche-metier',
                        'selectionner-activite',
                        'export',
                    ],
                    'roles' => [
                    ],
@@ -93,6 +94,17 @@ return [
                            ],
                        ],
                    ],
                    'export' => [
                        'type'  => Segment::class,
                        'may_terminate' => true,
                        'options' => [
                            'route'    => '/export/:fiche-poste',
                            'defaults' => [
                                'controller' => FichePosteController::class,
                                'action'     => 'export',
                            ],
                        ],
                    ],
                    'editer' => [
                        'type'  => Segment::class,
                        'may_terminate' => true,
+0 −1
Original line number Diff line number Diff line
@@ -12,7 +12,6 @@ use Application\Provider\Privilege\PostePrivileges;
use Application\Service\Poste\PosteService;
use Application\Service\Poste\PosteServiceFactory;
use Application\View\Helper\PosteViewHelper;
use Application\View\Helper\PosteViewHelperFactory;
use UnicaenAuth\Guard\PrivilegeController;
use Zend\Mvc\Router\Http\Literal;
use Zend\Mvc\Router\Http\Segment;
+18 −0
Original line number Diff line number Diff line
@@ -20,12 +20,14 @@ use Application\Form\FicheMetier\LibelleFormAwareTrait;
use Application\Form\FicheMetier\MissionsPrincipalesForm;
use Application\Form\FicheMetier\MissionsPrincipalesFormAwareTrait;
use Application\Service\Activite\ActiviteServiceAwareTrait;
use Application\Service\Export\FicheMetier\FicheMetierPdfExporter;
use Application\Service\FicheMetier\FicheMetierServiceAwareTrait;
use Application\Service\RessourceRh\RessourceRhServiceAwareTrait;
use Zend\Form\Element\Select;
use Zend\Http\Request;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\View\Renderer\PhpRenderer;

class FicheMetierController extends  AbstractActionController{
    /** Traits associé aux services */
@@ -379,4 +381,20 @@ class FicheMetierController extends AbstractActionController{
            'form' => $form,
        ]);
    }

    /** Document pour la signature en présidence */
    public function exportAction()
    {
        $fiche = $this->getFicheMetierService()->getRequestedFicheMetier($this, 'id');

        /* @var PhpRenderer $renderer  */
        $renderer = $this->getServiceLocator()->get('view_renderer');

        $exporter = new FicheMetierPdfExporter($renderer, 'A4');
        $exporter->setVars([
            'fiche' => $fiche,
        ]);
        $exporter->export('export.pdf');
        exit;
    }
}
 No newline at end of file
+19 −1
Original line number Diff line number Diff line
@@ -14,10 +14,12 @@ use Application\Form\FichePosteCreation\FichePosteCreationFormAwareTrait;
use Application\Form\SpecificitePoste\SpecificitePosteForm;
use Application\Form\SpecificitePoste\SpecificitePosteFormAwareTrait;
use Application\Service\Agent\AgentServiceAwareTrait;
use Application\Service\Export\FichePoste\FichePostePdfExporter;
use Application\Service\FichePoste\FichePosteServiceAwareTrait;
use Zend\Http\Request;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\View\Renderer\PhpRenderer;

class FichePosteController extends AbstractActionController {
    /** Service **/
@@ -78,7 +80,7 @@ class FichePosteController extends AbstractActionController {
    public function editerAction()
    {
        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste', false);
        $fiche = $this->getFichePosteService()->getLastFichePoste();
        if ($fiche === null) $fiche = $this->getFichePosteService()->getLastFichePoste();
        return new ViewModel([
            'fiche' => $fiche,
        ]);
@@ -366,4 +368,20 @@ class FichePosteController extends AbstractActionController {
            return (new ViewModel(['title' => 'Informations saisies incorrectes']))->setTemplate('layout/flashMessage');
        }
    }

    /** Document pour la signature en présidence */
    public function exportAction()
    {
        $fiche = $this->getFichePosteService()->getRequestedFichePoste($this, 'fiche-poste');

        /* @var PhpRenderer $renderer  */
        $renderer = $this->getServiceLocator()->get('view_renderer');

        $exporter = new FichePostePdfExporter($renderer, 'A4');
        $exporter->setVars([
            'fiche' => $fiche,
        ]);
        $exporter->export('export.pdf');
        exit;
    }
}
 No newline at end of file
Loading