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

Merge branch 'Structure_WS'

parents 85728106 fddda2e9
Loading
Loading
Loading
Loading
+4 −3
Changes for module/Application/src/Application/Controller/StatistiqueController.php: 4 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -37,9 +37,9 @@ class StatistiqueController extends AbstractController
        $structureId = $this->params()->fromQuery("structure_id");
        $qb = $this->decorateWithStructure($qb, $structureType, $structureId);

        $dateType = $this->params()->fromQuery("date");
        $dateDebut = $this->params()->fromQuery("debut");
        $dateFin = $this->params()->fromQuery("fin");
        $dateType = $this->params()->fromQuery("date_type");
        $dateDebut = $this->params()->fromQuery("date_min");
        $dateFin = $this->params()->fromQuery("date_max");
        $qb = $this->decorateWithDate($qb, $dateType, $dateDebut, $dateFin);

        $theses = $qb->getQuery()->execute();
@@ -51,6 +51,7 @@ class StatistiqueController extends AbstractController
            'ecoles' => $ecoles,
            'unites' => $unites,
            'etablissements' => $etablissements,
            'structure_id' => $structureId,
        ]);
    }

+121 −36
Changes for module/Application/view/application/statistique/index.phtml: 121 added lines, 36 removed lines.
Original line number Diff line number Diff line
@@ -32,43 +32,40 @@ function display_debug($texte) {
<script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<h1 class="page-header first"><?php echo $this->translate("Statistiques") ?> <span
        class="badge"><?php echo count($theses) ?></span></h1>
        class="badge"><?php echo count($theses) . " thèses"?></span></h1>

<div class='selector' style='border-radius: 5px;
<div  id="filtrage_option"                style='border-radius: 5px;
                             border:solid gray 2px;
                             background-color: whitesmoke;
                             padding: 5px;
                             margin: 10px;
                             '>
    <div class='selector' style='border-radius: 0px;
                                 border-left:solid gray 2px;
                                 background-color: whitesmoke;
                                 padding: 5px;
                                 margin: 10px;
                                 width:415px;
                                 float:left;'>
        <form id="selection" method="post" action="">
            <div style="width:200px; padding: 5px; margin: 5px; float:left;">
                <h4>Type de structure : </h4>
            <input type="radio" name="structure_type" value="Aucun" checked>  Aucune <br/>
            <input type="radio" name="structure_type" value="Etab">   Établissement <br/>
            <input type="radio" name="structure_type" value="ED">     École doctorale <br/>
            <input type="radio" name="structure_type" value="UR">     Unité de recherche
        </div>
        <div style='width:190px;
                    height:150px;
                    float:left;
                    text-align:center;
                    padding-top: 75px;'
             id="linku">
            <a  href='/statistique'>
                <input type='button' class='btn btn-info' value='Remise à zéro du filtrage'/>
            </a>
                <input id="structure_aucun" type="radio" name="structure_type" value="Aucun">  Aucune <br/>
                <input id="structure_etab" type="radio" name="structure_type" value="Etab">   Établissement <br/>
                <input id="structure_ed" type="radio" name="structure_type" value="ED">     École doctorale <br/>
                <input id="structure_ur" type="radio" name="structure_type" value="UR">     Unité de recherche
            </div>

            <div style="clear:both;"></div>
        <div id='structure_selector' >
            <h4>Libellé de la structure :</h4>
            <select style='width: 400px; max-width:400px; ' id='structure_id'> </select>
        </div>
        </form>

    </div>
<div class='selector' style='border-radius: 5px;
                             border:solid gray 2px;

    <div class='selector' style='border-radius: 0px;
                                 border-left:solid gray 2px;
                                 background-color: whitesmoke;
                                 padding: 5px;
                                 margin: 10px;
@@ -77,19 +74,10 @@ function display_debug($texte) {
                                 float:left;'>
        <div style="width:200px; padding: 5px; margin: 5px; float:left;">
            <h4>Type de date :</h4>
        <input type="radio" name="date_type" value="Inscription" checked>  Inscription <br/>
        <input type="radio" name="date_type" value="Soutenance">   Soutenance <br/>
    </div>
    <div style='width:190px;
                    height:100px;
                    float:left;
                    text-align:center;
                    padding-top: 50px;'
         id="linku">
        <a  href='/statistique'>
            <input type='button' class='btn btn-info' value='Filtrage selon date'/>
        </a>
            <input id="date_inscription" type="radio" name="date_type" value="inscription">  Inscription <br/>
            <input id="date_soutenance" type="radio" name="date_type" value="soutenance">   Soutenance <br/>
        </div>

        <div style="clear:both;"></div>
        <div>
            <h4>Sélection de la période :</h4>
@@ -104,7 +92,27 @@ function display_debug($texte) {
        </div>

    </div>

    <div style="clear:both;"></div>

            <div style=' float:right;
                         text-align:center;
                         padding:10px;'>
                <a  href='/statistique'>
                    <input type='button' class='btn btn-info' value='Remise à zéro'/>
                </a>
            </div>
            <div style=' float:right;
                         text-align:center;
                         padding:10px; '
                id = "linku">
                <a  href='/statistique'>
                    <input type='button' class='btn btn-info' value='Filtrer les thèses'/>
                </a>
            </div>

    <div style="clear:both;"></div>
</div>


<script>
@@ -125,12 +133,24 @@ function display_debug($texte) {

<script>
    $(document).ready(function(){
        $('#structure_id').change(function() {

        var date_type = $.urlParam('date_type');
        var date_min = $.urlParam('date_min');
        var date_max = $.urlParam('date_max');
        var structure_type = $.urlParam('structure_type');
        var structure_id = $.urlParam('structure_id');

        $.resetForm(structure_type,structure_id,date_type,date_min,date_max);

        $('#filtrage_option').change(function() {
            var selected_structure_type = document.querySelector('input[name="structure_type"]:checked').value;
            var selected_structure_id = document.getElementById("structure_id").value;
            var selected_date_type = document.querySelector('input[name="date_type"]:checked').value;
            var selected_min = $( "#slider-range" ).slider( "values", 0 );
            var selected_max = $( "#slider-range" ).slider( "values", 1 );
            document.getElementById("linku").innerHTML = "" +
                "<a  href='/statistique?structure_type=" + selected_structure_type + "& structure_id=" + selected_structure_id + "'> " +
                "<input type='button' class='btn btn-info' value='Filtrer les thèse'/>" +
                "<a  href='/statistique?structure_type=" + selected_structure_type + "&structure_id=" + selected_structure_id + "&date_type="+ selected_date_type + "&date_min="+ selected_min + "&date_max="+ selected_max +"'> " +
                "<input type='button' class='btn btn-info' value='Filtrer les thèses'/>" +
                "</a>";
            //alert( this.value );
        });
@@ -159,16 +179,71 @@ function display_debug($texte) {
                }
        });
    });

    $.urlParam = function(name){
        var results = new RegExp('[\?&]' + name + '=([^&#]*)').exec(window.location.href);
        if (results==null){
            return null;
        }
        else{
            return decodeURI(results[1]) || 0;
        }
    }

    $.resetForm = function(structure_type, structure_id, date_type, date_min, date_max) {
        // alert("Data \n" + structure_type + " = " + structure_id +"\n" + date_type + " = [" + date_min + "," + date_max + "]");

        //Date
        if (date_type == "soutenance") {
            document.getElementById('date_soutenance').checked = true;
        } else {
            document.getElementById('date_inscription').checked = true;
        }

        if (date_min == null) date_min=1998;
        if (date_max == null) date_max=2018;
        $("#slider-range").slider('values',0,date_min);
        $("#slider-range").slider('values',1,date_max);
        $( "#amount" ).val( "" + date_min + " - " + date_max );


        //structure
        if (structure_type == "ED") {
            document.getElementById('structure_ed').checked = true;
            var form = " <?php echo generateStructureSelector($ecoles, $structure_id); ?> ";

        } else {
            if (structure_type == "UR") {
                document.getElementById('structure_ur').checked = true;
                var form = " <?php echo generateStructureSelector($unites, $structure_id); ?> ";
            } else {
                if (structure_type == "Etab") {
                    document.getElementById('structure_etab').checked = true;
                    var form = " <?php echo generateStructureSelector($etablissements, $structure_id); ?> ";
                } else {
                    document.getElementById('structure_aucun').checked = true;
                    var form = "";
                }
            }
        }
        document.getElementById('structure_id').innerHTML = form;

    }
</script>

<?php
    function generateStructureSelector($structures) {
    function generateStructureSelector($structures, $id = null) {
        //var_dump($id);

        $texte = "";
        $texte .= "<select id='structure_id'>";
        $texte .= "<option value=''> Aucune </option>";
        /** @var Structure $structure */
        foreach ($structures as $structure) {
            $texte .= "<option value='".$structure->getId()."'>". $structure->getLibelle() ."</option>";

            $texte .= "<option value='".$structure->getId()."'";
            if($structure->getId() == $id) $texte .= " selected ";
            $texte .= ">".$structure->getLibelle() ."</option>";
        }
        $texte .= "</select>";
        return $texte;
@@ -192,12 +267,17 @@ $start = $end - 20;
$effectifsInscription = [];
$effectifsSoutenance = [];

$dateMinimum = 2018;
$dateMaximum = 2018;

if (! empty($validInscriptionTheses)) {
    $dateMinimum = min( $validInscriptionTheses[0]->getDatePremiereInscription()->format("Y"),
                        $validSoutenanceTheses[0]->getDateSoutenance()->format("Y")
                    );
    $dateMaximum = max( end($validInscriptionTheses)->getDatePremiereInscription()->format("Y"),
                        end($validSoutenanceTheses)->getDateSoutenance()->format("Y")
                    );
    }


for ($annee = $dateMinimum; $annee <= $dateMaximum ; $annee++) {
@@ -475,6 +555,7 @@ function generateEffectifParPays($effectifsInscription, $start , $end) {
    $code["BIELORUSSE"] = "Belarus";
    $code["BIRMAN(E)"] = "Myanmar";
    $code["BELGE"] = "Belgium";
    $code["BENGALI(E)"] = "Bengladesh";
    $code["BENINOIS(E)"] = "Benin";
    $code["BOLIVIEN(NE)"] = "Bolivia";
    $code["BOSNIAQUE"] = "Bosnia";
@@ -495,6 +576,7 @@ function generateEffectifParPays($effectifsInscription, $start , $end) {
    $code["COMORIEN(NE)"] = "Comoros";
    $code["CONGOLAIS(E)"] = "Congo";
    $code["CROATE"] = "Croatia";
    $code["CUBAIN(E)"] = "Cuba";
    $code["DANOIS(E)"] = "Denmark";
    $code["DJIBOUTIEN(NE)"] = "Djibouti";
    $code["EGYPTIEN(NE)"] = "Egypt";
@@ -532,6 +614,7 @@ function generateEffectifParPays($effectifsInscription, $start , $end) {
    $code["LITHUANIEN(NE)"] = "Lithuania";
    $code["LUXEMBOURGEOIS(E)"] = "Luxembourg";
    $code["MALAIS(E)"] = "Malaysia";
    $code["MALAWIEN(NE)"] = "Malawi";
    $code["MALGACHE"] = "Madagascar";
    $code["MALIEN(NE)"] = "Mali";
    $code["MALTAIS(E)"] = "Malta";
@@ -559,10 +642,12 @@ function generateEffectifParPays($effectifsInscription, $start , $end) {
    $code["PORTUGAIS(E)"] = "Portugal";
    $code["ROUMAIN(E)"] = "Romania";
    $code["RUANDAIS(E)"] = "Rwanda";
    $code["RWANDAIS(E)"] = "Rwanda";
    $code["RUSSE"] = "Russia";
    $code["SAOUDIEN(NE)"] = "Saudi Arabia";
    $code["SENEGALAIS(E)"] = "Senegal";
    $code["SERBE"] = "Serbia";
    $code["SLOVAQUE"] = "Slovakia";
    $code["SOUDANAIS(E)"] = "Sudan";
    $code["SUD COREEN(NE)"] = "Korea, Republic of";
    $code["SUEDOIS(E)"] = "Sweden";
+1 −1
Changes for module/Import/config/module.config.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -99,7 +99,7 @@ return array(
                                'source_code'   => 'non renseigné',
                            ],
                            'constraints' => [
                                'service'       => implode ('|', ["all","these","doctorant","acteur","variable","individu","role"]),
                                'service'       => implode ('|', ["all","these","doctorant","acteur","variable","individu","role", "structure", "etablissement", "unite-recherche", "ecole-doctorale"]),
                                'etablissement' => implode ('|', ["UCN","ULHN","INSA","URN"]),
                            ]
                        ],
+9 −3
Changes for module/Import/src/Import/Controller/ImportController.php: 9 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ class ImportController extends AbstractActionController

        /** is it all ? */
        if ($service_para === "all") {
            $services = ['variable', 'role', 'doctorant', 'these', 'individu', 'acteur'];
            $services = ['variable', 'role', 'doctorant', 'these', 'individu', 'acteur', 'structure', 'etablissement', 'ecole-doctorale', 'unite-recherche'];
        } else {
            $services = [ $service_para ];
        }
@@ -72,10 +72,16 @@ class ImportController extends AbstractActionController


            $dataName = $service;
            $entityClass = "Import\Model\Tmp" . ucwords($service);
            $entityName = str_replace("-"," ", $service);
            $entityName = ucwords($entityName);
            $entityName = str_replace(" ","", $entityName);
            $entityClass = "Import\Model\Tmp" . $entityName;
            $source_code = ($source_code != "non renseigné") ? $source_code : null;

            /** Execution de la récupération */
//            var_dump($dataName);
//            var_dump($entityClass);
//            var_dump($source_code);
            try {
                $logs[] = $this->fetcherService->fetch($dataName, $entityClass, $source_code);
            } catch (\Exception $e) {
@@ -106,7 +112,7 @@ class ImportController extends AbstractActionController

        /** is it all ? */
        if ($service_para === "all") {
            $services = ['variable', 'role', 'doctorant', 'these', 'individu', 'acteur'];
            $services = ['variable', 'role', 'doctorant', 'these', 'individu', 'acteur', 'structure', 'etablissement', 'ecole-doctorale', 'unite-recherche'];
        } else {
            $services = [ $service_para ];
        }
+12 −0
Changes for module/Import/src/Import/Model/Mapping/Import.Model.TmpEcoleDoctorale.dcm.xml: 12 added lines, 0 removed lines.
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<doctrine-mapping xmlns="http://doctrine-project.org/schemas/orm/doctrine-mapping"
                  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                  xsi:schemaLocation="http://doctrine-project.org/schemas/orm/doctrine-mapping http://doctrine-project.org/schemas/orm/doctrine-mapping.xsd">
    <entity name="Import\Model\TmpEcoleDoctorale" table="TMP_ECOLE_DOCT">
        <id name="id" type="string" column="ID"/>
        <field name="etablissementId"   type="string"   column="ETABLISSEMENT_ID"    length="64"    nullable="true"/>
        <field name="sourceId"          type="string"   column="SOURCE_ID"           length="64"    nullable="true"/>
        <field name="sourceCode"        type="string"   column="SOURCE_CODE"         length="64"    nullable="true"/>
        <field name="structureId"       type="string"   column="STRUCTURE_ID"        length="64"    nullable="true"/>
    </entity>
</doctrine-mapping>
Loading