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

Theses à soutenir

parent eea601fe
Loading
Loading
Loading
Loading
+56
Changes for module/Application/src/Application/Service/These/TheseService.php: 56 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ use Application\Entity\Db\NatureFichier;
use Application\Entity\Db\RdvBu;
use Application\Entity\Db\Repository\TheseRepository;
use Application\Entity\Db\These;
use Application\Entity\Db\TypeValidation;
use Application\Entity\Db\VersionFichier;
use Application\Notification\ValidationRdvBuNotification;
use Application\Service\BaseService;
@@ -325,4 +326,59 @@ class TheseService extends BaseService

        return $result;
    }

    public function getThesesAvecSoutenanceSansCouverture()
    {

        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
            ->join("these.validations", "validation")
            ->join("validation.typeValidation", "typeValidation")
            ->andWhere("these.dateSoutenance IS NOT NULL")
            ->andWhere("typeValidation.code = :typeValidation")
            //->andWhere("these.validations IS NULL")
            ->setParameter("typeValidation", TypeValidation::CODE_VERSION_PAPIER_CORRIGEE);
        ;
        $result = $qb->getQuery()->getResult();

        return $result;
    }

    public function getTheseASoutenir()
    {
        $aujourdhui = new \DateTime();
        $anneeCourante = ((int) (new \DateTime())->format("Y"));
        $anneeProchaine = $anneeCourante + 1;
        $dateMin = \DateTime::createFromFormat("d/m/Y", "01/01/".$anneeCourante);
        $dateMax = \DateTime::createFromFormat("d/m/Y", "01/01/".$anneeProchaine);
        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
                ->addSelect("doctorant")
                ->addSelect("individu")
                ->leftJoin("these.doctorant", "doctorant")
                ->leftJoin("doctorant.individu", "individu")
                ->addSelect("etablissement")
                ->addSelect("ecoleDoctorale")
                ->addSelect("uniteRecherche")
                ->addSelect("structure_etab")
                ->addSelect("structure_ed")
                ->addSelect("structure_ur")
                ->leftJoin("these.etablissement", "etablissement")
                ->leftJoin("etablissement.structure", "structure_etab")
                ->leftJoin("these.ecoleDoctorale", "ecoleDoctorale")
                ->leftJoin("ecoleDoctorale.structure", "structure_ed")
                ->leftJoin("these.uniteRecherche", "uniteRecherche")
                ->leftJoin("uniteRecherche.structure", "structure_ur")
            ->andWhere("these.dateSoutenance IS NOT NULL")
            ->andWhere("these.dateSoutenance < :dateN")
            ->andWhere("these.dateSoutenance >= :dateC")
            ->andWhere("these.etatThese = :encours")
            ->setParameter("dateN", $dateMax)
//            ->setParameter("dateC", $dateMin)
            ->setParameter("dateC", $aujourdhui)
            ->setParameter("encours",These::ETAT_EN_COURS)
            ->orderBy("these.dateSoutenance", "ASC");
            ;

        $result = $qb->getQuery()->getResult();
        return $result;
    }
}
 No newline at end of file
+24
Changes for module/Indicateur/config/module.config.php: 24 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -20,6 +20,8 @@ return array(
                        'export-doctorants-sans-mail',
                        'theses-anciennes',
                        'export-theses-anciennes',
                        'theses-a-soutenir',
                        'export-theses-a-soutenir',
                ],
                    'roles' => [
                        'Administrateur technique',
@@ -110,6 +112,28 @@ return array(
                            ],
                        ],
                    ],
                    'theses-a-soutenir' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/theses-a-soutenir',
                            'defaults'    => [
                                'action' => 'theses-a-soutenir',
                            ],
                        ],
                        'child_routes'  => [
                            'export' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/export',
                                    'defaults'    => [
                                        'action' => 'export-theses-a-soutenir',
                                    ],
                                ],
                            ],
                        ],
                    ],
                    'doctorants-sans-mail' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
+60
Changes for module/Indicateur/src/Indicateur/Controller/IndicateurController.php: 60 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -4,6 +4,7 @@ namespace Indicateur\Controller;

use Application\Entity\Db\Acteur;
use Application\Entity\Db\These;
use Application\Entity\Db\TypeValidation;
use Application\Service\AnomalieServiceAwareTrait;
use Application\Service\Etablissement\EtablissementServiceAwareTrait;
use Application\Service\Individu\IndividuServiceAwareTrait;
@@ -24,8 +25,18 @@ class IndicateurController extends AbstractActionController {
        $doctorantsSansMail = $this->getIndividuService()->getDoctorantSansMail();
        $theses = $this->getTheseService()->getTheseEnCoursPostSoutenance();
        $thesesAnciennes = $this->getTheseService()->getThesesAnciennes(6);
        $thesesASoutenir = $this->getTheseService()->getTheseASoutenir();

//        $thesesSansCouverture = $this->getTheseService()->getThesesAvecSoutenanceSansCouverture();
//        /** @var These $these */
//        var_dump(count($thesesSansCouverture));
//        foreach ($thesesSansCouverture as $these) {
//            var_dump($these->getValidations(TypeValidation::CODE_PAGE_DE_COUVERTURE));
//        }

        $anomalies = $this->getAnomalieService()->getAnomalies();


        $etablissements = [];
        $etablissements[] = $this->getEtablissementService()->getEtablissementById(2);
        $etablissements[] = $this->getEtablissementService()->getEtablissementById(3);
@@ -42,6 +53,7 @@ class IndicateurController extends AbstractActionController {
        return new ViewModel([
                "effectifs" => $effectifs,
                "theses" => $theses,
                "thesesASoutenir" => $thesesASoutenir,
                "anciennes" => $thesesAnciennes,
                "acteursSansMail" => $acteursSansMail,
                "doctorantsSansMail" => $doctorantsSansMail,
@@ -50,6 +62,54 @@ class IndicateurController extends AbstractActionController {
        );
    }

    /**
     * faire remonter les thèses ayant en cours ayant une date de soutenance dépassée
     * @return ViewModel
     */
    public function thesesASoutenirAction()
    {
        $theses = $this->getTheseService()->getTheseASoutenir();
        return new ViewModel([
                'theses' => $theses,
            ]
        );
    }

    public function exportThesesASoutenirAction()
    {
        $data = $this->getTheseService()->getTheseASoutenir();
        $headers = [
            'Identitfiant'                    => function(These $these) {return $these->getId();},
            'SourceCode'                      => function(These $these) {return $these->getSourceCode();},
            'Titre'                           => function(These $these) {return $these->getTitre();},
            'Doctorant'                       => function(These $these) {return $these->getDoctorant()->getIndividu()->getNomComplet();},
            'État'                            => function(These $these) {return $these->getEtatThese();},
            'Date de soutenace'               => function(These $these) {return $these->getDateSoutenance()->format("d/m/Y");},
            'Établissement'                   => function(These $these) {return ($these->getEtablissement())?$these->getEtablissement()->getStructure()->getCode():"";},
            'École doctorale'                 => function(These $these) {return ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getStructure()->getCode():"";},
            'Unité de recherche'              => function(These $these) {return ($these->getUniteRecherche())?$these->getUniteRecherche()->getStructure()->getCode():"";},

        ];

        $records = [];
        foreach ($data as $entry) {
            $record = [];
            foreach($headers as $key => $fct) {
                $record[] = $fct($entry);
            }
            $records[] = $record;
        }

        $CSV = new CsvModel();
        $CSV->setDelimiter(';');
        $CSV->setEnclosure('"');
        $CSV->setHeader(array_keys($headers));
        $CSV->setData($records);
        $CSV->setFilename('export_soutenanceDepassee.csv');

        return $CSV;
    }

    /**
     * faire remonter les thèses ayant en cours ayant une date de soutenance dépassée
     * @return ViewModel
+52 −5
Changes for module/Indicateur/view/indicateur/indicateur/index.phtml: 52 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,8 @@ use Application\Entity\Db\These;
 * @var These[] $doctorantsSansMail
 * @var These[] $theses
 * @var These[] $anciennes
 * @var These[] $soutenancesSansCouverture
 * @var These[] $thesesASoutenir
 * @var Anomalie[] $anomalies
 */
?>
@@ -65,7 +67,7 @@ use Application\Entity\Db\These;
                <div class="panel-heading">
                    <h4>
                        Thèses avec soutenance dépassée
                        <span class="badge"> <?echo count($theses); ?> </span>
                        <span class="badge"> <?php echo count($theses); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
@@ -106,7 +108,7 @@ use Application\Entity\Db\These;
                <div class="panel-heading">
                    <h4>
                        Thèses anciennes (plus de 6 ans)
                        <span class="badge"> <?echo count($anciennes); ?> </span>
                        <span class="badge"> <?php echo count($anciennes); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
@@ -146,6 +148,51 @@ use Application\Entity\Db\These;

    </div>

    <div class="row">
        <div class="col-md-4">
            <div class="panel panel-info">
                <div class="panel-heading">
                    <h4>
                        Thèse en cours à soutenir
                        <span class="badge"> <?php echo count($thesesASoutenir); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
                    <table class="table table-extra-condensed">
                        <thead>
                        <tr>
                            <th> Thèse </th>
                            <th> Nom </th>
                            <th> Date de soutenance</th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php for($i = 0; $i < 5 && $i < count($thesesASoutenir); $i++): ?>
                            <tr>
                                <td> <?php echo $thesesASoutenir[$i]->getSourceCode(); ?></td>
                                <td> <?php echo $thesesASoutenir[$i]->getDoctorant()->getIndividu()->getNomComplet(); ?></td>
                                <td> <?php echo $thesesASoutenir[$i]->getDateSoutenance()->format("d/m/Y"); ?></td>


                            </tr>
                        <?php endfor; ?>
                        <?php if(count($thesesASoutenir) >= 5): ?>
                            <tr>
                                <td colspan="3"> ... </td>
                            </tr>
                        <?php endif; ?>
                        </tbody>
                    </table>
                    <div class="pull-right">
                        <a class="btn btn-success" href="<?php echo $this->url('indicateur/theses-a-soutenir', [], [], true);?>">
                            <span class="glyphicon glyphicon-eye-open"></span> Visualiser les données
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">

        <div class="col-md-4">
@@ -153,7 +200,7 @@ use Application\Entity\Db\These;
                <div class="panel-heading">
                    <h4>
                        Doctorants sans eMail
                        <span class="badge"> <?echo count($doctorantsSansMail); ?> </span>
                        <span class="badge"> <?php echo count($doctorantsSansMail); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
@@ -196,7 +243,7 @@ use Application\Entity\Db\These;
                <div class="panel-heading">
                    <h4>
                        Acteurs sans eMail
                        <span class="badge"> <?echo count($acteursSansMail); ?> </span>
                        <span class="badge"> <?php echo count($acteursSansMail); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
@@ -239,7 +286,7 @@ use Application\Entity\Db\These;
                <div class="panel-heading">
                    <h4>
                        Anomalie de clefs étrangères
                        <span class="badge"> <?echo count($anomalies); ?> </span>
                        <span class="badge"> <?php echo count($anomalies); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
+50
Changes for module/Indicateur/view/indicateur/indicateur/theses-a-soutenir.phtml: 50 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php

use Application\Entity\Db\These;

/**
 * @var These[] $theses
 */
?>

<h1>
    Thèses en cours ayant une soutenance avant fin de l'année civile
    <span class="badge"> <?php echo count($theses); ?> </span>
</h1>

<a class="btn btn-success" href="<?php echo $this->url('indicateur/theses-a-soutenir/export',[],[], true); ?>">
    <span class="glyphicon glyphicon-download-alt"></span> Exporter au format CSV
</a>

<table class="table table-extra-condensed">
    <thead>
        <tr>
            <th> SourceCode </th>
            <th> Titre </th>
            <th> Doctorant </th>
            <th> État</th>
            <th> Date de soutenance </th>
            <th> Établissement </th>
            <th> École doctorale </th>
            <th> Unité de recherche </th>
        </tr>
    </thead>
    <tbody>
    <?php foreach ($theses as $these) : ?>
    <tr>
        <td>
            <a href="<?php echo $this->url('these/identite', ['these'=>$these->getId()], [], true); ?>">
                <?php echo $these->getSourceCode(); ?>
            </a>
        </td>
        <td> <?php echo $these->getTitre(); ?>  </td>
        <td> <?php echo $these->getDoctorant()->getIndividu()->getNomComplet(); ?>  </td>
        <td> <?php echo $these->getEtatThese(); ?>  </td>
        <td> <?php echo $these->getDateSoutenance()->format("d/m/Y"); ?>  </td>
        <td> <?php if($these->getEtablissement()) echo $these->getEtablissement()->getStructure()->getCode(); ?> </td>
        <td> <?php if($these->getEcoleDoctorale()) echo $these->getEcoleDoctorale()->getStructure()->getSigle(); ?> </td>
        <td> <?php if($these->getUniteRecherche())echo $these->getUniteRecherche()->getStructure()->getSigle(); ?> </td>
    </tr>
    <?php endforeach; ?>
    </tbody>
</table>
 No newline at end of file