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

Debut correction

parent bb3ac407
Loading
Loading
Loading
Loading
+1 −1
Changes for module/Formation/SQL/002_donnees_initiales.sql: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -2,4 +2,4 @@ INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) V
INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) VALUES ('O', 'Inscription ouverte', null, 'glyphicon glyphicon-ok-circle', '#11cc00', 2);
INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) VALUES ('F', 'Inscription fermée', null, 'glyphicon glyphicon-ban-circle', '#008fcc', 3);
INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) VALUES ('A', 'Session annulée', 'La session a été annulée', 'icon icon-historiser', '#cc0000', 5);
INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) VALUES ('C', 'Cloturer', 'Formation cloturer', null, null, 4);
 No newline at end of file
INSERT INTO FORMATION_ETAT (CODE, LIBELLE, DESCRIPTION, ICONE, COULEUR, ORDRE) VALUES ('C', 'Close', 'Formation close', null, null, 4);
 No newline at end of file
+12
Changes for module/Formation/config/others/session.config.php: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ return [
                    'action' => [
                        'afficher',
                        'generer-emargements',
                        'generer-export',
                    ],
                    'privileges' => [
                        SessionPrivileges::SESSION_AFFICHER,
@@ -135,6 +136,17 @@ return [
                                    ],
                                ],
                            ],
                            'generer-export' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
                                'options' => [
                                    'route'    => '/generer-export/:session',
                                    'defaults' => [
                                        'controller' => SessionController::class,
                                        'action'     => 'generer-export',
                                    ],
                                ],
                            ],
                            'ajouter' => [
                                'type'  => Segment::class,
                                'may_terminate' => true,
+1 −1
Changes for module/Formation/src/Formation/Controller/ModuleController.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -148,7 +148,7 @@ class ModuleController extends AbstractController {
        return $vm;
    }

    public function catalogueAction()
    public function catalogueAction() : ViewModel
    {
        /** @var Module[] $modules */
        $modules = $this->getEntityManager()->getRepository(Module::class)->findAll();
+43
Changes for module/Formation/src/Formation/Controller/SessionController.php: 43 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,8 +3,10 @@
namespace Formation\Controller;

use Application\Controller\AbstractController;
use Application\Entity\Db\These;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\File\FileServiceAwareTrait;
use DateTime;
use Formation\Entity\Db\Etat;
use Formation\Entity\Db\Inscription;
use Formation\Entity\Db\Formation;
@@ -19,6 +21,7 @@ use Formation\Service\Session\SessionServiceAwareTrait;
use UnicaenApp\Service\EntityManagerAwareTrait;
use Laminas\View\Model\ViewModel;
use Laminas\View\Renderer\PhpRenderer;
use UnicaenApp\View\Model\CsvModel;

class SessionController extends AbstractController
{
@@ -291,6 +294,46 @@ class SessionController extends AbstractController
        return $this->redirect()->toRoute('formation/session/afficher', ['session' => $session->getId()], [], true);
    }

    public function genererExportAction() : CsvModel
    {
        /**@var Session $session */
        $session = $this->getEntityManager()->getRepository(Session::class)->getRequestedSession($this);

        $headers = ['Liste', 'Dénomination étudiant', 'Adresse électronique', 'Établissement', 'École doctorale', 'Unité de recherche'];

        $inscriptions = $session->getInscriptions()->toArray();
        usort($inscriptions, function (Inscription $a, Inscription $b) {

        });
        $records = [];
        /** @var Inscription $inscription */
        foreach ($inscriptions as $inscription) {
            $doctorant = $inscription->getDoctorant();
            $theses = array_filter($doctorant->getTheses(), function (These $t) { return $t->getEtatThese() === These::ETAT_EN_COURS; });
            $etablissements = array_map(function (These $t) { return ($t->getEtablissement())?$t->getEtablissement()->getLibelle():"Établissement non renseigné";}, $theses);
            $ecoles = array_map(function (These $t) { return ($t->getEcoleDoctorale())?$t->getEcoleDoctorale()->getLibelle():"École doctorale non renseignée";}, $theses);
            $unites = array_map(function (These $t) { return ($t->getUniteRecherche())?$t->getUniteRecherche()->getLibelle():"Unité de recherche non renseignée";}, $theses);
            $entry = [
                'Liste' => $inscription->getListe(),
                'Dénomination étudiant' => $doctorant->getIndividu()->getNomComplet(),
                'Adresse électronique' => $doctorant->getIndividu()->getEmail(),
                'Établissement' => implode("/",$etablissements),
                'École doctorale' => implode("/",$ecoles),
                'Unité de recherche' => implode("/",$unites),
            ];
            $records[] = $entry;
        }

        $filename = (new DateTime())->format('Ymd-His') . '-session-' . str_replace(' ','_',$session->getFormation()->getLibelle()) . '-'. $session->getDateDebut()->format('d_m_Y') .'.csv';
        $CSV = new CsvModel();
        $CSV->setDelimiter(';');
        $CSV->setEnclosure('"');
        $CSV->setHeader($headers);
        $CSV->setData($records);
        $CSV->setFilename($filename);
        return $CSV;
    }

    public function genererEmargementsAction()
    {
        /**@var Session $session */
+2 −2
Changes for module/Formation/view/formation/formation/afficher.phtml: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -60,11 +60,11 @@ usort($sessions, function(Session $a, Session $b) { return $a->getIndex() > $b->
            <?php endif ?>
        </dl>

        <h2> Valeur par défaut transmises aux sessions </h2>
        <h2> Valeurs par défaut transmises aux sessions </h2>

        <dl class="row">
            <?php if ($formation->getSite()) : ?>
                <dt class="col-md-3"> Site</dt>
                <dt class="col-md-3"> Site organisateur</dt>
                <dd class="col-md-9"> <?php echo $this->site($formation); ?> </dd>
            <?php endif; ?>
            <?php if ($formation->getResponsable()) : ?>
Loading