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

Merge branch 'ModuleFormation_4.0.0' of git.unicaen.fr:open-source/sygal into ModuleFormation_4.0.0

parents d27da3cc c406ac28
Loading
Loading
Loading
Loading
+16 −2
Changes for module/Formation/Module.php: 16 added lines, 2 removed lines.
Original line number Diff line number Diff line
<?php
namespace Formation;

use Laminas\Console\Adapter\AdapterInterface as Console;
use Laminas\ModuleManager\Feature\ConsoleUsageProviderInterface;
use Laminas\Mvc\ModuleRouteListener;
use Laminas\Mvc\MvcEvent;
use Laminas\Config\Factory as ConfigFactory;
use Laminas\Stdlib\Glob;

class Module
class Module implements ConsoleUsageProviderInterface
{
    public function onBootstrap(MvcEvent $e)
    {
@@ -25,7 +27,7 @@ class Module
        return ConfigFactory::fromFiles($paths);
    }

    public function getAutoloaderConfig()
    public function getAutoloaderConfig(): array
    {
        return array(
            'Laminas\Loader\StandardAutoloader' => array(
@@ -35,4 +37,16 @@ class Module
            ),
        );
    }

    public function getConsoleUsage(Console $console): array
    {
        return [
            'formation:session:terminer-auto' =>
                'Terminaison des sessions dont toutes les séances sont passées',
//            ['--these',           "Id de la thèse concernée"],
//            ['--versionFichier',  "Version du fichier de thèse à utiliser (ex: 'VA', 'VOC')"],
//            ['--removeFirstPage', "(facultatif) Témoin indiquant si la première page doit être retirée avant la fusion"],
//            ['--notifier',        "(facultatif) Adresses électroniques auxquelles envoyer un courriel une fois la fusion terminée"],
        ];
    }
}
+26 −0
Changes for module/Formation/config/others/session.config.php: 26 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -2,6 +2,8 @@

namespace Formation;

use Formation\Controller\Console\SessionConsoleController;
use Formation\Controller\Console\SessionConsoleControllerFactory;
use Formation\Controller\Recherche\SessionRechercheController;
use Formation\Controller\Recherche\SessionRechercheControllerFactory;
use Formation\Controller\SessionController;
@@ -92,6 +94,13 @@ return [
                        SessionPrivileges::SESSION_INSCRIPTION,
                    ],
                ],
                [
                    'controller' => SessionConsoleController::class,
                    'action' => [
                        'terminer-auto',
                    ],
                    'role' => [],
                ],
            ],
        ],
    ],
@@ -267,6 +276,22 @@ return [
        ],
    ],

    'console' => [
        'router' => [
            'routes' => [
                'terminer-auto' => [
                    'options' => [
                        'route' => 'formation:session:terminer-auto',
                        'defaults' => [
                            'controller' => SessionConsoleController::class,
                            'action' => 'terminer-auto',
                        ],
                    ],
                ],
            ],
        ],
    ],

    'service_manager' => [
        'factories' => [
            SessionService::class => SessionServiceFactory::class,
@@ -277,6 +302,7 @@ return [
        'factories' => [
            SessionController::class => SessionControllerFactory::class,
            SessionRechercheController::class => SessionRechercheControllerFactory::class,
            SessionConsoleController::class => SessionConsoleControllerFactory::class,
        ],
    ],
    'form_elements' => [
+27 −0
Changes for module/Formation/src/Formation/Controller/Console/SessionConsoleController.php: 27 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Formation\Controller\Console;

use Formation\Service\Session\SessionServiceAwareTrait;
use Laminas\Mvc\Console\Controller\AbstractConsoleController;
use UnicaenApp\Exception\RuntimeException;

class SessionConsoleController extends AbstractConsoleController
{
    use SessionServiceAwareTrait;

    public function terminerAutoAction()
    {
        $this->console->writeLine("# Terminaison des sessions dont toutes les séances sont passées...");
        try {
            $ids = $this->sessionService->terminerSessionsDontToutesSeancesPassees();
            $this->console->writeLine(empty($ids) ?
                "Aucun session à mettre à jour." :
                "Sessions mises à jour : " . implode(', ', $ids) . '.'
            );
        } catch (\Exception $e) {
            throw new RuntimeException("Une erreur est survenue pendant l'opération.", null, $e);
        }
        $this->console->writeLine("Fait.");
    }
}
 No newline at end of file
+24 −0
Changes for module/Formation/src/Formation/Controller/Console/SessionConsoleControllerFactory.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

namespace Formation\Controller\Console;

use Formation\Service\Session\SessionService;
use Psr\Container\ContainerInterface;

class SessionConsoleControllerFactory
{
    /**
     * @throws \Psr\Container\NotFoundExceptionInterface
     * @throws \Psr\Container\ContainerExceptionInterface
     */
    public function __invoke(ContainerInterface $container): SessionConsoleController
    {
        $controller = new SessionConsoleController();

        /** @var SessionService $sessionService */
        $sessionService = $container->get(SessionService::class);
        $controller->setSessionService($sessionService);

        return $controller;
    }
}
 No newline at end of file
+0 −2
Changes for module/Formation/src/Formation/Entity/Db/Session.php: 0 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -27,13 +27,11 @@ class Session implements HistoriqueAwareInterface,
    const ETAT_PREPARATION      = 'P';
    const ETAT_INSCRIPTION      = 'O';
    const ETAT_EN_COURS         = 'E';
    const ETAT_TERMINE          = 'T';
    const ETAT_CLOS_FINAL       = 'C';
    const ETATS = [
        self::ETAT_PREPARATION => self::ETAT_PREPARATION,
        self::ETAT_INSCRIPTION => self::ETAT_INSCRIPTION,
        self::ETAT_EN_COURS => self::ETAT_EN_COURS,
        self::ETAT_TERMINE => self::ETAT_TERMINE,
        self::ETAT_CLOS_FINAL => self::ETAT_CLOS_FINAL,
    ];

Loading