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

Ajout de l'indicateur sur les doctorants sans mail

parent 580c901e
Loading
Loading
Loading
Loading
+16
Changes for module/Application/src/Application/Service/Individu/IndividuService.php: 16 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -3,12 +3,14 @@
namespace Application\Service\Individu;

use Application\Entity\Db\Acteur;
use Application\Entity\Db\Doctorant;
use Application\Entity\Db\Etablissement;
use Application\Entity\Db\Individu;
use Application\Entity\Db\IndividuRole;
use Application\Entity\Db\Repository\IndividuRepository;
use Application\Entity\Db\Role;
use Application\Entity\Db\SourceInterface;
use Application\Entity\Db\These;
use Application\Entity\Db\Utilisateur;
use Application\Entity\UserWrapper;
use Application\Service\BaseService;
@@ -158,4 +160,18 @@ class IndividuService extends BaseService
        $result = $qb->getQuery()->getResult();
        return $result;
    }

    public function getDoctorantSansMail()
    {
        $qb = $this->getEntityManager()->getRepository(These::class)->createQueryBuilder("these")
            ->leftJoin("these.doctorant", "doctorant")
            ->leftJoin("doctorant.individu", "individu")
            ->andWhere("individu.email is NULL")
            ->andWhere("these.etatThese = 'E'")
            ->orderBy("these.sourceCode")
        ;

        $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',
                        'doctorants-sans-mail',
                        'export-doctorants-sans-mail',
                        'theses-anciennes',
                        'export-theses-anciennes',
                ],
@@ -85,6 +87,28 @@ return array(
                            ],
                        ],
                    ],
                    'doctorants-sans-mail' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
                        'options'       => [
                            'route'       => '/doctorants-sans-mail',
                            'defaults'    => [
                                'action' => 'doctorants-sans-mail',
                            ],
                        ],
                        'child_routes'  => [
                            'export' => [
                                'type'          => Segment::class,
                                'may_terminate' => true,
                                'options'       => [
                                    'route'       => '/export',
                                    'defaults'    => [
                                        'action' => 'export-doctorants-sans-mail',
                                    ],
                                ],
                            ],
                        ],
                    ],
                    'theses-anciennes' => [
                        'type'          => Segment::class,
                        'may_terminate' => true,
+48 −1
Changes for module/Indicateur/src/Indicateur/Controller/IndicateurController.php: 48 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ class IndicateurController extends AbstractActionController {
    public function indexAction()
    {
        $acteursSansMail = $this->getIndividuService()->getActeurSansMail();
        $doctorantsSansMail = $this->getIndividuService()->getDoctorantSansMail();
        $theses = $this->getTheseService()->getTheseEnCoursPostSoutenance();
        $thesesAnciennes = $this->getTheseService()->getThesesAnciennes(6);
        $anomalies = $this->getAnomalieService()->getAnomalies();
@@ -42,7 +43,8 @@ class IndicateurController extends AbstractActionController {
                "effectifs" => $effectifs,
                "theses" => $theses,
                "anciennes" => $thesesAnciennes,
                "sansMail" => $acteursSansMail,
                "acteursSansMail" => $acteursSansMail,
                "doctorantsSansMail" => $doctorantsSansMail,
                "anomalies" => $anomalies,
            ]
        );
@@ -96,6 +98,51 @@ class IndicateurController extends AbstractActionController {
        return $CSV;
    }

    public function doctorantsSansMailAction()
    {
        $doctorantsSansMail = $this->getIndividuService()->getDoctorantSansMail();

        return new ViewModel([
                "sansMail" => $doctorantsSansMail,
            ]
        );
    }

    public function exportDoctorantsSansMailAction()
    {
        $doctorantsSansMail = $this->getIndividuService()->getDoctorantSansMail();

        $headers = [
            'Thèse Identitfiant'                    => function(These $these) {return $these->getId();},
            'Thèse SourceCode'                      => function(These $these) {return $these->getSourceCode();},
            'Thèse Titre'                           => function(These $these) {return $these->getTitre();},
            'Thèse Établissement'                   => function(These $these) {return ($these->getEtablissement())?$these->getEtablissement()->getStructure()->getCode():"";},
            'Thèse École doctorale'                 => function(These $these) {return ($these->getEcoleDoctorale())?$these->getEcoleDoctorale()->getStructure()->getCode():"";},
            'Thèse Unité de recherche'              => function(These $these) {return ($these->getUniteRecherche())?$these->getUniteRecherche()->getStructure()->getCode():"";},
            'Doctorant Identifiant'                 => function(These $these) {return $these->getDoctorant()->getId();},
            'Doctorant Nom'                         => function(These $these) {return $these->getDoctorant()->getIndividu()->getNomComplet();},
            'Première inscription'                  => function(These $these) {return ($these->getDatePremiereInscription())?$these->getDatePremiereInscription()->format("d/m/Y"):"";},
        ];

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

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

        return $CSV;
    }

    public function acteursSansMailAction()
    {
        $acteursSansMail = $this->getIndividuService()->getActeurSansMail();
+52
Changes for module/Indicateur/view/indicateur/indicateur/doctorants-sans-mail.phtml: 52 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?php


use Application\Entity\Db\These;

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

<h1>
    Doctorants sans mail
    <span class="badge"> <?php echo count($sansMail); ?> </span>
</h1>

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

<table class="table table-extra-condensed">
    <thead>
    <tr>
        <th> These</th>
        <th> Titre </th>
        <th> Acteur </th>
        <th> Date de première inscription </th>
        <th> État</th>
        <th> Établissement </th>
        <th> École doctorale </th>
        <th> Unité de recherche </th>
    </tr>
    </thead>
    <tbody>
    <?php foreach ($sansMail as $these) : ?>
        <?php $doctorant = $these->getDoctorant(); ?>
        <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 $doctorant->getIndividu()->getNomComplet(); ?>  </td>
            <td> <?php echo ($these->getDatePremiereInscription())?$these->getDatePremiereInscription()->format("d/m/Y"):""; ?>  </td>
            <td> <?php echo $these->getEtatThese(); ?>  </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
+54 −9
Changes for module/Indicateur/view/indicateur/indicateur/index.phtml: 54 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -7,7 +7,8 @@ use Application\Entity\Db\These;
/**
 * @see \Indicateur\Controller\IndicateurController::indexAction()
 * @var array $effectifs
 * @var Acteur[] $sansMail
 * @var Acteur[] $acteursSansMail
 * @var These[] $doctorantsSansMail
 * @var These[] $theses
 * @var These[] $anciennes
 * @var Anomalie[] $anomalies
@@ -140,6 +141,50 @@ use Application\Entity\Db\These;
    </div>
</div>

<div>
    <div class="col-md-4">
        <div class="panel panel-warning">
            <div class="panel-heading">
                <h4>
                    Doctorants sans adresse électronique
                    <span class="badge"> <?echo count($doctorantsSansMail); ?> </span>
                </h4>
            </div>
            <div class="panel-body">
                <table class="table table-extra-condensed">
                    <thead>
                    <tr>
                        <th> Thèse </th>
                        <th> Identifiant</th>
                        <th> Nom </th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php for($i = 0; $i < 5 && $i < count($doctorantsSansMail); $i++): ?>
                        <tr>
                            <td> <?php echo $doctorantsSansMail[$i]->getSourceCode(); ?></td>
                            <td> <?php echo $doctorantsSansMail[$i]->getDoctorant()->getSourceCode(); ?></td>
                            <td> <?php echo $doctorantsSansMail[$i]->getDoctorant()->getIndividu()->getNomComplet(); ?></td>


                        </tr>
                    <?php endfor; ?>
                    <?php if(count($doctorantsSansMail) >= 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/doctorants-sans-mail', [], [], true);?>">
                        <span class="glyphicon glyphicon-eye-open"></span> Visualiser les données
                    </a>
                </div>
            </div>
        </div>
    </div>
</div>


<div>
@@ -148,7 +193,7 @@ use Application\Entity\Db\These;
            <div class="panel-heading">
                <h4>
                    Acteurs sans adresse électronique
                    <span class="badge"> <?echo count($sansMail); ?> </span>
                    <span class="badge"> <?echo count($acteursSansMail); ?> </span>
                </h4>
            </div>
            <div class="panel-body">
@@ -161,16 +206,16 @@ use Application\Entity\Db\These;
                    </tr>
                    </thead>
                    <tbody>
                    <?php for($i = 0; $i < 5 && $i < count($sansMail); $i++): ?>
                    <?php for($i = 0; $i < 5 && $i < count($acteursSansMail); $i++): ?>
                        <tr>
                            <td> <?php echo $sansMail[$i]->getThese()->getSourceCode(); ?></td>
                            <td> <?php echo $sansMail[$i]->getSourceCode(); ?></td>
                            <td> <?php echo $sansMail[$i]->getRole()->getLibelle(); ?></td>
                            <td> <?php echo $acteursSansMail[$i]->getThese()->getSourceCode(); ?></td>
                            <td> <?php echo $acteursSansMail[$i]->getSourceCode(); ?></td>
                            <td> <?php echo $acteursSansMail[$i]->getRole()->getLibelle(); ?></td>


                        </tr>
                    <?php endfor; ?>
                    <?php if(count($theses) >= 5): ?>
                    <?php if(count($acteursSansMail) >= 5): ?>
                        <tr>
                            <td colspan="3"> ... </td>
                        </tr>
@@ -206,7 +251,7 @@ use Application\Entity\Db\These;
                    </tr>
                    </thead>
                    <tbody>
                    <?php for($i = 0; $i < 5 && $i < count($sansMail); $i++): ?>
                    <?php for($i = 0; $i < 5 && $i < count($anomalies); $i++): ?>
                        <tr>
                            <td> <?php echo $anomalies[$i]->getTableName(); ?></td>
                            <td> <?php echo $anomalies[$i]->getTableColumn(); ?></td>
@@ -215,7 +260,7 @@ use Application\Entity\Db\These;

                        </tr>
                    <?php endfor; ?>
                    <?php if(count($theses) >= 5): ?>
                    <?php if(count($anomalies) >= 5): ?>
                        <tr>
                            <td colspan="3"> ... </td>
                        </tr>