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

Ajout des indicateurs à 1 et 2 mois de la soutenance

parent 893dad22
Loading
Loading
Loading
Loading
+69 −16
Changes for module/Application/src/Application/Service/These/TheseService.php: 69 added lines, 16 removed lines.
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ 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\Validation;
use Application\Entity\Db\VersionFichier;
use Application\Notification\ValidationRdvBuNotification;
use Application\Service\BaseService;
@@ -24,6 +25,7 @@ use Doctrine\ORM\OptimisticLockException;
use UnicaenApp\Exception\RuntimeException;
use UnicaenApp\Traits\MessageAwareInterface;
use UnicaenAuth\Entity\Db\UserInterface;
use Zend\Validator\Date;

class TheseService extends BaseService
{
@@ -357,7 +359,6 @@ class TheseService extends BaseService
            ->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");
@@ -367,38 +368,90 @@ class TheseService extends BaseService
        return $result;
    }

    /** these à un moi de la soutenance sans aucun dépot
    /**
     * @param $nbMois
     * @return array
     * @throws \Exception
     */
    public function getThesesAvantSoutenanceSansDepot() {

        $interval = new DateInterval('P1M');
        $minusOneMonth = (new \DateTime())->sub($interval);
    public function getTheseSansCouverture($nbMois)
    {
        $dateCourante = new \DateTime();
        $dateLimite = (new \DateTime())->add(new DateInterval("P".$nbMois."M"));

        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
            ->andWhere("t.dateSoutenance >= :minusOneMonth")
            ->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.etatThese = :encours")
            ->setParameter("minusOneMonth", $minusOneMonth)
            ->andWhere("these.dateSoutenance IS NOT NULL")
            ->andWhere("these.dateSoutenance >= :dateCourante")
            ->andWhere("these.dateSoutenance < :dateLimite")
            ->setParameter("encours", These::ETAT_EN_COURS)
        ;
            ->setParameter("dateCourante", $dateCourante)
            ->setParameter("dateLimite", $dateLimite)

            ->leftJoin("these.validations", "validation")
            ->andWhere("validation.id IS NULL")

            ->leftjoin("validation.typeValidation", "typeValidation", "WITH", "typeValidation.code = :PDC")
            ->setParameter("PDC", TypeValidation::CODE_PAGE_DE_COUVERTURE)

        ;
        $result = $qb->getQuery()->getResult();
        return $result;
    }

    public function getThesesAvecSoutenanceSansCouverture()
    public function getTheseSansDepot($nbMois)
    {
        $dateCourante = new \DateTime();
        $dateLimite = (new \DateTime())->add(new DateInterval("P".$nbMois."M"));

        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
            ->join("these.validations", "validation")
            ->join("validation.typeValidation", "typeValidation")
            ->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.etatThese = :encours")
            ->andWhere("these.dateSoutenance IS NOT NULL")
            ->andWhere("typeValidation.code = :typeValidation")
            //->andWhere("these.validations IS NULL")
            ->setParameter("typeValidation", TypeValidation::CODE_VERSION_PAPIER_CORRIGEE);
            ->andWhere("these.dateSoutenance >= :dateCourante")
            ->andWhere("these.dateSoutenance < :dateLimite")
            ->setParameter("encours", These::ETAT_EN_COURS)
            ->setParameter("dateCourante", $dateCourante)
            ->setParameter("dateLimite", $dateLimite)

            ->leftJoin("these.fichiers", "fichier")
            ->andWhere("fichier.id IS NULL")

            ->leftJoin("fichier.nature", "nature", "WITH", "nature.code = :nature")
            ->setParameter("nature", NatureFichier::CODE_THESE_PDF)
        ;
        $result = $qb->getQuery()->getResult();

        $result = $qb->getQuery()->getResult();
        return $result;
    }
}
 No newline at end of file
+48
Changes for module/Indicateur/config/module.config.php: 48 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -22,6 +22,10 @@ return array(
                        'export-theses-anciennes',
                        'theses-a-soutenir',
                        'export-theses-a-soutenir',
                        'theses-sans-pdc',
                        'export-theses-sans-pdc',
                        'theses-sans-depot',
                        'export-theses-sans-depot',
                ],
                    'roles' => [
                        'Administrateur technique',
@@ -134,6 +138,50 @@ return array(
                            ],
                        ],
                    ],
                    'theses-sans-pdc' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/theses-sans-pdc',
                            'defaults'    => [
                                'action' => 'theses-sans-pdc',
                            ],
                        ],
                        'child_routes'  => [
                            'export' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/export',
                                    'defaults'    => [
                                        'action' => 'export-theses-sans-pdc',
                                    ],
                                ],
                            ],
                        ],
                    ],
                    'theses-sans-depot' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/theses-sans-depot',
                            'defaults'    => [
                                'action' => 'theses-sans-depot',
                            ],
                        ],
                        'child_routes'  => [
                            'export' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/export',
                                    'defaults'    => [
                                        'action' => 'export-theses-sans-depot',
                                    ],
                                ],
                            ],
                        ],
                    ],
                    'doctorants-sans-mail' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
+102 −7
Changes for module/Indicateur/src/Indicateur/Controller/IndicateurController.php: 102 added lines, 7 removed lines.
Original line number Diff line number Diff line
@@ -19,6 +19,10 @@ class IndicateurController extends AbstractActionController {
    use EtablissementServiceAwareTrait;
    use AnomalieServiceAwareTrait;

    /**
     * @return array|ViewModel
     * @throws \Exception
     */
    public function indexAction()
    {
        $acteursSansMail = $this->getIndividuService()->getActeurSansMail();
@@ -26,13 +30,8 @@ class IndicateurController extends AbstractActionController {
        $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));
//        }
        $pasPDC = $this->getTheseService()->getTheseSansCouverture(2);
        $pasDepot = $this->getTheseService()->getTheseSansDepot(1);

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

@@ -58,6 +57,8 @@ class IndicateurController extends AbstractActionController {
                "acteursSansMail" => $acteursSansMail,
                "doctorantsSansMail" => $doctorantsSansMail,
                "anomalies" => $anomalies,
                "pasPDC" => $pasPDC,
                "pasDepot" => $pasDepot,
            ]
        );
    }
@@ -110,6 +111,51 @@ class IndicateurController extends AbstractActionController {
        return $CSV;
    }

    public function thesesSansPdcAction()
    {
        $theses = $this->getTheseService()->getTheseSansDepot(2);
        return new ViewModel([
                'theses' => $theses,
            ]
        );
    }

    public function exportThesesSansPdcAction()
    {
        $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_pasPDC.csv');

        return $CSV;
    }


    /**
     * faire remonter les thèses ayant en cours ayant une date de soutenance dépassée
     * @return ViewModel
@@ -158,6 +204,55 @@ class IndicateurController extends AbstractActionController {
        return $CSV;
    }

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

    public function exportThesesSansDepotAction()
    {
        $data = $this->getTheseService()->getTheseSansDepot(1);
        $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_sansDepot.csv');

        return $CSV;
    }


    public function doctorantsSansMailAction()
    {
        $doctorantsSansMail = $this->getIndividuService()->getDoctorantSansMail();
+82
Changes for module/Indicateur/view/indicateur/indicateur/index.phtml: 82 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -191,6 +191,88 @@ use Application\Entity\Db\These;
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h4>
                        Pas de PdC à 2 mois de la soutenance
                        <span class="badge"> <?php echo count($pasPDC); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
                    <table class="table table-extra-condensed">
                        <thead>
                        <tr>
                            <th> These</th>
                            <th> Nom </th>
                            <th> Date de soutenance </th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php for($i = 0; $i < 5 && $i < count($pasPDC); $i++): ?>
                            <tr>
                                <td> <?php echo $pasPDC[$i]->getSourceCode(); ?></td>
                                <td> <?php echo $pasPDC[$i]->getDoctorant()->getIndividu()->getNomComplet(); ?></td>
                                <td> <?php echo $pasPDC[$i]->getDateSoutenance()->format("d/m/Y"); ?></td>
                            </tr>
                        <?php endfor; ?>
                        <?php if(count($pasPDC) >= 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-sans-pdc', [], [], true);?>">
                            <span class="glyphicon glyphicon-eye-open"></span> Visualiser les données
                        </a>
                    </div>
                </div>
            </div>
        </div>

        <div class="col-md-4">
            <div class="panel panel-warning">
                <div class="panel-heading">
                    <h4>
                        Pas de dépôt à 1 mois de la soutenance
                        <span class="badge"> <?php echo count($pasDepot); ?> </span>
                    </h4>
                </div>
                <div class="panel-body">
                    <table class="table table-extra-condensed">
                        <thead>
                        <tr>
                            <th> These</th>
                            <th> Nom </th>
                            <th> Date de soutenance </th>
                        </tr>
                        </thead>
                        <tbody>
                        <?php for($i = 0; $i < 5 && $i < count($pasDepot); $i++): ?>
                            <tr>
                                <td> <?php echo $pasDepot[$i]->getSourceCode(); ?></td>
                                <td> <?php echo $pasDepot[$i]->getDoctorant()->getIndividu()->getNomComplet(); ?></td>
                                <td> <?php echo $pasDepot[$i]->getDateSoutenance()->format("d/m/Y"); ?></td>
                            </tr>
                        <?php endfor; ?>
                        <?php if(count($pasDepot) >= 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-sans-depot', [], [], true);?>">
                            <span class="glyphicon glyphicon-eye-open"></span> Visualiser les données
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="row">
+50
Changes for module/Indicateur/view/indicateur/indicateur/theses-sans-depot.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 sans dépôt sans SyGAL à 1 mois de la soutenance
    <span class="badge"> <?php echo count($theses); ?> </span>
</h1>

<a class="btn btn-success" href="<?php echo $this->url('indicateur/theses-sans-depot/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
Loading