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

Theses anciennes

parent 20ca3465
Loading
Loading
Loading
Loading
+17
Changes for module/Application/src/Application/Service/These/TheseService.php: 17 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -274,4 +274,21 @@ class TheseService extends BaseService

        return [count($result_enCours), count($result_inscriptions), count($result_soutenues)];
    }

    public function getThesesAnciennes($age)
    {
        $date = new \DateTime();
        $mois = $date->format("m") - $age;
        $annee = $date->format("Y") - $age;
        $dateLimite = \DateTime::createFromFormat('d/m/Y', "01/".$mois."/".$annee);

        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
            ->andWhere("these.etatThese = :encours")
            ->andWhere("these.datePremiereInscription <= :date")
            ->setParameter("encours", These::ETAT_EN_COURS)
            ->setParameter("date", $dateLimite);
        $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
@@ -16,6 +16,8 @@ return array(
                        'export-soutenance-depassee',
                        'acteurs-sans-mail',
                        'export-acteurs-sans-mail',
                        'theses-anciennes',
                        'export-theses-anciennes',
                ],
                    'roles' => [
                        'Administrateur technique',
@@ -83,6 +85,28 @@ return array(
                            ],
                        ],
                    ],
                    'theses-anciennes' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/theses-anciennes',
                            'defaults'    => [
                                'action' => 'theses-anciennes',
                            ],
                        ],
                        'child_routes'  => [
                            'export' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/export',
                                    'defaults'    => [
                                        'action' => 'export-theses-anciennes',
                                    ],
                                ],
                            ],
                        ],
                    ],
                ],
            ],
        ],
+52 −1
Changes for module/Indicateur/src/Indicateur/Controller/IndicateurController.php: 52 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ class IndicateurController extends AbstractActionController {
    {
        $acteursSansMail = $this->getIndividuService()->getActeurSansMail();
        $theses = $this->getTheseService()->getTheseEnCoursPostSoutenance();
        $thesesAnciennes = $this->getTheseService()->getThesesAnciennes(6);
        $anomalies = $this->getAnomalieService()->getAnomalies();

        $etablissements = [];
@@ -40,6 +41,7 @@ class IndicateurController extends AbstractActionController {
        return new ViewModel([
                "effectifs" => $effectifs,
                "theses" => $theses,
                "anciennes" => $thesesAnciennes,
                "sansMail" => $acteursSansMail,
                "anomalies" => $anomalies,
            ]
@@ -68,7 +70,7 @@ class IndicateurController extends AbstractActionController {
            '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");},
            '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():"";},
@@ -138,5 +140,54 @@ class IndicateurController extends AbstractActionController {

        return $CSV;
    }

    /**
     * faire remonter les thèses ayant plus de 6 ans
     * @return ViewModel
     */
    public function thesesAnciennesAction()
    {
        $theses = $this->getTheseService()->getThesesAnciennes(6);
        return new ViewModel([
                'theses' => $theses,
            ]
        );
    }

    public function exportThesesAnciennesAction()
    {
        $data = $this->getTheseService()->getTheseEnCoursPostSoutenance();
        $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 première inscription'    => function(These $these) {return ($these->getDatePremiereInscription())?$these->getDatePremiereInscription()->format("d/m/Y"):"";},
            'Date de soutenace'               => function(These $these) {return ($these->getDateSoutenance())?$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_thesesAnciennes.csv');

        return $CSV;
    }
}
+46
Changes for module/Indicateur/view/indicateur/indicateur/index.phtml: 46 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Application\Entity\Db\These;
 * @var array $effectifs
 * @var Acteur[] $sansMail
 * @var These[] $theses
 * @var These[] $anciennes
 * @var Anomalie[] $anomalies
 */
?>
@@ -96,6 +97,51 @@ use Application\Entity\Db\These;
    </div>
</div>

<div class="col-md-4">
    <div class="panel panel-warning">
        <div class="panel-heading">
            <h4>
                Thèses anciennes (plus de 6 ans)
                <span class="badge"> <?echo count($anciennes); ?> </span>
            </h4>
        </div>
        <div class="panel-body">
            <table class="table table-extra-condensed">
                <thead>
                <tr>
                    <th> These</th>
                    <th> État </th>
                    <th> Première inscription </th>
                    <th> Soutenance </th>
                </tr>
                </thead>
                <tbody>
                <?php for($i = 0; $i < 5 && $i < count($anciennes); $i++): ?>
                    <tr>
                        <td> <?php echo $anciennes[$i]->getSourceCode(); ?></td>
                        <td> <?php echo $anciennes[$i]->getEtatThese(); ?></td>
                        <td> <?php echo $anciennes[$i]->getDatePremiereInscription()->format("d/m/Y"); ?></td>
                        <td> <?php echo ($anciennes[$i]->getDateSoutenance())?$anciennes[$i]->getDateSoutenance()->format("d/m/Y"):""; ?></td>
                    </tr>
                <?php endfor; ?>
                <?php if(count($anciennes) >= 5): ?>
                    <tr>
                        <td colspan="4"> ... </td>
                    </tr>
                <?php endif; ?>
                </tbody>
            </table>
            <div class="pull-right">
                <a class="btn btn-success" href="<?php echo $this->url('indicateur/theses-anciennes', [], [], true);?>">
                    <span class="glyphicon glyphicon-eye-open"></span> Visualiser les données
                </a>
            </div>
        </div>
    </div>
</div>



<div>
    <div class="col-md-4">
        <div class="panel panel-warning">
+52
Changes for module/Indicateur/view/indicateur/indicateur/theses-anciennes.phtml: 52 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 anciennes (plus de 6 ans)
    <span class="badge"> <?php echo count($theses); ?> </span>
</h1>

<a class="btn btn-success" href="<?php echo $this->url('indicateur/theses-anciennes/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 premiere inscription </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->getDatePremiereInscription()->format("d/m/Y"); ?>  </td>
        <td> <?php echo ($these->getDateSoutenance())?$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