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

Emargement

parent d0e666df
Loading
Loading
Loading
Loading
+25
Changes for module/Formation/config/others/inscription.config.php: 25 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -26,6 +26,8 @@ return [
                        'supprimer',
                        'passer-liste-principale',
                        'passer-liste-complementaire',
                        'generer-convocation',
                        'generer-attestation',
                    ],
                    'privileges' => [
                        IndexPrivileges::INDEX_AFFICHER,
@@ -135,6 +137,29 @@ return [
                                    ],
                                ],
                            ],

                            'generer-convocation' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/generer-convocation/:inscription',
                                    'defaults' => [
                                        'controller' => InscriptionController::class,
                                        'action'     => 'generer-convocation',
                                    ],
                                ],
                            ],
                            'generer-attestation' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/generer-attestation/:inscription',
                                    'defaults' => [
                                        'controller' => InscriptionController::class,
                                        'action'     => 'generer-attestation',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
+12
Changes for module/Formation/config/others/seance.config.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -28,6 +28,7 @@ return [
                        'historiser',
                        'restaurer',
                        'supprimer',
                        'generer-emargement',
                    ],
                    'privileges' => [
                        IndexPrivileges::INDEX_AFFICHER,
@@ -126,6 +127,17 @@ return [
                                    ],
                                ],
                            ],
                            'generer-emargement' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/generer-emargement/:seance',
                                    'defaults' => [
                                        'controller' => SeanceController::class,
                                        'action'     => 'generer-emargement',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
+12
Changes for module/Formation/config/others/session.config.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ return [

                        'classer-inscriptions',
                        'declasser-inscriptions',
                        'generer-emargements',
                    ],
                    'privileges' => [
                        IndexPrivileges::INDEX_AFFICHER,
@@ -163,6 +164,17 @@ return [
                                    ],
                                ],
                            ],
                            'generer-emargements' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/generer-emargements/:session',
                                    'defaults' => [
                                        'controller' => SessionController::class,
                                        'action'     => 'generer-emargements',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
+66 −1
Changes for module/Formation/src/Formation/Controller/InscriptionController.php: 66 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -6,19 +6,39 @@ use Application\Controller\AbstractController;
use Application\Entity\Db\Doctorant;
use Application\Entity\Db\Individu;
use Application\Service\Doctorant\DoctorantServiceAwareTrait;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\File\FileServiceAwareTrait;
use Application\Service\Individu\IndividuServiceAwareTrait;
use Formation\Entity\Db\Inscription;
use Formation\Entity\Db\Session;
use Formation\Service\Exporter\Attestation\AttestationExporter;
use Formation\Service\Exporter\Convocation\ConvocationExporter;
use Formation\Service\Inscription\InscriptionServiceAwareTrait;
use Formation\Service\Presence\PresenceServiceAwareTrait;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Zend\View\Model\ViewModel;
use Zend\View\Renderer\PhpRenderer;

class InscriptionController extends AbstractController
{
    use EntityManagerAwareTrait;
    use IndividuServiceAwareTrait;
    use DoctorantServiceAwareTrait;
    use EtablissementServiceAwareTrait;
    use FileServiceAwareTrait;
    use IndividuServiceAwareTrait;
    use InscriptionServiceAwareTrait;
    use PresenceServiceAwareTrait;

    /** @var PhpRenderer */
    private $renderer;

    /**
     * @param PhpRenderer $renderer
     */
    public function setRenderer($renderer)
    {
        $this->renderer = $renderer;
    }

    public function indexAction()
    {
@@ -148,4 +168,49 @@ class InscriptionController extends AbstractController
        if ($retour) return $this->redirect()->toUrl($retour);
        return $this->redirect()->toRoute('formation/inscription',[],[], true);
    }

    public function genererConvocationAction()
    {
        /** @var Inscription|null $inscription */
        $inscription = $this->getEntityManager()->getRepository(Inscription::class)->getRequestedInscription($this);
        $session = $inscription->getSession();

        $logos = [];
        $logos['site'] = $this->fileService->computeLogoFilePathForStructure($session->getSite());
        if ($comue = $this->etablissementService->fetchEtablissementComue()) {
            $logos['comue'] = $this->fileService->computeLogoFilePathForStructure($comue);
        }

        //exporter
        $export = new ConvocationExporter($this->renderer, 'A4');
        $export->setVars([
            'inscription' => $inscription,
            'logos' => $logos,
        ]);
        $export->export('SYGAL_convocation_' . $session->getId() . "_" . $inscription->getId() . ".pdf");
    }

    public function genererAttestationAction()
    {
        /** @var Inscription|null $inscription */
        $inscription = $this->getEntityManager()->getRepository(Inscription::class)->getRequestedInscription($this);
        $session = $inscription->getSession();

        $presences = $this->getPresenceService()->calculerDureePresence($inscription);

        $logos = [];
        $logos['site'] = $this->fileService->computeLogoFilePathForStructure($session->getSite());
        if ($comue = $this->etablissementService->fetchEtablissementComue()) {
            $logos['comue'] = $this->fileService->computeLogoFilePathForStructure($comue);
        }

        //exporter
        $export = new AttestationExporter($this->renderer, 'A4');
        $export->setVars([
            'inscription' => $inscription,
            'logos' => $logos,
            'presences' => $presences,
        ]);
        $export->export('SYGAL_attestation_' . $session->getId() . "_" . $inscription->getId() . ".pdf");
    }
}
 No newline at end of file
+19
Changes for module/Formation/src/Formation/Controller/InscriptionControllerFactory.php: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,10 +3,15 @@
namespace Formation\Controller;

use Application\Service\Doctorant\DoctorantService;
use Application\Service\Etablissement\EtablissementService;
use Application\Service\File\FileService;
use Application\Service\Individu\IndividuService;
use Doctrine\ORM\EntityManager;
use Formation\Entity\Db\Presence;
use Formation\Service\Inscription\InscriptionService;
use Formation\Service\Presence\PresenceService;
use Interop\Container\ContainerInterface;
use Zend\View\Renderer\PhpRenderer;

class InscriptionControllerFactory {

@@ -19,21 +24,35 @@ class InscriptionControllerFactory {
        /**
         * @var EntityManager $entityManager
         * @var DoctorantService $doctorantService
         * @var EtablissementService $etablissementService
         * @var FileService $fileService
         * @var InscriptionService $inscriptionService
         * @var IndividuService $individuService
         * @var PresenceService $presenceService
         */
        $entityManager = $container->get('doctrine.entitymanager.orm_default');
        $doctorantService = $container->get(DoctorantService::class);
        $etablissementService = $container->get(EtablissementService::class);
        $fileService = $container->get(FileService::class);
        $individuService = $container->get(IndividuService::class);
        $inscriptionService = $container->get(InscriptionService::class);
        $presenceService = $container->get(PresenceService::class);

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

        $controller = new InscriptionController();
        /** services **************************************************************************************************/
        $controller->setEntityManager($entityManager);
        $controller->setDoctorantService($doctorantService);
        $controller->setEtablissementService($etablissementService);
        $controller->setFileService($fileService);
        $controller->setIndividuService($individuService);
        $controller->setInscriptionService($inscriptionService);
        $controller->setPresenceService($presenceService);
        /** forms *****************************************************************************************************/
        /** autres*****************************************************************************************************/
        $controller->setRenderer($renderer);

        return $controller;
    }
Loading