diff --git a/amd/build/header.js b/amd/build/header.js
index ef5d2533217da6850d40f69c25a07d62888904da..deba9369a068c84bb47ec0c2f3af3a527cc1910e 100644
--- a/amd/build/header.js
+++ b/amd/build/header.js
@@ -27,29 +27,40 @@ define(['jquery', 'core/ajax', 'core/str'],
        	return{
        		
        		registerHeader:function(){
-	    		$("#button-collapse").click(function(){
-	    			if($("#summary-wrapper").hasClass('collapsed')){
-	    				$("#summary-wrapper").animate({ "max-height": '7rem' }, "slow" );
-	    				var message=str.get_string('displayInfos', 'format_iena');
-		    			$.when(message).done(function(localizedEditString) {
-						    $("#button-collapse").text(localizedEditString);
-						});	
+                var heightWrapper= $("#summary-wrapper").css("height");
+        
+                if(parseInt(heightWrapper, 10) >= 144){
+                    $("#button-collapse").click(function(){
+                    if($("#summary-wrapper").hasClass('collapsed')){
+                        $("#summary-wrapper").animate({ "max-height": '144px' }, "slow" );
+                        var message=str.get_string('displayInfos', 'format_iena');
+                        $.when(message).done(function(localizedEditString) {
+                            $("#button-collapse").text(localizedEditString);
+                        }); 
 
-	    			}
-	    			else{
-	    				var height= $("#summary-collapse").css("height");
-		    			$("#summary-wrapper").animate({ "max-height": height }, "slow" );
-		    			var message=str.get_string('hideInfos', 'format_iena');
-		    			$.when(message).done(function(localizedEditString) {
-						    $("#button-collapse").text(localizedEditString);
-						});	
-		    			
-		    			
-	    			}
-	    			$("#summary-wrapper").toggleClass("collapsed");
-	    			
-	    			
-	    		})
+                    }
+                    else{
+
+                        var height= $("#summary-collapse").height();
+                        var calcHeight=height+20;
+         
+                        $("#summary-wrapper").animate({ "max-height": calcHeight+'px' }, "slow" );
+                        var message=str.get_string('hideInfos', 'format_iena');
+                        $.when(message).done(function(localizedEditString) {
+                            $("#button-collapse").text(localizedEditString);
+                        }); 
+                        
+                        
+                    }
+                    $("#summary-wrapper").toggleClass("collapsed");
+                    
+                    
+                    })
+                }
+                else{
+                    $("#button-collapse").hide();
+                }
+	    		
 	    		
        		}
        		
diff --git a/amd/build/suivi-table.js b/amd/build/suivi-table.js
index 0dccd035ec7c8997382c2c218ebd42f15c94ff0e..19bb33672c890947c4cd232d4dc77a91a4afd91f 100644
--- a/amd/build/suivi-table.js
+++ b/amd/build/suivi-table.js
@@ -24,33 +24,55 @@
 define(['jquery'],
        function($) {
        	var all_selected=false;
+        nb_results=$("#table-body input").length;
+        $("#select-actions-suivi-iena").prop("disabled", true);
        	return{
+          
        		registerSelectAll:function(){
        			all_selected=false;
-       			$('#iena-select-all').on('click', function(e){
-					select_all_studs(e);
-	    		});
-	    		
-	    		
-	    		
+            if(!$._data( $('#iena-select-all')[0], 'events' )){
+         			$('#iena-select-all').on('click', function(e){
+  					     select_all_studs(e);
+  	    		  });
+              $(".checkstudent").on("click", function(){
+                checkSelectActions();
+              })
+            }
        		}
        	}
 
    
     function select_all_studs(e) {
-    	
-		all_selected=!all_selected;
-		var counter = 0;
-		var checks = document.querySelectorAll("#table-body tr");
-		for (var i = 0; i < checks.length; i++) {
-			if ( checks[i].style.display != "none" || all_selected ) {
-				var box = checks[i].querySelector("input[type='checkbox']");
-				box.checked = all_selected;
-				counter++;
-			}
-		}
+  		all_selected=!all_selected;
+  		var counter = 0;
+  		var checks = document.querySelectorAll("#table-body tr");
+  		for (var i = 0; i < checks.length; i++) {
+  			if ( checks[i].style.display != "none" || all_selected ) {
+  				var box = checks[i].querySelector("input[type='checkbox']");
+  				box.checked = all_selected;
+  				counter++;
+  			}
+  		}
+        checkSelectActions();
 	}
 
+      function checkSelectActions(){
+        var selectedChecks=$("#table-body input:checked");
+        if($("#select-actions-suivi-iena").prop("disabled") == false){
+            
+            
+            if(selectedChecks.length==0){
+                $("#select-actions-suivi-iena").prop("disabled", true);
+            }
+        }
+        else{
+            $("#select-actions-suivi-iena").prop("disabled", false);
+        }
+        $("#count-selected-students").text(selectedChecks.length+" résultat(s) sélectionné(s) sur "+nb_results);
+    }
+
+
+
 
 
 });
diff --git a/amd/build/suivi.js b/amd/build/suivi.js
index 7480dba27b774cafe2391d5388a1e050a6bc3e0d..7535e2b4cb85c02e904f8c16763fbef9674a8b22 100644
--- a/amd/build/suivi.js
+++ b/amd/build/suivi.js
@@ -25,6 +25,7 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
        function($, ajax, templates, str) {
        	var all_selected=false;
        	var data=[];
+
        	return{
        		
        		registerFilters:function(){
@@ -49,8 +50,13 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
 	    		$("#symbol-select").on('change', function(){
 	    			changeCompletion();
 	    		});
+                $('.dropdown-menu-form').on('click', function (e) {
+                   e.stopPropagation();
+                });
+               
 	    		
 	    		changeSection();
+                registerSelectAllActivitiesFilter();
 	    		/*calcPercentage(data);
 	    		changeCompletion();*/
        		}
@@ -77,6 +83,14 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
     	groupid=$("#group-select").val();
     	sectionid=$("#section-select").val();
     	filter=$("#symbol-select").val() + $("#filter-select").val();
+        /*checkedActivities=$('input[name="options[]"]:checked');
+        activities=[];
+        for(var i=0; i< checkedActivities.length; i++){
+            if(checkedActivities[i].value >0){
+                activities.push(checkedActivities[i].value);
+            }
+            
+        }*/
     	completeUrl='suivi_unit.php?courseid='+courseid;
     	if(sectionid){
     		completeUrl+='&sectionid='+sectionid;
@@ -97,9 +111,6 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
         	data: {action: 'test'},
         	type: 'post',
         	success: function(request) { 
-        		console.log("wat");
-        		console.log(JSON.parse(request));
-        		
         		data=calcPercentage(JSON.parse(request));
         		//changeCompletion();
         		changeSection();
@@ -133,7 +144,6 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
     			}
     		}
     		else if(symbol=="≤"){
-    			console.log("on passe ici");
     			if(data.students[i].percentage <= filter){
     				data.count_results++;
     				data.students[i].visible=true;
@@ -194,16 +204,56 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
     	else{
     		data=calcPercentage(data);
     		changeCompletion();
-    		//reloadTable(data);
     	}
+        changeActivitiesDropdown(data.modules);
+    }
 
-    	
-    	
-    	//reloadTable(data);
+    //Charge les activités dynamiquement en fonction de la section choisie
+    function changeActivitiesDropdown(modules){
+        //html='<li><label class="checkbox"><input type="checkbox" class="selectall" value="all" checked>Toutes les activités</label></li><li class="divider"></li>';
+        html="";
+        for (var i = 0; i<modules.length;i++){
+            if(modules[i].visible){
+                html+='<li><label class="checkbox"><input type="checkbox" name="options[]" checked value='+modules[i].id+' class="option justone">'+modules[i].displayname+'</label></li>';
+
+            }
+        }
+        $(".iena-dynamic-options").html(html);
+        registerActivityFilter();
+        checkAllActivitiesFilter();
     }
 
+    function displayActivities(){
+        var arrayActivitiesID=[];
+        var activitiesToStore=[];
+        var activities = $('input[name="options[]"]');
+        for(var i=0; i<activities.length;i++){
+
+            prog=data.modules.find(element => element.id === activities[i].value);
+            if(activities[i].checked){
+                prog.visible=true;
+                for(var j = 0; j<data.students.length; j++){
+                    data.students[j].progress.find(progress => progress.idmodule === activities[i].value).visible=true;
+                }
+                activitiesToStore.push(activities[i].value);
+            }
+            else{
+                prog.visible=false;
+                for(var j = 0; j<data.students.length; j++){
+                    data.students[j].progress.find(progress => progress.idmodule === activities[i].value).visible=false;
+                }
+            }
+           
+          
+        }
+        localStorage.setItem("activities",JSON.stringify(activitiesToStore));
+        //changeCompletion();
+        reloadTable(data);
+    }
+
+
+
     function loadMessage(type){
-    	console.log("on load");
     	if(type=="loading"){
     		var message = str.get_string('loadingResults', 'format_iena');
 	    	
@@ -217,16 +267,16 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
 		});	
     }
 
+    //Reload table with nex parameters.
     function reloadTable(params){
-    	console.log(params);
     	url=getCompleteUrl();
     	templates.render('format_iena/suivi-table', params)
      	.done(function(html, js){
-     		console.log("done done");
      		 $("#partial-table").html(html);
      		 templates.runTemplateJS(js);
      		 window.history.pushState('suivi',"", url);
      		 initHeaders();
+             
      	})
         .fail(function(){
         	loadMessage("error");
@@ -407,7 +457,6 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
 
 	//Pour chaque module non caché, on va regarder pour chaque étudiant 
 	function calcPercentage(data){
-		console.log(data);
 		for (var i = 0; i < data.students.length; i++) {
 			data.students[i].percentage=0;
 			var done=0;
@@ -426,8 +475,119 @@ define(['jquery', 'core/ajax', 'core/templates', 'core/str'],
 		//reloadTable(data);
 	}
 
+    //Evenement pour le selectall : créé une seule fois au chargement de la page
+    function registerSelectAllActivitiesFilter(){
+        $('.selectall').click(function() {
+            if ($(".selectall").is(':checked')) {
+                checkAllActivitiesFilter();
+                displayActivities();
+            } else {
+                $('.option').prop('checked', false);
+                var message=str.get_string('selectedActivities', 'format_iena');
+                $.when(message).done(function(localizedEditString) {
+                    $(".dropdown-text").html('0 '+localizedEditString);
+                }); 
+                $(".select-text").html(' Select');
+                displayActivities();
+            }
+        });
+        initActivityFilter();
+    }
 
 
-   
+    //On va recharger dynamiquement les options donc on doit recréer les événements à chaque fois qu'on change de section
+    function registerActivityFilter(){
+        /*$("input[type='checkbox'].justone").change(function(){
+            var a = $("input[type='checkbox'].justone");
+            if(a.length == a.filter(":checked").length){
+                console.log("on va sélectionner tout du coup");
+                $('.selectall').prop('checked', true);
+                $(".select-text").html(' Deselect');
+            }
+            else {
+                console.log("on va décocher le sélectionner tout");
+                $('.selectall').prop('checked', false);
+                $(".select-text").html(' Select');
+            }
+            displayTotalActivitiesFilter();
+        });*/
+
+        $("input[type='checkbox'].justone").on('click', function(e){
+            e.stopPropagation();
+             var a = $("input[type='checkbox'].justone");
+            if(a.length == a.filter(":checked").length){
+                $('.selectall').prop('checked', true);
+                $(".select-text").html(' Deselect');
+            }
+            else {
+
+                $('.selectall').prop('checked', false);
+                $(".select-text").html(' Select');
+            }
+            displayTotalActivitiesFilter();
+            displayActivities();
+        });
+
+        
+    }
+
+    //Update activities filter label
+    function displayTotalActivitiesFilter(){
+        var total = $('input[name="options[]"]:checked').length;
+        if(total == $('input[name="options[]"]').length){
+            var message=str.get_string('allActivities', 'format_iena');
+            $.when(message).done(function(localizedEditString) {
+                $(".dropdown-text").html(localizedEditString);
+            }); 
+        }
+        else{
+            var message=str.get_string('selectedActivities', 'format_iena');
+            $.when(message).done(function(localizedEditString) {
+                $(".dropdown-text").html(total + ' '+localizedEditString);
+            }); 
+        }
+        //displayActivities();
+          
+
+    }
+  
+    //Stocke le filtre des activités en localStorage pour ne pas avoir 50 id dans l'url
+    //On fait bien attention à rétablir cocher le selectall si toutes les activités sont bien cochées
+    function initActivityFilter(){
+
+        if(localStorage.activities){
+            var checkedActivities=JSON.parse(localStorage.activities);
+            var activities=$("input[type='checkbox'].justone");
+            if(activities.length===checkedActivities.length){
+
+                $(".selectall").prop("checked", true);
+                $("input[type='checkbox'].justone").prop("checked", true);
+            }
+            else{
+
+                $(".selectall").prop("checked", false);
+                for(var i=0; i<activities.length; i++){
+                    if(checkedActivities.includes(activities[i].value)){
+                        activities[i].checked=true;
+                    }
+                    else{
+                        activities[i].checked=false;
+                    }
+                }
+            }
+
+        }
+        displayTotalActivitiesFilter();
+        displayActivities();
+    }
+
+    //Coche toutes les activités quand on change de section
+    function checkAllActivitiesFilter(){
+        $('.selectall').prop('checked', true);
+        $('.option').prop('checked', true);
+        displayTotalActivitiesFilter();
+        $(".select-text").html(' Deselect');
+        
+    }
   
 });
diff --git a/classes/output/courseformat/content.php b/classes/output/courseformat/content.php
new file mode 100644
index 0000000000000000000000000000000000000000..198cbf81884a0253bba2e5ca0976c0481d12b1a7
--- /dev/null
+++ b/classes/output/courseformat/content.php
@@ -0,0 +1,128 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+/**
+ * Contains the default content output class.
+ *
+ * @package   format_topics
+ * @copyright 2020 Ferran Recio <ferran@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+namespace format_iena\output\courseformat;
+
+use core_courseformat\output\local\content as content_base;
+use format_iena\entity\course_format_iena_completion;
+require_once($CFG->libdir . '/accesslib.php');
+
+
+/**
+ * Base class to render a course content.
+ *
+ * @package   format_topics
+ * @copyright 2020 Ferran Recio <ferran@moodle.com>
+ * @license   http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class content extends content_base {
+
+    /**
+     * Export this data so it can be used as the context for a mustache template (core/inplace_editable).
+     *
+     * @param renderer_base $output typically, the renderer that's calling this function
+     * @return stdClass data context for a mustache template
+     */
+    public function export_for_template(\renderer_base $output) {
+        global $CFG, $COURSE, $USER;
+
+        $data=parent::export_for_template($output);
+        //$section_entity = new course_format_iena_sections();
+        
+        // return false if completion disabled (site or course)
+        $completion=new course_format_iena_completion();
+        $cpl = $completion->get_completion_by_sections($data->sections);
+        /* Passer le calcul de complétion de la classe course_format_iena_completion à part à la vue qui fait le header permet de ne pas récupérer deux fois les mêmes informations. */
+        //$header = new view_course_header($nameSections, $idSections, $course, $cpl);
+        $progress= $this->create_view($cpl);
+
+        foreach ($progress as $key => $value) {
+            $data->$key=$value;
+        }
+        //$data->progress=(object)$progress;
+        //$data->student=$progress['student'];
+        //$data->summary=$progress['summary'];
+        //$course_infos=$header->get_data($cpl);
+
+
+        return $data;
+    }
+
+    /**
+     * Retourne un tableau d'informations : array progress_total, array progress_sections, bool student, string summary
+     * @param array of object $infos 
+     * @return array
+     */
+    private function get_data($infos){
+        global $CFG, $COURSE, $USER;
+        require_once($CFG->libdir . '/accesslib.php');
+        $course_data=[];
+        $course_data['student']=false;
+        //if user is a student
+        if(!has_capability('course/iena:suivi', $context = \context_course::instance($COURSE->id), $USER->id) &&$infos["progress"]){
+            $course_data['progress_total']=$infos['progress']->total;
+            
+
+
+            // PROGRESS TOTAL : total progression percentage
+            if ( $infos['progress'] !== false && $infos['progress']->total !== false ) {
+                
+                
+                $course_data['progress_sections']=[];
+                // section progress total
+                foreach ($infos['progress']->sections as $section) {
+                    if ( count($section->modules) > 0 ) {
+                        array_push($course_data['progress_sections'], $section);
+                    
+                    }
+                }
+            }
+            else {
+            
+            }
+            $course_data['student']=true;
+        }
+
+        $course_data['summary']=$COURSE->summary;
+
+        return $course_data;
+    }
+
+    /**
+     * Description
+     * @param type $progress 
+     * @return type
+     */
+    public function create_view($progress) {
+        // $this->get_progress_bis($this->section_names, $this->idSection, $this->course);
+        //$prog = $progress != false ? $progress : $this->get_progress_bis($this->section_names, $this->idSection, $this->course);
+        $infos = [
+            'progress' => $progress,
+            //'teachers' => $this->get_teachers(),
+            //'groups' => $this->get_groupes(),
+            // 'attendance' => $this->get_attendance_link()
+        ];
+        return $this->get_data($infos);
+    }
+}
diff --git a/classes/output/courseformat/content/section/header.php b/classes/output/courseformat/content/section/header.php
new file mode 100644
index 0000000000000000000000000000000000000000..19ac53e4922321b1e70d43ea6801ac596ab08c17
--- /dev/null
+++ b/classes/output/courseformat/content/section/header.php
@@ -0,0 +1,168 @@
+<?php
+
+namespace format_iena\output\courseformat\content\section;
+
+use core_courseformat\output\local\content\section\header as header_base;
+use format_iena\entity\course_format_iena_completion;
+use context_course;
+
+class header extends header_base{
+
+    /**
+     * Export this data so it can be used as the context for a mustache template.
+     *
+     * @param renderer_base $output typically, the renderer that's calling this function
+     * @return array data context for a mustache template
+     */
+    
+   public function export_for_template(\renderer_base $output): \stdClass {
+    global $USER;
+        $format = $this->format;
+        $section = $this->section;
+        $course = $format->get_course();
+
+        $data = (object)[
+            'num' => $section->section,
+            'id' => $section->id,
+        ];
+        $data->title = $output->section_title_without_link($section, $course);
+
+        $coursedisplay = $format->get_course_display();
+        $data->headerdisplaymultipage = false;
+        if ($coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
+            $data->headerdisplaymultipage = true;
+            $data->title = $output->section_title($section, $course);
+        }
+
+        if ($section->section > $format->get_last_section_number()) {
+            // Stealth sections (orphaned) has special title.
+            $data->title = get_string('orphanedactivitiesinsectionno', '', $section->section);
+        }
+
+        if (!$section->visible) {
+            $data->ishidden = true;
+        }
+
+        if ($course->id == SITEID) {
+            $data->sitehome = true;
+        }
+
+        $data->editing = $format->show_editor();
+
+        if (!$format->show_editor() && $coursedisplay == COURSE_DISPLAY_MULTIPAGE && empty($data->issinglesection)) {
+            if ($section->uservisible) {
+                $data->url = course_get_url($course, $section->section);
+            }
+        }
+        $data->name = get_section_name($course, $section);
+        $param_section = (object)$format->get_format_options($section);        
+        $data->mode=$this->get_header_mode($param_section);
+        $data->date=$this->get_header_date($param_section, $data->mode);
+        if (has_capability('course/iena:suivi', $context = context_course::instance($course->id), $USER->id)) {
+            $data->link_suivi=$this->get_suivi_link($course->id, $section);
+        }
+        else{
+            $data->progress=$this->get_progress_student($course->id, $section, $course);
+        }
+        return $data;
+    }
+
+
+
+    public function get_header_mode($param_section){
+        $data=(object)[];       
+        //Ajouté par le plugin
+        if ($param_section !== false) {
+
+            if (isset($param_section->presence)) {
+                if ($param_section->presence == 1) {
+                    $data->presence = true;
+                    $data->distance =false;
+                    
+                } else if ($param_section->presence == 2) {
+                    $data->presence = false;
+                    $data->distance =true;
+                }
+                else{
+                    $data->presence = false;
+                    $data->distance =false;
+                }
+            }
+
+            
+        } 
+        return $data;
+    }
+
+    public function get_header_date($param_section, $mode){
+        $string_date=false;
+        if (isset($param_section->daterendu) && $param_section->daterendu != 0) {
+            $date=date("j/m H:i", $param_section->daterendu);
+            $date_jour = date("j/m", $param_section->daterendu);
+            $date_heure =  date("H:i", $param_section->daterendu);
+            if($mode->distance==true){
+                $string_date_presence="Pour le ";
+            }
+            else{
+                 $string_date_presence="Le ";
+            }
+            //if($string_date_presence){
+                $string_date=$string_date_presence.$date_jour." à ".$date_heure;
+            /*}
+            else{
+                $string_date="Le ".$date_jour." à ".$date_heure;
+            }*/
+        }
+        return $string_date;
+    }
+
+    public function get_suivi_link($courseid, $section){
+        global $USER, $CFG;
+       
+        $display_button=false;
+        $link_suivi=false;
+        foreach ($section->modinfo->cms as $cm) {
+            if($cm->completion>0 && $cm->section==$section->id){
+                $display_button=true;
+                break;
+            }
+        }
+        $context = context_course::instance($courseid);
+        $groups=groups_get_all_groups($courseid);
+        //$nb_modules = count($modules);
+        if($display_button){
+            //si trop d'étudiants on va afficher le premier groupe dans le suivi
+            if($this->count_students($context)>299 && count($groups)>0){
+                $link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $courseid . "&sectionid=" . $section->id . "&groupid=".reset($groups)->id;
+            }
+            else{
+                $link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $courseid . "&sectionid=" . $section->id . "&groupid=0";
+            }
+            
+        }
+            
+            
+        
+        return $link_suivi;
+    }
+
+    public function get_progress_student($courseid, $section,$course){
+        global $USER;
+        $section_progress=false;
+       
+        //On va chercher la progression pour la section
+        $completion_entity = new course_format_iena_completion();
+        $section_progress=$completion_entity->get_completion_by_section($section, $section->modinfo->cms, $course);
+        
+        
+        //var_dump($section_progress);
+        return $section_progress;
+    }
+   
+    private function count_students($context){
+        $count = count_enrolled_users($context);
+        return $count;
+    }
+
+}
+?>
\ No newline at end of file
diff --git a/classes/output/renderer.php b/classes/output/renderer.php
new file mode 100644
index 0000000000000000000000000000000000000000..db0b4f6efffb10305f22df177a3a4f1f8dddcd99
--- /dev/null
+++ b/classes/output/renderer.php
@@ -0,0 +1,112 @@
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+namespace format_iena\output;
+
+use core_courseformat\output\section_renderer;
+
+
+class renderer extends section_renderer {
+
+    /**
+     * Displays the activities list in cases when course view page is not
+     * redirected to the activity page.
+     *
+     * @param stdClass $course record from table course
+     * @param bool $orphaned if false displays the main activity (if present)
+     *     if true displays all other activities
+     */
+   /**
+     * Renders the provided widget and returns the HTML to display it.
+     *
+     * Course format templates uses a similar subfolder structure to the renderable classes.
+     * This method find out the specific template for a course widget. That's the reason why
+     * this render method is different from the normal plugin renderer one.
+     *
+     * course format templatables can be rendered using the core_course/local/* templates.
+     * Format plugins are free to override the default template location using render_xxx methods as usual.
+     *
+     * @param \renderable $widget instance with renderable interface
+     * @return string the widget HTML
+     */
+    public function render(\renderable $widget) {
+        global $CFG;
+        $fullpath = str_replace('\\', '/', get_class($widget));
+        $classparts = explode('/', $fullpath);
+        // Strip namespaces.
+        $classname = array_pop($classparts);
+        // Remove _renderable suffixes.
+        $classname = preg_replace('/_renderable$/', '', $classname);
+
+        $rendermethod = 'render_' . $classname;
+        if (method_exists($this, $rendermethod)) {
+            return $this->$rendermethod($widget);
+        }
+        // Check for special course format templatables.
+        if ($widget instanceof \templatable) {
+            // Templatables from both core_courseformat\output\xxx_format\* and format_xxx\output\xxx_format\*
+            // use core_crouseformat/local/xxx_format templates by default.
+            $corepath = 'core_courseformat\/output\/local';
+            $pluginpath = 'format_.+\/output\/courseformat';
+            $specialrenderers = '/^(?<componentpath>' /*. $corepath . '|'*/ . $pluginpath . ')\/(?<template>.+)$/'; // CHANGED.
+            $matches = null;
+            if (preg_match($specialrenderers, $fullpath, $matches)) {
+                $data = $widget->export_for_template($this);
+                return $this->render_from_template('format_iena/courseformat/' . $matches['template'], $data);    // CHANGED.
+            }
+        }
+        // If nothing works, let the parent class decide.
+        return parent::render($widget);
+    }
+
+    //Permet d'ajouter l'édition rapide sur les sections
+    /**
+     * Generate the section title, wraps it in a link to the section page if page is to be displayed on a separate page
+     *
+     * @param stdClass $section The course_section entry from DB
+     * @param stdClass $course The course entry from DB
+     * @return string HTML to output.
+     */
+    public function section_title($section, $course) {
+        return $this->render(course_get_format($course)->inplace_editable_render_section_name($section));
+    }
+
+    /**
+     * Generate the section title to be displayed on the section page, without a link
+     *
+     * @param stdClass $section The course_section entry from DB
+     * @param stdClass $course The course entry from DB
+     * @return string HTML to output.
+     */
+    public function section_title_without_link($section, $course) {
+        return $this->render(course_get_format($course)->inplace_editable_render_section_name($section, false));
+    }
+
+     public function display_completion($data){
+        echo $this->render_from_template('format_iena/suivi', $data);
+    }
+
+    public function display_table_completion($data){
+        echo $this->render_from_template('format_iena/suivi-table', $data);
+    }
+
+    public function display_message($data){
+        echo $this->render_from_template('format_iena/send-message', $data);
+    }
+
+
+
+}
diff --git a/classes/task/sync_task_iena_message.php b/classes/task/sync_task_iena_message.php
index 078e16697a3a21da56eb1a79b4a72d7e9a9ab8fa..d5363835860600ba35c147a486ac20cc42538ad5 100644
--- a/classes/task/sync_task_iena_message.php
+++ b/classes/task/sync_task_iena_message.php
@@ -1,64 +1,46 @@
-<?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 15/03/18
-	 * Time: 16:22
-	 */
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * sync_task_iena_message lunch cron_message()
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	namespace format_iena\task;
-	
-	class sync_task_iena_message extends \core\task\scheduled_task
-	{
-		/**
-		 * Get a descriptive name for this task (shown to admins).
-		 *
-		 * @return string
-		 */
-		
-		public function get_name()
-		{
-			return "task_iena_message";
-		}
-		
-		
-		public function execute()
-		{
-			global $CFG;
-			mtrace("IENA notifications task started");
-
-			require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_cron_action.php');
-			$cron_test = new \course_format_iena_cron_action();
-			// echo 'send message start';
-			$cron_test->cron_message();
-			mtrace("IENA notifications task completed");
-			// echo 'send message stop';
-		}
-		
-	}
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * sync_task_iena_message lunch cron_message()
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+namespace format_iena\task;
+
+class sync_task_iena_message extends \core\task\scheduled_task {
+    /**
+     * Get a descriptive name for this task (shown to admins).
+     *
+     * @return string
+     */
+    public function get_name() {
+        return "task_iena_message";
+    }
+
+    public function execute() {
+        global $CFG;
+        mtrace("IENA notifications task started");
+
+        require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_cron_action.php');
+        $cron = new \course_format_iena_cron_action();
+        $cron->cron_message();
+        mtrace("IENA notifications task completed");
+    }
+}
diff --git a/db/access.php b/db/access.php
index da3f58ea7548df5a38f4eb5689eb89721e716f65..7f4beb1913d0b1968932376be10fcb6c0108f269 100644
--- a/db/access.php
+++ b/db/access.php
@@ -1,22 +1,45 @@
-<?php
-$capabilities = array(
-	'course/iena:suivi' => array(
-		'captype' => 'read',
-		'contextlevel' => CONTEXT_COURSE,
-		'archetypes' => array(
-			'teacher' => CAP_ALLOW,
-			'editingteacher' => CAP_ALLOW,
-			'manager' => CAP_ALLOW
-		)
-	),
-	'course/iena:suivi_edit' => array(
-		'captype' => 'write',
-		'contextlevel' => CONTEXT_COURSE,
-		'archetypes' => array(
-			'teacher' => CAP_PREVENT,
-			'editingteacher' => CAP_ALLOW,
-			'manager' => CAP_ALLOW
-		)
-	),
-	
-);
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Plugin capabilities
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+defined('MOODLE_INTERNAL') || die();
+
+$capabilities = array(
+    'course/iena:suivi' => array(
+        'captype' => 'read',
+        'contextlevel' => CONTEXT_COURSE,
+        'archetypes' => array(
+            'teacher' => CAP_ALLOW,
+            'editingteacher' => CAP_ALLOW,
+            'manager' => CAP_ALLOW
+        )
+    ),
+    'course/iena:suivi_edit' => array(
+        'captype' => 'write',
+        'contextlevel' => CONTEXT_COURSE,
+        'archetypes' => array(
+            'teacher' => CAP_PREVENT,
+            'editingteacher' => CAP_ALLOW,
+            'manager' => CAP_ALLOW
+        )
+    ),
+);
diff --git a/db/tasks.php b/db/tasks.php
index 5d9bca3eb01e8fd77754d0d159033f1924bee1a5..9a26a1fb0469211225ab4f33c6a9c5334bfe7b8e 100644
--- a/db/tasks.php
+++ b/db/tasks.php
@@ -1,51 +1,38 @@
-<?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 15/03/18
-	 * Time: 16:34
-	 */
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * Set setting for cron
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	defined('MOODLE_INTERNAL') || die();
-	
-	
-	$tasks = array(
-		
-
-		array(
-			'classname' => 'format_iena\task\sync_task_iena_message',
-			'blocking' => 0,
-			'minute' => '0',
-			'hour' => '22',
-			'day' => '*',
-			'month' => '*',
-			'dayofweek' => '*'
-		)
-	
-	);
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * Set setting for cron
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$tasks = array(
+    array(
+        'classname' => 'format_iena\task\sync_task_iena_message',
+        'blocking' => 0,
+        'minute' => '0',
+        'hour' => '22',
+        'day' => '*',
+        'month' => '*',
+        'dayofweek' => '*'
+    )
+);
diff --git a/db/upgrade.php b/db/upgrade.php
index 8616fe3696a4c8015ca53375842c64540f3ec375..4aceccdc28e07c7816651160f2a729b09117dd64 100644
--- a/db/upgrade.php
+++ b/db/upgrade.php
@@ -1,73 +1,97 @@
 <?php
-
-	
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * Set setting for cron
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 
 function xmldb_format_iena_upgrade($oldversion) {
     global $CFG, $DB;
- 	$dbman = $DB->get_manager();
-    $result = TRUE;
- 
-      if ($oldversion < 2021220900) {
-
-       
+    $dbman = $DB->get_manager();
+    $result = true;
 
-        //Support for old versions: we copy format options to the course_format_options table
+    if ($oldversion < 2021220900) {
+        // Support for old versions: we copy format options to the course_format_options table.
         try {
-            $sections= $DB->get_records_sql('select * FROM {format_iena}');
-        } 
-        catch (dml_exception $e) {
+            $sections = $DB->get_records_sql('select * FROM {format_iena}');
+        } catch (dml_exception $e) {
             echo "Aucun cours avec le format hybride dans la base";
         }
-        if(count($sections) > 0){
+        if (count($sections) > 0) {
             foreach ($sections as $section) {
                 try {
+                    $courseid = $DB->get_record_sql('SELECT course
+                        FROM {course_sections}
+                        WHERE id=?',
+                        array($section->id_section));
+
+                    $sectiondata = new stdClass();
+                    $sectiondata->courseid = $courseid->course;
+                    $sectiondata->format = "iena";
+                    $sectiondata->sectionid = $section->id_section;
+                    // On va faire pour présence, daterendu et daysnotif.
+                    $sectiondata->name = "presence";
+                    $sectiondata->value = $section->presence;
+
+                    $exists = $DB->get_record_sql('SELECT *
+                        FROM {course_format_options}
+                        WHERE sectionid=?
+                        AND name="presence"',
+                        array($section->id_section));
 
-                    $courseid = $DB->get_record_sql('select course FROM {course_sections} WHERE id=?', array($section->id_section));
-                    
-                    $section_data = new stdClass();
-                    $section_data->courseid = $courseid->course;
-                    $section_data->format = "iena";
-                    $section_data->sectionid = $section->id_section;
-                    //On va faire pour présence, daterendu et daysnotif
-                    $section_data->name = "presence";
-                    $section_data->value = $section->presence;
-                    
-                    $exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="presence"', array($section->id_section));
-                    
-                    if(!$exists){
-                       
-                        $resultat = $DB->insert_record('course_format_options', $section_data, true);
+                    if (!$exists) {
+                        $resultat = $DB->insert_record('course_format_options', $sectiondata, true);
                     }
-                    $exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="daterendu"', array($section->id_section));
-                    if(!$exists){
-                       
-                        if(isset($section->date_rendu)){
-                            $section_data->name = "daterendu";
-                            $section_data->value = strtotime($section->date_rendu);
-                            $resultat = $DB->insert_record('course_format_options', $section_data, true);
+                    $exists = $DB->get_record_sql('SELECT *
+                        FROM {course_format_options}
+                        WHERE sectionid=?
+                        AND name="daterendu"',
+                        array($section->id_section));
+
+                    if (!$exists) {
+                        if (isset($section->date_rendu)) {
+                            $sectiondata->name = "daterendu";
+                            $sectiondata->value = strtotime($section->date_rendu);
+                            $resultat = $DB->insert_record('course_format_options', $sectiondata, true);
                         }
                     }
-                    $exists = $DB->get_record_sql('select * FROM {course_format_options} WHERE sectionid=? AND name="daysnotif"', array($section->id_section));
-                    if(!$exists){
-                        
-                        if(!empty($section->day_before)){
-                            $section_data->name = "daysnotif";
-                          
-                            $section_data->value = $section->nb_days_before;
-                            $resultat = $DB->insert_record('course_format_options', $section_data, true);
+                    $exists = $DB->get_record_sql('SELECT *
+                        FROM {course_format_options}
+                        WHERE sectionid=?
+                        AND name="daysnotif"',
+                        array($section->id_section));
+
+                    if (!$exists) {
+                        if (!empty($section->day_before)) {
+                            $sectiondata->name = "daysnotif";
+                            $sectiondata->value = $section->nb_days_before;
+                            $resultat = $DB->insert_record('course_format_options', $sectiondata, true);
                         }
                     }
-                } 
-                catch (dml_exception $e) {
+                } catch (dml_exception $e) {
                 }
             }
         }
-
         // Format_iena savepoint reached.
-        upgrade_plugin_savepoint(true, 2021070600,'format', 'iena');
+        upgrade_plugin_savepoint(true, 2021070600, 'format', 'iena');
     }
- 
     return $result;
 }
-
-?>
\ No newline at end of file
diff --git a/entity/course_format_iena_attendance.php b/entity/course_format_iena_attendance.php
index 938314efd64db50ba7d36cfbb2ae2f489c4bbb03..fc8c79db1adfd308958175035aaca49bce07796d 100644
--- a/entity/course_format_iena_attendance.php
+++ b/entity/course_format_iena_attendance.php
@@ -1,5 +1,4 @@
 <?php
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -14,53 +13,31 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
 /**
  *
  * course_format_iena_sections
  *
  * @package    format_iena
- * @category   format
  * @copyright  2018 Softia/Université lorraine
  * @author     Thomas Fradet
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
-class course_format_iena_attendance
-{
-
-	/**
-	 * @param $id_course
-	 * @return array
-	 * @throws dml_exception
-	 */
-	public function get_attendance_sessions($course_id) {
-
-
-		global $DB;
-			// -- FROM {attendance_sessions} 
-		// $DB->set_debug(true);
-		$res = $DB->get_records_sql('SELECT sessdate, att_sess.id, duration, groupid 
-			FROM {attendance_sessions} as att_sess
-			INNER JOIN {attendance} as att on att_sess.attendanceid = att.id
-			WHERE att.course = ?'
-			, array($course_id));
-
-		return $res;
-		// $groups = array();
-		// $i = 0;
-		// foreach ($requete as $value) {
-		// 	$group = new course_format_iena_groups();
-		// 	$group->get_group_by_id_group($value->id);
-		// 	$groups[$i] = $group;
-		// 	$i++;
-		// }
-
-		// return $groups;
-
-
-	}
-
-
-
-
+class course_format_iena_attendance {
+
+    /**
+     * @param $idcourse
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_attendance_sessions($courseid) {
+        global $DB;
+
+        $res = $DB->get_records_sql('SELECT sessdate, att_sess.id, duration, groupid
+            FROM {attendance_sessions} att_sess
+            INNER JOIN {attendance} att ON att_sess.attendanceid = att.id
+            WHERE att.course = ?',
+            array($courseid));
+
+        return $res;
+    }
 }
diff --git a/entity/course_format_iena_completion.php b/entity/course_format_iena_completion.php
index 9df796923646327bcbe58a85304cc918d12db3da..874596d4fe2d12b54c5b65b9ad5e77f963d2e936 100644
--- a/entity/course_format_iena_completion.php
+++ b/entity/course_format_iena_completion.php
@@ -1,5 +1,4 @@
 <?php
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -17,153 +16,244 @@
 
 /**
  *
- * This file give completion datas to get and display completion infos. 
+ * This file give completion datas to get and display completion infos.
  *
  * @package    format_iena
- * @category   format
  * @copyright  2018 Softia/Université lorraine
  * @author     Thomas Fradet
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  */
+namespace format_iena\entity;
+
 class course_format_iena_completion {
 
-	/**
-	 * Get completion by sections
-	 * @param array $section_names 
-	 * @param array $idSection 
-	 * @return type
-	 */
-	public static function get_completion_by_section($section_names, $idSection) {
-	
-		global $COURSE, $USER, $DB, $CFG;
-
-		$completion = new \completion_info($COURSE);
-		if ( $completion->is_enabled_for_site() == false || $completion->has_activities() == false || $completion->is_enabled() == 0 ) {
-			return false;
-		}
-
-
-		$sections = [];
-
-		$fast_modinfo = get_fast_modinfo($COURSE->id);
-		$modinfos_cms = $fast_modinfo->get_cms();
-
-		$modules = [];
-		//Il récupère les modules qui ne sont pas en cours de suppression, qui ont l'achèvement d'activité, et qui sont visibles pour l'user
-		foreach ($modinfos_cms as $cm) {
-			$module = $completion->get_data($cm, true, $USER->id, $fast_modinfo);
-			$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
-			$module->section = $cm->section;
-			if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible) {
-				$module->name = $cm->name;
-				$module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
-				$modules[] = $module;
-			}
-		}
-
-
-
-		$total_completed = 0;
-		$total_modules = 0;
-		foreach ($idSection as $i => $section_id) {
-			$section = new StdClass();
-			$section->id = $i;
-			$section->name = $section_names[$i];
-			$inner_modules = [];
-			$inner_completed = 0;
-			foreach ($modules as $module) {
-				if ( $module->section == $section_id) {
-					$mod = new StdClass();
-					$mod->coursemoduleid = $module->coursemoduleid;
-					$mod->completion = $module->completionstate;
-					$mod->name = $module->name;
-					$mod->url = $module->url;
-					if ( $mod->completion == 1 || $mod->completion == 2 ) {
-						$inner_completed++;
-					}
-					$inner_modules[] = $mod;
-				}
-			}
-			$section->modules = $inner_modules;
-			if ( count($inner_modules) == 0 ) {
-				$section->completion = 0;
-			} else {
-				$section->completion = number_format( 100 * $inner_completed / count($inner_modules), 0 );
-			}
-			$total_completed += $inner_completed;
-			$total_modules += count($inner_modules);
-			array_push($sections, $section);
-		}
-		if($total_modules==0){
-			return false;
-		}
-		$progress = new StdClass();
-		$progress->total = number_format( 100 * $total_completed / $total_modules, 0);
-		$progress->sections = $sections;
-		return $progress;
-
-	}
-
-	public static function get_completion_by_section_old() {
-
-		global $COURSE, $DB, $USER;
-
-		$completion = new \completion_info($COURSE);
-		if ( $completion->is_enabled_for_site() == false || $completion->has_activities() == false || $completion->is_enabled() == 0 ) {
-			return false;
-		}
-
-		$modinfo = get_fast_modinfo($COURSE->id);
-
-		$sections_infos = $modinfo->get_section_info_all();
-		$section_ids = [];
-		foreach ($sections_infos as $section) {
-			array_push($section_ids, $section->__get('id') );
-		}
-
-		$modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
-			FROM  {course_modules_completion} as cmc
-			inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
-			inner join {user} as u on u.id = cmc.userid
-			inner join {modules} as m on m.id = cm.module
-			where cm.course = ? and cm.deletioninprogress = 0
-			and cmc.userid = ?
-			order by section, coursemoduleid asc', array($COURSE->id, $USER->id));
-
-		$sections = [];
-
-		foreach ($section_ids as $i => $section_id) {
-			$section = new StdClass();
-			$section->id = $i;
-			$inner_modules = [];
-			$inner_completed = 0;
-			foreach ($modules as $module) {
-				if ( $module->section == $section_id ) {
-					$mod = new StdClass();
-					$mod->coursemoduleid = $module->coursemoduleid;
-					$mod->completion = $module->completionstate;
-					if ( $mod->completion == 1 || $mod->completion == 2 ) {
-						$inner_completed++;
-					}
-					$inner_modules[] = $mod;
-				}
-			}
-			$section->modules = $inner_modules;
-			if ( count($inner_modules) == 0 ) {
-				$section->completion = false;
-			} else {
-				$section->completion = number_format( 100 * $inner_completed / count($inner_modules), 0 );
-			}
-			array_push($sections, $section);
-		}
-
-		// echo '<pre>';
-		// var_dump($sections);
-		// echo '</pre>';
-
-		return $sections;
-
-
-	}
-
-}
\ No newline at end of file
+    /**
+     * Get completion by sections
+     * @param array $sectionnames
+     * @param array $idsection
+     * @return type
+     */
+    public static function get_completion_by_sections($arraySections) {
+
+        global $COURSE, $USER, $DB, $CFG;
+
+        $completion = new \completion_info($COURSE);
+        if ($completion->is_enabled_for_site() == false
+            || $completion->has_activities() == false || $completion->is_enabled() == 0) {
+            return false;
+        }
+        $course = course_get_format($COURSE)->get_course();
+        $fastmodinfo = get_fast_modinfo($COURSE->id);
+        $modinfoscms = $fastmodinfo->get_cms();
+        $sections=[];
+       //$hiddenbutavailable = $course->allmodulesbreadcrum == 1;
+        $modules = [];
+        //Il récupère les modules qui ne sont pas en cours de suppression, qui ont l'achèvement d'activité, qui sont visibles pour l'user, et qui dépend du paramètre "caché mais disponible"
+        /*foreach ($modinfoscms as $cm) {
+            $module = $completion->get_data($cm, true, $USER->id, $fastmodinfo);
+            $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+            $module->section = $cm->section;
+            if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible && ($cm->visibleoncoursepage==1 || $hiddenbutavailable)) {
+                $module->name = $cm->name;
+                $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+                $modules[] = $module;
+            }
+        }*/
+
+        $totalcompleted = 0;
+        $totalmodules = 0;
+        foreach ($arraySections as $singleSection) {
+            $section = new \StdClass();
+            $section->id = $singleSection->id;
+            $section->name = $singleSection->header->name;
+            $innermodules = [];
+            $innercompleted = 0;
+            $modules=self::get_completion_modules($modinfoscms, $USER->id, $course, $completion, $singleSection);
+            //$section->completion=$this->get_completion_by_section($section, $modinfoscms, $course, $modules );
+            foreach ($modules as $module) {
+                //if ($module->section == $singleSection->id) {
+                    $mod = new \StdClass();
+                    $mod->coursemoduleid = $module->coursemoduleid;
+                    $mod->completion = $module->completionstate;
+                    $mod->name = $module->name;
+                    $mod->url = $module->url;
+                    if ($mod->completion == 1 || $mod->completion == 2) {
+                        $innercompleted++;
+                    }
+                    $innermodules[] = $mod;
+                //}
+            }
+            $section->modules = $innermodules;
+            if (count($innermodules) == 0) {
+                $section->completion = 0;
+            } else {
+                $section->completion = number_format(100 * $innercompleted / count($innermodules), 0);
+            }
+            $totalcompleted += $innercompleted;
+            $totalmodules += count($innermodules);
+
+            array_push($sections, $section);
+        }
+        if ($totalmodules == 0) {
+            return false;
+        }
+        $progress = new \StdClass();
+        $progress->total = number_format(100 * $totalcompleted / $totalmodules, 0);
+        $progress->sections = $sections;
+        return $progress;
+    }
+
+    /**
+     * [get_completion_by_section Retourne la progression pour une section donnée]
+     * @param  [section_info] $section 
+     * @param  [type] $cms     liste des modules du cours
+     * @param  [type] $course  cours
+     * @return [float] $progress    pourcentage de complétion pour une section
+     */
+    public static function get_completion_by_section($section, $cms, $course) {
+
+        global $USER, $DB, $CFG;
+
+        $completion = new \completion_info($course);
+        if ($completion->is_enabled_for_site() == false
+            || $completion->has_activities() == false || $completion->is_enabled() == 0) {
+            return false;
+        }
+
+        ///$course = course_get_format($COURSE)->get_course();//
+        //$fastmodinfo = get_fast_modinfo($course->id);
+        //$modinfoscms = $fastmodinfo->get_cms();
+
+        $modules = []; 
+        $modules=self::get_completion_modules($cms, $USER->id, $course, $completion, $section);
+    
+
+        
+        //Il récupère les modules qui ne sont pas en cours de suppression, qui ont l'achèvement d'activité, qui sont visibles pour l'user, et qui dépend du paramètre "caché mais disponible"
+        /*foreach ($cms as $cm) {
+            if ($cm->section == $section->id) {
+                $module = $completion->get_data($cm, true, $USER->id);
+                $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+                $module->section = $cm->section;
+                if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible && ($cm->visibleoncoursepage==1 || $hiddenbutavailable)) {
+                    $module->name = $cm->name;
+                    $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+                    $modules[] = $module;
+                }
+            }
+
+        }*/
+        
+
+        $totalcompleted = 0;
+        $totalmodules = 0;
+
+        $innermodules = [];
+        $innercompleted = 0;
+        //on récupère les modules qui ont la complétion d'activé
+        foreach ($modules as $module) {
+            if ($module->completionstate == 1 || $module->completionstate == 2) {
+                $innercompleted++;
+            }
+            $innermodules[] = $module;
+        }
+        /*if (count($innermodules) == 0) {
+            $section->completion = 0;
+        } else {
+            $section->completion = number_format(100 * $innercompleted / count($innermodules), 0);
+        }*/
+        $totalcompleted += $innercompleted;
+        $totalmodules += count($innermodules);
+
+        if ($totalmodules == 0) {
+            return false;
+        }
+
+        $progress = number_format(100 * $totalcompleted / $totalmodules, 0);
+        //$progress->sections = $sections;
+        return $progress;
+    }
+
+    public static function get_completion_by_section_old() {
+
+        global $COURSE, $DB, $USER;
+
+        $completion = new \completion_info($COURSE);
+        if ($completion->is_enabled_for_site() == false
+            || $completion->has_activities() == false
+            || $completion->is_enabled() == 0) {
+            return false;
+        }
+
+        $modinfo = get_fast_modinfo($COURSE->id);
+
+        $sectionsinfos = $modinfo->get_section_info_all();
+        $sectionids = [];
+        foreach ($sectionsinfos as $section) {
+            array_push($sectionids, $section->__get('id') );
+        }
+
+        $modules = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate, cm.section
+            FROM  {course_modules_completion} cmc
+            INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
+            INNER JOIN {user} u ON u.id = cmc.userid
+            INNER JOIN {modules} m ON m.id = cm.module
+            WHERE cm.course = ? AND cm.deletioninprogress = 0
+            AND cmc.userid = ?
+            ORDER BY section, coursemoduleid ASC',
+            array($COURSE->id, $USER->id));
+
+        $sections = [];
+
+        foreach ($sectionids as $i => $sectionid) {
+            $section = new \StdClass();
+            $section->id = $i;
+            $innermodules = [];
+            $innercompleted = 0;
+            foreach ($modules as $module) {
+                if ($module->section == $sectionid) {
+                    $mod = new \StdClass();
+                    $mod->coursemoduleid = $module->coursemoduleid;
+                    $mod->completion = $module->completionstate;
+                    if ($mod->completion == 1 || $mod->completion == 2) {
+                        $innercompleted++;
+                    }
+                    $innermodules[] = $mod;
+                }
+            }
+            $section->modules = $innermodules;
+            if (count($innermodules) == 0) {
+                $section->completion = false;
+            } else {
+                $section->completion = number_format(100 * $innercompleted / count($innermodules), 0);
+            }
+            array_push($sections, $section);
+        }
+
+        return $sections;
+    }
+
+    public static function get_completion_modules($cms, $userid, $course, $completion, $section){
+        global $CFG;
+        $hiddenbutavailable = $course->allmodulesbreadcrum == 1;
+        $modules=[];
+        foreach ($cms as $cm) {
+
+            if ($cm->section == $section->id) {
+
+                $module = $completion->get_data($cm, true, $userid);
+                $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+                $module->section = $cm->section;
+                if ( $cm->deletioninprogress == 0 && $cm->completion != 0 && $cm->uservisible && ($cm->visibleoncoursepage==1 || $hiddenbutavailable)) {
+                    $module->name = $cm->name;
+                    $module->url = "$CFG->wwwroot/mod/$cm->modname/view.php?id=$cm->id";
+                    $modules[] = $module;
+                }
+            }
+
+        }
+        return $modules;
+    }
+
+}
+
diff --git a/entity/course_format_iena_cron_action.php b/entity/course_format_iena_cron_action.php
index 59e7c833c52e80399e8411b0cdf353bac519e17b..79d2e578775d1850b3397f5769858bfc51e65d2a 100644
--- a/entity/course_format_iena_cron_action.php
+++ b/entity/course_format_iena_cron_action.php
@@ -1,148 +1,141 @@
-<?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 15/03/18
-	 * Time: 11:33
-	 */
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * Class course_format_iena_cron_action
-	 * This class hide and show section with setting present in table format_iena
-	 * This class send message with setting present in table format_iena
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille / Michaël Lebeau
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	// include('../../lib.php');
-	// include('../../../../config.php');
-	
-	
-	class course_format_iena_cron_action
-	{
-		
-		
-
-		/**
-		 * Récupère le nombre de jours avant le rendu/présence pour envoyer une notification
-		 * @return type
-		 */
-		public function cron_message()
-		{
-			global $DB, $USER, $CFG;
-
-			$sections = $DB->get_records_sql("SELECT fo1.sectionid, fo1.value daysnotif, fo2.value daterendu, fo3.value presence FROM {course_format_options} fo1 LEFT JOIN {course_format_options} fo2 ON fo1.sectionid = fo2.sectionid LEFT JOIN {course_format_options} fo3 ON fo1.sectionid = fo3.sectionid WHERE fo1.format='iena' AND fo1.name ='daysnotif' AND (fo1.value IS NOT NULL) AND fo1.value != -1 AND fo2.name='daterendu' AND fo3.name='presence'");
-			foreach ($sections as $section) {
-				$requete = $DB->get_record('course_sections', array('id' => $section->sectionid));
-				$date_notif = $this->is_notif($section);
-				if ($date_notif == false) {
-					continue;
-				}
-				$this->iena_send_message($requete, $section);
-	
-			}
-		}
-		
-		/**
-		 * Check if it's time to send a notif by comparing the date withe the numbers of days before sending one in the db
-		 * @param $section
-		 * @return bool true if it's time to send a notif
-		 */
-		private function is_notif($section)
-		{
-			//On compare la date d'aujourd'hui avec le timestamp - daysnotifs
-			$date_now=date('Ymd');
-			$timenotif=strtotime('-'.$section->daysnotif.' days', $section->daterendu);
-			$date_notif=date('Ymd', $timenotif);
-			if($date_notif==$date_now){
-				return true;
-			}
-			return false;
-		}
-		
-		/**
-		 * @param $requete
-		 * @param $section
-		 * @throws coding_exception
-		 * @throws dml_exception
-		 */
-		private function iena_send_message($requete, $section)
-		{
-			global $DB, $CFG, $USER;
-			$course_ctx = context_course::instance($requete->course);
-
-			//À vérifier : on récupère tous les utilisateurs, même les invités
-			//2. $students = get_role_users(5 , $context) (the 5 represents the role-id with role.shortname = 'student')
-			//
-
-			$students = get_enrolled_users($course_ctx);
-			$course = $DB->get_record('course', array('id' => $requete->course), '*', MUST_EXIST);
-
-			$messageContent = false;
-
-			$messageContent .= "<h1>Rappel</h1>";
-			$messageContent .= "<h2>$course->fullname</h2>";
-
-			$date_jour = date('d/m', $section->daterendu);
-			$date_heure = date('H:i', $section->daterendu);
-
-			// 0 : NC
-			// 1 : work in the classroom
-			// 2 : online work
-			if ( $section->presence < 2 ) {
-				$messageContent .= "<p>La séance de cours <strong>$requete->name</strong> aura lieu le $date_jour à $date_heure.</p>";
-			} else if ( $section->presence == 2 ) {
-				$messageContent .= "<p>Le travail de la séance de cours à distance <strong>$requete->name</strong> est à finir pour le $date_jour à $date_heure.</p>";
-			}
-
-			$messageContent .= "<p>Lien vers le cours : <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a></p>";
-
-			//Create message
-			$message = new \core\message\message();
-			$message->component = 'moodle';
-			$message->name = 'instantmessage';
-			$message->userfrom = $USER;
-			$message->courseid = $course->id;
-			$message->notification = '1';
-			$message->contexturl = $CFG->wwwroot . "/course/view.php?id=" . $course->id . "#section-" . $requete->section;
-			$message->contexturlname = $course->fullname;
-			$message->fullmessageformat = FORMAT_HTML;
-			$log = "Messages sent for section $requete->name of course $course->fullname (id $course->id) to ";
-			$studs_counter = 0;
-			foreach ($students as $student) {
-				$studs_counter++;
-				$message->userto = $student;
-				$studs[] = 
-				$message->smallmessage = $messageContent;
-				$message->fullmessage = $messageContent;
-				$message->fullmessagehtml = $messageContent;
-				$message->subject = "Rappel : " . $course->fullname . " — " . $requete->name;
-				// $message->subject = $messageContent;
-				message_send($message);
-			}
-			$log .= $studs_counter . " students.";
-			echo $log;
-		}
-		
-		
-	}
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * Class course_format_iena_cron_action
+ * This class hide and show section with setting present in table format_iena
+ * This class send message with setting present in table format_iena
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille / Michaël Lebeau
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+class course_format_iena_cron_action {
+    /**
+     * Récupère le nombre de jours avant le rendu/présence pour envoyer une notification
+     * @return type
+     */
+    public function cron_message() {
+        global $DB, $USER, $CFG;
+
+        $sections = $DB->get_records_sql("SELECT fo1.sectionid, fo1.value daysnotif,
+            fo2.value daterendu, fo3.value presence, fo4.value msg
+            FROM {course_format_options} fo1
+            LEFT JOIN {course_format_options} fo2 ON fo1.sectionid = fo2.sectionid
+            LEFT JOIN {course_format_options} fo3 ON fo1.sectionid = fo3.sectionid
+            LEFT JOIN {course_format_options} fo4 ON fo1.sectionid = fo4.sectionid
+            WHERE fo1.format='iena'
+            AND fo1.name ='daysnotif'
+            AND (fo1.value IS NOT NULL)
+            AND fo1.value != -1
+            AND fo2.name='daterendu'
+            AND fo3.name='presence'
+            AND fo4.name='msg'");
+        foreach ($sections as $section) {
+            $requete = $DB->get_record('course_sections', array('id' => $section->sectionid));
+            $datenotif = $this->is_notif($section);
+            if ($datenotif == false) {
+                continue;
+            }
+            $this->iena_send_message($requete, $section);
+        }
+    }
+
+    /**
+     * Check if it's time to send a notif by comparing the date withe the numbers of days before sending one in the db
+     * @param $section
+     * @return bool true if it's time to send a notif
+     */
+    private function is_notif($section) {
+        // On compare la date d'aujourd'hui avec le timestamp - daysnotifs.
+        $datenow = date('Ymd');
+        $timenotif = strtotime('-'.$section->daysnotif.' days', $section->daterendu);
+        $datenotif = date('Ymd', $timenotif);
+        if ($datenotif == $datenow) {
+            return true;
+        }
+        return false;
+    }
+
+    /**
+     * @param $requete
+     * @param $section
+     * @throws coding_exception
+     * @throws dml_exception
+     */
+    private function iena_send_message($requete, $section) {
+        global $DB, $CFG, $USER;
+        $coursectx = context_course::instance($requete->course);
+
+        if ($section->presence == 2) {
+            $modalite = get_string('not_presence', 'format_iena');
+        } else if ($section->presence == 1) {
+            $modalite = get_string('in_presence', 'format_iena');
+        }
+        
+        // Si le message personnalisé est vide.
+        if ((empty($section->msg)) && ($section->presence == 2)) {
+            $section->msg = get_config('format_iena', 'msg_dist');
+        } else if ((empty($section->msg)) && ($section->presence == 1)) {
+            $section->msg = get_config('format_iena', 'msg_pres');
+        }
+
+        // A vérifier : on récupère tous les utilisateurs, même les invités.
+        // 2. $students = get_role_users(5 , $context) (the 5 represents the role-id with role.shortname = 'student').
+        $students = get_enrolled_users($coursectx);
+        $course = $DB->get_record('course', array('id' => $requete->course), '*', MUST_EXIST);
+
+        $messagecontent = false;
+
+        $messagecontent .= "<h1>Rappel</h1>";
+        $messagecontent .= "<h2>$course->fullname ($modalite) - " . date('d/m/Y H:i', $section->daterendu) . "</h2>";
+
+        // 0 : NC
+        // 1 : work in the classroom
+        // 2 : online work
+        $messagecontent .= "$section->msg";
+
+        $messagecontent .= "<p>Lien vers le cours : <a href='" . $CFG->wwwroot .
+            "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a></p>";
+
+        // Create message.
+        $message = new \core\message\message();
+        $message->component = 'moodle';
+        $message->name = 'instantmessage';
+        $message->userfrom = $USER;
+        $message->courseid = $course->id;
+        $message->notification = '1';
+        $message->contexturl = $CFG->wwwroot . "/course/view.php?id=" . $course->id . "#section-" . $requete->section;
+        $message->contexturlname = $course->fullname;
+        $message->fullmessageformat = FORMAT_HTML;
+        $log = "Messages sent for section $requete->name of course $course->fullname (id $course->id) to ";
+        $studscounter = 0;
+        foreach ($students as $student) {
+            $studscounter++;
+            $message->userto = $student;
+            $studs[] =
+            $message->smallmessage = $messagecontent;
+            $message->fullmessage = $messagecontent;
+            $message->fullmessagehtml = $messagecontent;
+            $message->subject = "Rappel : " . $course->fullname . " — " . $requete->name;
+            message_send($message);
+        }
+        $log .= $studscounter . " students.";
+        echo $log;
+    }
+}
diff --git a/entity/course_format_iena_groups.php b/entity/course_format_iena_groups.php
index 466a39477d870394a7c1da0e9ec2131fab570d1f..2a4ef2bb26cac6787720da75e375875d66fe9768 100644
--- a/entity/course_format_iena_groups.php
+++ b/entity/course_format_iena_groups.php
@@ -1,98 +1,99 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-	/**
-	 *
-	 * course_format_iena_sections
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille / Michaël Lebeau
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	class course_format_iena_groups
-	{
-		/** @var int id of group */
-		public $id;
-		/** @var int id of course */
-		public $id_course;
-		/** @var string idnumber of group */
-		public $idnumber;
-		/** @var string name of group */
-		public $name;
-		/** @var string description of group */
-		public $description;
-
-		/** @var array<userid>  */
-		public $list_userid;
-		
-		
-		/**
-		 * @param $id_course
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_groups_by_id_course($id_course)
-		{
-			global $DB;
-			$requete = $DB->get_records_sql('SELECT id FROM {groups} WHERE courseid = ?', array($id_course));
-			$groups = array();
-			$i = 0;
-			foreach ($requete as $value) {
-				$group = new course_format_iena_groups();
-				$group->get_group_by_id_group($value->id);
-				$groups[$i] = $group;
-				$i++;
-			}
-			
-			return $groups;
-		}
-		
-		
-		/**
-		 * @param $id_section
-		 * @throws dml_exception
-		 */
-		public function get_group_by_id_group($id_group)
-		{
-			global $DB;
-			$requete = $DB->get_record_sql('SELECT * FROM {groups} WHERE id = ?', array($id_group));
-			$this->id = $requete->id;
-			$this->id_course = $requete->courseid;
-			$this->idnumber = "id_groupe".$requete->id;
-			$this->name = $requete->name;
-			$this->description = $requete->description;
-			$this->list_userid = $DB->get_records_sql('SELECT userid FROM {groups_members} WHERE groupid = ?', array($id_group));
-			
-		}
-		
-		/**
-		 * 
-		 * @gparam $id_course
-		 * @return array
-		 */
-		public function get_students_group($id_course)
-		{
-			global $DB;
-			$students_group = $DB->get_records_sql('SELECT gm.userid, gm.groupid FROM {groups} as g 
-				inner join {groups_members} as gm on gm.groupid=g.id 
-				WHERE g.courseid = ?', array($id_course));
-			return $students_group;
-		}
-		
-	}
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * course_format_iena_sections
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille / Michaël Lebeau
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+class course_format_iena_groups {
+    /** @var int id of group */
+    public $id;
+    /** @var int id of course */
+    public $idcourse;
+    /** @var string idnumber of group */
+    public $idnumber;
+    /** @var string name of group */
+    public $name;
+    /** @var string description of group */
+    public $description;
+
+    /** @var array<userid>  */
+    public $listuserid;
+
+    /**
+     * @param $id_course
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_groups_by_id_course($idcourse) {
+        global $DB;
+        $requete = $DB->get_records_sql('SELECT id
+            FROM {groups}
+            WHERE courseid = ?',
+            array($idcourse));
+        $groups = array();
+        $i = 0;
+        foreach ($requete as $value) {
+            $group = new course_format_iena_groups();
+            $group->get_group_by_id_group($value->id);
+            $groups[$i] = $group;
+            $i++;
+        }
+
+        return $groups;
+    }
+
+    /**
+     * @param $id_section
+     * @throws dml_exception
+     */
+    public function get_group_by_id_group($idgroup) {
+        global $DB;
+        $requete = $DB->get_record_sql('SELECT *
+            FROM {groups}
+            WHERE id = ?',
+            array($idgroup));
+        $this->id = $requete->id;
+        $this->idcourse = $requete->courseid;
+        $this->idnumber = "id_groupe".$requete->id;
+        $this->name = $requete->name;
+        $this->description = $requete->description;
+        $this->listuserid = $DB->get_records_sql('SELECT userid
+            FROM {groups_members}
+            WHERE groupid = ?',
+            array($idgroup));
+    }
+
+    /**
+     *
+     * @gparam $id_course
+     * @return array
+     */
+    public function get_students_group($idcourse) {
+        global $DB;
+        $studentsgroup = $DB->get_records_sql('SELECT gm.userid, gm.groupid
+            FROM {groups} g
+            INNER JOIN {groups_members} gm ON gm.groupid=g.id
+            WHERE g.courseid = ?',
+            array($idcourse));
+        return $studentsgroup;
+    }
+}
diff --git a/entity/course_format_iena_message.php b/entity/course_format_iena_message.php
index c673ae56dd946d2cbf5479c499463dcfe6c12375..c90c969069313df9e4edd16c58ec5a06334f11e8 100644
--- a/entity/course_format_iena_message.php
+++ b/entity/course_format_iena_message.php
@@ -1,11 +1,4 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 13/03/18
-	 * Time: 11:26
-	 */
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -20,45 +13,36 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * course_format_iena_sections
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2021 Softia/Université lorraine
-	 * @author     Delaruelle Myriam
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
+/**
+ *
+ * course_format_iena_sections
+ *
+ * @package    format_iena
+ * @copyright  2021 Softia/Université lorraine
+ * @author     Delaruelle Myriam
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
 
-	require_once("{$CFG->libdir}/formslib.php");
+require_once("{$CFG->libdir}/formslib.php");
 
+class course_format_iena_message extends moodleform {
+    public function definition() {
+        // TODO: Implement definition() method.
 
-	class course_format_iena_message extends moodleform
-	{
-		public function definition()
-		{
-			// TODO: Implement definition() method.
-		
-			$mform = $this->_form; // Don't forget the underscore!
+        $mform = $this->_form;
+        $description = "";
 
-			$description = "";
-			
-			$mform->addElement('editor', 'summary', get_string('summary', 'format_iena'));
-			$mform->setType('summary', PARAM_RAW);
-			$mform->addRule('summary', get_string('error'), 'required', null, null, false, false);
-			$mform->setDefault('summary', array('text' => $description));
-			$mform->addElement('hidden', 'back_url', '');
-			$mform->setType('back_url', PARAM_TEXT);
-			$mform->setDefault('back_url', $this->_customdata['back_url']);
-			$mform->addElement('hidden', 'students', '');
-			$mform->setType('students', PARAM_TEXT);
-			$mform->setDefault('students', $this->_customdata['students']);
+        $mform->addElement('editor', 'summary', get_string('summary', 'format_iena'));
+        $mform->setType('summary', PARAM_RAW);
+        $mform->addRule('summary', get_string('error'), 'required', null, null, false, false);
+        $mform->setDefault('summary', array('text' => $description));
+        $mform->addElement('hidden', 'back_url', '');
+        $mform->setType('back_url', PARAM_TEXT);
+        $mform->setDefault('back_url', $this->_customdata['back_url']);
+        $mform->addElement('hidden', 'students', '');
+        $mform->setType('students', PARAM_TEXT);
+        $mform->setDefault('students', $this->_customdata['students']);
 
-			$this->add_action_buttons(true, "Envoyer");
-			
-			
-		}
-		
-	}
\ No newline at end of file
+        $this->add_action_buttons(true, "Envoyer");
+    }
+}
diff --git a/entity/course_format_iena_section_ressources.php b/entity/course_format_iena_section_ressources.php
index 30e4fcd0cd550d354f832434428342ebeb0556fa..f1a4cd9b220f3fc9cb6bb053f71f86274cb8b76f 100644
--- a/entity/course_format_iena_section_ressources.php
+++ b/entity/course_format_iena_section_ressources.php
@@ -1,221 +1,234 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-	/**
-	 *
-	 * course_format_iena_section_ressources
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille/Thomas Fradet
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	class course_format_iena_section_ressources
-	{
-		/** @var int Id of ressource */
-		public $id;
-		/** @var string name of ressource */
-		public $name;
-		/** @var string type of ressource */
-		public $type;
-		/** @var int module id of ressource */
-		public $module;
-		/** @var string intro of ressource */
-		public $descrition;
-		/** @var course_format_iena_section_ressources section */
-		public $section;
-		/** @var module hide indicator (from table format_iena_settings) */
-		public $ressource_hide_indic;
-		
-		
-		/**
-		 * @param $id_module
-		 * @return mixed
-		 * @throws dml_exception
-		 */
-		public function get_ressource_hide_indicator($id_module)
-		{
-			global $DB;
-			$module_state = $DB->get_record_sql('SELECT hide from {format_iena_settings} where cmid = ?', array($id_module));
-			return $module_state->hide;
-		}
-
-		/**
-		 * @param $id_module
-		 * @return mixed
-		 * @throws dml_exception
-		 */
-		public function is_followed_ressources($cm_ids)
-		{
-			global $DB;
-			$module_state = $DB->get_records_sql('SELECT hide from {format_iena_settings} where cmid = ?', $cm_ids);
-			// echo "<pre>";
-			// var_dump($module_state);
-			// echo "</pre>";
-			return $module_state;
-		}
-		
-		/**
-		 * @param $id_section
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_ressources_by_id_section($id_section)
-		{
-			global $DB;
-			
-			$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0', array($id_section));
-			$ressources = array();
-			$i = 0;
-			foreach ($requete as $value) {
-				$ressource = new course_format_iena_section_ressources();
-				$ressource->get_ressource_by_id($value->id);
-				$ressources[$i] = $ressource;
-				$i++;
-			}
-			
-			return $ressources;
-		}
-		
-		/**
-		 * @param $id_section
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_ressources_completion_on_by_id_section($id_section)
-		{
-			global $COURSE, $DB;
-
-			// !!! format_iena_settings.hide stands for this module is followed by teacher in a section following indicator — this course module is NOT hidden
-
-			// visible : disponibility for studient (right to access), visibleoncoursepage : visibility for student (display on course page) ; 1 : true, 0 : false. 
-
-			$course = course_get_format($COURSE)->get_course();
-
-
-			// search only modules by general course format parameters
-			// count only if it is follewed by teacher
-			// $if_followed = $course->restrictedbreadcrum == 1;
-			// count even if it is "hidden on course page but available"
-			$even_if_hidden_but_available = $course->allmodulesbreadcrum == 1;
-
-			if ( $even_if_hidden_but_available ) {
-				$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0
-					AND visible = 1
-					AND completion != 0', array($id_section));
-			} else {
-				$requete = $DB->get_records_sql('SELECT id FROM {course_modules} WHERE section = ? AND deletioninprogress = 0
-					AND visible = 1
-					AND visibleoncoursepage = 1
-					AND completion != 0', array($id_section));
-			}
-			
-			$ressources = array();
-			$i = 0;
-			foreach ($requete as $value) {
-				$ressource = new course_format_iena_section_ressources();
-				$ressource->get_ressource_by_id($value->id);
-				$ressources[$i] = $ressource;
-				$i++;
-			}
-			
-			return $ressources;
-		}
-		
-		
-		/**
-		 * @param $id_course_modules
-		 * @throws dml_exception
-		 */
-		public function get_ressource_by_id($id_course_modules)
-		{
-			
-			global $DB;
-			if ($id_course_modules) {
-				$this->id = $id_course_modules;
-				$requete = $DB->get_record_sql('SELECT * FROM {course_modules} WHERE id = ? AND deletioninprogress = 0', array($id_course_modules));
-				$id_instance = $requete->instance;
-				$id_module = $requete->module;
-				if ($id_module) {
-					$modules = $DB->get_record_sql('SELECT * FROM {modules} WHERE id = ?', array($id_module));
-				}
-				if ($modules->name) {
-					$instance = $DB->get_record_sql('SELECT * FROM {' . $modules->name . '} WHERE id = ?', array($id_instance));
-				}
-				if ($instance->name) {
-					$this->name = $instance->name;
-				}
-				$this->descrition = $instance->intro;
-				$this->type = $modules->name;
-				$this->module = $modules->id;
-				// $this->section = new course_format_iena_section_ressources();
-				$this->section = new course_format_iena_sections();
-				$this->section->get_section_by_id_section($requete->section);
-			}
-		}
-		
-		/**
-		 * @param $userId
-		 * @param $courseID
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_completions_by_userid($userId, $courseID)
-		{
-			global $DB;
-			$modules_completion_infos = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
-				FROM  {course_modules_completion} as cmc
-				inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
-				inner join {user} as u on u.id = cmc.userid
-				inner join {modules} as m on m.id = cm.module
-				where cm.course = ? and cm.deletioninprogress = 0
-				and cmc.userid = ?
-				order by section, coursemoduleid asc', array($courseID, $userId));
-			
-			return $modules_completion_infos;
-		}
-		
-		/**
-		 * @param $userId
-		 * @param $courseID
-		 * @param $moduleID
-		 * @return mixed
-		 * @throws dml_exception
-		 */
-		public function get_completions_by_module($userId, $courseID, $moduleID)
-		{
-			global $DB, $COURSE;
-
-			$course = course_get_format($COURSE)->get_course();
-			
-			$modules_completion_infos = $DB->get_record_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
-				FROM  {course_modules_completion} as cmc
-				inner join {course_modules} as cm on cm.id = cmc.coursemoduleid
-				inner join {user} as u on u.id = cmc.userid
-				inner join {modules} as m on m.id = cm.module
-				where cm.course = ? and cm.deletioninprogress = 0
-				and cmc.userid = ?
-				and cmc.coursemoduleid = ?
-				order by section, coursemoduleid asc', array($courseID, $userId, $moduleID));
-
-			return $modules_completion_infos;
-		}
-		
-	}
-
-
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * course_format_iena_section_ressources
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille/Thomas Fradet
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+class course_format_iena_section_ressources {
+    /** @var int Id of ressource */
+    public $id;
+    /** @var string name of ressource */
+    public $name;
+    /** @var string type of ressource */
+    public $type;
+    /** @var int module id of ressource */
+    public $module;
+    /** @var string intro of ressource */
+    public $description;
+    /** @var course_format_iena_section_ressources section */
+    public $section;
+    /** @var module hide indicator (from table format_iena_settings) */
+    public $ressourcehideindic;
+
+    /**
+     * @param $idmodule
+     * @return mixed
+     * @throws dml_exception
+     */
+    public function get_ressource_hide_indicator($idmodule) {
+        global $DB;
+        $modulestate = $DB->get_record_sql('SELECT hide
+            FROM {format_iena_settings}
+            WHERE cmid = ?',
+            array($idmodule));
+        return $modulestate->hide;
+    }
+
+    /**
+     * @param $idmodule
+     * @return mixed
+     * @throws dml_exception
+     */
+    public function is_followed_ressources($cmids) {
+        global $DB;
+        $modulestate = $DB->get_records_sql('SELECT hide
+            FROM {format_iena_settings}
+            WHERE cmid = ?',
+            $cmids);
+        return $modulestate;
+    }
+
+    /**
+     * @param $idsection
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_ressources_by_id_section($idsection) {
+        global $DB;
+
+        $requete = $DB->get_records_sql('SELECT id
+            FROM {course_modules}
+            WHERE section = ?
+            AND deletioninprogress = 0',
+            array($idsection));
+        $ressources = array();
+        $i = 0;
+        foreach ($requete as $value) {
+            $ressource = new course_format_iena_section_ressources();
+            $ressource->get_ressource_by_id($value->id);
+            $ressources[$i] = $ressource;
+            $i++;
+        }
+
+        return $ressources;
+    }
+
+    /**
+     * @param $idsection
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_ressources_completion_on_by_id_section($idsection) {
+        global $COURSE, $DB;
+
+        // Format_iena_settings.hide stands for this module is followed by teacher in a section following indicator —
+        // this course module is NOT hidden.
+
+        // Visible : disponibility for studient (right to access), visibleoncoursepage : visibility for student
+        // (display on course page) ; 1 : true, 0 : false.
+
+        $course = course_get_format($COURSE)->get_course();
+
+        // Search only modules by general course format parameters
+        // count only if it is follewed by teacher
+        // count even if it is "hidden on course page but available".
+        $evenifhiddenbutavailable = $course->allmodulesbreadcrum == 1;
+
+        if ($evenifhiddenbutavailable) {
+            $requete = $DB->get_records_sql('SELECT id
+                FROM {course_modules}
+                WHERE section = ?
+                AND deletioninprogress = 0
+                AND visible = 1
+                AND completion != 0',
+                array($idsection));
+        } else {
+            $requete = $DB->get_records_sql('SELECT id
+                FROM {course_modules}
+                WHERE section = ?
+                AND deletioninprogress = 0
+                AND visible = 1
+                AND visibleoncoursepage = 1
+                AND completion != 0',
+                array($idsection));
+        }
+
+        $ressources = array();
+        $i = 0;
+        foreach ($requete as $value) {
+            $ressource = new course_format_iena_section_ressources();
+            $ressource->get_ressource_by_id($value->id);
+            $ressources[$i] = $ressource;
+            $i++;
+        }
+
+        return $ressources;
+    }
+
+    /**
+     * @param $idcoursemodules
+     * @throws dml_exception
+     */
+    public function get_ressource_by_id($idcoursemodules) {
+
+        global $DB;
+        if ($idcoursemodules) {
+            $this->id = $idcoursemodules;
+            $requete = $DB->get_record_sql('SELECT *
+                FROM {course_modules}
+                WHERE id = ?
+                AND deletioninprogress = 0',
+                array($idcoursemodules));
+            $idinstance = $requete->instance;
+            $idmodule = $requete->module;
+            if ($idmodule) {
+                $modules = $DB->get_record_sql('SELECT *
+                    FROM {modules}
+                    WHERE id = ?',
+                    array($idmodule));
+            }
+            if ($modules->name) {
+                $instance = $DB->get_record_sql('SELECT *
+                    FROM {' . $modules->name . '}
+                    WHERE id = ?',
+                    array($idinstance));
+            }
+            if ($instance->name) {
+                $this->name = $instance->name;
+            }
+            $this->descrition = $instance->intro;
+            $this->type = $modules->name;
+            $this->module = $modules->id;
+            $this->section = new course_format_iena_sections();
+            $this->section->get_section_by_id_section($requete->section);
+        }
+    }
+
+    /**
+     * @param $userid
+     * @param $courseid
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_completions_by_userid($userid, $courseid) {
+        global $DB;
+        $modulescompletioninfos = $DB->get_records_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
+            FROM  {course_modules_completion} cmc
+            INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
+            INNER JOIN {user} u ON u.id = cmc.userid
+            INNER JOIN {modules} m ON m.id = cm.module
+            WHERE cm.course = ?
+            AND cm.deletioninprogress = 0
+            AND cmc.userid = ?
+            ORDER BY section, coursemoduleid ASC',
+            array($courseid, $userid));
+
+        return $modulescompletioninfos;
+    }
+
+    /**
+     * @param $userid
+     * @param $courseid
+     * @param $moduleid
+     * @return mixed
+     * @throws dml_exception
+     */
+    public function get_completions_by_module($userid, $courseid, $moduleid) {
+        global $DB, $COURSE;
+
+        $course = course_get_format($COURSE)->get_course();
+
+        $modulescompletioninfos = $DB->get_record_sql('SELECT cmc.id, cmc.coursemoduleid, cmc.userid, cmc.completionstate
+            FROM  {course_modules_completion} cmc
+            INNER JOIN {course_modules} cm ON cm.id = cmc.coursemoduleid
+            INNER JOIN {user} u ON u.id = cmc.userid
+            INNER JOIN {modules} m ON m.id = cm.module
+            WHERE cm.course = ?
+            AND cm.deletioninprogress = 0
+            AND cmc.userid = ?
+            AND cmc.coursemoduleid = ?
+            ORDER BY section, coursemoduleid ASC',
+            array($courseid, $userid, $moduleid));
+
+        return $modulescompletioninfos;
+    }
+}
diff --git a/entity/course_format_iena_sections.php b/entity/course_format_iena_sections.php
index 16432599bae9f5f190003a89510eade6947e02e8..2a7f5e6d0d4e8c06f582124bb745602114223f01 100644
--- a/entity/course_format_iena_sections.php
+++ b/entity/course_format_iena_sections.php
@@ -1,285 +1,264 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * course_format_iena_sections
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille / Michaël Lebeau
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	class course_format_iena_sections
-	{
-		/** @var int id of section */
-		public $id;
-		/** @var string name of section */
-		public $name;
-		/** @var int id of course */
-		public $id_course;
-		/** @var block_career_resources array<Ressource> resources */
-		public $resources;
-		/** @var date */
-		public $date;
-		/** @var string availability */
-		public $availability;
-		public $visibility;
-		
-		
-		/**
-		 * @param $id_course
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_sections_by_id_course($id_course)
-		{
-			global $DB;
-			$requete = $DB->get_records_sql('SELECT * FROM {course_sections} WHERE course = ? ORDER BY section', array($id_course));
-            // $numsection = $DB->get_record_sql('SELECT value FROM {course_format_options} WHERE courseid = ? AND name = ?', array($id_course,"numsections"));
-            return $requete;
-            $sections = array();
-			$i = 0;
-			foreach ($requete as $value) {
-			    // if ($value->section > $numsection->value){
-			    //     continue;
-  			    //          }
-				$section = new course_format_iena_sections();
-				$section->get_section_by_id_section($value->id);
-				$sections[$i] = $section;
-				$i++;
-			}
-			// var_dump($sections);
-			return $sections;
-		}
-		
-		
-		/**
-		 * @param $id_section
-		 * @throws dml_exception
-		 */
-		public function get_section_by_id_section($id_section)
-		{
-			global $DB;
-			$requete = $DB->get_record_sql('SELECT * FROM {course_sections} WHERE id = ?', array($id_section));
-			$this->id = $requete->id;
-			$this->name = $requete->name;
-			$this->id_course = $requete->course;
-			
-			if (!$this->name) {
-				$this->name = get_string('section', 'format_iena') . " " . $requete->section;
-			}
-		}
-		
-		/**
-		 * @param $id_section
-		 * @return mixed
-		 * @throws dml_exception
-		 */
-		public function get_section_settings_by_id_section($id_section)
-		{
-			global $DB;
-			$requete = $DB->get_record_sql('SELECT * FROM {format_iena} WHERE id_section = ?', array($id_section));
-			return $requete;
-		}
-		
-		
-		/**
-		 * @param $id_section
-		 * @param $id_user
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_completion_by_sectionID_userID($id_section, $id_user)
-		{
-			global $DB;
-			$requete = $DB->get_records_sql('SELECT cmc.id as moduleid, cm.course, cm.section, cmc.userid, cmc.completionstate
-                                        FROM {course_modules} as cm
-                                        inner join  {course_modules_completion} as cmc on cmc.coursemoduleid = cm.id
-                                        WHERE cm.section= ? AND cmc.userid= ?
-                                        order by cm.section, cmc.userid', array($id_section, $id_user));
-			return $requete;
-		}
-		
-		/**
-		 * @param $id_section
-		 * @return array
-		 * @throws dml_exception
-		 */
-		public function get_hidden_modules_by_section($id_section)
-		{
-			global $DB;
-			$requete = $DB->get_records_sql('SELECT *
-                                        FROM {format_iena_settings}
-                                        WHERE sectionid =?', array($id_section));
-			return $requete;
-		}
-		
-	
-    /**
-     * @return mixed
-     */
-    public function getId()
-    {
-        return $this->id;
-    }
-
-    /**
-     * @param mixed $id
-     *
-     * @return self
-     */
-    public function setId($id)
-    {
-        $this->id = $id;
-
-        return $this;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getName()
-    {
-        return $this->name;
-    }
-
-    /**
-     * @param mixed $name
-     *
-     * @return self
-     */
-    public function setName($name)
-    {
-        $this->name = $name;
-
-        return $this;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getIdCourse()
-    {
-        return $this->id_course;
-    }
-
-    /**
-     * @param mixed $id_course
-     *
-     * @return self
-     */
-    public function setIdCourse($id_course)
-    {
-        $this->id_course = $id_course;
-
-        return $this;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getResources()
-    {
-        return $this->resources;
-    }
-
-    /**
-     * @param mixed $resources
-     *
-     * @return self
-     */
-    public function setResources($resources)
-    {
-        $this->resources = $resources;
-
-        return $this;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getDate()
-    {
-        return $this->date;
-    }
-
-    /**
-     * @param mixed $date
-     *
-     * @return self
-     */
-    public function setDate($date)
-    {
-        $this->date = $date;
-
-        return $this;
-    }
-
-    /**
-     * @return mixed
-     */
-    public function getAvailability()
-    {
-        return $this->availability;
-    }
-
-    /**
-     * @param mixed $availability
-     *
-     * @return self
-     */
-    public function setAvailability($availability)
-    {
-        $this->availability = $availability;
-
-        return $this;
-    }
-
-
-
-    /**
-     * @return mixed
-     */
-    public function getVisibility()
-    {
-        return $this->visibility;
-    }
-
-    /**
-     * @param mixed $visibility
-     *
-     * @return self
-     */
-    public function setVisibility($visibility)
-    {
-        $this->visibility = $visibility;
-
-        return $this;
-    }
-
-
-    public function toArray(){
-    	$vars = [];
-	    foreach($this as $varName => $varValue) {
-	        $vars[$varName] = $varValue;
-	    }
-
-	    return $vars;
-    }
-}
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * course_format_iena_sections
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille / Michaël Lebeau
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+class course_format_iena_sections {
+    /** @var int id of section */
+    public $id;
+    /** @var string name of section */
+    public $name;
+    /** @var int id of course */
+    public $idcourse;
+    /** @var block_career_resources array<Ressource> resources */
+    public $resources;
+    /** @var date */
+    public $date;
+    /** @var string availability */
+    public $availability;
+    public $visibility;
+
+    /**
+     * @param $idcourse
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_sections_by_id_course($idcourse) {
+        global $DB;
+        $requete = $DB->get_records_sql('SELECT *
+            FROM {course_sections}
+            WHERE course = ?
+            ORDER BY section',
+            array($idcourse));
+
+        return $requete;
+        $sections = array();
+        $i = 0;
+        foreach ($requete as $value) {
+            $section = new course_format_iena_sections();
+            $section->get_section_by_id_section($value->id);
+            $sections[$i] = $section;
+            $i++;
+        }
+        return $sections;
+    }
+
+    /**
+     * @param $idsection
+     * @throws dml_exception
+     */
+    public function get_section_by_id_section($idsection) {
+        global $DB;
+        $requete = $DB->get_record_sql('SELECT *
+            FROM {course_sections}
+            WHERE id = ?',
+            array($idsection));
+        $this->id = $requete->id;
+        $this->name = $requete->name;
+        $this->id_course = $requete->course;
+
+        if (!$this->name) {
+            $this->name = get_string('section', 'format_iena') . " " . $requete->section;
+        }
+    }
+
+    /**
+     * @param $idsection
+     * @return mixed
+     * @throws dml_exception
+     */
+    public function get_section_settings_by_id_section($idsection) {
+        global $DB;
+        $requete = $DB->get_record_sql('SELECT *
+            FROM {format_iena}
+            WHERE id_section = ?',
+            array($idsection));
+        return $requete;
+    }
+
+    /**
+     * @param $idsection
+     * @param $iduser
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_completion_by_sectionID_userID($idsection, $iduser) {
+        global $DB;
+        $requete = $DB->get_records_sql('SELECT cmc.id as moduleid, cm.course, cm.section, cmc.userid, cmc.completionstate
+            FROM {course_modules} cm
+            INNER JOIN  {course_modules_completion} cmc ON cmc.coursemoduleid = cm.id
+            WHERE cm.section= ?
+            AND cmc.userid= ?
+            ORDER BY cm.section, cmc.userid',
+            array($idsection, $iduser));
+        return $requete;
+    }
+
+    /**
+     * @param $idsection
+     * @return array
+     * @throws dml_exception
+     */
+    public function get_hidden_modules_by_section($idsection) {
+        global $DB;
+        $requete = $DB->get_records_sql('SELECT *
+            FROM {format_iena_settings}
+            WHERE sectionid =?',
+            array($idsection));
+        return $requete;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getId() {
+        return $this->id;
+    }
+
+    /**
+     * @param mixed $id
+     *
+     * @return self
+     */
+    public function setId($id) {
+        $this->id = $id;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getName() {
+        return $this->name;
+    }
+
+    /**
+     * @param mixed $name
+     *
+     * @return self
+     */
+    public function setName($name) {
+        $this->name = $name;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getIdCourse() {
+        return $this->id_course;
+    }
+
+    /**
+     * @param mixed $id_course
+     *
+     * @return self
+     */
+    public function setIdCourse($idcourse) {
+        $this->id_course = $idcourse;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getResources() {
+        return $this->resources;
+    }
+
+    /**
+     * @param mixed $resources
+     *
+     * @return self
+     */
+    public function setResources($resources) {
+        $this->resources = $resources;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getDate() {
+        return $this->date;
+    }
+
+    /**
+     * @param mixed $date
+     *
+     * @return self
+     */
+    public function setDate($date) {
+        $this->date = $date;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getAvailability() {
+        return $this->availability;
+    }
+
+    /**
+     * @param mixed $availability
+     *
+     * @return self
+     */
+    public function setAvailability($availability) {
+        $this->availability = $availability;
+
+        return $this;
+    }
+
+    /**
+     * @return mixed
+     */
+    public function getVisibility() {
+        return $this->visibility;
+    }
+
+    /**
+     * @param mixed $visibility
+     *
+     * @return self
+     */
+    public function setVisibility($visibility) {
+        $this->visibility = $visibility;
+
+        return $this;
+    }
+
+    public function toArray() {
+        $vars = [];
+        foreach ($this as $varname => $varvalue) {
+            $vars[$varname] = $varvalue;
+        }
+        return $vars;
+    }
+}
diff --git a/format.js b/format.js
index 0eeeafa14c750619b771ca5bdaa9813003c839e2..e657204f864b420e8d1cc228d53b185018d2e947 100644
--- a/format.js
+++ b/format.js
@@ -76,10 +76,35 @@ M.course.format.process_sections = function(Y, sectionlist, response, sectionfro
 };
 
 (function () {
+    $(".iena-description .description-inner").each(function(index){
+        if(parseInt($( this ).css('height'))<=144){
+            $(this).parent().next().hide();
+        }
+    })
+    //Gère les animations sur les descriptions des sections pour agrandir/rétrecir les infos
     $('.section').find('a[href="#"].voir-plus').on('click', function (e) {
         e.preventDefault();
         this.expand = !this.expand;
         $(this).text(this.expand?"Réduire la description":"Voir la description complète");
-        $(this).closest('.section').find('.small, .big').toggleClass('small big');
+        //$(this).closest('.section').find('.small, .big').toggleClass('small big');
+        //
+     
+        if($(this).prev().hasClass('small')){
+            $(this).prev().toggleClass('small big');
+            var height= $(this).prev().find(".description-inner").css("height");
+            $(this).prev().animate({ "max-height": height }, "slow" );
+
+        } 
+        else if($(this).prev().hasClass('big')){
+
+            $(this).prev().toggleClass('small big');
+            $(this).prev().animate({ "max-height": '144px' }, "slow" );
+        }
+        else{
+            $(this).prev().addClass("big");
+            var height= $(this).prev().find(".description-inner").css("height");
+            $(this).prev().animate({ "max-height": height }, "slow" );
+        }
+        
     });
 }(jQuery));
\ No newline at end of file
diff --git a/format.php b/format.php
index 1f0c83396b48f65adaa845cdef54e69482952d2a..4a23a59d00cce9cbe98718c79683ce3df0d76db8 100644
--- a/format.php
+++ b/format.php
@@ -1,74 +1,101 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-	/**
-	 * format_iena
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 *
-	 * Point d'entrée du plugin
-	 */
-	
-	defined('MOODLE_INTERNAL') || die();
-	require_once($CFG->libdir . '/filelib.php');
-	require_once($CFG->libdir . '/completionlib.php');
-	require_once('entity/course_format_iena_section_ressources.php');
-	require_once('entity/course_format_iena_sections.php');
-	require_once('entity/course_format_iena_completion.php');
-	require_once('entity/course_format_iena_cron_action.php');
-	require_once('entity/course_format_iena_groups.php');
-	require_once('entity/course_format_iena_attendance.php');
-	
-	
-	
-	require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
-	require_once($CFG->dirroot . '/completion/classes/progress.php');
-	require_once($CFG->libdir . '/completionlib.php');
-
-	$PAGE->requires->js('/course/format/iena/js/jquery.min.js');
-	$PAGE->requires->js('/course/format/iena/format.js');
-
-	if ($topic = optional_param('topic', 0, PARAM_INT)) {
-		$url = $PAGE->url;
-		$url->param('section', $topic);
-		debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
-		redirect($url);
-	}
-	$context = context_course::instance($course->id);
-	if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
-		$course->marker = $marker;
-		course_set_marker($course->id, $marker);
-	}
-	$course = course_get_format($course)->get_course();
-	// course_create_sections_if_missing($course, range(0, $course->numsections));
-	course_create_sections_if_missing($course, 0);
-	$renderer = $PAGE->get_renderer('format_iena');
-	if (!empty($displaysection)) {
-		
-		$renderer->print_single_section_page($course, null, null, null, null, $displaysection);
-	} else {
-		
-		$renderer->switch_mode($course);
-		
-		
-		//$renderer->print_iena_section_pages($course);
-	}
-//	$PAGE->requires->js('/course/format/iena/js/jquery.min.js');
-//	$PAGE->requires->js('/course/format/iena/format.js');
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ * format_iena
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ *
+ * Point d'entrée du plugin
+ */
+
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->libdir . '/filelib.php');
+require_once($CFG->libdir . '/completionlib.php');
+require_once('entity/course_format_iena_section_ressources.php');
+require_once('entity/course_format_iena_sections.php');
+require_once('entity/course_format_iena_completion.php');
+require_once('entity/course_format_iena_cron_action.php');
+require_once('entity/course_format_iena_groups.php');
+require_once('entity/course_format_iena_attendance.php');
+
+require_once($CFG->dirroot . '/blocks/myoverview/lib.php');
+require_once($CFG->dirroot . '/completion/classes/progress.php');
+require_once($CFG->libdir . '/completionlib.php');
+
+$PAGE->requires->js('/course/format/iena/js/jquery.min.js');
+$PAGE->requires->js('/course/format/iena/format.js');
+
+/*if ($topic = optional_param('topic', 0, PARAM_INT)) {
+    $url = $PAGE->url;
+    $url->param('section', $topic);
+    debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
+    redirect($url);
+}
+$context = context_course::instance($course->id);
+if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
+    $course->marker = $marker;
+    course_set_marker($course->id, $marker);
+}
+$course = course_get_format($course)->get_course();
+course_create_sections_if_missing($course, 0);
+$renderer = $PAGE->get_renderer('format_iena');
+if (!empty($displaysection)) {
+
+    $renderer->print_single_section_page($course, null, null, null, null, $displaysection);
+} else {
+    $renderer->switch_mode($course);
+}*/
+
+
+
+
+// Horrible backwards compatible parameter aliasing.
+if ($topic = optional_param('topic', 0, PARAM_INT)) {
+    $url = $PAGE->url;
+    $url->param('section', $topic);
+    debugging('Outdated topic param passed to course/view.php', DEBUG_DEVELOPER);
+    redirect($url);
+}
+// End backwards-compatible aliasing.
+
+// Retrieve course format option fields and add them to the $course object.
+$format = course_get_format($course);
+
+$course = $format->get_course();
+$context = context_course::instance($course->id);
+
+if (($marker >= 0) && has_capability('moodle/course:setcurrentsection', $context) && confirm_sesskey()) {
+    $course->marker = $marker;
+    course_set_marker($course->id, $marker);
+}
+
+// Make sure section 0 is created.
+course_create_sections_if_missing($course, 0);
+
+$renderer = $PAGE->get_renderer('format_iena');
+if (!empty($displaysection)) {
+    $format->set_section_number($displaysection);
+}
+$outputclass = $format->get_output_classname('content');
+$widget = new $outputclass($format);
+echo $renderer->render($widget);
+
+// Include course format js module.
+
+
diff --git a/js/file.js b/js/file.js
index 73acc9ada7a271829f5baf8979f44f4d9e14da30..3bb53ac53fef111064c47d6067efdd32d887f5e2 100644
--- a/js/file.js
+++ b/js/file.js
@@ -46,13 +46,6 @@
 				}
 			}
 			var url = 'suivi_unit.php?courseid=' + $('#courseID').val();
-			console.log(result);
-			console.log(result.toString());
-			// var form = $('<form action="' + url + '" method="post">' +
-			// 	'<input type="text" name="api_url" value="' + result.toString() + '" />' +
-			// 	'</form>');
-			// $('body').append(form);
-			// form.submit();
 		});
 
 		$('.sectionH').hide();
@@ -103,16 +96,9 @@
 		students.hide();
 		
 		students = $('#example tbody tr');
-		// var students = $('.student-row');
-		// console.log(students)
-
 		var sel_student = $('#select-student').val();
-		// console.log('filtrer : ' + sel_student);
 		var sel_group = $('#select-group').val().replace('id_groupe', '');
-		// console.log('group : ' + sel_group);
 		var sel_section = $('#select-section').val();
-		// console.log('section : ' + sel_section);
-
 		students.each(function (i, el) {
 			var show = false;
 			if ( sel_group == "groupAll" ) {
@@ -120,7 +106,6 @@
 			} else {
 				var groups = el.dataset.groups.split('-');
 				groups.shift();
-				// console.log(groups)
 				if (groups.length > 0 && groups.indexOf(sel_group) > -1) {
 					show = true;
 				}
@@ -129,12 +114,10 @@
 			if ( sel_student == 'studentFilter' ) {
 				var completed = el.dataset.completed.split('-');
 				completed.shift();
-				// console.log(completed)
 				if (completed.length == 0 || completed.indexOf(sel_section.replace('section-', '')) > -1) {
 					show = false;
 				}
 			}
-
 			if (show) {
 				var elem = el.getAttribute('class').match(/iena-stud-[0-9]+/)[0];
 				$("." + elem).show();
diff --git a/lang/en/format_iena.php b/lang/en/format_iena.php
index 1a7ce582aaea2fe9dbda760e3ae7cf9999a395a9..ee7a3467cf67279c2ad72a13f7f239b4c28d6df8 100644
--- a/lang/en/format_iena.php
+++ b/lang/en/format_iena.php
@@ -1,99 +1,103 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 * format_iena
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     Michael lebeau
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	defined('MOODLE_INTERNAL') || die();
-	
-	$string['pluginname'] = 'Blended learning format';
-	$string['currentsection'] = 'The section';
-	$string['editsection'] = 'Edit section';
-	$string['deletesection'] = 'Delete section';
-	$string['sectionname'] = 'Section';
-	$string['section0name'] = 'General';
-	$string['hidefromothers'] = 'Hide section';
-	$string['showfromothers'] = 'Show section';
-	$string['showdefaultsectionname'] = 'Show the default sections name';
-	$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
-By definition an unnamed section is displayed as <strong>section [N]</strong>.';
-	$string['yes'] = 'Yes';
-	$string['no'] = 'No';
-	$string['sectionposition'] = 'Section zero position';
-	
-	$string['name'] = 'Name';
-	$string['summary'] = 'Summary';
-	$string['modalite'] = 'Modality';
-	$string['notif'] = 'Notification';
-	$string['notif_summary'] = 'A notification can be sent to the student by email. She will remind her to consult the section and will contain various information (name of the course, link to the course, name of the section, date the section and modality';
-	$string['in_presence'] = 'In the presence';
-	$string['not_presence'] = 'Remote';
-	$string['days_before'] = 'A number of days before the session';
-	$string['days_after'] = 'A number of days after the session';
-	$string['days_same'] = 'The same day';
-	$string['nb_days_before'] = 'days before';
-	$string['nb_days_after'] = 'days after';
-	$string['hide_section'] = 'Hide the section';
-	$string['hide_section_summary'] = 'Restrict access to the session and hide it before a certain date';
-	$string['hide_option_1'] = 'Do not restrict access before a date';
-	$string['hide_option_2'] = 'Before the date of the session';
-	$string['hide_option_3'] = 'Before the date of notification';
-	$string['hide_bread_crum'] = 'Show progress bar';
-	$string['hide_icon_message'] = 'Show the mail icon';
-	$string['modules_for'] = 'Activities followed for';
-	$string['all_course'] = 'All the Course';
-	$string['students'] = 'Students';
-	$string['not_done'] = 'not having completed everything';
-	$string['all_students'] = 'all the students';
-	$string['student'] = 'Student';
-	$string['send_message'] = 'Send a message';
-	$string['for_section_select'] = 'For the selected section, you will have an indicator of the number of students who have not completed the activities below.';
-	$string['cancel'] = 'Cancel';
-	$string['save'] = 'Save';
-	$string['check_completion'] = 'Monitor completion';
-	$string['indic_suivi'] = 'Tracking indicators of the section';
-	$string['form_not_defined'] = 'Not specified';
-	$string['settings_section_form'] = 'Section parameter';
-	$string['course'] = 'Course';
-	$string['link'] = 'Link';
-	$string['prof'] = 'Professor';
-	$string['section'] = 'Section';
-	$string['hide_section'] = 'HIDE section ';
-	$string['show_section'] = 'SHOW section ';
-	$string['aboutcourse'] = 'About this course';
-	$string['modalite_help'] = 'To get help on modalities';
-	$string['loadingResults'] = "Loading results...";
-	$string['errorLoadingResults'] = "Students could not be retrieved, please contact an administrator";
-	$string['caption']="Caption";
-	$string['status0']="Activity not completed";
-	$string['status1']="Activity completed";
-	$string['status2']="Activity completed and passed";
-	$string['status3']="Activity completed but not passed";
-	$string["send_message_title"]="Sending a message to {{nb_results}} people";
-	$string['display_course_infos']="Show/hide course information";
-	$string['my_progress']="My progress in the course: ";
-	$string['table_progress']="Tracking";
-	$string['displayInfos']="Display course informations";
-	$string['hideInfos']="Hide course informations";
-
-
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ * format_iena
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     Michael lebeau
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$string['pluginname'] = 'Course format with advanced activity tracking';
+$string['currentsection'] = 'The section';
+$string['editsection'] = 'Edit section';
+$string['deletesection'] = 'Delete section';
+$string['sectionname'] = 'Section';
+$string['section0name'] = 'General';
+$string['hidefromothers'] = 'Hide section';
+$string['showfromothers'] = 'Show section';
+$string['showdefaultsectionname'] = 'Show the default sections name';
+$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
+By definition an unnamed section is displayed as <strong>section [N]</strong>.';
+$string['yes'] = 'Yes';
+$string['no'] = 'No';
+$string['sectionposition'] = 'Section zero position';
+$string['name'] = 'Name';
+$string['summary'] = 'Summary';
+$string['modalite'] = 'Modality';
+$string['notif'] = 'Notification';
+$string['notif_summary'] = 'A notification can be sent to the student by email. She will remind her to consult the section and will contain various information (name of the course, link to the course, name of the section, date the section and modality';
+$string['in_presence'] = 'Face-to-face session';
+$string['not_presence'] = 'Remote session';
+$string['days_before'] = 'A number of days before the session';
+$string['days_after'] = 'A number of days after the session';
+$string['days_same'] = 'The same day';
+$string['nb_days_before'] = 'days before';
+$string['nb_days_after'] = 'days after';
+$string['hide_section'] = 'Hide the section';
+$string['hide_section_summary'] = 'Restrict access to the session and hide it before a certain date';
+$string['hide_option_1'] = 'Do not restrict access before a date';
+$string['hide_option_2'] = 'Before the date of the session';
+$string['hide_option_3'] = 'Before the date of notification';
+$string['hide_bread_crum'] = 'Show progress bar';
+$string['hide_icon_message'] = 'Show the mail icon';
+$string['modules_for'] = 'Activities followed for';
+$string['all_course'] = 'All the Course';
+$string['students'] = 'Students';
+$string['not_done'] = 'not having completed everything';
+$string['all_students'] = 'all the students';
+$string['student'] = 'Student';
+$string['send_message'] = 'Send a message';
+$string['for_section_select'] = 'For the selected section, you will have an indicator of the number of students who have not completed the activities below.';
+$string['cancel'] = 'Cancel';
+$string['save'] = 'Save';
+$string['check_completion'] = 'Monitor completion';
+$string['indic_suivi'] = 'Tracking indicators of the section';
+$string['form_not_defined'] = 'Not specified';
+$string['settings_section_form'] = 'Section parameter';
+$string['course'] = 'Course';
+$string['link'] = 'Link';
+$string['prof'] = 'Professor';
+$string['section'] = 'Section';
+$string['hide_section'] = 'HIDE section ';
+$string['show_section'] = 'SHOW section ';
+$string['aboutcourse'] = 'About this course';
+$string['modalite_help'] = 'The "Distance" mode will allow you to define a date for a course session and notifications x days before the session. The "Face to face" mode will allow you to define a date for an assessment, and notifications x days before the assessment due date';
+$string['loadingResults'] = "Loading results...";
+$string['errorLoadingResults'] = "Students could not be retrieved, please contact an administrator";
+$string['caption'] = "Caption";
+$string['status0'] = "Activity not completed";
+$string['status1'] = "Activity completed";
+$string['status2'] = "Activity completed and passed";
+$string['status3'] = "Activity completed but not passed";
+$string["send_message_title"] = "Sending a message to {{nb_results}} people";
+$string['display_course_infos'] = "Show/hide course information";
+$string['my_progress'] = "My progress in the course: ";
+$string['table_progress'] = "Tracking";
+$string['displayInfos'] = "Display course informations";
+$string['hideInfos'] = "Hide course informations";
+$string['message_pres'] = "presential learning mail";
+$string['message_default_pres'] = "Default message presential learning";
+$string['message_pres_desc'] = "Configure default presential course message";
+$string['message_dist'] = "distance learning mail";
+$string['message_dist_desc'] = "Configure default blended course message";
+$string['message_default_dist'] = "Default message distance learning";
+$string['formatenabled']="Course completion is disabled. You can enable it in the \"Course completion\" section here: ";
+$string['selectedActivities']="selected";
+$string['allActivities']="All";
\ No newline at end of file
diff --git a/lang/fr/format_iena.php b/lang/fr/format_iena.php
index a4cf6401d66023f36e39c27f1bc6fec226181697..3222e080ffa39cf16b78b667c517b62e83d77203 100644
--- a/lang/fr/format_iena.php
+++ b/lang/fr/format_iena.php
@@ -1,99 +1,103 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 * format_iena
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	defined('MOODLE_INTERNAL') || die();
-	
-	$string['pluginname'] = 'Format enseignement hybride';
-	$string['currentsection'] = 'La section';
-	$string['editsection'] = 'Modifier section';
-	$string['deletesection'] = 'Supprimer section';
-	$string['sectionname'] = 'Section';
-	$string['section0name'] = 'Général';
-	$string['hidefromothers'] = 'Cacher section';
-	$string['showfromothers'] = 'Voir section';
-	$string['showdefaultsectionname'] = 'Show the default sections name';
-	$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
-By definition an unnamed section is displayed as <strong>section [N]</strong>.';
-	$string['yes'] = 'Oui';
-	$string['no'] = 'Non';
-	$string['sectionposition'] = 'Section zero position';
-	
-	$string['name'] = 'Nom';
-	$string['summary'] = 'Résumé';
-	$string['modalite'] = 'Modalité';
-	$string['notif'] = 'Notification';
-	$string['notif_summary'] = 'Une notification peut être envoyée à l étudiant par mail. Elle lui rapplera de consulter la section et contiendra diverses informations (nom du cours, lien vers le cours, nom de la section, date le la section et modalité';
-	$string['in_presence'] = 'En présence';
-	$string['not_presence'] = 'À distance';
-	$string['days_before'] = 'Un certain nombre de jours avant la séance';
-	$string['days_after'] = 'Un certain nombre de jours après la séance';
-	$string['days_same'] = 'Le jour même';
-	$string['nb_days_before'] = 'jours avant';
-	$string['nb_days_after'] = 'jours après';
-	$string['hide_section'] = 'Cacher la section';
-	$string['hide_section_summary'] = 'Restreindre l\'accès à la séance et la cacher avant une certaine date';
-	$string['hide_option_1'] = 'Ne pas restreindre l\'accès avant une date';
-	$string['hide_option_2'] = 'Avant la date de la séance';
-	$string['hide_option_3'] = 'Avant la date de la notification';
-	$string['hide_bread_crum'] = 'Afficher la barre de progression';
-	$string['hide_icon_message'] = 'Afficher l\'icone messagerie';
-	$string['modules_for'] = 'Activités suivies pour';
-	$string['all_course'] = 'Tout le Cours';
-	$string['students'] = 'Etudiants';
-	$string['not_done'] = 'n\'ayant pas tout achevé';
-	$string['all_students'] = 'tous les étudiants';
-	$string['student'] = 'Eleve';
-	$string['send_message'] = 'Envoyer un message';
-	$string['for_section_select'] = 'Pour la section sélectionnée, vous aurez un indicateur du nombre d\'étudiant qui n\'ont pas achevé les activités ci-dessous.';
-	$string['cancel'] = 'Annuler';
-	$string['save'] = 'Enregistrer';
-	$string['check_completion'] = 'Surveiller l\'achèvement';
-	$string['indic_suivi'] = 'Indicateurs de suivi de la section';
-	$string['form_not_defined'] = 'Non renseigné';
-	$string['settings_section_form'] = 'Paramètre de la section';
-	$string['course'] = 'Cours';
-	$string['link'] = 'Lien';
-	$string['prof'] = 'Professeur';
-	$string['section'] = 'Section';
-	$string['hide_section'] = 'CACHER la section ';
-	$string['show_section'] = 'MONTRER la section ';
-	$string['aboutcourse'] = 'À propos de ce cours';
-	$string['modalite_help'] = 'Pour avoir de l\'aide sur les modalités';
-	$string['loadingResults'] = "Chargement des résultats...";
-	$string['errorLoadingResults'] = "Les étudiants n'ont pas pu être chargés, veuillez contacter un administrateur.";
-	$string['caption']="Légende";
-	$string['status0']="Activité non complétée";
-	$string['status1']="Activité complétée";
-	$string['status2']="Activité complétée et validée";
-	$string['status3']="Activité complétée non validée";
-	$string["send_message_title"]="Envoi d'un message à {{nb_results}} personnes";
-	$string['display_course_infos']="Afficher/Masquer les informations du cours";
-	$string['my_progress']="Ma progression dans le cours : ";
-	$string['table_progress']="Suivi des étudiants";
-	$string['displayInfos']="Afficher les infos du cours";
-	$string['hideInfos']="Masquer les infos du cours";
-
-
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ * format_iena
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$string['pluginname'] = 'Format de cours avec suivi avancé des activités';
+$string['currentsection'] = 'La section';
+$string['editsection'] = 'Modifier section';
+$string['deletesection'] = 'Supprimer section';
+$string['sectionname'] = 'Section';
+$string['section0name'] = 'Général';
+$string['hidefromothers'] = 'Cacher section';
+$string['showfromothers'] = 'Voir section';
+$string['showdefaultsectionname'] = 'Show the default sections name';
+$string['showdefaultsectionname_help'] = 'If no name is set for the section will not show anything.<br>
+By definition an unnamed section is displayed as <strong>section [N]</strong>.';
+$string['yes'] = 'Oui';
+$string['no'] = 'Non';
+$string['sectionposition'] = 'Section zero position';
+$string['name'] = 'Nom';
+$string['summary'] = 'Résumé';
+$string['modalite'] = 'Modalité';
+$string['notif'] = 'Notification';
+$string['notif_summary'] = 'Une notification peut être envoyée à l étudiant par mail. Elle lui rapplera de consulter la section et contiendra diverses informations (nom du cours, lien vers le cours, nom de la section, date le la section et modalité';
+$string['in_presence'] = 'Session en présence';
+$string['not_presence'] = 'Session à distance';
+$string['days_before'] = 'Un certain nombre de jours avant la séance';
+$string['days_after'] = 'Un certain nombre de jours après la séance';
+$string['days_same'] = 'Le jour même';
+$string['nb_days_before'] = 'jours avant';
+$string['nb_days_after'] = 'jours après';
+$string['hide_section'] = 'Cacher la section';
+$string['hide_section_summary'] = 'Restreindre l\'accès à la séance et la cacher avant une certaine date';
+$string['hide_option_1'] = 'Ne pas restreindre l\'accès avant une date';
+$string['hide_option_2'] = 'Avant la date de la séance';
+$string['hide_option_3'] = 'Avant la date de la notification';
+$string['hide_bread_crum'] = 'Afficher la barre de progression';
+$string['hide_icon_message'] = 'Afficher l\'icone messagerie';
+$string['modules_for'] = 'Activités suivies pour';
+$string['all_course'] = 'Tout le Cours';
+$string['students'] = 'Etudiants';
+$string['not_done'] = 'n\'ayant pas tout achevé';
+$string['all_students'] = 'tous les étudiants';
+$string['student'] = 'Eleve';
+$string['send_message'] = 'Envoyer un message';
+$string['for_section_select'] = 'Pour la section sélectionnée, vous aurez un indicateur du nombre d\'étudiant qui n\'ont pas achevé les activités ci-dessous.';
+$string['cancel'] = 'Annuler';
+$string['save'] = 'Enregistrer';
+$string['check_completion'] = 'Surveiller l\'achèvement';
+$string['indic_suivi'] = 'Indicateurs de suivi de la section';
+$string['form_not_defined'] = 'Non renseigné';
+$string['settings_section_form'] = 'Paramètre de la section';
+$string['course'] = 'Cours';
+$string['link'] = 'Lien';
+$string['prof'] = 'Professeur';
+$string['section'] = 'Section';
+$string['hide_section'] = 'CACHER la section ';
+$string['show_section'] = 'MONTRER la section ';
+$string['aboutcourse'] = 'À propos de ce cours';
+$string['modalite_help'] = 'La modalité "Distance" vous permettra de définir une date de séance et des notifications x jours avant la séance. La modalité "Présentiel" vous permettra de définir une date pour un rendu, et des notifications x jours avant la date de rendu';
+$string['loadingResults'] = "Chargement des résultats...";
+$string['errorLoadingResults'] = "Les étudiants n'ont pas pu être chargés, veuillez contacter un administrateur.";
+$string['caption'] = "Légende";
+$string['status0'] = "Activité non complétée";
+$string['status1'] = "Activité complétée";
+$string['status2'] = "Activité complétée et validée";
+$string['status3'] = "Activité complétée non validée";
+$string["send_message_title"] = "Envoi d'un message à {{nb_results}} personnes";
+$string['display_course_infos'] = "Afficher/Masquer les informations du cours";
+$string['my_progress'] = "Ma progression dans le cours : ";
+$string['table_progress'] = "Suivi des étudiants";
+$string['displayInfos'] = "Afficher les infos du cours";
+$string['hideInfos'] = "Masquer les infos du cours";
+$string['message_pres'] = "Message présentiel";
+$string['message_default_pres'] = "Entrez ici le message qui sera envoyé à vos étudiants";
+$string['message_pres_desc'] = "Paramétrez le message qui sera envoyé par défaut pour un cours en présentiel";
+$string['message_dist'] = "Message distanciel";
+$string['message_dist_desc'] = "Paramétrez le message qui sera envoyé par défaut pour un cours à distance";
+$string['message_default_dist'] = "Entrez ici le message qui sera envoyé à vos étudiants";
+$string['formatenabled']="L'achèvement de cours n'est pas activé. Vous pouvez l'activer dans la section \"Achèvement de cours\" des paramètres du cours : ";
+$string['selectedActivities']="sélectionnée(s)";
+$string['allActivities']="Toutes";
\ No newline at end of file
diff --git a/lib.php b/lib.php
index 70875887437b635ee47114fe97ece35b69a3c58a..ad4fcd6b23e4432104f2d877cc0bf2b2e9fe3a0a 100644
--- a/lib.php
+++ b/lib.php
@@ -1,367 +1,392 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	defined('MOODLE_INTERNAL') || die();
-	require_once($CFG->dirroot . '/course/format/topics/lib.php');
-	
-	/**
-	 * format_iena
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille/Thomas Fradet
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	class format_iena extends format_topics
-	{
-		
-		/**
-		 * course_format_options
-		 *
-		 * @param bool $foreditform
-		 * @return array
-		 */
-		public function course_format_options($foreditform = false)
-		{
-			global $PAGE;
-			static $courseformatoptions = false;
-			if ($courseformatoptions === false) {
-				// $courseconfig = get_config('moodlecourse');
-				$courseformatoptions['allmodulesbreadcrum'] = array(
-					'default' => 0,
-					'type' => PARAM_INT,
-				);
-				$courseformatoptions['viewiconmessage'] = array(
-					'default' => 1,
-					'type' => PARAM_INT,
-				);
-			}
-			if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) {
-				$choiceTab = array();
-				$choiceTab['1'] = get_string('yes', 'format_iena');
-				$choiceTab['0'] = get_string('no', 'format_iena');
-				$courseformatoptionsedit['allmodulesbreadcrum'] = array(
-					'label' => "Afficher les activités cachées mais disponibles dans la barre de progression.",
-					'element_type' => 'select',
-					'element_attributes' => array($choiceTab),
-				);
-				$courseformatoptionsedit['viewiconmessage'] = array(
-					'label' => get_string('hide_icon_message', 'format_iena'),
-					'element_type' => 'select',
-					'element_attributes' => array($choiceTab),
-				);
-				$courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit);
-			}
-			return $courseformatoptions;
-		}
-
-			 /**
-     * Definitions of the additional options that this course format uses for section
-     *
-     * See {@link format_base::course_format_options()} for return array definition.
-     *
-     * Additionally section format options may have property 'cache' set to true
-     * if this option needs to be cached in {@link get_fast_modinfo()}. The 'cache' property
-     * is recommended to be set only for fields used in {@link format_base::get_section_name()},
-     * {@link format_base::extend_course_navigation()} and {@link format_base::get_view_url()}
-     *
-     * For better performance cached options are recommended to have 'cachedefault' property
-     * Unlike 'default', 'cachedefault' should be static and not access get_config().
-     *
-     * Regardless of value of 'cache' all options are accessed in the code as
-     * $sectioninfo->OPTIONNAME
-     * where $sectioninfo is instance of section_info, returned by
-     * get_fast_modinfo($course)->get_section_info($sectionnum)
-     * or get_fast_modinfo($course)->get_section_info_all()
-     *
-     * All format options for particular section are returned by calling:
-     * $this->get_format_options($section);
-     *
-     * @param bool $foreditform
-     * @return array
-     */
-    public function section_format_options($foreditform = false) {
-         global $CFG;
-        static $courseformatoptions = false;
-
-        if ($courseformatoptions === false) {
-            $courseformatoptions = array(
-           
-                'presence'=>array(
-                	'label'=>"Présence",
-                	'type'=>PARAM_INT
-                ),
-                'daterendu'=>array(
-                	'label'=>"Date rendu",
-                	'type'=>PARAM_INT
-            	),
-            	'daysnotif'=>array(
-            		'label'=>"Notification",
-            		'type'=>PARAM_INT
-            	)
-
-            );
-        }
-        
-        return $courseformatoptions;
-    }
-
-
-
-     /**
-     * Adds format options elements to the course/section edit form.
-     *
-     * This function is called from {@link course_edit_form::definition_after_data()}.
-     *
-     * @param MoodleQuickForm $mform form the elements are added to.
-     * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form.
-     * @return array array of references to the added form elements.
-     */
-    public function create_edit_form_elements(&$mform, $forsection = false) {
-        global $COURSE;
-        global $PAGE;
-        $elements = parent::create_edit_form_elements($mform, $forsection);
-
-        if ($forsection) {
-           	$mform->removeElement('presence', false);
-           	$mform->removeElement('daterendu', false);
-           	$mform->removeElement('daysnotif', false);
-           	$sectionclass = new stdClass();
-           	$sectionclass->id=optional_param('id', 0, PARAM_INT);
-           
-          	$section_config=$this->get_format_options($sectionclass);
-          	
-			$mform->addElement('header', 'nameforyourheaderelement', 'Format hybride');
-          	$radioarray=array();
-	    	$radioarray[] = $mform->createElement('radio', 'presence', '', 'Distance', 2);
-			$radioarray[] = $mform->createElement('radio', 'presence', '', 'Présentiel', 1);
-			$radioarray[] = $mform->createElement('radio', 'presence', '', 'Aucune', 0);
-			$mform->addGroup($radioarray, 'modalite', 'Modalité', array(' '), false);
-
-			$mform->addHelpButton('modalite', 'modalite', 'format_iena');
-
-
-			$datearray=array();
-			$datearray[] = $mform->createElement('date_time_selector', 'daterendu', '');
-			$datearray[] = $mform->createElement('checkbox', 'daterenducheck', 'Activer');
-			$mform->addGroup($datearray, 'groupdate', 'Date d\'échéance', array(' '), false);
-			$mform->disabledIf('groupdate', 'daterenducheck');
-
-			//On montre le groupe seulement si à distance
-			$mform->hideIf('groupdate', 'presence', 'neq', 2);
-			//$mform->hideIf('groupdate', 'id_presence_2', 'notchecked');
-			
-
-			$datearray=array();
-			$datearray[] = $mform->createElement('date_time_selector', 'daterendu2', '');
-			$datearray[] = $mform->createElement('checkbox', 'daterenducheck2', 'Activer');
-			$mform->addGroup($datearray, 'groupdate2', 'Date du cours', array(' '), false);
-			$mform->disabledIf('groupdate2', 'daterenducheck2');
-			//On montre le groupe si pas distance
-			$mform->hideIf('groupdate2', 'presence', 'eq', 2);
-
-
-
-			$daysarray=array();
-			$days=array(0=>0, 1=>1, 2=>2, 3=>3, 4=>4, 5=>5);
-			$daysarray[] = $mform->createElement('select', 'daysnotif', "jours avant la séance", $days);
-			$daysarray[]=$mform->createElement('html', ' <span id="days-text">jours avant la séance</span>');
-			$daysarray[] = $mform->createElement('checkbox', 'selectdayscheck', 'Activer');
-			$mform->addGroup($daysarray, 'groupdays', 'Notification', array(' '), false);
-			$mform->disabledIf('groupdays', 'selectdayscheck');
-			$mform->disabledIf('groupdays', 'daterenducheck');
-			$mform->hideIf('groupdays', 'presence', 'neq', 2);
-
-
-			$daysarray=array();
-			
-			$daysarray[] = $mform->createElement('select', 'daysnotif2', "jours avant le rendu", $days);
-			$daysarray[]=$mform->createElement('html', ' <span id="days-text">jours avant le rendu</span>');
-			$daysarray[] = $mform->createElement('checkbox', 'selectdayscheck2', 'Activer');
-			$mform->addGroup($daysarray, 'groupdays2', 'Notification', array(' '), false);
-			$mform->disabledIf('groupdays2', 'selectdayscheck2');
-			$mform->disabledIf('groupdays2', 'daterenducheck2');
-			$mform->hideIf('groupdays2', 'presence', 'eq', 2);
-
-			//on ne peut pas activer des notifs s'il n'y a pas de date de rendu/date de cours
-			
-
-          	if($section_config['presence']){
-          		$mform->setDefault('presence', $section_config['presence']);
-          	}
-          	if($section_config['daterendu']){
-
-          		if(isset($section_config['presence']) && $section_config['presence']==2){
-          			error_log("on passe là");
-          			$mform->setDefault('daterendu', $section_config['daterendu']);
-          			$mform->setDefault('daterenducheck', "1");
-          		}
-          		else if(isset($section_config['presence'])){
-          			error_log("non on passe là");
-          			$mform->setDefault('daterendu2', $section_config['daterendu']);
-          			$mform->setDefault('daterenducheck2', "1");
-          		}
-          		
-          	}
-          	if(isset($section_config['daysnotif']) && $section_config['daysnotif'] > -1){
-          		$mform->setDefault('selectdays', $section_config['daysnotif']);
-          		$mform->setDefault('selectdayscheck', "1");
-          	}
-
-        }
-
-        return $elements;
-    }
-
-    /**
-     * Updates format options for a course
-     *
-     * In case if course format was changed to 'periods', we try to copy options
-     * 'coursedisplay', 'numsections' and 'hiddensections' from the previous format.
-     * If previous course format did not have 'numsections' option, we populate it with the
-     * current number of sections
-     *
-     * @param stdClass|array $data return value from {@link moodleform::get_data()} or array with data
-     * @param stdClass $oldcourse if this function is called from {@link update_course()}
-     *     this object contains information about the course before update
-     * @return bool whether there were any changes to the options values
-     */
-    public function update_section_format_options($data) {
-        global $DB;
-        
-       	$objectSection=new stdClass();
-       	$objectSection->id=$data["id"];
-        $section_config=$this->get_format_options($objectSection);
-        
-        //$data = (array)$data;
-        //if a date was set but we want to remove it
-        if(!isset($data['daterenducheck']) && !isset($data['daterenducheck2'])){
-        	if(array_key_exists('daterendu', $section_config) && !empty($section_config['daterendu'])){
-        		$data['daterendu']=NULL;
-        	}
-        	else{
-        		unset($data['daterendu']);
-        	}
-        }
-        else if(isset($data['daterenducheck2'])){
-        	$data['daterendu']=$data['daterendu2'];
-
-        }
-        if(!isset($data['selectdayscheck'])){
-        	if(isset($data['daysnotif2'])){
-    			$data['daysnotif']=$data["daysnotif2"];
-    		}
-        	if(array_key_exists('daysnotif', $section_config) && $section_config['daysnotif']>-1){
-        		$data['daysnotif']=-1;
-
-        	}
-        	else{
-        		unset($data['daysnotif']);
-        	}
-        }
-        return $this->update_format_options($data, $data['id']);
-    }
-
-		
-		/**
-		 * get_view_url
-		 *
-		 * @param int|stdclass $section
-		 * @param array $options
-		 * @return null|moodle_url
-		 */
-		public function get_view_url($section, $options = array())
-		{
-			global $CFG;
-			$course = $this->get_course();
-			$url = new moodle_url('/course/view.php', array('id' => $course->id));
-			
-			$sr = null;
-			if (array_key_exists('sr', $options)) {
-				$sr = $options['sr'];
-			}
-			if (is_object($section)) {
-				$sectionno = $section->section;
-			} else {
-				$sectionno = $section;
-			}
-			if ($sectionno !== null) {
-				if ($sr !== null) {
-					if ($sr) {
-						$usercoursedisplay = COURSE_DISPLAY_MULTIPAGE;
-						$sectionno = $sr;
-					} else {
-						$usercoursedisplay = COURSE_DISPLAY_SINGLEPAGE;
-					}
-				} else {
-					$usercoursedisplay = 0;
-				}
-				if ($sectionno != 0 && $usercoursedisplay == COURSE_DISPLAY_MULTIPAGE) {
-					$url->param('section', $sectionno);
-				} else {
-					if (empty($CFG->linkcoursesections) && !empty($options['navigation'])) {
-						return null;
-					}
-					$url->set_anchor('section-' . $sectionno);
-				}
-			}
-			return $url;
-		}
-	}
-	
-	/**
-	 * Implements callback inplace_editable() allowing to edit values in-place
-	 *
-	 * @param string $itemtype
-	 * @param int $itemid
-	 * @param mixed $newvalue
-	 * @return \core\output\inplace_editable
-	 */
-	function format_iena_inplace_editable($itemtype, $itemid, $newvalue)
-	{
-		global $DB, $CFG;
-		require_once($CFG->dirroot . '/course/lib.php');
-		if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
-			$section = $DB->get_record_sql(
-				'SELECT s.* FROM {course_sections} s JOIN {course} c ON s.course = c.id WHERE s.id = ? AND c.format = ?',
-				array($itemid, 'iena'),
-				MUST_EXIST
-			);
-			return course_get_format($section->course)->inplace_editable_update_section_name($section, $itemtype, $newvalue);
-		}
-	}
-
-	
-		/**
-	 * Extends the course administration navigation with the Badges page
-	 *
-	 * @param navigation_node $coursenode
-	 * @param object $course
-	 */
-	function iena_add_course_navigation(navigation_node $coursenode, stdClass $course) {
-		echo "<br><br>br>";
-		echo "ien add course";
-	}
-	function format_iena_add_course_navigation(navigation_node $coursenode, stdClass $course) {
-
-		echo "<br><br>br>";
-		echo "formatien add course";
-	}
-
-
-
-
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+
+defined('MOODLE_INTERNAL') || die();
+require_once($CFG->dirroot . '/course/format/topics/lib.php');
+
+/**
+ * format_iena
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille/Thomas Fradet
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+class format_iena extends format_topics {
+    /**
+     * course_format_options
+     *
+     * @param bool $foreditform
+     * @return array
+     */
+    public function course_format_options($foreditform = false) {
+        global $PAGE;
+        static $courseformatoptions = false;
+        if ($courseformatoptions === false) {
+            $courseformatoptions['allmodulesbreadcrum'] = array(
+                'default' => 0,
+                'type' => PARAM_INT,
+            );
+            $courseformatoptions['viewiconmessage'] = array(
+                'default' => 1,
+                'type' => PARAM_INT,
+            );
+        }
+        if ($foreditform && !isset($courseformatoptions['coursedisplay']['label'])) {
+            $choicetab = array();
+            $choicetab['1'] = get_string('yes', 'format_iena');
+            $choicetab['0'] = get_string('no', 'format_iena');
+            $courseformatoptionsedit['allmodulesbreadcrum'] = array(
+                'label' => "Afficher les activités cachées mais disponibles dans la barre de progression.",
+                'element_type' => 'select',
+                'element_attributes' => array($choicetab),
+            );
+            $courseformatoptionsedit['viewiconmessage'] = array(
+                'label' => get_string('hide_icon_message', 'format_iena'),
+                'element_type' => 'select',
+                'element_attributes' => array($choicetab),
+            );
+            $courseformatoptions = array_merge_recursive($courseformatoptions, $courseformatoptionsedit);
+        }
+        return $courseformatoptions;
+    }
+
+    /**
+     * Definitions of the additional options that this course format uses for section
+     *
+     * See {@link format_base::course_format_options()} for return array definition.
+     *
+     * Additionally section format options may have property 'cache' set to true
+     * if this option needs to be cached in {@link get_fast_modinfo()}. The 'cache' property
+     * is recommended to be set only for fields used in {@link format_base::get_section_name()},
+     * {@link format_base::extend_course_navigation()} and {@link format_base::get_view_url()}
+     *
+     * For better performance cached options are recommended to have 'cachedefault' property
+     * Unlike 'default', 'cachedefault' should be static and not access get_config().
+     *
+     * Regardless of value of 'cache' all options are accessed in the code as
+     * $sectioninfo->OPTIONNAME
+     * where $sectioninfo is instance of section_info, returned by
+     * get_fast_modinfo($course)->get_section_info($sectionnum)
+     * or get_fast_modinfo($course)->get_section_info_all()
+     *
+     * All format options for particular section are returned by calling:
+     * $this->get_format_options($section);
+     *
+     * @param bool $foreditform
+     * @return array
+     */
+    public function section_format_options($foreditform = false) {
+        global $CFG;
+        static $courseformatoptions = false;
+
+        if ($courseformatoptions === false) {
+            $courseformatoptions = array(
+                'presence' => array(
+                    'label' => "Présence",
+                    'type' => PARAM_INT
+                ),
+                'daterendu' => array(
+                    'label' => "Date rendu",
+                    'type' => PARAM_INT
+                ),
+                'daysnotif' => array(
+                    'label' => "Notification",
+                    'type' => PARAM_INT
+                ),
+                'msg' => array(
+                    'label' => "Message",
+                    'type' => PARAM_RAW
+                ),
+            );
+        }
+
+        return $courseformatoptions;
+    }
+
+    /**
+     * Adds format options elements to the course/section edit form.
+     *
+     * This function is called from {@link course_edit_form::definition_after_data()}.
+     *
+     * @param MoodleQuickForm $mform form the elements are added to.
+     * @param bool $forsection 'true' if this is a section edit form, 'false' if this is course edit form.
+     * @return array array of references to the added form elements.
+     */
+    public function create_edit_form_elements(&$mform, $forsection = false) {
+        global $COURSE;
+        global $PAGE;
+
+        $elements = parent::create_edit_form_elements($mform, $forsection);
+
+        if ($forsection) {
+            $mform->removeElement('presence', false);
+            $mform->removeElement('daterendu', false);
+            $mform->removeElement('daysnotif', false);
+            $mform->removeElement('msg', false);
+
+            $sectionclass = new stdClass();
+            $sectionclass->id = optional_param('id', 0, PARAM_INT);
+            $sectionconfig = $this->get_format_options($sectionclass);
+
+            $mform->addElement('header', 'nameforyourheaderelement', 'Format hybride');
+
+            // Modalité.
+            $radioarray = array();
+            $radioarray[] = $mform->createElement('radio', 'presence', '', 'Distance', 2);
+            $radioarray[] = $mform->createElement('radio', 'presence', '', 'Présentiel', 1);
+            $radioarray[] = $mform->createElement('radio', 'presence', '', 'Aucune', 0);
+            $mform->addGroup($radioarray, 'modalite', 'Modalité', array(' '), false);
+            $mform->addHelpButton('modalite', 'modalite', 'format_iena');
+
+            // Date cours à distance.
+            $datearray = array();
+            $datearray[] = $mform->createElement('date_time_selector', 'daterendu', '');
+            $datearray[] = $mform->createElement('checkbox', 'daterenducheck', 'Activer');
+            $mform->addGroup($datearray, 'groupdate', 'Date d\'échéance', array(' '), false);
+            $mform->disabledIf('groupdate', 'daterenducheck');
+            // On montre le groupe seulement si à distance.
+            $mform->hideIf('groupdate', 'presence', 'neq', 2);
+
+            // Date cours présentiel.
+            $datearray = array();
+            $datearray[] = $mform->createElement('date_time_selector', 'daterendu2', '');
+            $datearray[] = $mform->createElement('checkbox', 'daterenducheck2', 'Activer');
+            $mform->addGroup($datearray, 'groupdate2', 'Date du cours', array(' '), false);
+            $mform->disabledIf('groupdate2', 'daterenducheck2');
+            // On montre le groupe si à présentiel.
+            $mform->hideIf('groupdate2', 'presence', 'neq', 1);
+
+            // Notification distanciel.
+            $daysarray = array();
+            $days = array(0 => 0, 1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5);
+            $daysarray[] = $mform->createElement('select', 'daysnotif', "jours avant la séance", $days);
+            $daysarray[] = $mform->createElement('html', ' <span id="days-text">jours avant la séance</span>');
+            $daysarray[] = $mform->createElement('checkbox', 'selectdayscheck', 'Activer');
+            $mform->addGroup($daysarray, 'groupdays', 'Notification', array(' '), false);
+            $mform->disabledIf('groupdays', 'selectdayscheck');
+            $mform->disabledIf('groupdays', 'daterenducheck');
+            $mform->hideIf('groupdays', 'presence', 'neq', 2);
+            $mform->hideIf('groupdays', 'daterenducheck');
+
+            // Notification présentiel.
+            $daysarray = array();
+            $daysarray[] = $mform->createElement('select', 'daysnotif2', "jours avant le rendu", $days);
+            $daysarray[] = $mform->createElement('html', ' <span id="days-text">jours avant le rendu</span>');
+            $daysarray[] = $mform->createElement('checkbox', 'selectdayscheck2', 'Activer');
+            $mform->addGroup($daysarray, 'groupdays2', 'Notification', array(' '), false);
+            $mform->disabledIf('groupdays2', 'selectdayscheck2');
+            $mform->disabledIf('groupdays2', 'daterenducheck2');
+            $mform->hideIf('groupdays2', 'presence', 'neq', 1);
+            $mform->hideIf('groupdays2', 'daterenducheck2');
+
+            // Message présentiel.
+            $msgpresgrp = array();
+            $msgpresgrp[] = $mform->createElement('editor', 'msg_pres', get_string('message_pres', 'format_iena'));
+            $mform->setType('msg_pres', PARAM_RAW);
+            $mform->setDefault('msg_pres', array('text' => get_string('message_default_pres', 'format_iena')));
+            $mform->addGroup($msgpresgrp, 'msg_pres_grp', get_string('message_pres', 'format_iena'), ' ', false);
+            $mform->hideIf('msg_pres_grp', 'presence', 'neq', 1);
+            $mform->hideIf('msg_pres_grp', 'selectdayscheck2');
+            $mform->hideIf('msg_pres_grp', 'daterenducheck2');
+
+            // Message distanciel.
+            $msgdistgrp = array();
+            $msgdistgrp[] = $mform->createElement('editor', 'msg_dist', get_string('message_dist', 'format_iena'));
+            $mform->setType('msg_dist', PARAM_RAW);
+            $mform->setDefault('msg_dist', array('text' => get_string('message_default_dist', 'format_iena')));
+            $mform->addGroup($msgdistgrp, 'msg_dist_grp', get_string('message_dist', 'format_iena'), ' ', false);
+            $mform->hideIf('msg_dist_grp', 'presence', 'neq', 2);
+            $mform->hideIf('msg_dist_grp', 'selectdayscheck');
+            $mform->hideIf('msg_dist_grp', 'daterenducheck');
+
+            // On ne peut pas activer des notifs s'il n'y a pas de date de rendu/date de cours.
+            // On prérempli le formulaire si des données existent en BDD.
+            if ($sectionconfig['presence']) {
+                $mform->setDefault('presence', $sectionconfig['presence']);
+            }
+            if ($sectionconfig['daterendu']) {
+                // Cas distance.
+                if (isset($sectionconfig['presence']) && $sectionconfig['presence'] == 2) {
+                    $mform->setDefault('daterendu', $sectionconfig['daterendu']);
+                    $mform->setDefault('daterenducheck', "1");
+                    if (isset($sectionconfig['daysnotif']) && $sectionconfig['daysnotif'] > -1) {
+                        $mform->setDefault('daysnotif', $sectionconfig['daysnotif']);
+                        $mform->setDefault('selectdayscheck', "1");
+                        $mform->setDefault('msg_dist', array('text' => $sectionconfig['msg']));
+                    }
+                } else if (isset($sectionconfig['presence']) && $sectionconfig['presence'] == 1) {
+                    // Cas présence.
+                    $mform->setDefault('daterendu2', $sectionconfig['daterendu']);
+                    $mform->setDefault('daterenducheck2', "1");
+                    if (isset($sectionconfig['daysnotif']) && $sectionconfig['daysnotif'] > -1) {
+                        $mform->setDefault('daysnotif2', $sectionconfig['daysnotif']);
+                        $mform->setDefault('selectdayscheck2', "1");
+                        $mform->setDefault('msg_pres', array('text' => $sectionconfig['msg']));
+                    }
+                }
+            }
+        }
+        return $elements;
+    }
+
+    /**
+     * Updates format options for a course
+     *
+     * In case if course format was changed to 'periods', we try to copy options
+     * 'coursedisplay', 'numsections' and 'hiddensections' from the previous format.
+     * If previous course format did not have 'numsections' option, we populate it with the
+     * current number of sections
+     *
+     * @param stdClass|array $data return value from {@link moodleform::get_data()} or array with data
+     * @param stdClass $oldcourse if this function is called from {@link update_course()}
+     *     this object contains information about the course before update
+     * @return bool whether there were any changes to the options values
+     */
+    public function update_section_format_options($data) {
+        global $DB;
+
+        $objectsection = new stdClass();
+        $objectsection->id = $data["id"];
+        $sectionconfig = $this->get_format_options($objectsection);
+
+        // If a date was set but we want to remove it.
+        if (!isset($data['daterenducheck']) && !isset($data['daterenducheck2'])) {
+            if (array_key_exists('daterendu', $sectionconfig) && !empty($sectionconfig['daterendu'])) {
+                $data['daterendu'] = null;
+            } else {
+                unset($data['daterendu']);
+            }
+        } else if (isset($data['daterenducheck2'])) {
+            $data['daterendu'] = $data['daterendu2'];
+        }
+
+        if (isset($data['daysnotif']) && ($data['presence'] == 2)) {
+            $data['msg'] = $data['msg_dist']['text'];
+
+        } else if (isset($data['daysnotif2']) && ($data['presence'] == 1)) {
+            $data['msg'] = $data['msg_pres']['text'];
+        }
+
+        if ($data['msg'] == "<p dir=\"ltr\" style=\"text-align: left;\"><br></p>") {
+            $data['msg'] = "";
+        }
+
+        // De base daysnotifs est vide et daysnotifs2 n'existe pas.
+        // Le système de notification n'a jamais été activé et on veut l'activer
+        // Si c'est en présence.
+        if (isset($data['daysnotif2']) && isset($data['selectdayscheck2']) && $data['presence'] == 1) {
+            $data['daysnotif'] = $data["daysnotif2"];
+        }
+
+        // Le système de notif a déjà été activé  et on veut le désactiver OU il a jamais été activé et on ne veut pas l'activer.
+        if (empty($data['daysnotif']) || (!isset($data['selectdayscheck']) && !isset($data['selectdayscheck2']))) {
+            if (array_key_exists('daysnotif', $sectionconfig) && $sectionconfig['daysnotif'] > -1) {
+                $data['daysnotif'] = -1;
+                $data['msg'] = null;
+            } else {
+                unset($data['daysnotif']);
+            }
+        }
+
+        return $this->update_format_options($data, $data['id']);
+    }
+
+    /**
+     * get_view_url
+     *
+     * @param int|stdclass $section
+     * @param array $options
+     * @return null|moodle_url
+     */
+    public function get_view_url($section, $options = array()) {
+        global $CFG;
+        $course = $this->get_course();
+        $url = new moodle_url('/course/view.php', array('id' => $course->id));
+
+        $sr = null;
+        if (array_key_exists('sr', $options)) {
+            $sr = $options['sr'];
+        }
+        if (is_object($section)) {
+            $sectionno = $section->section;
+        } else {
+            $sectionno = $section;
+        }
+        if ($sectionno !== null) {
+            if ($sr !== null) {
+                if ($sr) {
+                    $usercoursedisplay = COURSE_DISPLAY_MULTIPAGE;
+                    $sectionno = $sr;
+                } else {
+                    $usercoursedisplay = COURSE_DISPLAY_SINGLEPAGE;
+                }
+            } else {
+                $usercoursedisplay = 0;
+            }
+            if ($sectionno != 0 && $usercoursedisplay == COURSE_DISPLAY_MULTIPAGE) {
+                $url->param('section', $sectionno);
+            } else {
+                if (empty($CFG->linkcoursesections) && !empty($options['navigation'])) {
+                    return null;
+                }
+                $url->set_anchor('section-' . $sectionno);
+            }
+        }
+        return $url;
+    }
+}
+
+/**
+ * Implements callback inplace_editable() allowing to edit values in-place
+ *
+ * @param string $itemtype
+ * @param int $itemid
+ * @param mixed $newvalue
+ * @return \core\output\inplace_editable
+ */
+function format_iena_inplace_editable($itemtype, $itemid, $newvalue) {
+    global $DB, $CFG;
+    require_once($CFG->dirroot . '/course/lib.php');
+    if ($itemtype === 'sectionname' || $itemtype === 'sectionnamenl') {
+        $section = $DB->get_record_sql('SELECT s.*
+            FROM {course_sections} s
+            JOIN {course} c ON s.course = c.id
+            WHERE s.id = ?
+            AND c.format = ?',
+            array($itemid, 'iena'),
+            MUST_EXIST
+        );
+        return course_get_format($section->course)->inplace_editable_update_section_name($section, $itemtype, $newvalue);
+    }
+}
+
+/**
+ * Extends the course administration navigation with the Badges page
+ *
+ * @param navigation_node $coursenode
+ * @param object $course
+ */
+function iena_add_course_navigation(navigation_node $coursenode, stdClass $course) {
+    echo "<br><br>br>";
+    echo "ien add course";
+}
+
+function format_iena_add_course_navigation(navigation_node $coursenode, stdClass $course) {
+
+    echo "<br><br>br>";
+    echo "formatien add course";
+}
diff --git a/param_indicateur.php b/param_indicateur.php
index d9284ac384c59bb10636e85fb678ba403527eb59..f4c7d7fb934735ff4cac82b3e7f97fd5e1d8a600 100644
--- a/param_indicateur.php
+++ b/param_indicateur.php
@@ -1,401 +1,194 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- *
- * @package    format_iena
- * @category   format
- * @copyright  2018 Softia/Université lorraine
- * @author     vrignaud camille
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-require_once('../../../config.php');
-	require_once('view/view_param_indicateur.php');
-		require_once('entity/course_format_iena_section_ressources.php');
-			require_once('entity/course_format_iena_sections.php');
-
-				global $COURSE, $DB, $USER;
-
-				$courseID = required_param('courseid', PARAM_INT);
-				$sectionID = required_param('sectionid', PARAM_INT);
-				$url = new moodle_url('/course/format/iena/param_indicateur.php', array('courseid' => $courseID));
-
-				$PAGE->set_pagelayout('course');
-				$PAGE->set_url($url);
-
-				if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseID), $USER->id)) {
-					$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-					header("Location: {$link}");
-					exit;
-				}
-				$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
-				require_login($course, false, NULL);
-
-				$PAGE->set_title('Indicateurs de suivi');
-				$PAGE->set_heading('Indicateurs de suivi');
-
-				/* Update in Database all tables format_iena_settings for each module */
-				if ($_POST) {
-
-					if ($_POST['select-section']) {
-						$sectionid = $_POST['select-section'];
-						$sectionid = explode('-', $sectionid)[1];
-					} else {
-						$sectionid = "undefined";
-					}
-
-					/* Récupération de l'état des modules du formulaire */
-					$posted_module_ids = [];
-					$y = 0;
-					foreach ($_POST as $key => $form_module) {
-						$temp = explode($_POST['select-section'], $key);
-						if (count($temp) > 1) {
-							$posted_module_ids[$y] = $temp[0];
-						}
-						$y++;
-					}
-
-					$all_modules = explode("-", $_POST['all_modules']);
-
-
-					
-
-					// echo "<pre>";
-/* var_dump($_POST);
-echo "---<br>";
-var_dump($all_modules);
-echo "---<br>";
-var_dump($posted_module_ids);
-die; */
-
-$suivi_records = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
-
-/* pour chaque activité du cours */
-foreach ($all_modules as $course_mod_id) {
-	$done = false;
-	/* pour chaque activité suivie ou non en base */
-	foreach ($suivi_records as $record) {
-		/* si l'activité est en base (suivie ou non) */
-		if ( $record->cmid == $course_mod_id ) {
-			/* l'activité est suivie en base (1 ou 0 => true, false) */
-			$is_suivi = $record->hide == 1 ? true : false;
-			/* l'activité a été checkée pour être suivie à présent (true ou false) */
-			$is_ask_suivi = in_array($record->cmid, $posted_module_ids);
-			/* si l'état de suivi de l'activité n'est pas le même que demandé */
-			if ( $is_suivi !== $is_ask_suivi ) {
-				/* mise à jour de l'état de l'activité suivie */
-				$update = new stdClass();
-				$update->id = $record->id;
-				$update->hide = $is_ask_suivi ? 1 : 0;
-				$DB->update_record('format_iena_settings', $update, false);
-				/* l'activité a été traitée */
-				$done = true;
-			} else {
-				/* l'activité n'a pas besoin d'être traitée */
-				$done = true;
-			}
-		}
-	}
-	/* si l'activité n'est pas en base (n'a pas été traitée) */
-	if ( $done == false ) {
-		/* si l'activité a été checkée pour être suivie à présent (true ou false) */
-		if ( in_array($course_mod_id, $posted_module_ids) ) {
-			$insert = new stdClass();
-			$insert->courseid = $COURSE->id;
-			$insert->cmid = $course_mod_id;
-			$insert->hide = 1;
-			$insert->sectionid = $sectionid;
-			$DB->insert_record('format_iena_settings', $insert, false);
-		}
-	}
-}
-
-// die;
-
-
-/*
-
-$DB->insert_record('format_iena_settings', $format_iena_setting_data, false);
-
-Records (0 ou 1)
-Form (1)
-
-Pour chaque activité $all_modules
-	Enregistrement traité = faux
-	Pour chaque enregistrement $suivi_records
-		Si l'enregistement $posted_module_ids existe dans $suivi_records
-			Si l'enregistrement est différent
-				Modifier l'enregistrement
-				Enregistrement traité = vrai
-				Break
-	Si Enregistrement traité == faux
-		Créer l'enregistrement
-
-*/
-
-
-		// foreach ($posted_module_ids as $module_id) {
-		// 	$prev_record_exists = false;
-		// 	foreach ( $suivi_records as $record ) {
-		// 		if ( $module_id == $record->cmid ) {
-		// 			$update = new stdClass();
-		// 			$update->id = $record->id;
-		// 			$update->hide = 1;
-		// 			$DB->update_record('format_iena_settings', $update, false);
-					$prev_record_exists = true;
-		// 			break;
-		// 		}
-		// 	}
-		// 	if ( !$prev_record_exists ) {
-		// 		$insert = new stdClass();
-		// 		$insert->courseid = $COURSE->id;
-		// 		$insert->cmid = $module_id;
-		// 		$insert->hide = 1;
-		// 		$insert->sectionid = $sectionid;
-		// 		$DB->insert_record('format_iena_settings', $insert, false);
-		// 	}
-		// }
-
-		
-
-
-
-
-
-		/*---*/
-
-
-		// // récupération de l'état des modules dans la BDD
-  // $modulesStates = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
-
-  // foreach ($modulesStates as $module) {
-		// 	//var_dump($modulesStates);
-		// 	// Création de l'objet à updater
-		// 	//$format_iena_setting_data_upd = new stdClass();
-  // 	$indic = false;
-  // 	foreach ($posted_module_ids as $form_module) {
-  // 		if ($module->cmid == $form_module) {
-  // 			$format_iena_setting_data_upd = new stdClass();
-  // 			$format_iena_setting_data_upd->hide = 1;
-  // 			$format_iena_setting_data_upd->sectionid = $sectionid;
-  // 			$format_iena_setting_data_upd->id = $module->id;
-  // 			$DB->update_record('format_iena_settings', $format_iena_setting_data_upd, false);
-  // 			$indic = true;
-  // 			break;
-  // 		}
-  // 	}
-  // 	if ($indic == false) {
-  // 		$format_iena_setting_data_upd = new stdClass();
-  // 		$format_iena_setting_data_upd->hide = 0;
-  // 		$format_iena_setting_data_upd->sectionid = $sectionid;
-  // 		$format_iena_setting_data_upd->id = $module->id;
-  // 		$DB->update_record('format_iena_settings', $format_iena_setting_data_upd, false);
-  // 	}
-  // }
-
-
-
-		$link = $CFG->wwwroot . '/course/format/iena/suivi_unit.php?courseid=' . $courseID . '&sectionid=' . $sectionid;
-		header("Location: {$link}");
-		exit;
-
-
-
-	} elseif ( $_GET['sectionid'] ) {
-
-		echo $OUTPUT->header();
-
-		$get_section_id = $_GET['sectionid'];
-
-		$modinfo = get_fast_modinfo($COURSE->id);
-
-		$sections = $modinfo->get_section_info_all();
-
-		$suivi_cms = $DB->get_records_sql('SELECT id, cmid, hide from {format_iena_settings} where courseid = ? and sectionid = ?', array($COURSE->id, $get_section_id));
-
-		$is_course_section = false;
-		$current_section_name = "";
-
-		$sections_arr = [];
-
-		foreach ($sections as $section_num => $section) {
-
-			$section_id = $section->__get('id');
-			$section_name = $section->__get('name');
-			if ( $section_name == NULL ) {
-				$section_name = "Section " . $section_num;
-			}
-			if ( $section_id == $get_section_id ) {
-				$is_course_section = true;
-				$current_section_name = $section_name;
-				$current_section_id = $section_id;
-			}
-
-			$section_cms = [];
-			foreach ($modinfo->get_cms() as $module) {
-				if ( $module->section == $section_id ) {
-					$mod = new stdClass();
-					$mod->moduleid = $module->id;
-					$mod->name = $module->name;
-					$mod->courseid = $module->course;
-					$mod->sectionid = $module->section;
-					foreach ($suivi_cms as $suivi) {
-						if ( $module->id == $suivi->cmid ) {
-							if ( $suivi->hide == 1 ) {
-								$mod->suivi = 1;
-							} else {
-								$mod->suivi = 0;
-							}
-						}
-					}
-					array_push($section_cms, $mod);
-				}
-			}
-
-			$sec = new stdClass();
-			$sec->id = $section_id;
-			$sec->name = $section_name;
-			$sec->modules = $section_cms;
-			$sections_arr[] = $sec;
-		}
-
-		if ( $is_course_section == false ) {
-			echo "<p class='alert alert-warning'>Id de section invalide</p>";
-			echo $OUTPUT->footer();
-		} else {
-			// echo "<pre>";
-			// var_dump($sections_arr);
-			// echo "</pre>";
-			$view_param_indicateur = new view_param_indicateur();
-			echo $view_param_indicateur->get_content($sections_arr, $current_section_name, $current_section_id);
-			echo $OUTPUT->footer();
-		}
-
-	} else {
-		$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-		header("Location: {$link}");
-		exit;
-	}
-
-//	$PAGE->requires->js("/course/format/Sprint3/js/jquery.min.js");
-//	$PAGE->requires->js("/course/format/iena/js/file.js");
-//	$PAGE->requires->js_call_amd("/course/format/Sprint3/js/jquery.dataTables.js",  'init');
-	// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"normalize.css\">";
-	// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"common.css\">";
-	// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.16/css/jquery.dataTables.css\">";
-	// echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"styles.css\">";
-
-
-
-	// var_dump(count($modinfo->get_cms()));
-
-	// $suivi_cms = $DB->get_records_sql('SELECT id, cmid, hide from {format_iena_settings}
-	// 	where courseid = ? and sectionid = ?', array($COURSE->id, 124));
-
-	// echo "<pre>";
-	// var_dump($suivi_cms);
-	// echo "</pre>";
-
-
-
-
-
-
-
-
-
-
-	// echo $OUTPUT->footer();
-	// die;
-
-
-	// $view_param_indicateur = new view_param_indicateur();
-	// $sections = $view_param_indicateur->get_course_sections_modules();
-
-
-
-
-	// $Tab_id_modules = array();
-	// $i = 0;
-
-	// foreach ($sections as $section) {
-	// 	foreach ($section->ressources as $mod) {
-	// 		$Tab_id_modules[$i] = $mod->id;
-	// 		$i++;
-	// 	}
-	// }
-
-	// $initee="avant creation";
-
-	// var_dump($initee);
-
-	// die;
-
-	// $suivi_cms = $DB->get_records_sql('SELECT * from {format_iena_settings}
-	// 	where courseid = ?', array($COURSE->id));
-
-	// // var_dump($suivi_cms);
-
-	// // die;
-
-	// $inidezaaaatee="apres premiere requete";
-
-	// var_dump($inidezaaaatee);
-
-	// $to_insert = [];
-
-	// foreach ($sections as $section) {
-	// 	foreach ($Tab_id_modules as $id_module) {
-	// 		// $verif_db = $DB->get_record('format_iena_settings', array('cmid' => $id_module, 'sectionid' => $section->id), '*');
-
-	// 		$verif_db = false;
-	// 		foreach ($suivi_cms as $suivi_cm) {
-	// 			if ( $suivi_cm->cmid == $id_module && $suivi_cm->sectionid == $section->id ) {
-	// 				$verif_db = true;
-	// 				break;
-	// 			}
-	// 		}
-
-	// 		// if ($verif_db == false) {
-	// 		if ($verif_db == false) {
-	// 			$format_iena_setting_data = new stdClass();
-	// 			$format_iena_setting_data->cmid = $id_module;
-	// 			$format_iena_setting_data->hide = 0;
-	// 			$format_iena_setting_data->courseid = $COURSE->id;
-	// 			$format_iena_setting_data->sectionid = $section->id;
-	// 			array_push($to_insert, $format_iena_setting_data);
-	// 			// $DB->insert_record('format_iena_settings', $format_iena_setting_data, false);
-	// 		}
-	// 	}
-	// }
-
-	// $indezite="avant requete";
-
-	// var_dump($indezite);
-
-	// if ( count($to_insert) > 0 ) {
-	// 	$DB->insert_records('format_iena_settings', $to_insert);
-	// }
-
-	// $inite="initialisation terminée";
-
-	// var_dump($inite);
-
-
-	// echo $view_param_indicateur->get_content();
-	// echo $OUTPUT->footer();
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+require_once('../../../config.php');
+require_once('view/view_param_indicateur.php');
+require_once('entity/course_format_iena_section_ressources.php');
+require_once('entity/course_format_iena_sections.php');
+
+global $COURSE, $DB, $USER;
+
+$courseid = required_param('courseid', PARAM_INT);
+$sectionid = required_param('sectionid', PARAM_INT);
+$url = new moodle_url('/course/format/iena/param_indicateur.php', array('courseid' => $courseid));
+
+$PAGE->set_pagelayout('course');
+$PAGE->set_url($url);
+
+if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseid), $USER->id)) {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+}
+$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
+require_login($course, false, null);
+
+$PAGE->set_title('Indicateurs de suivi');
+$PAGE->set_heading('Indicateurs de suivi');
+
+// Update in Database all tables format_iena_settings for each module.
+if ($_POST) {
+    if ($_POST['select-section']) {
+        $sectionid = $_POST['select-section'];
+        $sectionid = explode('-', $sectionid)[1];
+    } else {
+        $sectionid = "undefined";
+    }
+
+    // Récupération de l'état des modules du formulaire.
+    $postedmoduleids = [];
+    $y = 0;
+    foreach ($_POST as $key => $formmodule) {
+        $temp = explode($_POST['select-section'], $key);
+        if (count($temp) > 1) {
+            $postedmoduleids[$y] = $temp[0];
+        }
+        $y++;
+    }
+
+    $allmodules = explode("-", $_POST['all_modules']);
+
+    $suivirecords = $DB->get_records('format_iena_settings', array('sectionid' => $sectionid));
+
+    // Pour chaque activité du cours.
+    foreach ($allmodules as $coursemodid) {
+        $done = false;
+        // Pour chaque activité suivie ou non en base.
+        foreach ($suivirecords as $record) {
+            // Si l'activité est en base (suivie ou non).
+            if ($record->cmid == $coursemodid) {
+                // L'activité est suivie en base (1 ou 0 => true, false).
+                $issuivi = $record->hide == 1 ? true : false;
+                // L'activité a été checkée pour être suivie à présent (true ou false).
+                $isasksuivi = in_array($record->cmid, $postedmoduleids);
+                // Si l'état de suivi de l'activité n'est pas le même que demandé.
+                if ($issuivi !== $isasksuivi ) {
+                    // Mise à jour de l'état de l'activité suivie.
+                    $update = new stdClass();
+                    $update->id = $record->id;
+                    $update->hide = $isasksuivi ? 1 : 0;
+                    $DB->update_record('format_iena_settings', $update, false);
+                    // L'activité a été traitée.
+                    $done = true;
+                } else {
+                    // L'activité n'a pas besoin d'être traitée.
+                    $done = true;
+                }
+            }
+        }
+        // Si l'activité n'est pas en base (n'a pas été traitée).
+        if ($done == false) {
+            // Si l'activité a été checkée pour être suivie à présent (true ou false).
+            if (in_array($coursemodid, $postedmoduleids) ) {
+                $insert = new stdClass();
+                $insert->courseid = $COURSE->id;
+                $insert->cmid = $coursemodid;
+                $insert->hide = 1;
+                $insert->sectionid = $sectionid;
+                $DB->insert_record('format_iena_settings', $insert, false);
+            }
+        }
+    }
+
+            $prevrecordexists = true;
+
+        $link = $CFG->wwwroot . '/course/format/iena/suivi_unit.php?courseid=' . $courseid . '&sectionid=' . $sectionid;
+        header("Location: {$link}");
+        exit;
+
+} else if ( $_GET['sectionid'] ) {
+
+    echo $OUTPUT->header();
+
+    $getsectionid = $_GET['sectionid'];
+
+    $modinfo = get_fast_modinfo($COURSE->id);
+
+    $sections = $modinfo->get_section_info_all();
+
+    $suivicms = $DB->get_records_sql('SELECT id, cmid, hide
+        FROM {format_iena_settings}
+        WHERE courseid = ?
+        AND sectionid = ?',
+        array($COURSE->id, $getsectionid));
+
+    $iscoursesection = false;
+    $currentsectionname = "";
+
+    $sectionsarr = [];
+
+    foreach ($sections as $sectionnum => $section) {
+
+        $sectionid = $section->__get('id');
+        $sectionname = $section->__get('name');
+        if ($sectionname == null) {
+            $sectionname = "Section " . $sectionnum;
+        }
+        if ($sectionid == $getsectionid) {
+            $iscoursesection = true;
+            $currentsectionname = $sectionname;
+            $currentsectionid = $sectionid;
+        }
+
+        $sectioncms = [];
+        foreach ($modinfo->get_cms() as $module) {
+            if ( $module->section == $sectionid ) {
+                $mod = new stdClass();
+                $mod->moduleid = $module->id;
+                $mod->name = $module->name;
+                $mod->courseid = $module->course;
+                $mod->sectionid = $module->section;
+                foreach ($suivicms as $suivi) {
+                    if ($module->id == $suivi->cmid) {
+                        if ($suivi->hide == 1) {
+                            $mod->suivi = 1;
+                        } else {
+                            $mod->suivi = 0;
+                        }
+                    }
+                }
+                array_push($sectioncms, $mod);
+            }
+        }
+
+        $sec = new stdClass();
+        $sec->id = $sectionid;
+        $sec->name = $sectionname;
+        $sec->modules = $sectioncms;
+        $sectionsarr[] = $sec;
+    }
+
+    if ($iscoursesection == false) {
+        echo "<p class='alert alert-warning'>Id de section invalide</p>";
+        echo $OUTPUT->footer();
+    } else {
+        $viewparamindicateur = new view_param_indicateur();
+        echo $viewparamindicateur->get_content($sectionsarr, $currentsectionname, $currentsectionid);
+        echo $OUTPUT->footer();
+    }
+
+} else {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+}
diff --git a/param_section.php b/param_section.php
index 9d17da33727d1d66db6fa4a94abb35ade980b050..168706afbbaa35ced56de8785af48bde59624d8e 100644
--- a/param_section.php
+++ b/param_section.php
@@ -1,125 +1,111 @@
-<?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 06/03/18
-	 * Time: 10:20
-	 */
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	define('NO_OUTPUT_BUFFERING', true);
-	require_once('../../../config.php');
-	require_once('../../lib.php');
-	
-	global $COURSE, $DB, $USER;
-	
-	$courseID = required_param('courseid', PARAM_INT);
-	$sectionId = required_param('sectionid', PARAM_INT);
-	$url = new moodle_url('/course/format/iena/param_section.php', array('courseid' => $courseID, 'sectionid' => $sectionId));
-	
-	$PAGE->set_pagelayout('course');
-	$PAGE->set_url($url);
-
-	$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
-	require_login($course, false, NULL);
-	
-	if (!has_capability('moodle/course:update', $context = context_course::instance($courseID), $USER->id)) {
-		$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-		header("Location: {$link}");
-		exit;
-	}
-	
-	if ($_POST) {
-		global $DB;
-		$dateChaine = $_POST["date_iena"]["year"] . "-" . $_POST["date_iena"]["month"] . "-" . $_POST["date_iena"]["day"] . " " .
-		$_POST["date_iena"]["hour"] . ":" . $_POST["date_iena"]["minute"] . ":00";
-		$dateUp = date_create($dateChaine);
-		$data_iena = new stdClass();
-		if (isset($_POST['date_render'])) {
-			$dateChaine = "";
-		}
-		$data_iena->date_rendu = $dateChaine;
-		$data_iena->presence = $_POST['presence'];
-		$data_iena->id_section = $sectionId;
-		if (isset($_POST['day_same'])) {
-			$data_iena->day_same = $_POST['day_same'];
-		} else {
-			$data_iena->day_same = 0;
-		}
-		
-		if (isset($_POST['day_before'])) {
-			$data_iena->day_before = $_POST['day_before'];
-		} else {
-			$data_iena->day_before = 0;
-		}
-		if (isset($_POST['day_after'])) {
-			$data_iena->day_after = $_POST['day_after'];
-		} else {
-			$data_iena->day_after = 0;
-		}
-		$data_iena->nb_days_before = $_POST['nb_days_before'];
-		$data_iena->nb_days_after = $_POST['nb_days_after'];
-		/* Anciennement, servait à décider si la section était suivie dans les tableau de bord. Aujourd'hui, c'est le suivi d'achèvement d'activité qui est utilisé à la place. */
-		/* $data_iena->hide = $_POST['hide']; */
-		$data_iena->hide = false;
-		
-		$testIfsection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
-		if ($testIfsection == false) {
-			$DB->insert_record('format_iena', $data_iena, false);
-		} else {
-			$data_iena->id = $testIfsection->id;
-			$DB->update_record('format_iena', $data_iena, false);
-		}
-		
-		$section = $DB->get_record('course_sections', array('id' => $sectionId), '*', MUST_EXIST);
-		$data = new stdClass();
-		$data->name = $_POST['name'];
-		$data->summary = $_POST['summary']['text'];
-		$data->summaryformat = $_POST['summary']['format'];
-		course_update_section($COURSE, $section, $data);
-		
-		$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-		header("Location: {$link}");
-		exit;
-
-	} else {
-
-		$dataSection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
-
-		$PAGE->set_title($COURSE->fullname);
-		$PAGE->set_heading($COURSE->fullname);
-		echo $OUTPUT->header();
-		//$PAGE->requires->js("/course/format/Sprint3/js/jquery.min.js");
-		//$PAGE->requires->js("/course/format/iena/js/file.js");
-		//$PAGE->requires->js_call_amd("/course/format/Sprint3/js/jquery.dataTables.js",  'init');
-		require_once("$CFG->libdir/formslib.php");
-		require_once('view/view_param_section.php');
-		$view_param_section = new view_param_section();
-
-		echo $view_param_section->get_content($course, $dataSection);
-
-		echo $OUTPUT->footer();
-
-	}
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+require_once('../../../config.php');
+require_once('../../lib.php');
+
+global $COURSE, $DB, $USER;
+
+$courseid = required_param('courseid', PARAM_INT);
+$sectionid = required_param('sectionid', PARAM_INT);
+$url = new moodle_url('/course/format/iena/param_section.php', array('courseid' => $courseid, 'sectionid' => $sectionid));
+
+$PAGE->set_pagelayout('course');
+$PAGE->set_url($url);
+
+$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
+require_login($course, false, null);
+
+if (!has_capability('moodle/course:update', $context = context_course::instance($courseid), $USER->id)) {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+}
+
+if ($_POST) {
+    global $DB;
+    $datechaine = $_POST["date_iena"]["year"] . "-" . $_POST["date_iena"]["month"] . "-" . $_POST["date_iena"]["day"] . " " .
+    $_POST["date_iena"]["hour"] . ":" . $_POST["date_iena"]["minute"] . ":00";
+    $dateup = date_create($datechaine);
+    $dataiena = new stdClass();
+    if (isset($_POST['date_render'])) {
+        $datechaine = "";
+    }
+    $dataiena->date_rendu = $datechaine;
+    $dataiena->presence = $_POST['presence'];
+    $dataiena->id_section = $sectionid;
+    if (isset($_POST['day_same'])) {
+        $dataiena->day_same = $_POST['day_same'];
+    } else {
+        $dataiena->day_same = 0;
+    }
+
+    if (isset($_POST['day_before'])) {
+        $dataiena->day_before = $_POST['day_before'];
+    } else {
+        $dataiena->day_before = 0;
+    }
+    if (isset($_POST['day_after'])) {
+        $dataiena->day_after = $_POST['day_after'];
+    } else {
+        $dataiena->day_after = 0;
+    }
+    $dataiena->nb_days_before = $_POST['nb_days_before'];
+    $dataiena->nb_days_after = $_POST['nb_days_after'];
+    // Anciennement, servait à décider si la section était suivie dans les tableau de bord.
+    // Aujourd'hui, c'est le suivi d'achèvement d'activité qui est utilisé à la place.
+    $dataiena->hide = false;
+
+    $testifsection = $DB->get_record('format_iena', array('id_section' => $sectionid), '*');
+    if ($testifsection == false) {
+        $DB->insert_record('format_iena', $dataiena, false);
+    } else {
+        $dataiena->id = $testifsection->id;
+        $DB->update_record('format_iena', $dataiena, false);
+    }
+
+    $section = $DB->get_record('course_sections', array('id' => $sectionid), '*', MUST_EXIST);
+    $data = new stdClass();
+    $data->name = $_POST['name'];
+    $data->summary = $_POST['summary']['text'];
+    $data->summaryformat = $_POST['summary']['format'];
+    course_update_section($COURSE, $section, $data);
+
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+} else {
+    $datasection = $DB->get_record('format_iena', array('id_section' => $sectionid), '*');
+
+    $PAGE->set_title($COURSE->fullname);
+    $PAGE->set_heading($COURSE->fullname);
+    echo $OUTPUT->header();
+    require_once("$CFG->libdir/formslib.php");
+    require_once('view/view_param_section.php');
+    $viewparamsection = new view_param_section();
+
+    echo $viewparamsection->get_content($course, $datasection);
+
+    echo $OUTPUT->footer();
+}
diff --git a/renderer.php b/renderer.php
index 84bfef05a23701076b5aa40e98b4ac10d6eb4f63..bdb75f0209fea0d531c03df44bb2a013cc14aaf0 100644
--- a/renderer.php
+++ b/renderer.php
@@ -1,823 +1,34 @@
-<?php
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- * format_iena
- *
- * @package    format_iena
- * @category   format
- * @copyright  2018 Softia/Université lorraine
- * @author     vrignaud camille/Thomas Fradet
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-
-defined('MOODLE_INTERNAL') || die();
-
-require_once($CFG->dirroot . '/course/format/topics/renderer.php');
-require_once($CFG->dirroot . '/course/format/iena/view/view_course_header.php');
-
-/**
- * format_iena_renderer
- *
- * @package    format_iena
- * @category   format
- * @copyright  2018 Softia/Université lorraine
- * @author     vrignaud camille
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-class format_iena_renderer extends format_topics_renderer{
-
-
-	/**
-	 * start_section_list
-	 *
-	 * @return string
-	 */
-	//bientôt useless
-	protected function start_section_list()
-	{
-		return html_writer::start_tag('ul', ['class' => 'iena-editing']);
-	}
-
-	/**
-	 * section_header
-	 *
-	 * @param stdclass $section
-	 * @param stdclass $course
-	 * @param bool $onsectionpage
-	 * @param int $sectionreturn
-	 * @return string
-	 */
-	//Bientôt useless
-	protected function section_header($section, $course, $onsectionpage, $sectionreturn = null, $iena = false){
-		global $PAGE, $CFG;
-		$o = '';
-		$currenttext = '';
-		$sectionstyle = '';
-		if ($section->section != 0) {
-			if (!$section->visible) {
-				$sectionstyle = ' hidden';
-			} elseif (course_get_format($course)->is_section_current($section)) {
-				$sectionstyle = ' current';
-			}
-		}
-		
-		if ($PAGE->user_is_editing()) {
-			$o .= html_writer::start_tag('li', ['id' => 'section-' . $section->section,
-				'class' => 'section main clearfix' . $sectionstyle,
-				'role' => 'region', 'aria-label' => get_section_name($course, $section)]);
-		}
-		
-		$o .= html_writer::tag('span', $this->section_title($section, $course), ['class' => 'hidden sectionname']);
-
-		//This is were the editing menu is generated
-		if ($PAGE->user_is_editing()) {
-			$leftcontent = $this->section_left_content($section, $course, $onsectionpage);
-			$o .= html_writer::tag('div', $leftcontent, ['class' => 'left side']);
-			$rightcontent = $this->section_right_content($section, $course, $onsectionpage);
-			$o .= html_writer::tag('div', $rightcontent, ['class' => 'right side']);
-		}
-
-		$hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name)));
-		$hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));
-		$classes = ' accesshide';
-		if ($hasnamenotsecpg || $hasnamesecpg) {
-			$classes = '';
-		}
-		$sectionname = html_writer::tag('span', $this->section_title($section, $course));
-		if ($PAGE->user_is_editing()) {
-			$o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes);
-		}
-		// if ($course->showdefaultsectionname) {
-		// 	$o .= $this->output->heading($sectionname, 3, 'sectionname' . $classes);
-		// }
-		// if (!$iena) { $o .= $sectionname; }
-
-		$context = context_course::instance($course->id);
-		
-		/* résumé de section */
-		if ( $section->summary != "" ) {
-			$o .= html_writer::start_tag('div', ['class' => 'iena-description']);
-			$o .= html_writer::start_tag('div', ['class' => 'small']);
-
-			$o .= html_writer::start_tag('div', ['class' => 'iena-summary']);
-			$o .= $this->format_summary_text($section);
-			$o .= html_writer::end_tag('div');
-
-			$o .= html_writer::end_tag('div');
-			$o .= html_writer::end_tag('div');
-			$o .= html_writer::tag('a', 'Voir la description complète', ['href' => '#', 'class' => 'voir-plus']);
-		}
-		
-		$o .= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context));
-
-		
-
-		return $o;
-	}
-
-	/**
-	 * Add style attributes, classes (useless?), format section summary and add the hidden/restricted message 
-	 * @param StdClass $section 
-	 * @param StdClass $course 
-	 * @param bool $onsectionpage 
-	 * @param type|null $sectionreturn 
-	 * @param type|bool $iena 
-	 * @param type $groups
-	 * @return type
-	 */
-	protected function get_section_header($section, $course, $onsectionpage, $mods, $sectionreturn = null, $iena = false, $groups=false){
-		
-		global $PAGE, $CFG, $COURSE, $USER;
-		$completion_entity = new course_format_iena_completion();
-		$o = '';
-		$currenttext = '';
-		$sectionstyle = '';
-		if ($section->section != 0) {
-			if (!$section->visible) {
-				$section->sectionstyle = ' hidden';
-			} elseif (course_get_format($course)->is_section_current($section)) {
-				$section->sectionstyle = ' current';
-			}
-		}
-		
-		$section->edit=$this->section_title_without_link($section, $course);
-
-		$hasnamenotsecpg = (!$onsectionpage && ($section->section != 0 || !is_null($section->name)));
-		$hasnamesecpg = ($onsectionpage && ($section->section == 0 && !is_null($section->name)));
-		$section->classes = ' accesshide';
-		if ($hasnamenotsecpg || $hasnamesecpg) {
-			$section->classes = '';
-		}
-		$section->sectionname = get_section_name($course, $section);
-		
-		$context = context_course::instance($course->id);
-		if($section->summary != ""){
-			$section->summary=$this->format_summary_text($section);
-		}
-		
-		$section->messageavailability= $this->section_availability_message($section, has_capability('moodle/course:viewhiddensections', $context));
-
-
-		/* Paramètres */
-		$presence = "";
-		$format = course_get_format($course);
-		
-		$param_section = (object)$format->get_format_options($section);
-		if ($param_section !== false) {
-
-				if (isset($param_section->presence)) {
-					if ($param_section->presence == 1) {
-						$section->presence = true;
-						$section->distance =false;
-						$string_date_presence="Le ";
-					} else if ($param_section->presence == 2) {
-						$section->presence = false;
-						$section->distance =true;
-						$string_date_presence="Pour le ";
-					}
-					else{
-						$string_date_presence="Le ";
-						$section->presence = false;
-						$section->distance =false;
-					}
-				}
-
-				if (isset($param_section->daterendu) && $param_section->daterendu != 0) {
-					$section->date=date("j/m H:i", $param_section->daterendu);
-					$section->date_jour = date("j/m", $param_section->daterendu);
-					$section->date_heure =  date("H:i", $param_section->daterendu);
-
-					/*$section->dateUp = new DateTime("@$param_section->daterendu");
-					$section->date = $section->dateUp->format("j/m H:i");
-					$section->date_jour = $section->dateUp->format("j/m");
-					$section->date_heure = $section->dateUp->format("H:i");
-					$section->dateUp = $section->dateUp->getTimestamp();*/
-					if($string_date_presence){
-						$section->string_date=$string_date_presence.$section->date_jour." à ".$section->date_heure;
-					}
-					else{
-						$section->string_date="Le ".$section->date_jour." à ".$section->date_heure;
-					}
-				} else {
-					$section->date = "";
-				}
-		} else {
-			$section->date = "";
-		}
-		
-		//Bouton de suivi dans chaque section : si pas d'activités suivies on n'affiche pas le bouton
-		if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)) {
-			$ressources_entity = new course_format_iena_section_ressources();
-			//$modules = $ressources_entity->get_ressources_completion_on_by_id_section($section->id);
-			$display_button=false;
-			foreach ($mods->get_cms() as $cm) {
-				if($cm->completion>0 && $cm->section==$section->id){
-					$display_button=true;
-					break;
-				}
-			}
-			//$nb_modules = count($modules);
-			if($display_button){
-				//si trop d'étudiants on va afficher le premier groupe dans le suivi
-				if($this->count_students($context)>299 && count($groups)>0){
-					$section->link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id . "&groupid=".reset($groups)->id;
-				}
-				else{
-					$section->link_suivi = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $section->id . "&groupid=0";
-				}
-				
-			}
-			
-			
-		}
-		else{
-			//On va chercher la progression pour la section
-			$section_progress=$completion_entity->get_completion_by_section([$section->name], [$section->id]);
-			if($section_progress){
-				$section->section_progress=$section_progress->total;	
-			}
-			
-			
-		}
-		
-	
-		return $section;
-	}
-
-	//useless
-	/*public function get_completion_by_section($idSection){
-		global $COURSE, $USER;
-		$ressources_entity = new course_format_iena_section_ressources();
-		$section_entity = new course_format_iena_sections();
-		$modules = $ressources_entity->get_ressources_completion_on_by_id_section($idSection);
-		$nb_modules = count($modules);
-		if ($nb_modules == 0) {
-			return array($nb_modules, 999);
-		}
-
-		$valueI = 100 / $nb_modules;
-		$valueTotal = 0;
-		foreach ($modules as $module) {
-			$complet = $ressources_entity->get_completions_by_module($USER->id, $COURSE->id, $module->id);
-			if ($complet->completionstate != 0) {
-				$valueTotal += $valueI;
-			}
-		}
-
-		return array($modules, $valueTotal);
-	}*/
-
-
-	//Bientôt useless
-	public function get_view_iena($course, $htmlsection, $nameSection, $introSection, $idSection){
-		global $CFG, $COURSE, $USER;
-		$section_entity = new course_format_iena_sections();
-
-		
-
-		// nouvelle génération du header
-
-		$view = "";
-
-		require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_completion.php');
-		// return false if completion disabled (site or course)
-		$cpl = course_format_iena_completion::get_completion_by_section($nameSection, $idSection);
-
-		/* Passer le calcul de complétion de la classe course_format_iena_completion à part à la vue qui fait le header permet de ne pas récupérer deux fois les mêmes informations. */
-		$header = new view_course_header($nameSection, $idSection, $course, $cpl);
-		$view .= $header->get_content();
-
-		$i = 0;
-		$link = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id;
-		$view .= "<!-- <script defer src=\"https://use.fontawesome.com/releases/v5.0.8/js/all.js\"></script>  -->
-		<style>
-
-		/*
-		style for clean page
-		*/
-
-		/* [BOOST] : course header */
-		#page-header .card {
-					border: none;
-				}
-		#page-header .card-body {
-				padding-left: 0;
-			}
-			/* [BOOST] : left nav */
-		#nav-drawer,
-			[data-region='drawer'] {
-				background-color: #fff;
-			}
-		#nav-drawer .list-group-item {
-			border: 1px solid #ffffff;
-		}
-		#nav-drawer .list-group-item:hover {
-		background-color: #e7e9ea;
-		}
-		#nav-drawer .list-group-item.active:hover {
-		color: #000000;
-		}
-
-		/* [BOOST] : blocks */
-		#block-region-side-pre section.block {
-		border: none;
-		}
-		#block-region-side-pre section.block .card-body {
-		padding-top: 0;
-		}
-
-		/* [BOOST] : margin for ul, because ul is used to list sections */
-
-		ul, ul ul {
-			padding-left: 2.5rem;
-			margin-bottom: 0.5rem !important;
-		}
-
-		/* style for ? */
-
-					#completionprogressid {
-		display: none;
-		}
-
-		#region-main > .card {
-		border: none;
-		overflow-x: visible !important;
-		overflow-y: visible;
-		}
-
-		#region-main > .card > .card-body {
-		border: none;
-		padding: 0;
-		}
-
-		.centered {
-			display:flex;justify-content:center;align-items:center;
-		}
-		.contenu {
-			min-width: 15rem;
-		}
-		ul.bulle {
-			list-style: none;
-			padding:5%;
-		}
-
-		.bulle {
-			list-style: none;
-		}
-
-		.bulle > li {
-			list-style: none;
-			font-weight: normal;
-			font-size: 0.8rem;
-			line-height: 1rem;
-			padding-top: 5%;
-		}
-		</style>";
-		foreach ($htmlsection as $section) {
-			$presence = "";
-			if (!$section) {
-				continue;
-			}
-			$param_section = $section_entity->get_section_settings_by_id_section($idSection[$i]);
-			// dates, modality and notification section parameters : false if not set. 
-			if ($param_section !== false) {
-				if ($param_section->presence && $i != 0) {
-					if ($param_section->presence == 1) {
-						$presence = "En présence";
-					} else if ($param_section->presence == 2) {
-						$presence = "A distance";
-					}
-				}
-
-				if ($param_section->date_rendu) {
-					$dateUp = date_create($param_section->date_rendu);
-					$date = $dateUp->format("j/m H:i");
-					$date_jour = $dateUp->format("j/m");
-					$date_heure = $dateUp->format("H:i");
-					$dateUp = $dateUp->getTimestamp();
-				} else {
-					$date = "";
-				}
-			} else {
-				$date = "";
-			}
-
-			$titre = $nameSection[$i];
-			$sectionIntro = isset($introSection[$i]) ? $introSection[$i] : '';
-						//If section is hidden continue
-			if ($titre == null && !(has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id))) {
-				$i++;
-				continue;
-			}
-			$view .= "<section class=\"section iena-section\" id=\"section-$i\">
-			<div class=\"card card_block\">
-			<div class=\"heading-iena set_height\">";
-
-			if ( $cpl != false && count($cpl->sections[$i]->modules) > 0 && !has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)) {
-				$view .= "<div class='iena-percent set_height'>" . $cpl->sections[$i]->completion . "%</div>";
-			}
-
-			if (has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
-			
-
-				$course_groups = groups_get_all_groups($COURSE->id);
-
-				$group_indicateur = 0;
-
-				$view .= "<a href='$link&sectionid=".$idSection[$i]."style='color : white'>";
-				$view .="<div onclick='change_grouplink(this)' style='display:block' class='nb_pers set_height id_groupe0'>";
-				$view .= "Suivi étudiants";
-				$view .= "</div>";
-				$view .="</a>";
-				
-				
-			}
-
-
-
-			$view .= "<div class=\"titre_section set_height\">
-			<p>$titre</p>
-			</div>
-			<div class=\"right_info\">
-			";
-						// if ($presence) {
-						// 	$view .= "
-						// 	<div class=\"label_item\">
-						// 	$presence
-						// 	</div>";
-						// }
-			if ($date) {
-				$link_date = $CFG->wwwroot . "/calendar/view.php?view=month&time=" . $dateUp . "&course=" . $COURSE->id;
-				if ($presence && $presence == "A distance") {
-					$view .= "
-					<div class=\"label_item sect-date\">
-					À distance
-					</div>
-					<div class=\"label_item sect-date\">
-					Pour le $date_jour à $date_heure
-					</div>";
-				} else if ($presence && $presence == "En présence") {	
-					$view .= "
-					<div class=\"label_item sect-date\">
-					En présence
-					</div>
-					<div class=\"label_item sect-date\">
-					Le $date_jour à $date_heure
-					</div>";
-				} else {
-					$view .= "
-					<div class=\"label_item sect-date\">
-					Le $date_jour à $date_heure
-					</div>";
-				}
-			} else {
-				if ($presence && $presence == "A distance") {
-					$view .= "
-					<div class=\"label_item sect-date\">
-					À distance
-					</div>";
-				} else if ($presence && $presence == "En présence") {	
-					$view .= "
-					<div class=\"label_item sect-date\">
-					En présence
-					</div>";
-				}
-			}
-			
-			$cpt = "";
-			if ($cpt != "") {
-				$view .= "
-				<div class=\"titre_section set_height\">
-
-				";
-				$view .= $cpt;
-				$view .= "</div>
-				";
-			}
-
-			$link_param = $CFG->wwwroot . "/course/format/iena/param_section.php?courseid=" . $COURSE->id . "&sectionid=" . $idSection[$i];
-			if (has_capability('moodle/course:update', $context = context_course::instance($COURSE->id), $USER->id) && $i != 0) {
-				$view .= "<div class=\"titre_section set_height\">
-				<a href='$link_param' style=\"color : white\">
-				<i class=\"fa fa-cog \" aria-hidden=\"true\" ></i>
-				</a>
-				</div>";
-			}
-			$view .= "</div>
-
-			</div>
-			";
-			$view .= "<div class=\"wrapper section\">";
-			$view .= $sectionIntro;
-			
-			$view .= "<div class=\"wrapper\">
-			$section
-			</div >
-
-			</div>
-
-			</section>";
-			$i++;
-		}
-		return $view;
-	}
-
-	/**
-	 * Render le template du header avec les infos nécessaires : le progrès
-	 * @param StdObject $course 
-	 * @param array<string> $nameSections
-	 * @param array<int> $idSections
-	 * @return type
-	 */
-	public function get_view_iena_new($course,$nameSections, $idSections){
-		global $CFG, $COURSE, $USER;
-		$section_entity = new course_format_iena_sections();
-		require_once($CFG->dirroot . '/course/format/iena/entity/course_format_iena_completion.php');
-		// return false if completion disabled (site or course)
-		$cpl = course_format_iena_completion::get_completion_by_section($nameSections, $idSections);
-
-		/* Passer le calcul de complétion de la classe course_format_iena_completion à part à la vue qui fait le header permet de ne pas récupérer deux fois les mêmes informations. */
-		$header = new view_course_header($nameSections, $idSections, $course, $cpl);
-		$course_infos= $header->create_view($cpl);
-		//$course_infos=$header->get_data($cpl);
-
-
-		echo $this->render_from_template('format_iena/course-header', $course_infos);
-
-		
-	}
-
-
-
-	public function count_students($context){
-		$count = count_enrolled_users($context);
-		return $count;
-	}
-
-
-
-	//Seulement en mode édition - 
-	//bientôt useless
-	public function print_iena_section_pages($course){
-		global $PAGE, $USER;
-
-		
-
-		$context = context_course::instance($course->id);
-		$course = course_get_format($course)->get_course();
-		$completion = new \completion_info($course);
-
-
-		$modinfo = get_fast_modinfo($course);
-		// $course = course_get_format($course)->get_course();
-		
-		// $completioninfo = new completion_info($course);
-		if (isset($_COOKIE['sectionvisible_' . $course->id])) {
-			$sectionvisible = $_COOKIE['sectionvisible_' . $course->id];
-		} elseif ($course->marker > 0) {
-			$sectionvisible = $course->marker;
-		} else {
-			$sectionvisible = 1;
-		}
-		$htmlsection = false;
-		$nameSection = [];
-		$idSection = false;
-		$introSection = false;
-		
-		//On récupère toutes les infos des sections
-		foreach ($modinfo->get_section_info_all() as $section => $thissection) {
-
-			//Nom de la section
-
-			$htmlsection[$section] = '';
-			
-			$numsections = course_get_format($course)->get_last_section_number();
-
-			// if ($section > $numsections) {
-			// // if ($section > $course->numsections) {
-			// 	// continue;
-			// }
-			/* if is not editing verify the rules to display the sections */
-			if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) {
-
-				//si la section est cachée
-				if (isset($course->hiddensections) && !(int)$thissection->visible) {
-					continue;
-				}
-
-				//si la section n'est pas disponible
-				if (!$thissection->available && !empty($thissection->availableinfo)) {
-					$htmlsection[$section] .= $this->section_header($thissection, $course, false, 0);
-					continue;
-				}
-
-				if (!$thissection->uservisible || !$thissection->visible) {
-					$htmlsection[$section] .= $this->section_hidden($section, $course->id);
-					continue;
-				}
-			}
-
-
-			//Affiche le nom de la section en mode propre sans lien
-			$idSection[$section] = $thissection->id;
-			// $nameSection[$section] .= $this->section_title_without_link($thissection, $course);
-			$nameSection[$section] = $this->section_title_without_link($thissection, $course);
-			if ($PAGE->user_is_editing()) {
-				$htmlsection[$section] .= $this->section_header($thissection, $course, false, 0);
-			}
-			$introSection[$section] = $this->section_header($thissection, $course, false, 0, true);
-			if ($thissection->uservisible) {
-				/* Ne pas enlever sinon le activity chooser ne fonctionne pas en JS */
-				$htmlsection[$section] .= "<div class='content'>";
-				// Renvoie le lien du cours avec icone
-				$htmlsection[$section] .= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
-				$htmlsection[$section] .= $this->courserenderer->course_section_add_cm_control($course, $section, 0);
-				$htmlsection[$section] .= "</div>";
-			}
-	
-			/* pas de footer car on ne commence par la structure par une div non fermée et que ce footer ferme par une div */
-			// $htmlsection[$section] .= $this->section_footer();
-			
-			
-		} //ENDFOREACH
-
-		// echo $completioninfo->display_help_icon();
-		
-		echo $this->output->heading($this->page_title(), 2, 'accesshide');
-		echo $this->course_activity_clipboard($course, 0);
-		echo $this->start_section_list();
-		
-		
-		//A ce stade on à toutes les activité déja prête en HTML par contre il manque le nom des sections
-		// Il se trouve dans : $thissection->name
-
-
-
-
-			//here all activities are displayed
-			//If we are in etition mode then we display the "BASE" page Otherwise our model
-		if (!$PAGE->user_is_editing()) {
-			echo $this->get_view_iena($course, $htmlsection, $nameSection, $introSection, $idSection);
-		} else {
-			foreach ($htmlsection as $current) {
-				echo $current;
-			}
-		}
-			//At this stage nothing is yet displayed except the icon: Your progress
-			// if ($course->sectionposition == 1 and isset($htmlsection0)) {
-				// if ($PAGE->user_is_editing())
-				// 	echo html_writer::tag('span', $htmlsection0, ['class' => 'below']);
-			// }
-
-			//Add the + and - at the end of the page to see which part of the code to really keep
-		if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
-			foreach ($modinfo->get_section_info_all() as $section => $thissection) {
-				if ($section <= $numsections or empty($modinfo->sections[$section])) {
-					continue;
-				}
-				echo $this->stealth_section_header($section);
-				echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
-				echo $this->stealth_section_footer();
-			}
-			echo $this->end_section_list();
-			echo html_writer::start_tag('div', ['id' => 'changenumsections', 'class' => 'mdl-right']);
-			$straddsection = get_string('addsections');
-			$url = $url = new moodle_url('/course/changenumsections.php', ['courseid' => $course->id, 'insertsection' => 0, 'increase' => false, 'sesskey' => sesskey(), 'sectionreturn' => 0]);
-			$icon = $this->output->pix_icon('t/switch_plus', $straddsection);
-			echo html_writer::link($url, $icon . $straddsection, ['class' => 'increase-sections']);
-				
-			echo html_writer::end_tag('div');
-		} else {
-			echo $this->end_section_list();
-		}
-		echo html_writer::tag('style', '.course-content ul.iena #section-' . $sectionvisible . ' { display: block; }');
-		//if (!$PAGE->user_is_editing()) {
-				//$PAGE->requires->js_init_call('M.format_iena.init', [$course->numsections]);
-		//}
-
-	}
-
-	/**
-	 * Fetch the course sections with infos
-	 * @param StdObject $course 
-	 * @param bool $onsectionpage 
-	 * @return templates
-	 */
-	public function get_iena_sections($course, $editing, $onsectionpage=false){
-		global $PAGE, $USER;
-
-		$context = context_course::instance($course->id);
-		
-		$completion = new \completion_info($course);
-		$groups=groups_get_all_groups($course->id);
-		
-
-
-		$modinfo = get_fast_modinfo($course);
-		
-		if (isset($_COOKIE['sectionvisible_' . $course->id])) {
-			$sectionvisible = $_COOKIE['sectionvisible_' . $course->id];
-		} elseif ($course->marker > 0) {
-			$sectionvisible = $course->marker;
-		} else {
-			$sectionvisible = 1;
-		}
-		$htmlsection = false;
-		$nameSections = [];
-		$idSections = [];
-		$introSection = false;
-	
-
-
-		$sections=['sections'=>[]];
-
-
-		
-
-		foreach($modinfo->get_section_info_all() as $section => $thissection){
-			if (!$PAGE->user_is_editing() && (!has_capability('moodle/course:viewhiddensections', $context = context_course::instance($course->id), $USER->id))) {
-				if (isset($course->hiddensections) && !(int)$thissection->visible) {
-					continue;
-				}
-				if (!$thissection->available && !empty($thissection->availableinfo)) {
-					$thissection= $this->get_section_header($thissection, $course, false,$modinfo, 0, $groups);
-					
-					continue;
-				}
-				if (!$thissection->uservisible || !$thissection->visible) {
-					$htmlsection = $this->section_hidden($section, $course->id);
-					
-					continue;
-				}
-			}
-			$thissection=$this->get_section_header($thissection, $course, false, $modinfo,0, true, $groups);
-
-			if ($thissection->uservisible) {
-				$thissection->resources= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
-				if ($editing) {
-
-					$thissection->addresources = $this->courserenderer->course_section_add_cm_control($course, $thissection->section, 0);
-					$thissection->leftcontent = $this->section_left_content($thissection, $course, $onsectionpage);
-					$thissection->rightcontent = $this->section_right_content($thissection, $course, $onsectionpage);
-
-				}
-		
-			}
-
-
-			array_push($sections['sections'], $thissection);
-			array_push($nameSections, $thissection->name);
-			array_push($idSections, $thissection->id);
-		}
-		if($editing){
-			$sections['link_add_sections']=new moodle_url('/course/changenumsections.php', ['courseid' => $course->id, 'insertsection' => 0, 'increase' => false, 'sesskey' => sesskey(), 'sectionreturn' => 0]);
-		}
-
-		echo $this->get_view_iena_new($course, $nameSections, $idSections);
-		echo $this->render_from_template('format_iena/sections', $sections);
-		
-	}
-
-
-
-	//If edit mode, we use the old code that generates HTML, else we use the templates - bientôt useless
-	public function switch_mode($course){
-		global $PAGE, $CFG;
-		$context = context_course::instance($course->id);
-		$course = course_get_format($course)->get_course();
-		if($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)){
-			//$this->print_iena_section_pages($course);
-			$this->get_iena_sections($course, true);
-		}
-		else{
-			
-			$this->get_iena_sections($course, false);
-		}
-	}
-
-	public function display_completion($data){
-		echo $this->render_from_template('format_iena/suivi', $data);
-	}
-
-	public function display_table_completion($data){
-		echo $this->render_from_template('format_iena/suivi-table', $data);
-	}
-
-	public function display_message($data){
-		echo $this->render_from_template('format_iena/send-message', $data);
-	}
-}
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+// 
+
+
+
+
+defined('MOODLE_INTERNAL') || die();
+
+
+require_once($CFG->dirroot . '/course/format/topics/renderer.php');
+
+/**
+ * format_iena_renderer
+ *
+ * @package    format_iena
+ * @category   format
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
diff --git a/send_message.php b/send_message.php
index f589f690fe55156c71019a4a87f7612ece00d616..6d359827026c606087eb0fae77f14e51f56fc323 100644
--- a/send_message.php
+++ b/send_message.php
@@ -1,11 +1,4 @@
 <?php
-	/**
-	 * Created by PhpStorm.
-	 * User: softia
-	 * Date: 06/03/18
-	 * Time: 10:20
-	 */
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -20,168 +13,111 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     vrignaud camille
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	define('NO_OUTPUT_BUFFERING', true);
-	require_once('../../../config.php');
-	
-	global $COURSE, $DB, $USER, $CFG;
-	
-	$courseID = required_param('courseid', PARAM_INT);
-	$url = new moodle_url('/course/format/iena/send_message.php', array('courseid' => $courseID));
-	
-	$PAGE->set_pagelayout('course');
-	$PAGE->set_url($url);
-	
-	if (!has_capability('course/iena:suivi', $context = context_course::instance($courseID), $USER->id)) {
-		$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-		header("Location: {$link}");
-		exit;
-	}
-	
-	$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
-	require_login($course, false, NULL);
-	
-	/*if (isset($_POST['action'])) {
-		$messageContent = $_POST['summary']['text'];
-		$usersid = explode(",", $_POST["usersid"]);
-		// $messageContent .= "<br>". get_string('course', 'format_iena') . " : " . $course->fullname;
-		$messageContent .= "<br>". get_string('course', 'format_iena') . " :  <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
-		$messageContent .= "<br> ". get_string('prof', 'format_iena') . " : " . $USER->firstname . " " . $USER->lastname;
-		$brutMessageContent = $course->fullname . " " . $_POST['summary']['text'];
-		$course_ctx = context_course::instance($courseID);
-		$students = get_enrolled_users($course_ctx);
-		
-		// sending a notification to each students
-		foreach ($usersid as $userID) {
-			foreach ($students as $student) {
-				if ($student->id == $userID) {
-					$message = new \core\message\message();
-					$message->courseid = $course->id;
-					$message->component = 'moodle';
-					$message->name = 'instantmessage';
-					$message->userfrom = $USER;
-					$message->notification = '0';
-					$message->fullmessageformat = FORMAT_HTML;
-					$message->subject = "Rappel : " . $course->fullname;
-					$message->smallmessage = $messageContent;
-					$message->fullmessage = $brutMessageContent;
-					$message->fullmessagehtml = $messageContent;
-					$message->userto = $student;
-					$messageid = message_send($message);
-					break;
-				}
-			}
-		}
-		$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-		header("Location: {$link}");
-		exit;
-	}*/
-	
-	//$dataSection = $DB->get_record('format_iena', array('id_section' => $sectionId), '*');
-	//$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
-	// require_login($course, false, NULL);
+/**
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+require_once('../../../config.php');
+
+global $COURSE, $DB, $USER, $CFG;
+
+$courseid = required_param('courseid', PARAM_INT);
+$url = new moodle_url('/course/format/iena/send_message.php', array('courseid' => $courseid));
+
+$PAGE->set_pagelayout('course');
+$PAGE->set_url($url);
+
+if (!has_capability('course/iena:suivi',
+    $context = context_course::instance($courseid), $USER->id)) {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+}
+
+$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
+require_login($course, false, null);
 
-	$students="";
-	$back_url=$CFG->wwwroot . '/course/view.php?id=' . $courseID;
-	
-	if(isset($_POST["students"])){
-		$students=$_POST["students"];
-	}
-	if(isset($_POST["back_url"])){
-		$back_url=$_POST["back_url"];
-		
-	}
+$students = "";
+$backurl = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
 
+if (isset($_POST["students"])) {
+    $students = $_POST["students"];
+}
+if (isset($_POST["back_url"])) {
+    $backurl = $_POST["back_url"];
+}
 
-	$data=new stdClass();
-	$nb = $students != "" ? count( explode(",", $students) ) : 0;
-	require_once('entity/course_format_iena_message.php');
-	$send_message = new course_format_iena_message(null, array('back_url'=>$back_url, 'students'=>$students));
-	
-	if ( $nb == 0 ) {
-		$data->nb_results=0;
-		
-	} else {
-		$data->nb_results=$nb;
-		$data->users_id=$students;
-		$courseID = required_param('courseid', PARAM_INT);
-		$data->link_cancel= $CFG->wwwroot . "/course/view.php?id=" . $courseID;;
-		$data->form=$send_message->render();
-	}
+$data = new stdClass();
+$nb = $students != "" ? count( explode(",", $students) ) : 0;
+require_once('entity/course_format_iena_message.php');
+$sendmessage = new course_format_iena_message(null, array('back_url' => $backurl,
+    'students' => $students));
 
-	
+if ($nb == 0) {
+    $data->nb_results = 0;
+} else {
+    $data->nb_results = $nb;
+    $data->users_id = $students;
+    $courseid = required_param('courseid', PARAM_INT);
+    $data->link_cancel = $CFG->wwwroot . "/course/view.php?id=" . $courseid;
+    $data->form = $sendmessage->render();
+}
 
-	
-	//if form is cancelled, we go back to the table. Else, we send the message and then go back to the table, with a success or failure message.
-	if($send_message->is_cancelled()){
-		$back_url=$CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$back_url;
-		
-		header("Location: {$back_url}");
-	}
-	else if ($fromform = $send_message->get_data()) {
-		$back_url=$CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$back_url;
-		
-		try{
-			$messageContent = $fromform->summary['text'];
-			
-			$usersid = explode(",", $fromform->students);
-			
-			$messageContent .= "<br>". get_string('course', 'format_iena') . " :  <a href='" . $CFG->wwwroot . "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
-			$messageContent .= "<br> ". get_string('prof', 'format_iena') . " : " . $USER->firstname . " " . $USER->lastname;
-			$brutMessageContent = $course->fullname . " " . $_POST['summary']['text'];
-			$course_ctx = context_course::instance($courseID);
-			$students = get_enrolled_users($course_ctx);
-			
-			// sending a notification to each students
-			foreach ($usersid as $userID) {
-				foreach ($students as $student) {
-					if ($student->id == $userID) {
-						$message = new \core\message\message();
-						$message->courseid = $course->id;
-						$message->component = 'moodle';
-						$message->name = 'instantmessage';
-						$message->userfrom = $USER;
-						$message->notification = '0';
-						$message->fullmessageformat = FORMAT_HTML;
-						$message->subject = "Rappel : " . $course->fullname;
-						$message->smallmessage = $messageContent;
-						$message->fullmessage = $brutMessageContent;
-						$message->fullmessagehtml = $messageContent;
-						$message->userto = $student;
-						$messageid = message_send($message);
-						break;
-					}
-				}
-			}
-			$back_url.="&msg_success=true";
-		}
-		catch(Exception $e){
-			$back_url.="&msg_failure=true";
-		}
-		
-    	header("Location: {$back_url}");
-	}
-	else{
-		echo $OUTPUT->header();
-		$renderer = $PAGE->get_renderer('format_iena');
-		$renderer->display_message($data);
-		echo $OUTPUT->footer();
-	}
+// If form is cancelled, we go back to the table.
+// Else, we send the message and then go back to the table, with a success or failure message.
+$backurl = $CFG->wwwroot . '/course/format/iena/suivi_unit.php'.$backurl;
+if ($sendmessage->is_cancelled()) {
+    header("Location: {$backurl}");
+} else if ($fromform = $sendmessage->get_data()) {
+    
+    try {
+        $messagecontent = $fromform->summary['text'];
 
+        $usersid = explode(",", $fromform->students);
 
+        $messagecontent .= "<br>". get_string('course', 'format_iena') . " :  <a href='" . $CFG->wwwroot .
+            "/course/view.php?id=" . $course->id . "'>" . $course->fullname . "</a>";
+        $messagecontent .= "<br> ". get_string('prof', 'format_iena') . " : " .
+            $USER->firstname . " " . $USER->lastname;
+        $brutmessagecontent = $course->fullname . " " . $_POST['summary']['text'];
+        $coursectx = context_course::instance($courseid);
+        $students = get_enrolled_users($coursectx);
 
-	//echo $view_param_section->get_content($course, $dataSection);
-	
-	
-	
-	
+        // Sending a notification to each students.
+        foreach ($usersid as $userid) {
+            foreach ($students as $student) {
+                if ($student->id == $userid) {
+                    $message = new \core\message\message();
+                    $message->courseid = $course->id;
+                    $message->component = 'moodle';
+                    $message->name = 'instantmessage';
+                    $message->userfrom = $USER;
+                    $message->notification = '0';
+                    $message->fullmessageformat = FORMAT_HTML;
+                    $message->subject = "Rappel : " . $course->fullname;
+                    $message->smallmessage = $messagecontent;
+                    $message->fullmessage = $brutmessagecontent;
+                    $message->fullmessagehtml = $messagecontent;
+                    $message->userto = $student;
+                    $messageid = message_send($message);
+                    break;
+                }
+            }
+        }
+        $backurl .= "&msg_success=true";
+    } catch (Exception $e) {
+        $backurl .= "&msg_failure=true";
+    }
 
+    header("Location: {$backurl}");
+} else {
+    echo $OUTPUT->header();
+    $renderer = $PAGE->get_renderer('format_iena');
+    $renderer->display_message($data);
+    echo $OUTPUT->footer();
+}
diff --git a/settings.php b/settings.php
new file mode 100644
index 0000000000000000000000000000000000000000..0ce4ff8df770039088d5cf409df5afe9d7d24914
--- /dev/null
+++ b/settings.php
@@ -0,0 +1,31 @@
+<?php
+// This file is part of Moodle - https://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ * Adds admin settings for the plugin.
+ *
+ * @package     format_iena
+ * @copyright   2018 Softia/Université lorraine
+ * @license     https://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+if ($hassiteconfig) {
+    $settings->add(new admin_setting_confightmleditor('format_iena/msg_dist', get_string('message_dist', 'format_iena'),
+    get_string('message_dist_desc', 'format_iena'), get_string('message_default_dist', 'format_iena'), PARAM_RAW));
+    $settings->add(new admin_setting_confightmleditor('format_iena/msg_pres', get_string('message_pres', 'format_iena'),
+    get_string('message_pres_desc', 'format_iena'), get_string('message_default_pres', 'format_iena'), PARAM_RAW));
+}
\ No newline at end of file
diff --git a/styles.css b/styles.css
index 54c7b272749ef07bf0b93d9a35881e798e6a5036..5d146f5b9f82d16025a69d30c40f7ae33e6d5e95 100644
--- a/styles.css
+++ b/styles.css
@@ -55,6 +55,12 @@ ul.iena-editing .voir-plus {
     border-bottom-right-radius: 7px;
 }
 
+
+.voir-plus{
+    margin-left: 3%;
+margin-top: 14px;
+}
+
 .iena-section .instancename {
     font-size: 1rem;
 }
@@ -106,8 +112,7 @@ ul.nav.navbar-nav.ml-auto {
 
 .set_height {
 	/*min-height: 3rem;*/
-	line-height: 2.4rem;
-}
+	}
 
 .heading-iena {
 	background: #D6D6D6;
@@ -161,16 +166,26 @@ ul.nav.navbar-nav.ml-auto {
 }
 
 .titre_section {
-	float: left;
-	
+	display: flex;
+    align-items: center;
+	margin-left: -40px;
 	/*padding-left: 0.8rem;*/
-	padding-right: 1rem;
+	/*padding-right: 1rem;*/
 	font-size: 1.4rem;
 	color: #1a1a1a;
     font-weight: 100;
+    /* border: 2px solid; */
+    background: #2a657d;
+    border-radius: 50px;
+    margin-left: -64px;
+    margin-right: 24px;
 	/*font-weight: bold;*/
 }
 
+.iena .my-3{
+    border-bottom: 1px solid #dee2e6;
+}
+
 .titre_section p {
 	margin-bottom: 0;
 	display: inline-block;
@@ -180,6 +195,8 @@ ul.nav.navbar-nav.ml-auto {
 .titre_section .label_item.sect-date{
 	display: inline-block;
 	border-left: none;
+    font-style: italic;
+
 }
 
 .nb_pers {
@@ -187,57 +204,102 @@ ul.nav.navbar-nav.ml-auto {
     background: #009186;
     float: right;
     min-width: 4rem;
-    padding: .6rem .6rem;
-    font-size: 14px	;
-    border-radius: 5px;
-    margin-top: 0.35rem;
-    line-height: 0.5rem;
-    margin-right: .4rem;
-    margin-left: .4rem;
+    padding: 7px 20px;
+    font-size: 14px;
+    border-radius: 10px;
+    
+    /* line-height: 0.9rem; */
+    margin: 0;
+    transition: 0.3s;
 }
 .nb_pers a {
 	color: white;
 }
-.nb_pers a:hover {
+.nb_pers:hover {
 	text-decoration: unset;
 	color: white;
+    background: #02746C;
 }
 
 .right_info {
-	float: right;
+	margin-left: auto;
+    display: flex;
+    align-items: center;
+}
+
+.right_info a{
+    margin-left:10px;
 }
 
-.label_item.sect-date {
+.section_action_menu.ml-auto{
+    margin-left: 5px!important;
+}
+
+.label_item.sect-date, .label_item.sect-mode {
     /* color: #fafafa; */
     /* border: 1px solid #fafafa; */
-    border-right: 1px solid white;
-    border-left: 1px solid white;
-    border-radius: .15rem;
     /* margin: .9rem .2rem .9rem .2rem; */
     padding: .05rem .6rem;
     float: left;
     font-weight: 700;
     /* background-color: #666; */
     font-size: .85rem;
-    line-height: 2.4rem;
+    /*line-height: 2.4rem;*/
     color: #666;
     font-weight: 400;
+    border: 1px solid lightgrey;
+    border-radius: 50px;
+}
+
+.label_item.sect-date{
+    font-style: italic;
+}
+
+.label_item.sect-mode{
+    background: var(--main-color)!important;
+    padding-top: 7px;
+    padding-bottom: 2px;
+    display: flex;
+    align-items: center;
+    border:none;
 }
 
 .label_item.sect-date.prog{
 	background-color:#40aca3;
-	font-weight: bold;
 	color: white;
+    font-weight: 500;
+    padding: 5px 17px;
+    font-weight: 700;
+    font-size: 1rem;
+    border: none;
+    font-style: normal;
+    margin-left: 5px;
+
 }
 
 .iena-description {
-	background: #EEE;
+	
 	color: #323232;
 	padding: 1rem;
 	clear: both;
-	margin-bottom: 0.5rem;
+    display: flex;
+    align-items: baseline;
+    flex-wrap: wrap;
+    border-top: 1px solid #dee2e6;
 }
 
+.iena-description i{
+    color:#2a657d;
+    flex-basis: 3%;
+}
+.format-iena .course-description-item.summarytext{
+    flex-basis: 97%;
+    overflow:hidden;
+    max-height: 144px;
+}
+
+
+
 /* iENA course format header with progression */
 
 
@@ -313,9 +375,12 @@ ul.nav.navbar-nav.ml-auto {
 .iena-course-header > .iena-course-header-bottom {
 	margin-bottom: 40px;
     background: #eaeaea;
-    padding: 15px;
+    padding: 1.5rem;
+    border-radius:10px;
 }
 
+
+
 /* Toggler */
 
 .iena-course-header-toggler {
@@ -347,10 +412,26 @@ ul.nav.navbar-nav.ml-auto {
 
 .iena-progress-header{
 	background-color: #eaeaea;
-    padding: 10px;
+    padding: 15px;
     margin-bottom: 20px;
+    border-radius: 5px;
+}
+
+.iena-progress-header .btn.btn-icon:hover, .iena-progress-header .btn.btn-icon:focus{
+    background:white;
+}
+
+.iena-progress-header h5{
+    margin: 0 7px 0 2px;
 }
 
+.iena-progress-wrapper{
+    display: flex;
+    align-items: center;
+    flex-wrap: wrap;
+    align-items: center;
+
+}
 .progress-wrapper{
 	vertical-align: 8%;
 }
@@ -386,6 +467,7 @@ ul.nav.navbar-nav.ml-auto {
 	width: 17px;
     height: 17px;
     vertical-align: middle;
+    display: inline-block;
     border-radius: 10px;
 }
 
@@ -397,6 +479,9 @@ ul.nav.navbar-nav.ml-auto {
     display: block;
 }
 
+.iena-progress-legend #caption-iena .caption-icons-iena{
+    margin-top: 10px;
+}
 
 
 /* Section progression block */
@@ -594,7 +679,7 @@ ul.nav.navbar-nav.ml-auto {
  #summary-wrapper{
  	padding-left: 1px;
  	display: block;
-	max-height: 7rem;
+	max-height: 144px;
 	height: auto;
 	overflow: hidden;
 	margin-bottom: 5px;
@@ -619,7 +704,7 @@ ul.nav.navbar-nav.ml-auto {
 
 
 
-#days-text{
+span#days-text{
 	margin:0 20px 0 5px;
 }
 
@@ -631,7 +716,7 @@ ul.nav.navbar-nav.ml-auto {
 /* Permet la rotation des entêtes du tableau */
 th.th-rotate {
 	/* Something you can count on */
-	height: 140px;
+	height: 185px;
 	white-space: nowrap;
 	position: sticky;
 	top:0;
@@ -641,16 +726,16 @@ th.th-rotate {
 th.th-rotate > div {
 	transform: 
 	/* Magic Numbers */
-	translate(18px, 53px)
+	/*translate(18px, 53px)*/
+    translate(18px, 74px)
 	/* 45 is really 360 - 45 */
 	rotate(315deg);
 	width: 30px;
 }
 th.th-rotate > div > span {
 	border-bottom: 1px solid #ccc;
-	padding: 5px 10px;
-	padding-bottom: 2px;
-    width: 180px;
+	padding: 0px 3px;
+    width: 240px;
     display: block;
 
 }
@@ -682,32 +767,40 @@ th.th-rotate > div > span {
 	color: white;
 }
 
+
 .state-1 span.icon-progress::after{
-	content: "\f1db";
+	content: "\f10c";
 	font-family: FontAwesome; width: 100%; display: inline-block;text-align: center; 
 	color: white;
-	font-size: x-large;
-	vertical-align: text-bottom;
-    line-height: 19px;
+	font-size: 130%;
+	vertical-align: middle;
+    line-height: 20px;
+    
 }
 
 .state-2 span.icon-progress::after{
 	content: "\f05d";
 	font-family: FontAwesome; width: 100%; display: inline-block; text-align: center;
 	color: white;
-	font-size: x-large;
-	vertical-align: text-bottom;
-    line-height: 19px;
+	font-size: 130%;
+	vertical-align: middle;
+    line-height: 20px;
+    
 }
 .state-3 span.icon-progress::after{
-	content: "\f1db";
+	content: "\f05c";
 	font-family: FontAwesome; width: 100%; display: inline-block; text-align: center;
 	color: white;
-	font-size: x-large;
-	vertical-align: text-bottom;
-    line-height: 19px;
+	font-size: 130%;
+	vertical-align: middle;
+    line-height: 20px;
+   
 }	
 
+#table-body span.icon-progress::after{
+    position: relative;
+    top: -1px;
+}
 .section-progress span.icon-progress::after, .iena-progress-legend span.icon-progress::after{
 	font-size: small;
 	line-height: 17px!important;
@@ -727,6 +820,7 @@ th.th-rotate > div > span {
 .stud_perc {
 	min-width: 45px;
 	display: inline-block;
+    text-align: right;
 }
 
 #table-body td { 
@@ -817,34 +911,40 @@ tbody th{
 }
 
 #caption-iena .caption-status{
-	display: inline-block;
+	display: flex;
 	margin-right: 20px;
+    align-items: center;
 }
 
 #caption-iena .caption-status .pointer-help{
 	width: 32px;
 	height: 25px;
-	margin-right: 2px;
-	display: inline-block;
-	vertical-align: bottom;
+	margin-right: 7px;
+	display: flex;
+    align-items: center;
+    border-radius: 5px;
 }
 
 #caption-iena .caption-status .pointer-help .icon-progress{
-	line-height: 26px;
+    display: flex;
+    margin: auto;
 }
 #caption-iena .caption-status .caption-title{
 	display: inline-block;
 }
 
 #caption-iena{
-	margin-top: 20px;
-	margin-bottom: 40px;
+	margin-top: 50px;
+	margin-bottom: 30px;
 }
 
 #caption-iena .icon-progress::after{
 	
 }
 
+.caption-wrapper{
+    display: flex;
+}
 .iena-icon-distance, .iena-icon-presence{
 	content: "";
 	display: block;
@@ -854,14 +954,14 @@ tbody th{
 .iena-icon-presence::after{
 	content: "\f0c0";
 	font-family: FontAwesome; width: 100%; display: inline-block;text-align: center; 
-	color: black;
+	color: white;
 	font-size: large;
 }
 
 .iena-icon-distance::after{
 	content: "\f108";
 	font-family: FontAwesome; width: 100%; display: inline-block;text-align: center; 
-	color: black;
+	color: white;
 	font-size: large;
 }
 
@@ -879,7 +979,9 @@ tbody th{
   overflow: auto;
   white-space: nowrap;
   max-height: 600px;
-  border:none;
+  border:1px solid lightgrey;
+  border-radius: 5px;
+  padding: 0 10px 10px 10px;
 }
 
 .first-column-iena, .second-column-iena, .actions-column-iena, .third-column-iena{
@@ -900,4 +1002,169 @@ th.first-column-iena, th.second-column-iena, th.actions-column-iena, th.third-co
 
 .iena-message{
 	margin-top: 20px;
-}
\ No newline at end of file
+}
+
+.course-content ul.iena li.section{
+    padding-top: 1rem;
+    padding-bottom: 1rem;
+    background-color: white;
+}
+
+.course-content ul.iena{
+    padding: 0;
+    margin: 0;
+    list-style: none;
+}
+.course-section-header.d-flex{
+    align-items: center;
+}
+
+.iena-filters .input-group .input-group-text{
+    border:none;
+}
+
+.iena-filters .input-group>.custom-select:not(:first-child){
+    border-color: #e9ecef;
+}
+
+#count-selected-students{
+    margin-top: 10px;
+}
+
+.iena-custom-dropdown{
+    border-radius: 0 5px 5px 0;
+    border: 1px solid #e9ecef;
+    min-width: 13rem !important;
+}
+
+.iena-custom-dropdown button{
+    border-radius: 0 5px 5px 0;
+    width: 100%;
+}
+
+.iena-custom-dropdown .dropdown-menu{
+    border-radius: 0 0 0.5rem 0.5rem; 
+    width:100%;
+    max-height: 200px;
+    overflow-y: auto;
+}
+
+.iena-custom-dropdown .dropdown-menu label{
+    justify-content: left!important;
+
+}
+
+.iena-custom-dropdown .dropdown-menu label input[type="checkbox"]{
+    margin: 0 5px 0 7px;
+}
+
+.iena-custom-dropdown .dropdown-text{
+    text-align: left;
+}
+
+.iena-custom-dropdown .dropdown-toggle::after{
+    position: absolute;
+    right: 10px;
+    top: 13px;
+}
+
+.iena-dynamic-options{
+    list-style: none;
+    padding: 0;
+    margin-left: 0;
+}
+
+.iena-dynamic-options label{
+    white-space: nowrap;
+text-overflow: ellipsis;
+width: 94%;
+display: block;
+overflow: hidden;
+}
+
+.dropdown-menu .divider{
+    height: 1px;
+    margin: 9px 0;
+    overflow: hidden;
+    background-color: #e5e5e5;
+}
+
+
+#region-main{
+    overflow-x: visible!important;
+}
+
+.mobile_titre_section, .mobile-bouton-suivi{
+    display: none;
+}
+
+
+
+#fgroup_id_modalite .form-inline.align-items-start.felement{
+    align-items: center !important;
+    padding-top: 0.38rem;
+}
+
+#days-text{
+    margin-right: 10px;
+}
+
+@media only screen and (max-width : 768px) {
+    .mobile_titre_section{
+        display: block;
+        flex-basis: 100%;
+        margin-bottom: 14px;
+padding-bottom: 14px;
+border-bottom: 1px solid #dee2e6;
+
+    }
+
+    .course-section-header{
+        flex-wrap: wrap;
+    }
+    .titre_section, .right_info .sect-date, .nb_pers.set_height.id_groupe0{
+        display: none!important;
+    }
+    .label_item.sect-date.prog{
+        display: block !important;
+        padding: 5px 8px;
+        font-size: 0.90rem;
+    }
+    .d-flex.align-items-start.position-relative{
+        flex-basis: 80%;
+    }
+    .right-info{
+        flex-basis: 15%;
+    }
+    .mobile-bouton-suivi{
+        display: block;
+        min-width: 1rem;
+        padding: 6px 10px 4px 10px;
+        border-radius: 31px;
+    }
+    .iena-icon-distance::after, .iena-icon-presence::after{
+        font-size: initial;
+        
+    }
+    .label_item.sect-mode{
+        padding: 2px 6px;
+    }
+    .mobile-sect-date{
+        float: right!important;
+    }
+    .iena-progress-wrapper .progress-wrapper{
+        flex-basis: 100%;
+    }
+    .iena-progress-wrapper .progress-wrapper .progress{
+        width: 80%;
+        margin:8px auto;
+    }
+    #progress-details .details-progress {
+        order:2;
+    }
+
+    #progress-details .iena-progress-legend{
+        order: 1;
+    }
+} 
+
diff --git a/suivi_unit.php b/suivi_unit.php
index ce8e60d461ad44fd11ddcb013988dd0a39dfcb09..befe60c2b874870f676c679e7c750c5e40c75800 100644
--- a/suivi_unit.php
+++ b/suivi_unit.php
@@ -1,466 +1,373 @@
-<?php
-
-// This file is part of Moodle - http://moodle.org/
-//
-// Moodle is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// Moodle is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-
-/**
- *
- * @package    format_iena
- * @category   format
- * @copyright  2018 Softia/Université lorraine
- * @author     vrignaud camille / Thomas Fradet
- * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
- */
-define('NO_OUTPUT_BUFFERING', true);
-require_once('../../../config.php');
-require_once('view/view_param_indicateur.php');
-require_once('entity/course_format_iena_section_ressources.php');
-require_once('entity/course_format_iena_sections.php');
-require_once('entity/course_format_iena_groups.php');
-$PAGE->requires->css('/course/format/iena/styles.css');
-
-
-global $COURSE, $DB, $USER, $PAGE;
-
-function init_page($course){
-	global $PAGE;
-	// Defines the id of the course with a get parameter
-	
-	// Getting DB information (*)  of the course
-	
-	$PAGE->set_title($course->fullname);
-	$PAGE->set_heading($course->fullname . " – " .get_string('table_progress', 'format_iena'));
-
-	$PAGE->set_pagelayout('incourse');
-
-
-	/* Cache le menu dans le header ?  */
-	$coursenode = $PAGE->navbar->add(get_string('table_progress', 'format_iena'), null, navigation_node::TYPE_CONTAINER, null, 'suiviena');
-	$coursenode->make_active();
-	$coursenode->force_open();
-
-}
-
-function get_groups($context, $active_group_id, $progress, $groups){
-	global $USER, $COURSE;
-	/* Groupe du GET provenant du sélecteur de la page du cours, ou premier groupe de l'utilisateur, ou groupe 0 (tous les groupes). */
-	$groups_all=new StdClass();
-	// @TODO à supprimer si pas utilisé dans le JS (mettre dans la clause IF pour éviter un appel inutile si le GET existe)
-	$current_user_groups_ids = groups_get_user_groups($COURSE->id, $USER->id)[0];
-	$current_user_groups=[];
-	$other_groups=[];
-	/* Si pas de groupe dans le get ou groupe 0 (tous) mais pas le droit => premier groupe existant du user ou groupe 0 (tous) */
-	if ($active_group_id == NULL || ($active_group_id == 0 && !has_capability('course/iena:suivi_edit', $context, $USER->id)) ) {
-		
-		if ( count($current_user_groups_ids) == 0 ) {
-			$active_group_id = 0;
-		} else {
-			
-			
-			$active_group_id = $current_user_groups_ids[0];
-		}
-	}
-	/* Groupes du cours avec id, nom et liste des id utilisateur de tous les membres (3 clefs d'un tableau de groupes : id, name, member) */
-	
-
-	//$current_user_groups = [];
-	$active_group_name = "";
-	
-	foreach ($groups as $group) {
-		/* Récupération du nom du group actif au passage */
-		if ( $group->id == $active_group_id ) {
-			$active_group_name = $group->name;
-
-			$group->selected='selected';
-		}
-		/*
-		foreach ($current_user_groups_ids as $ugi) {
-			if ( $group->id == $ugi ) {
-				$current_user_groups[] = $group;
-			}
-			else{
-				$other_groups[]=$group;
-			}
-		}*/
-		if ( in_array($group->id, $current_user_groups_ids)){
-			$current_user_groups[] = $group;
-		}
-		else{
-			$other_groups[]=$group;
-		}
-}
-
-	//Réservé pour l'export ?
-	/*if ( $active_group_id == 0 ) {
-		foreach ($progress as $prog) {
-
-			
-			$prog->groups = "";
-			foreach ($groups as $group) {
-				if ( in_array($prog->id, $group->members) ) {
-					$prog->groups .= $group->name . " ";
-				}
-			}
-		}
-	}*/
-	$groups_all->groups=$other_groups;
-	$groups_all->current_user_groups=$current_user_groups;
-	return $groups_all;
-
-}
-
-//Formate l'achèvement d'activités pour le tableau de suivi. Pour chaque étudiant, on aura dans le bon ordre la liste des modules et le completionstate
-function format_progress($progress, $modules, $groups, $active_group_id, $active_section_id){
-	global $CFG, $COURSE;
-	$students=array();
-	foreach ($progress as $prog_info) {
-		$progress_student=new StdClass();
-		$progress_student->firstname=$prog_info->firstname;
-		$progress_student->lastname=$prog_info->lastname;
-		//$progress_student->name=$prog_info->firstname." ".$prog_info->lastname;
-		$progress_student->id=$prog_info->id;
-		$progress_student->email=$prog_info->email;
-		$progress_student->progress=array();
-		$progress_student->report_link=$CFG->wwwroot . "/report/outline/user.php?id=" . $progress_student->id . "&course=" . $COURSE->id . "&mode=outline";
-		$progress_student->message_link=$CFG->wwwroot . "/message/index.php?id=" . $progress_student->id;
-
-
-		if ( $active_group_id == 0 ) {	
-			$progress_student->groups = "";
-			foreach ($groups as $group) {
-				if ( in_array($progress_student->id, $group->members) ) {
-					$progress_student->groups .= $group->name . " ";
-				}
-			}
-		}
-
-
-		foreach($modules as $key=>$module){
-			
-			$module_progress=new StdClass();
-			
-			if(!isset($prog_info->progress[$module->id])){
-				
-				$module_progress->completionstate='0';
-			}
-			else{
-				$module_progress->completionstate=$prog_info->progress[$module->id]->completionstate;
-			}
-			/*if($module->section == $active_section_id || $active_section_id == 0){
-				$module_progress->visible=true;
-			}
-			else{
-				$module_progress->visible=false;
-			}*/
-			$module_progress->namemodule=$module->name;
-			$module_progress->idmodule=$module->id;
-			
-			$progress_student->progress[$key]=$module_progress;
-		}
-
-		$students[]=$progress_student;
-	}
-
-	return $students;
-	
-}
-
-
-function get_activities($completion, $active_section_id){
-	$activities = $completion->get_activities();
-	$modules = [];
-	foreach ($activities as $activity) {
-		$module = new StdClass();
-		$module->id = $activity->id;
-		$module->name = $activity->name;
-		$displayname = format_string($activity->name, true, array('context' => $activity->context));
-		$module->displayname = strlen($displayname) > 20 ? mb_substr($displayname, 0, 19, 'UTF-8').'…' : $displayname;
-		$module->section = $activity->section;
-		$modules[] = $module;
-		if($activity->section == $active_section_id || $active_section_id==0 ){
-			$module->visible=true;
-		}
-		else{
-			$module->visible=false;
-		}
-		
-	}
-	return $modules;
-}
-
-function get_sections($active_section_id){
-	global $COURSE;
-	// Liste des sections du cours
-	$modinfo = get_fast_modinfo($COURSE->id);
-	$sections_info_all = $modinfo->get_section_info_all();
-	$sections = [];
-
-	
-
-
-	foreach ($sections_info_all as $key => $section_info) {
-		$section = new StdClass();
-		$section->id = $section_info->id;
-		$section->name = $section_info->name === NULL || $section_info->name === '' ? 'Section ' . $key : $section_info->name;
-		if($section->id==$active_section_id){
-			$section->selected="selected";
-		}
-
-		$sections[] = $section;
-
-	}
-	return $sections;
-}
-
-
-
-
-function set_filters($data, $filters, $symbols, $sections, $groups, $current_user_groups, $active_group_name, $active_section_id){
-	
-	if (isset($_GET['filter'])) {
-		$filterComplete = $_GET['filter'];
-		$symbols[substr($filterComplete, 0, 1)]->selected="selected";
-		$filters[substr($filterComplete, 1)]->selected="selected";
-	} else {
-		$filters["0"]->selected="selected";
-		$symbols["≥"]->selected="selected";
-	}
-
-
-	$data['filters']=array_values($filters);
-	$data['symbols']=array_values($symbols);
-	$data["sections"]=$sections;
-	$data["groups"]=array_values($groups);
-	$data['current_user_groups']=$current_user_groups;
-	//$data['active_section_id']=$active_section_id;
-
-	if($active_group_name==""){
-		$data['default_group']='selected';	
-	}
-
-
-	$data['data']=array();
-	$data['data']["sections"]=$sections;
-	$data['data']["groups"]=array_values($groups);
-	$data['data']['current_user_groups']=$current_user_groups;
-	$data['data']['active_group_name']=$active_group_name;
-	$data['data']['active_section_id']=$active_section_id;
-
-	return $data;
-}
-
-function set_data($data, $modules, $progress, $groups, $active_group_id, $active_section_id){
-	
-	global $COURSE, $USER, $CFG;
-
-
-
-
-	$data["modules"]=$modules;
-	$count_modules=count($data["modules"]);
-
-	$data["students"]=format_progress($progress, $modules, $groups, $active_group_id, $active_section_id);
-	$count_students=count($data["students"]);
-
-	if($count_students>0 && $count_modules>0){
-		$data['count_results']=count($data["students"]);
-	}
-	
-
-	if (has_capability('course/iena:suivi_edit', $context = context_course::instance($COURSE->id), $USER->id)) {
-		$data['link_bulkcompletion']= $CFG->wwwroot . "/course/bulkcompletion.php?id=" . $COURSE->id;
-	}
-
-	$data['link_classicview']= $CFG->wwwroot . "/report/progress/index.php?course=" . $COURSE->id;
-
-
-	//Pour le téléchargement du tableau ?
-	if(!isset($data['data'])){
-		$data['data']=array();
-	}
-	
-
-	$data['data']=json_encode($data);
-	
-
-
-	return $data;
-
-
-}
-
-$filters=[
-	"0"=>(object)[
-		"value"=>"0",
-		"name"=>"0",
-	],
-	"25"=>(object)[
-		"value"=>"25",
-		"name"=>"25%",
-	],
-	"50"=>(object)[
-		"value"=>"50",
-		"name"=>"50%",
-	],
-	"75"=>(object)[
-		"value"=>"75",
-		"name"=>"75%",
-	],
-	"100"=>(object)[
-		"value"=>"100",
-		"name"=>"100%",
-	]
-	,
-	
-];
-
-$symbols=[
-	"="=>(object)[
-		"value"=>"=",
-		"name"=>"=",
-	],
-	"<"=>(object)[
-		"value"=>"<",
-		"name"=>"<",
-	],
-	">"=>(object)[
-		"value"=>">",
-		"name"=>">",
-	],
-	"≤"=>(object)[
-		"value"=>"≤",
-		"name"=>"≤",
-	],
-	"≥"=>(object)[
-		"value"=>"≥",
-		"name"=>"≥",
-	]
-];
-
-
-
-$courseID = required_param('courseid', PARAM_INT);
-// Define the url of the view
-$url = new moodle_url('/course/format/iena/suivi_unit.php', array('courseid' => $courseID));
-
-
-$PAGE->set_url($url);
-
-
-
-$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
-require_login($course);
-
-require_once($CFG->libdir . '/completionlib.php');
-$completion = new completion_info($course);
-$context = context_course::instance($COURSE->id);
-
-// if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseID), $USER->id)) {
-if (!has_capability('course/iena:suivi', $context = context_course::instance($courseID), $USER->id)) {
-	$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-	header("Location: {$link}");
-	exit;
-}
-
-
-if(isset($_GET['groupid'])){
-	$active_group_id = $_GET['groupid'];
-}
-else{
-	$active_group_id=0;
-}
-
-$progress = $completion->get_progress_all(
-	'',
-	array(),
-	$active_group_id,
-	'u.lastname ASC, u.firstname ASC',
-	'',
-	'',
-	$context
-);
-
-
-$active_section_id=0;
-// Section du get acquise depuis le clic sur l'indicateur dans la page du cours, section depuis laquelle on a cliqué sur le bouton pour voir le suivi. 
-
-if(isset($_GET['sectionid'])){
-	$active_section_id = $_GET['sectionid'];
-}
-
-
-
-if ( $active_group_id == 0 ) {
-	//On récupère les ids des membres parce que dans l'excel on veut savoir qui appartient à quel groupe 
-	//$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
-	$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
-} else {
-	//On ne récupère pas les ids des membres
-	$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', false);
-}
-
-
-
-// If a post is sent trought the page
-/*if ($_POST && !isset($_POST["action"])) {
-	require_once("$CFG->libdir/formslib.php");
-	require_once('view/view_send_message.php');
-	$usersID = $_POST["api_url"];
-	$view = new view_send_message();
-	echo $view->get_content($usersID);
-} else */
-if(isset($_POST['action']) && !empty($_POST['action'])) {
-
-	//Si on change les filtres
-	$data=[];
-	$modules=get_activities($completion, $active_section_id);
-
-	$data=set_data($data, $modules, $progress, $groups, $active_group_id, $active_section_id);
-	echo json_encode($data);
-}
-else {
-
-	init_page($course, $PAGE);
-	echo $OUTPUT->header();
-	$current_user_groups=[];
-	$active_group_name="";
-	$data=[];
-
-	$modules=get_activities($completion, $active_section_id);
-	$groups_all=get_groups($context, $active_group_id, $progress, $groups);
-	
-	if(isset($groups_all->current_user_groups) && !empty($groups_all->current_user_groups)){
-		$current_user_groups=$groups_all->current_user_groups;
-	}
-	$groups=$groups_all->groups;
-	$sections=get_sections($active_section_id);
-	$data=set_filters($data, $filters, $symbols, $sections, $groups, $current_user_groups, $active_group_name, $active_section_id);
-
-	$data=set_data($data, $modules, $progress, $groups, $active_group_id, $active_section_id);
-	
-	if(isset($_GET["msg_success"])){
-		$msg=$_GET["msg_success"];
-		$data["msg_success"]=$msg;
-	}
-
-	$renderer = $PAGE->get_renderer('format_iena');
-	
-	$renderer->display_completion($data);
-	echo $OUTPUT->footer();
-}
-
-
-
-?>
\ No newline at end of file
+<?php
+// This file is part of Moodle - http://moodle.org/
+//
+// Moodle is free software: you can redistribute it and/or modify
+// it under the terms of the GNU General Public License as published by
+// the Free Software Foundation, either version 3 of the License, or
+// (at your option) any later version.
+//
+// Moodle is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+/**
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     vrignaud camille / Thomas Fradet
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+define('NO_OUTPUT_BUFFERING', true);
+require_once('../../../config.php');
+require_once('view/view_param_indicateur.php');
+require_once('entity/course_format_iena_section_ressources.php');
+require_once('entity/course_format_iena_sections.php');
+require_once('entity/course_format_iena_groups.php');
+$PAGE->requires->css('/course/format/iena/styles.css');
+
+global $COURSE, $DB, $USER, $PAGE;
+
+function init_page($course) {
+    global $PAGE;
+    // Defines the id of the course with a get parameter.
+    // Getting DB information (*)  of the course.
+
+    $PAGE->set_title($course->fullname);
+    $PAGE->set_heading($course->fullname . " – " .get_string('table_progress', 'format_iena'));
+    $PAGE->set_pagelayout('incourse');
+
+    // Cache le menu dans le header.
+    $coursenode = $PAGE->navbar->add(get_string('table_progress', 'format_iena'),
+        null, navigation_node::TYPE_CONTAINER, null, 'suiviena');
+    $coursenode->make_active();
+    $coursenode->force_open();
+}
+
+function get_groups($context, $activegroupid, $progress, $groups) {
+    global $USER, $COURSE;
+    // Groupe du GET provenant du sélecteur de la page du cours
+    // ou premier groupe de l'utilisateur, ou groupe 0 (tous les groupes).
+    $groupsall = new StdClass();
+    // TODO à supprimer si pas utilisé dans le JS (mettre dans la clause IF pour éviter un appel inutile si le GET existe).
+    $currentusergroupsids = groups_get_user_groups($COURSE->id, $USER->id)[0];
+    $currentusergroups = [];
+    $othergroups = [];
+    // Si pas de groupe dans le get ou groupe 0 (tous) mais pas le droit => premier groupe existant du user ou groupe 0 (tous).
+    if ($activegroupid == null || ($activegroupid == 0 &&
+        !has_capability('course/iena:suivi_edit', $context, $USER->id)) ) {
+        if ( count($currentusergroupsids) == 0 ) {
+            $activegroupid = 0;
+        } else {
+            $activegroupid = $currentusergroupsids[0];
+        }
+    }
+    // Groupes du cours avec id, nom et liste des id utilisateur de tous les
+    // membres (3 clefs d'un tableau de groupes : id, name, member).
+
+    $activegroupname = "";
+
+    foreach ($groups as $group) {
+        // Récupération du nom du group actif au passage.
+        if ( $group->id == $activegroupid ) {
+            $activegroupname = $group->name;
+            $group->selected = 'selected';
+        }
+        if (in_array($group->id, $currentusergroupsids)) {
+            $currentusergroups[] = $group;
+        } else {
+            $othergroups[] = $group;
+        }
+    }
+
+    $groupsall->groups = $othergroups;
+    $groupsall->current_user_groups = $currentusergroups;
+    return $groupsall;
+
+}
+
+// Formate l'achèvement d'activités pour le tableau de suivi. Pour chaque étudiant, on aura
+// dans le bon ordre la liste des modules et le completionstate.
+function format_progress($progress, $modules, $groups, $activegroupid, $activesectionid) {
+    global $CFG, $COURSE;
+    $students = array();
+    foreach ($progress as $proginfo) {
+        $progressstudent = new StdClass();
+        $progressstudent->firstname = $proginfo->firstname;
+        $progressstudent->lastname = $proginfo->lastname;
+        $progressstudent->id = $proginfo->id;
+        $progressstudent->email = $proginfo->email;
+        $progressstudent->progress = array();
+        $progressstudent->report_link = $CFG->wwwroot . "/report/outline/user.php?id=" .
+            $progressstudent->id . "&course=" . $COURSE->id . "&mode=outline";
+        $progressstudent->message_link = $CFG->wwwroot . "/message/index.php?id=" . $progressstudent->id;
+
+        if ($activegroupid == 0) {
+            $progressstudent->groups = "";
+            foreach ($groups as $group) {
+                if (in_array($progressstudent->id, $group->members)) {
+                    $progressstudent->groups .= $group->name . " ";
+                }
+            }
+        }
+
+        foreach ($modules as $key => $module) {
+            $moduleprogress = new StdClass();
+
+            if (!isset($proginfo->progress[$module->id])) {
+                $moduleprogress->completionstate = '0';
+            } else {
+                $moduleprogress->completionstate = $proginfo->progress[$module->id]->completionstate;
+            }
+            $moduleprogress->namemodule = $module->name;
+            $moduleprogress->idmodule = $module->id;
+
+            $progressstudent->progress[$key] = $moduleprogress;
+        }
+
+        $students[] = $progressstudent;
+    }
+
+    return $students;
+}
+
+function get_activities($completion, $activesectionid) {
+    $activities = $completion->get_activities();
+    $modules = [];
+    foreach ($activities as $activity) {
+        $module = new StdClass();
+        $module->id = $activity->id;
+        $module->name = $activity->name;
+        $displayname = format_string($activity->name, true, array('context' => $activity->context));
+        $module->displayname = strlen($displayname) > 30 ? mb_substr($displayname, 0, 29, 'UTF-8').'…' : $displayname;
+        $module->section = $activity->section;
+        $modules[] = $module;
+        if ($activity->section == $activesectionid || $activesectionid == 0 ) {
+            $module->visible = true;
+        } else {
+            $module->visible = false;
+        }
+    }
+    return $modules;
+}
+
+function get_sections($activesectionid) {
+    global $COURSE;
+    // Liste des sections du cours.
+    $modinfo = get_fast_modinfo($COURSE->id);
+    $sectionsinfoall = $modinfo->get_section_info_all();
+    $sections = [];
+
+    foreach ($sectionsinfoall as $key => $sectioninfo) {
+        $section = new StdClass();
+        $section->id = $sectioninfo->id;
+        $section->name = $sectioninfo->name === null || $sectioninfo->name === '' ? 'Section ' . $key : $sectioninfo->name;
+        if ($section->id == $activesectionid) {
+            $section->selected = "selected";
+        }
+
+        $sections[] = $section;
+    }
+    return $sections;
+}
+
+function set_filters($data, $filters, $symbols, $sections, $groups, $currentusergroups, $activegroupname, $activesectionid) {
+    if (isset($_GET['filter'])) {
+        $filtercomplete = $_GET['filter'];
+        $symbols[mb_substr($filtercomplete, 0, 1, 'UTF-8')]->selected = "selected";
+        $filters[mb_substr($filtercomplete, 1, null, 'UTF-8')]->selected = "selected";
+    } else {
+        $filters["0"]->selected = "selected";
+        $symbols["≥"]->selected = "selected";
+    }
+
+    $data['filters'] = array_values($filters);
+    $data['symbols'] = array_values($symbols);
+    $data["sections"] = $sections;
+    $data["groups"] = array_values($groups);
+    $data['current_user_groups'] = $currentusergroups;
+
+    if ($activegroupname == "") {
+        $data['default_group'] = 'selected';
+    }
+
+    $data['data'] = array();
+    $data['data']["sections"] = $sections;
+    $data['data']["groups"] = array_values($groups);
+    $data['data']['current_user_groups'] = $currentusergroups;
+    $data['data']['active_group_name'] = $activegroupname;
+    $data['data']['active_section_id'] = $activesectionid;
+
+    return $data;
+}
+
+function set_data($data, $modules, $progress, $groups, $activegroupid, $activesectionid) {
+    global $COURSE, $USER, $CFG;
+
+    $data["modules"] = $modules;
+    $countmodules = count($data["modules"]);
+
+    $data["students"] = format_progress($progress, $modules, $groups, $activegroupid, $activesectionid);
+    $countstudents = count($data["students"]);
+
+    if ($countstudents > 0 && $countmodules > 0) {
+        $data['count_results'] = count($data["students"]);
+    }
+
+    if (has_capability('course/iena:suivi_edit', $context = context_course::instance($COURSE->id), $USER->id)) {
+        $data['link_bulkcompletion'] = $CFG->wwwroot . "/course/bulkcompletion.php?id=" . $COURSE->id;
+    }
+
+    $data['link_classicview'] = $CFG->wwwroot . "/report/progress/index.php?course=" . $COURSE->id;
+
+    // Pour le téléchargement du tableau ?
+    if (!isset($data['data'])) {
+        $data['data'] = array();
+    }
+
+    $data['data'] = json_encode($data);
+    return $data;
+}
+
+$filters = [
+    "0" => (object)[
+        "value" => "0",
+        "name" => "0",
+    ],
+    "25" => (object)[
+        "value" => "25",
+        "name" => "25%",
+    ],
+    "50" => (object)[
+        "value" => "50",
+        "name" => "50%",
+    ],
+    "75" => (object)[
+        "value" => "75",
+        "name" => "75%",
+    ],
+    "100" => (object)[
+        "value" => "100",
+        "name" => "100%",
+    ]
+];
+
+$symbols = [
+    "=" => (object)[
+        "value" => "=",
+        "name" => "=",
+    ],
+    "<" => (object)[
+        "value" => "<",
+        "name" => "<",
+    ],
+    ">" => (object)[
+        "value" => ">",
+        "name" => ">",
+    ],
+    "≤" => (object)[
+        "value" => "≤",
+        "name" => "≤",
+    ],
+    "≥" => (object)[
+        "value" => "≥",
+        "name" => "≥",
+    ]
+];
+
+$courseid = required_param('courseid', PARAM_INT);
+// Define the url of the view.
+$url = new moodle_url('/course/format/iena/suivi_unit.php', array('courseid' => $courseid));
+$PAGE->set_url($url);
+
+$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
+require_login($course);
+require_once($CFG->libdir . '/completionlib.php');
+
+$completion = new completion_info($course);
+$context = context_course::instance($COURSE->id);
+
+if (!has_capability('course/iena:suivi', $context = context_course::instance($courseid), $USER->id)) {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
+}
+
+if (isset($_GET['groupid'])) {
+    $activegroupid = $_GET['groupid'];
+} else {
+    $activegroupid = 0;
+}
+
+$progress = $completion->get_progress_all(
+    '',
+    array(),
+    $activegroupid,
+    'u.lastname ASC, u.firstname ASC',
+    '',
+    '',
+    $context
+);
+
+$activesectionid = 0;
+// Section du get acquise depuis le clic sur l'indicateur dans la page du cours,
+// section depuis laquelle on a cliqué sur le bouton pour voir le suivi.
+if (isset($_GET['sectionid'])) {
+    $activesectionid = $_GET['sectionid'];
+}
+
+if ($activegroupid == 0) {
+    // On récupère les ids des membres parce que dans l'excel on veut savoir qui appartient à quel groupe.
+    $groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
+} else {
+    // On ne récupère pas les ids des membres.
+    $groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', false);
+}
+
+// If a post is sent trought the page.
+if (isset($_POST['action']) && !empty($_POST['action'])) {
+    // Si on change les filtres.
+    $data = [];
+    $modules = get_activities($completion, $activesectionid);
+
+    $data = set_data($data, $modules, $progress, $groups, $activegroupid, $activesectionid);
+    echo json_encode($data);
+} else {
+    init_page($course, $PAGE);
+    echo $OUTPUT->header();
+    $data = [];
+    if(!$COURSE->enablecompletion){
+        $data["completion_enabled"]=0;
+        $data["link_enable"]= "<a href='".$CFG->wwwroot . '/course/edit.php?id=' . $courseid."'>sur ce lien</a>";
+    }
+    else{
+        $data["completion_enabled"]=1;
+        $currentusergroups = [];
+        $activegroupname = "";
+        
+
+        $modules = get_activities($completion, $activesectionid);
+        $groupsall = get_groups($context, $activegroupid, $progress, $groups);
+
+        if (isset($groupsall->current_user_groups) && !empty($groupsall->current_user_groups)) {
+            $currentusergroups = $groupsall->current_user_groups;
+        }
+        $groups = $groupsall->groups;
+        $sections = get_sections($activesectionid);
+        $data = set_filters($data, $filters, $symbols, $sections, $groups, $currentusergroups, $activegroupname, $activesectionid);
+        $data = set_data($data, $modules, $progress, $groups, $activegroupid, $activesectionid);
+
+        if (isset($_GET["msg_success"])) {
+            $msg = $_GET["msg_success"];
+            $data["msg_success"] = $msg;
+        }
+
+}
+    
+    $renderer = $PAGE->get_renderer('format_iena');
+    $renderer->display_completion($data);
+    echo $OUTPUT->footer();
+}
diff --git a/suivi_unit_old.php b/suivi_unit_old.php
index b69a4491bdf0fc22d1df55d7ec052fa7c46ce6f9..40ce1f56d521678beede32cdbd9babe154031288 100644
--- a/suivi_unit_old.php
+++ b/suivi_unit_old.php
@@ -1,5 +1,4 @@
 <?php
-
 // This file is part of Moodle - http://moodle.org/
 //
 // Moodle is free software: you can redistribute it and/or modify
@@ -18,7 +17,6 @@
 /**
  *
  * @package    format_iena
- * @category   format
  * @copyright  2018 Softia/Université lorraine
  * @author     vrignaud camille / Thomas Fradet
  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
@@ -32,322 +30,265 @@ require_once('entity/course_format_iena_groups.php');
 
 global $COURSE, $DB, $USER;
 
+// Defines the id of the course with a get parameter.
+$courseid = required_param('courseid', PARAM_INT);
 
-
-// Defines the id of the course with a get parameter
-$courseID = required_param('courseid', PARAM_INT);
-// Define the url of the view
-$url = new moodle_url('/course/format/iena/suivi_unit.php', array('courseid' => $courseID));
-
+// Define the url of the view.
+$url = new moodle_url('/course/format/iena/suivi_unit.php', array('courseid' => $courseid));
 
 $PAGE->set_url($url);
 
-// Getting DB information (*)  of the course
-$course = $DB->get_record('course', array('id' => $courseID), '*', MUST_EXIST);
+// Getting DB information (*)  of the course.
+$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST);
 
-//require_login($course, false, NULL);
 require_login($course);
 $PAGE->set_title($course->fullname);
 $PAGE->set_heading($course->fullname . " – Suivi des étudiants");
 
 $PAGE->set_pagelayout('incourse');
 
-
-/* Cache le menu dans le header ?  */
+// Cache le menu dans le header.
 $coursenode = $PAGE->navbar->add('suiviiena', null, navigation_node::TYPE_CONTAINER, null, 'suiviena');
 $coursenode->make_active();
 $coursenode->force_open();
 
-
-
-
-
 require_once($CFG->libdir . '/completionlib.php');
 $completion = new completion_info($course);
 $context = context_course::instance($COURSE->id);
 
-// if (!has_capability('moodle/course:sectionvisibility', $context = context_course::instance($courseID), $USER->id)) {
-if (!has_capability('course/iena:suivi', $context = context_course::instance($courseID), $USER->id)) {
-	$link = $CFG->wwwroot . '/course/view.php?id=' . $courseID;
-	header("Location: {$link}");
-	exit;
+if (!has_capability('course/iena:suivi', $context = context_course::instance($courseid), $USER->id)) {
+    $link = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
+    header("Location: {$link}");
+    exit;
 }
-//$PAGE->requires->js_call_amd('format_iena/suivi', 'init');
-
-
 
 echo $OUTPUT->header();
 
-/*$filters = [
-	"all" => "Tous",
-	"=100" => "100%",
-	"=0" => "0%",
-	"<100" => "&lt;100%",
-	"<50" => "&lt;50%",
-	"<25" => "&lt;25%",
-	">50" => "&gt;=50%",
-	">25" => "&gt;=25%",
-	">0" => "&gt;0%",
-];*/
-
-$filters=[
-	"0"=>array(
-		"value"=>"all",
-		"name"=>"Tous",
-	),
-	"1"=>array(
-		"value"=>"=100%",
-		"name"=>"100%",
-	),
-	"2"=>array(
-		"value"=>"=0",
-		"name"=>"0",
-	),
-	"3"=>array(
-		"value"=>"<100",
-		"name"=>"<100%",
-	),
-	"4"=>array(
-		"value"=>"<50",
-		"name"=>"<50%",
-	),
-	"5"=>array(
-		"value"=>"<25",
-		"name"=>"<25%",
-	),
-	"6"=>array(
-		"value"=>">50",
-		"name"=>">=50%",
-	),
-	"7"=>array(
-		"value"=>">25",
-		"name"=>">=25%",
-	),
-	"8"=>array(
-		"value"=>"0",
-		"name"=>">0%",
-	),
-];
-
 
+$filters = [
+    "0" => array(
+        "value" => "all",
+        "name" => "Tous",
+    ),
+    "1" => array(
+        "value" => "=100%",
+        "name" => "100%",
+    ),
+    "2" => array(
+        "value" => "=0",
+        "name" => "0",
+    ),
+    "3" => array(
+        "value" => "<100",
+        "name" => "<100%",
+    ),
+    "4" => array(
+        "value" => "<50",
+        "name" => "<50%",
+    ),
+    "5" => array(
+        "value" => "<25",
+        "name" => "<25%",
+    ),
+    "6" => array(
+        "value" => ">50",
+        "name" => ">=50%",
+    ),
+    "7" => array(
+        "value" => ">25",
+        "name" => ">=25%",
+    ),
+    "8" => array(
+        "value" => "0",
+        "name" => ">0%",
+    ),
+];
 
-/* Groupe du GET provenant du sélecteur de la page du cours, ou premier groupe de l'utilisateur, ou groupe 0 (tous les groupes). */
-if(isset($_GET['groupid'])){
-	$active_group_id = $_GET['groupid'];
-}
-else{
-	$active_group_id=NULL;
+// Groupe du GET provenant du sélecteur de la page du cours, ou premier groupe de l'utilisateur, ou groupe 0 (tous les groupes).
+if (isset($_GET['groupid'])) {
+    $activegroupid = $_GET['groupid'];
+} else {
+    $activegroupid = null;
 }
 
-// @TODO à supprimer si pas utilisé dans le JS (mettre dans la clause IF pour éviter un appel inutile si le GET existe)
-$current_user_groups_ids=array();
-/* Si pas de groupe dans le get ou groupe 0 (tous) mais pas le droit => premier groupe existant du user ou groupe 0 (tous) */
-if ($active_group_id == NULL || ($active_group_id == 0 && !has_capability('course/iena:suivi_edit', $context, $USER->id)) ) {
-	if ( count($current_user_groups_ids) == 0 ) {
-		$active_group_id = 0;
-	} else {
-		$current_user_groups_ids = groups_get_user_groups($COURSE->id, $USER->id)[0];
-		$active_group_id = $current_user_groups_ids[0];
-	}
+// TODO à supprimer si pas utilisé dans le JS (mettre dans la clause IF pour éviter un appel inutile si le GET existe).
+$currentusergroupsids = array();
+// Si pas de groupe dans le get ou groupe 0 (tous) mais pas le droit => premier groupe existant du user ou groupe 0 (tous).
+if ($activegroupid == null || ($activegroupid == 0 && !has_capability('course/iena:suivi_edit', $context, $USER->id)) ) {
+    if (count($currentusergroupsids) == 0) {
+        $activegroupid = 0;
+    } else {
+        $currentusergroupsids = groups_get_user_groups($COURSE->id, $USER->id)[0];
+        $activegroupid = $currentusergroupsids[0];
+    }
 }
 
-/* Groupes du cours avec id, nom et liste des id utilisateur de tous les membres (3 clefs d'un tableau de groupes : id, name, member) */
-if ( $active_group_id == 0 ) {
-	//On récupère les ids des membres
-	//$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
-	$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
+// Groupes du cours avec id, nom et liste des id utilisateur de tous les
+// membres (3 clefs d'un tableau de groupes : id, name, member).
+if ($activegroupid == 0) {
+    // On récupère les ids des membres.
+    $groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', true);
 } else {
-	//On ne récupère pas les ids des membres
-	$groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', false);
+    // On ne récupère pas les ids des membres.
+    $groups = groups_get_all_groups($COURSE->id, 0, 0, 'g.*', false);
 }
 
-$current_user_groups = [];
-$active_group_name = "";
+$currentusergroups = [];
+$activegroupname = "";
 foreach ($groups as $group) {
-	/* Récupération du nom du group actif au passage */
-	if ( $group->id == $active_group_id ) {
-		$active_group_name = $group->name;
-		$group->selected='selected';
-	}
-	foreach ($current_user_groups_ids as $ugi) {
-		if ( $group->id == $ugi ) {
-			$current_user_groups[] = $group;
-		}
-	}
+    // Récupération du nom du group actif au passage.
+    if ($group->id == $activegroupid) {
+        $activegroupname = $group->name;
+        $group->selected = 'selected';
+    }
+    foreach ($currentusergroupsids as $ugi) {
+        if ($group->id == $ugi) {
+            $currentusergroups[] = $group;
+        }
+    }
 }
 
 
-/* Liste de tous les utilisateurs avec : 
-- informations personnelles (tous les utilisateurs du cours)
-- liste des activités avec état d'achèvement (si achevées, sinon vide) */
+// Liste de tous les utilisateurs avec :
+// - informations personnelles (tous les utilisateurs du cours)
+// - liste des activités avec état d'achèvement (si achevées, sinon vide).
 $progress = $completion->get_progress_all(
-	'',
-	array(),
-	$active_group_id,
-	'u.lastname ASC, u.firstname ASC',
-	'',
-	'',
-	$context
+    '',
+    array(),
+    $activegroupid,
+    'u.lastname ASC, u.firstname ASC',
+    '',
+    '',
+    $context
 );
 
-//Formate l'achèvement d'activités pour le tableau de suivi. Pour chaque étudiant, on aura dans le bon ordre la liste des modules et le completionstate
-function format_progress($progress, $modules){
-	global $CFG, $COURSE;
-	$students=array();
-	foreach ($progress as $prog_info) {
-		$progress_student=new StdClass();
-		$progress_student->name=$prog_info->firstname." ".$prog_info->lastname;
-		$progress_student->id=$prog_info->id;
-		$progress_student->email=$prog_info->email;
-		$progress_student->progress=array();
-		$progress_student->report_link=$CFG->wwwroot . "/report/outline/user.php?id=" . $progress_student->id . "&course=" . $COURSE->id . "&mode=outline";
-		$progress_student->message_link=$CFG->wwwroot . "/message/index.php?id=" . $progress_student->id;
-		foreach($modules as $key=>$module){
-			
-			$module_progress=new StdClass();
-			
-			if(!isset($prog_info->progress[$module->id])){
-				
-				$module_progress->completionstate='0';
-			}
-			else{
-				$module_progress->completionstate=$prog_info->progress[$module->id]->completionstate;
-			}
-			$module_progress->namemodule=$module->name;
-			
-			$progress_student->progress[$key]=$module_progress;
-		}
-
-		$students[]=$progress_student;
-	}
-	return $students;
-	
+// Formate l'achèvement d'activités pour le tableau de suivi.
+// Pour chaque étudiant, on aura dans le bon ordre la liste des modules et le completionstate.
+function format_progress($progress, $modules) {
+    global $CFG, $COURSE;
+    $students = array();
+    foreach ($progress as $proginfo) {
+        $progressstudent = new StdClass();
+        $progressstudent->name = $proginfo->firstname." ".$proginfo->lastname;
+        $progressstudent->id = $proginfo->id;
+        $progressstudent->email = $proginfo->email;
+        $progressstudent->progress = array();
+        $progressstudent->report_link = $CFG->wwwroot . "/report/outline/user.php?id=" .
+            $progressstudent->id . "&course=" . $COURSE->id . "&mode=outline";
+        $progressstudent->message_link = $CFG->wwwroot . "/message/index.php?id=" . $progressstudent->id;
+        foreach ($modules as $key => $module) {
+            $moduleprogress = new StdClass();
+            if (!isset($proginfo->progress[$module->id])) {
+                $moduleprogress->completionstate = '0';
+            } else {
+                $moduleprogress->completionstate = $proginfo->progress[$module->id]->completionstate;
+            }
+            $moduleprogress->namemodule = $module->name;
+            $progressstudent->progress[$key] = $moduleprogress;
+        }
+        $students[] = $progressstudent;
+    }
+    return $students;
 }
 
-/* Ajoute les groupes de l'utilisateur pour l'afficher dans l'export */
-/* Si le user a le droit d'afficher pour tous les groupes ou qu'il n'y en a pas, on récupère le groupe de l'utilisateur pour qu'il puisse être téléchargé dans le tableau blobal intergroupe. */
-if ( $active_group_id == 0 ) {
-	foreach ($progress as $prog) {
-
-		
-		$prog->groups = "";
-		foreach ($groups as $group) {
-			if ( in_array($prog->id, $group->members) ) {
-				$prog->groups .= $group->name . " ";
-			}
-		}
-	}
+// Ajoute les groupes de l'utilisateur pour l'afficher dans l'export
+// Si le user a le droit d'afficher pour tous les groupes ou qu'il n'y en a pas,
+// on récupère le groupe de l'utilisateur pour qu'il puisse être téléchargé dans le tableau blobal intergroupe.
+if ($activegroupid == 0) {
+    foreach ($progress as $prog) {
+        $prog->groups = "";
+        foreach ($groups as $group) {
+            if (in_array($prog->id, $group->members)) {
+                $prog->groups .= $group->name . " ";
+            }
+        }
+    }
 }
 
-/* Liste de toutes les activités du cours (sauf en attente de suppression). La liste est épurée et constitue un tableau d'objet. */
+// Liste de toutes les activités du cours (sauf en attente de suppression). La liste est épurée et constitue un tableau d'objet.
 $activities = $completion->get_activities();
 $modules = [];
 foreach ($activities as $activity) {
-	$module = new StdClass();
-	$module->id = $activity->id;
-	$module->name = $activity->name;
-	$displayname = format_string($activity->name, true, array('context' => $activity->context));
-	$module->displayname = strlen($displayname) > 20 ? mb_substr($displayname, 0, 19, 'UTF-8').'…' : $displayname;
-	$module->section = $activity->section;
-	$modules[] = $module;
+    $module = new StdClass();
+    $module->id = $activity->id;
+    $module->name = $activity->name;
+    $displayname = format_string($activity->name, true, array('context' => $activity->context));
+    $module->displayname = strlen($displayname) > 20 ? mb_substr($displayname, 0, 19, 'UTF-8').'…' : $displayname;
+    $module->section = $activity->section;
+    $modules[] = $module;
 }
 
-// Liste des sections du cours
+// Liste des sections du cours.
 $modinfo = get_fast_modinfo($COURSE->id);
-$sections_info_all = $modinfo->get_section_info_all();
+$sectionsinfoall = $modinfo->get_section_info_all();
 $sections = [];
 
-// Section du get acquise depuis le clic sur l'indicateur dans la page du cours, section depuis laquelle on a cliqué sur le bouton pour voir le suivi. 
-
-if(isset($_GET['sectionid'])){
-	$active_section_id = $_GET['sectionid'];
-}
-else{
-	$active_section_id=0;
+// Section du get acquise depuis le clic sur l'indicateur dans la page du cours,
+// section depuis laquelle on a cliqué sur le bouton pour voir le suivi.
+if (isset($_GET['sectionid'])) {
+    $activesectionid = $_GET['sectionid'];
+} else {
+    $activesectionid = 0;
 }
 
+foreach ($sectionsinfoall as $key => $sectioninfo) {
+    $section = new StdClass();
+    $section->id = $sectioninfo->id;
+    $section->name = $sectioninfo->name === null || $sectioninfo->name === '' ? 'Section ' . $key : $sectioninfo->name;
+    if ($section->id == $activesectionid) {
+        $section->selected = "selected";
+    }
 
-foreach ($sections_info_all as $key => $section_info) {
-	$section = new StdClass();
-	$section->id = $section_info->id;
-	$section->name = $section_info->name === NULL || $section_info->name === '' ? 'Section ' . $key : $section_info->name;
-	if($section->id==$active_section_id){
-		$section->selected="selected";
-	}
-
-	$sections[] = $section;
-
+    $sections[] = $section;
 }
 
-
-
-// Filtre actif si il existe (si la page est rechargée pour un filtre de groupe p.ex.)
+// Filtre actif si il existe (si la page est rechargée pour un filtre de groupe p.ex.).
 if (isset($_GET['filter'])) {
-	$filter = $_GET['filter'];
+    $filter = $_GET['filter'];
 } else {
-	$filter = 'all';
+    $filter = 'all';
 }
 
+// On a récupéré toutes les données, on met ça dans un tableau pour le template.
+$data = array();
+$data['filters'] = $filters;
+$data["sections"] = $sections;
+$data["groups"] = array_values($groups);
+$data['current_user_groups'] = $currentusergroups;
 
-
-
-
-
-
-/*On a récupéré toutes les données, on met ça dans un tableau pour le template*/
-$data=array();
-$data['filters']=$filters;
-$data["sections"]=$sections;
-$data["groups"]=array_values($groups);
-$data['current_user_groups']=$current_user_groups;
-
-if($active_group_name==""){
-	$data['default_group']='selected';	
+if ($activegroupname == "") {
+    $data['default_group'] = 'selected';
 }
 
-$data["modules"]=$modules;
-
-
-$data["students"]=format_progress($progress, $modules);
+$data["modules"] = $modules;
+$data["students"] = format_progress($progress, $modules);
 
 if (has_capability('course/iena:suivi_edit', $context = context_course::instance($COURSE->id), $USER->id)) {
-	$data['link_bulkcompletion']= $CFG->wwwroot . "/course/bulkcompletion.php?id=" . $COURSE->id;
+    $data['link_bulkcompletion'] = $CFG->wwwroot . "/course/bulkcompletion.php?id=" . $COURSE->id;
 }
 
-$data['link_classicview']= $CFG->wwwroot . "/report/progress/index.php?course=" . $COURSE->id;
-
-
+$data['link_classicview'] = $CFG->wwwroot . "/report/progress/index.php?course=" . $COURSE->id;
 
+$data['data'] = array();
+$data['data']["sections"] = $sections;
+$data['data']["groups"] = array_values($groups);
+$data['data']['current_user_groups'] = $currentusergroups;
+$data['data']["modules"] = $modules;
+$data['data']["students"] = format_progress($progress, $modules);
+$data['data'] = json_encode($data['data']);
 
-$data['data']=array();
-$data['data']["sections"]=$sections;
-$data['data']["groups"]=array_values($groups);
-$data['data']['current_user_groups']=$current_user_groups;
-$data['data']["modules"]=$modules;
-$data['data']["students"]=format_progress($progress, $modules);
-$data['data']=json_encode($data['data']);
-
-
-
-// If a post is sent trought the page
+// If a post is sent trought the page.
 if ($_POST && !isset($_POST["action"])) {
-	require_once("$CFG->libdir/formslib.php");
-	require_once('view/view_send_message.php');
-	$usersID = $_POST["api_url"];
-	$view = new view_send_message();
-	echo $view->get_content($usersID);
-} else if(isset($_POST['action']) && !empty($_POST['action'])) {
-   return $data;
-}
-else {
-
-	//require_once('view/view_suivi_unit3.php');
-
-	$renderer = $PAGE->get_renderer('format_iena');
-	$renderer->display_completion($data);
+    require_once("$CFG->libdir/formslib.php");
+    require_once('view/view_send_message.php');
+    $usersid = $_POST["api_url"];
+    $view = new view_send_message();
+    echo $view->get_content($usersid);
+} else if (isset($_POST['action']) && !empty($_POST['action'])) {
+    return $data;
+} else {
+    $renderer = $PAGE->get_renderer('format_iena');
+    $renderer->display_completion($data);
 }
 
-
-
-
-echo $OUTPUT->footer();
\ No newline at end of file
+echo $OUTPUT->footer();
diff --git a/templates/course-header.mustache b/templates/course-header.mustache
index 5202db49444caa420582d80bbc3d4cf18d158251..f0b4013e02a1dcc53a427941c83c0e1230ddedc5 100644
--- a/templates/course-header.mustache
+++ b/templates/course-header.mustache
@@ -46,7 +46,7 @@
 				</div>
 				<div class="col-md-5 iena-progress-legend">
 				<div id="caption-iena"><h5>{{# str }} caption, format_iena {{/ str}}</h5>
-					<div class="">
+					<div class="caption-icons-iena">
 						<div class="caption-status"><div class="pointer-help state-0"><span class="icon-progress"></span></div> <span class="caption-title"> {{# str }} status0, format_iena {{/ str}}</span></div>
 						<div class="caption-status"><div class="pointer-help state-1"><span class="icon-progress"></span></div> <span class="caption-title">{{# str }} status1, format_iena {{/ str}}</span></div>
 						<div class="caption-status"><div class="pointer-help state-2"><span class="icon-progress"></span></div>  <span class="caption-title">{{# str }} status2, format_iena {{/ str}}</span></div>
diff --git a/templates/courseformat/content.mustache b/templates/courseformat/content.mustache
new file mode 100644
index 0000000000000000000000000000000000000000..3c35596e84e8caedda0a46df2a1589f1f3a9453a
--- /dev/null
+++ b/templates/courseformat/content.mustache
@@ -0,0 +1,307 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    @template core_courseformat/local/content
+
+    Displays the complete course format.
+
+    Example context (json):
+    {
+        "initialsection": {
+                "num": 0,
+                "id": 34,
+                "cmlist": {
+                    "cms": [
+                        {
+                            "cmitem": {
+                                "cmformat": {
+                                    "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
+                                    "hasname": "true"
+                                },
+                                "id": 3,
+                                "module": "forum",
+                                "extraclasses": "newmessages"
+                            }
+                        }
+                    ],
+                    "hascms": true
+                },
+                "iscurrent": true,
+                "summary": {
+                    "summarytext": "Summary text!"
+                }
+            },
+        "sections": [
+            {
+                "num": 1,
+                "id": 35,
+                "header": {
+                    "name": "Section title",
+                    "url": "#"
+                },
+                "cmlist": {
+                    "cms": [
+                        {
+                            "cmitem": {
+                                "cmformat": {
+                                    "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Another forum</span></a>",
+                                    "hasname": "true"
+                                },
+                                "id": 3,
+                                "module": "forum",
+                                "extraclasses": "newmessages"
+                            }
+                        }
+                    ],
+                    "hascms": true
+                },
+                "iscurrent": true,
+                "summary": {
+                    "summarytext": "Summary text!"
+                }
+            },
+            {
+                "num": 4,
+                "id": 36,
+                "header": {
+                    "name": "Section 2 title",
+                    "url": "#"
+                },
+                "cmlist": {
+                    "cms": [
+                        {
+                            "cmitem": {
+                                "cmformat": {
+                                    "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
+                                    "hasname": "true"
+                                },
+                                "id": 5,
+                                "module": "forum",
+                                "extraclasses": "newmessages"
+                            }
+                        }
+                    ],
+                    "hascms": true
+                },
+                "iscurrent": true,
+                "summary": {
+                    "summarytext": "Summary text!"
+                }
+            }
+        ],
+        "format": "topics",
+        "title": "Course title example",
+            "hasnavigation": true,
+            "sectionnavigation": {
+            "hasprevious": true,
+            "previousurl": "#",
+            "larrow": "&#x25C4;",
+            "previousname": "Section 3",
+            "hasnext": true,
+            "rarrow": "&#x25BA;",
+            "nexturl": "#",
+            "nextname": "Section 5"
+        },
+        "sectionselector": {
+            "hasprevious": true,
+            "previousurl": "#",
+            "larrow": "&#x25C4;",
+            "previousname": "Section 3",
+            "hasnext": true,
+            "rarrow": "&#x25BA;",
+            "nexturl": "#",
+            "nextname": "Section 5",
+            "selector": "<select><option>Section 4</option></select>"
+        },
+        "sectionreturn": 1,
+        "singlesection": {
+            "num": 1,
+            "id": 35,
+            "header": {
+                "name": "Single Section Example",
+                "url": "#"
+            },
+            "cmlist": {
+                "cms": [
+                    {
+                        "cmitem": {
+                            "cmformat": {
+                                "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Assign example</span></a>",
+                                "hasname": "true"
+                            },
+                            "id": 4,
+                            "module": "assign",
+                            "extraclasses": ""
+                        }
+                    }
+                ],
+                "hascms": true
+            },
+            "iscurrent": true,
+            "summary": {
+                "summarytext": "Summary text!"
+            }
+        }
+    }
+}}
+<div class="iena-course-header">
+        {{#student}}
+        <!--<a href="#" class="btn btn-outline-primary iena-course-h-total" onclick="iena_toggle_course_header(event)">Ma progression : {{progress_total}}%</a>-->
+        <div class="iena-progress-header">
+            <div class="iena-progress-wrapper">
+                <a role="button" data-toggle="collapse" href="#progress-details" aria-expanded="false" aria-controls="progress-details" class="btn btn-icon mr-1 icons-collapse-expand justify-content-center  collapsed" aria-label="Progress">
+                        <span class="expanded-icon icon-no-margin p-2" title="Replier">
+                            <i class="icon fa fa-chevron-down fa-fw " aria-hidden="true"></i>
+                        </span>
+                        <span class="collapsed-icon icon-no-margin p-2" title="Déplier">
+                            <span class="dir-rtl-hide"><i class="icon fa fa-chevron-right fa-fw " aria-hidden="true"></i></span>
+                            <span class="dir-ltr-hide"><i class="icon fa fa-chevron-left fa-fw " aria-hidden="true"></i></span>
+                        </span>
+                    </a>
+                <h5 class="iena-progress-label">{{# str }} my_progress, format_iena {{/ str}}</h5>
+                <div class="progress-wrapper">
+                    <div class="progress">
+                        <div class="progress-bar" role="progressbar" aria-valuenow="{{progress_total}}" style="width:{{progress_total}}%" aria-valuemin="0" aria-valuemax="100"> {{progress_total}}%</div>
+
+                    </div>
+                </div>
+                   <!-- <a class="iena-progress-label" data-toggle="collapse" href="#progress-details" role="button" aria-expanded="false" aria-controls="progress-details"> <i class="fa fa-search-plus"></i> </a>-->
+
+
+                    
+            </div>
+        
+            <div class="iena-course-header-bottom" id="iena-h-bottom" aria-expanded="false" style="">
+                <div class="iena-h-prog-sect collapse row"  id="progress-details">
+                    <div class="details-progress col-md-7">
+                        {{#progress_sections}}
+                            <div class="section-progress">
+                                <a href="#section-{{id}}" class="iena-h-prog-name">{{name}}</a>
+                                <div class="progress-wrapper">
+                                    <div class="progress">
+                                      <div class="progress-bar" role="progressbar" aria-valuenow="{{completion}}" style="width:{{completion}}%" aria-valuemin="0" aria-valuemax="100"></div>
+
+                                    </div>
+                                    <div class="iena-prog-label">{{completion}}%</strong> terminé</div>
+                                </div>
+                                <div class="iena-prog-bubbles">
+                                {{#modules}}
+
+                                    <!-- <a href="{{url}}" class="iena-h-prog-mod-item iena-g-prog-{{completion}}"><span>{{name}}</span></a> -->
+                                    <div class="iena-prog-bubble iena-h-prog-mod-item state-{{completion}}">
+                                        
+                                        <span class="icon-progress"></span>
+                                        <a href="{{url}}" class="iena-prog-link">
+                                            
+                                            <span class="popover-module">{{name}}</span>
+                                        </a>
+                                    </div>
+                                {{/modules}}
+                                </div>
+                                
+                            </div>
+                        {{/progress_sections}}
+                    </div>
+                    <div class="col-md-5 iena-progress-legend">
+                    <div id="caption-iena"><h5>{{# str }} caption, format_iena {{/ str}}</h5>
+                        <div class="caption-icons-iena">
+                            <div class="caption-status"><div class="pointer-help state-0"><span class="icon-progress"></span></div> <span class="caption-title"> {{# str }} status0, format_iena {{/ str}}</span></div>
+                            <div class="caption-status"><div class="pointer-help state-1"><span class="icon-progress"></span></div> <span class="caption-title">{{# str }} status1, format_iena {{/ str}}</span></div>
+                            <div class="caption-status"><div class="pointer-help state-2"><span class="icon-progress"></span></div>  <span class="caption-title">{{# str }} status2, format_iena {{/ str}}</span></div>
+                            <div class="caption-status"><div class="pointer-help state-3"><span class="icon-progress"></span></div>  <span class="caption-title">{{# str }} status3, format_iena {{/ str}}</span></div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+                
+
+            </div>
+        </div>
+        
+        {{/student}}
+
+        {{#summary}}
+        <div class="iena-course-header-bottom" id="" aria-expanded="false">
+            <div id="title-summary-iena">
+                <h3>
+                    {{# str }} aboutcourse, format_iena {{/ str}}
+                </h3>
+                <div class=" my-3" data-for="sectioninfo" style="border-bottom: 1px solid #d1d1d1;"></div>
+                <div id="summary-wrapper">
+                    <div id="summary-collapse" aria-expanded="false">{{{ summary }}}</div>
+                </div>
+
+
+
+
+
+                <a role="button" href="#" onclick="return false" id="button-collapse" aria-expanded="false" aria-controls="summary-collapse">{{# str }} displayInfos, format_iena {{/ str}}</a>
+            </div>
+        </div>
+        {{/summary}}
+</div>
+<div id="{{uniqid}}-course-format">
+    <h2 class="accesshide">{{{title}}}</h2>
+    {{{completionhelp}}}
+    <ul class="{{format}}" data-for="course_sectionlist">
+        {{#initialsection}}
+            {{$ format_iena/courseformat/content/section }}
+                {{> format_iena/courseformat/content/section }}
+            {{/ format_iena/courseformat/content/section }}
+        {{/initialsection}}
+        {{#sections}}
+            {{$ format_iena/courseformat/content/section }}
+                {{> format_iena/courseformat/content/section }}
+            {{/ format_iena/courseformat/content/section }}
+        {{/sections}}
+    </ul>
+    {{#hasnavigation}}
+    <div class="single-section">
+        {{#sectionnavigation}}
+            {{$ core_courseformat/local/content/sectionnavigation }}
+                {{> core_courseformat/local/content/sectionnavigation }}
+            {{/ core_courseformat/local/content/sectionnavigation }}
+        {{/sectionnavigation}}
+        <ul class="{{format}}">
+        {{#singlesection}}
+            {{$ format_iena/content/section }}
+                {{> format_iena/content/section }}
+            {{/ format_iena/content/section }}
+        {{/singlesection}}
+        </ul>
+        {{#sectionselector}}
+            {{$ core_courseformat/local/content/sectionselector }}
+                {{> core_courseformat/local/content/sectionselector }}
+            {{/ core_courseformat/local/content/sectionselector }}
+        {{/sectionselector}}
+    </div>
+    {{/hasnavigation}}
+    {{#numsections}}
+        {{$ core_courseformat/local/content/addsection}}
+            {{> core_courseformat/local/content/addsection}}
+        {{/ core_courseformat/local/content/addsection}}
+    {{/numsections}}
+</div>
+{{#js}}
+require(['core_courseformat/local/content'], function(component) {
+    component.init('{{uniqid}}-course-format', {}, {{sectionreturn}});
+});
+require(['format_iena/header'], function(module) {
+    module.registerHeader();
+
+});
+{{/js}}
diff --git a/templates/courseformat/content/section.mustache b/templates/courseformat/content/section.mustache
new file mode 100644
index 0000000000000000000000000000000000000000..857075928f764c881a13e1e40687e9a5a6f0f5da
--- /dev/null
+++ b/templates/courseformat/content/section.mustache
@@ -0,0 +1,109 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    @template core_courseformat/local/content/section
+
+    Displays a course section.
+
+    Note: This template is a wrapper around the section/content template to allow course formats and theme designers to
+    modify parts of the wrapper without having to copy/paste the entire template.
+
+    Example context (json):
+    {
+        "num": 3,
+        "id": 35,
+        "controlmenu": "[tools menu]",
+        "header": {
+            "name": "Section title",
+            "title": "<a href=\"http://moodle/course/view.php?id=5#section-0\">Section title</a>",
+            "url": "#",
+            "ishidden": true
+        },
+        "cmlist": {
+            "cms": [
+                {
+                    "cmitem": {
+                        "cmformat": {
+                            "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
+                            "hasname": "true"
+                        },
+                        "id": 3,
+                        "module": "forum",
+                        "anchor": "activity-3",
+                        "extraclasses": "newmessages"
+                    }
+                },
+                {
+                    "cmitem": {
+                        "cmformat": {
+                            "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Assign example</span></a>",
+                            "hasname": "true"
+                        },
+                        "id": 4,
+                        "anchor": "activity-4",
+                        "module": "assign",
+                        "extraclasses": ""
+                    }
+                }
+            ],
+            "hascms": true
+        },
+        "ishidden": false,
+        "iscurrent": true,
+        "currentlink": "<span class=\"accesshide\">This topic</span>",
+        "availability": {
+            "info": "<span class=\"badge badge-info\">Hidden from students</span>",
+            "hasavailability": true
+        },
+        "summary": {
+            "summarytext": "Summary text!"
+        },
+        "controlmenu": {
+            "menu": "<a href=\"#\" class=\"d-inline-block dropdown-toggle icon-no-margin\">Edit<b class=\"caret\"></b></a>",
+            "hasmenu": true
+        },
+        "cmcontrols": "[Add an activity or resource]",
+        "iscoursedisplaymultipage": true,
+        "sectionreturnid": 0,
+        "contentcollapsed": false,
+        "insertafter": true,
+        "numsections": 42,
+        "sitehome": false,
+        "highlightedlabel" : "Highlighted"
+    }
+}}
+<li id="section-{{num}}"
+    class="section course-section main {{#onlysummary}} section-summary {{/onlysummary}} clearfix
+            {{#ishidden}} hidden {{/ishidden}} {{#iscurrent}} current {{/iscurrent}}
+            {{#isstealth}} orphaned {{/isstealth}}"
+    data-sectionid="{{num}}"
+    data-sectionreturnid="{{sectionreturnid}}"
+    data-for="section"
+    data-id="{{id}}"
+    data-number="{{num}}"
+>
+
+    <div class="course-section-header d-flex"
+        data-for="section_title"
+        data-id="{{id}}"
+        data-number="{{num}}"
+    >
+        {{$ format_iena/courseformat/content/section/content }}
+            {{> format_iena/courseformat/content/section/content }}
+        {{/ format_iena/courseformat/content/section/content }}
+    </div>
+</li>
diff --git a/templates/courseformat/content/section/content.mustache b/templates/courseformat/content/section/content.mustache
new file mode 100644
index 0000000000000000000000000000000000000000..6e1fe9a1d9d230faf4bdeea6b30258b9885d5294
--- /dev/null
+++ b/templates/courseformat/content/section/content.mustache
@@ -0,0 +1,169 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    @template core_courseformat/local/content/section/content
+
+    The internal content of a section.
+
+    Example context (json):
+    {
+        "num": 3,
+        "id": 35,
+        "controlmenu": "[tools menu]",
+        "header": {
+            "name": "Section title",
+            "title": "<a href=\"http://moodle/course/view.php?id=5#section-0\">Section title</a>",
+            "url": "#",
+            "ishidden": true
+        },
+        "cmlist": {
+            "cms": [
+                {
+                    "cmitem": {
+                        "cmformat": {
+                            "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Forum example</span></a>",
+                            "hasname": "true"
+                        },
+                        "id": 3,
+                        "module": "forum",
+                        "anchor": "activity-3",
+                        "extraclasses": "newmessages"
+                    }
+                },
+                {
+                    "cmitem": {
+                        "cmformat": {
+                            "cmname": "<a class=\"aalink\" href=\"#\"><span class=\"instancename\">Assign example</span></a>",
+                            "hasname": "true"
+                        },
+                        "id": 4,
+                        "anchor": "activity-4",
+                        "module": "assign",
+                        "extraclasses": ""
+                    }
+                }
+            ],
+            "hascms": true
+        },
+        "ishidden": false,
+        "iscurrent": true,
+        "currentlink": "<span class=\"accesshide\">This topic</span>",
+        "availability": {
+            "info": "<span class=\"badge badge-info\">Hidden from students</span>",
+            "hasavailability": true
+        },
+        "summary": {
+            "summarytext": "Summary text!"
+        },
+        "controlmenu": {
+            "menu": "<a href=\"#\" class=\"d-inline-block dropdown-toggle icon-no-margin\">Edit<b class=\"caret\"></b></a>",
+            "hasmenu": true
+        },
+        "cmcontrols": "[Add an activity or resource]",
+        "iscoursedisplaymultipage": true,
+        "sectionreturnid": 0,
+        "contentcollapsed": false,
+        "insertafter": true,
+        "numsections": 42,
+        "sitehome": false,
+        "highlightedlabel" : "Highlighted"
+    }
+}}
+{{#singleheader}}
+{{$ format_iena/courseformat/content/section/header }}
+    {{> format_iena/courseformat/content/section/header }}
+{{/ format_iena/courseformat/content/section/header }}
+{{/singleheader}}
+{{#header}}
+{{$ format_iena/courseformat/content/section/header }}
+    {{> format_iena/courseformat/content/section/header  }}
+{{/ format_iena/courseformat/content/section/header  }}
+{{/header}}
+{{#restrictionlock}}
+    <div class="align-self-center ml-2">
+        {{#pix}}t/unlock, core{{/pix}}
+    </div>
+{{/restrictionlock}}
+<div data-region="sectionbadges" class="sectionbadges d-flex align-items-center">
+    {{$ core_courseformat/local/content/section/badges }}
+        {{> core_courseformat/local/content/section/badges }}
+    {{/ core_courseformat/local/content/section/badges }}
+</div>
+{{#collapsemenu}}
+<div class="flex-fill d-flex justify-content-end mr-2 align-self-start mt-2">
+    <a
+        id="collapsesections"
+        class="section-collapsemenu"
+        href="#"
+        aria-expanded="true"
+        role="button"
+        data-toggle="toggleall"
+    >
+        <span class="collapseall text-nowrap">{{#str}}collapseall{{/str}}</span>
+        <span class="expandall text-nowrap">{{#str}}expandall{{/str}}</span>
+    </a>
+    </div>
+{{/collapsemenu}}
+{{#controlmenu}}
+    {{$ core_courseformat/local/content/section/controlmenu }}
+        {{> core_courseformat/local/content/section/controlmenu }}
+    {{/ core_courseformat/local/content/section/controlmenu }}
+{{/controlmenu}}
+</div>
+<div id="coursecontentcollapse{{num}}"
+    class="content {{^iscoursedisplaymultipage}}
+        {{^sitehome}}course-content-item-content collapse {{^contentcollapsed}}show{{/contentcollapsed}}{{/sitehome}}
+    {{/iscoursedisplaymultipage}}">
+    <div class="{{#hasavailability}}description{{/hasavailability}} my-3" data-for="sectioninfo">
+    {{#summary}}
+        {{#summarytext}}
+        <div class="iena-summary">
+            <div class="iena-description">
+                <i class="fa fa-info-circle" aria-hidden="true"></i>
+                {{$ core_courseformat/local/content/section/summary }}
+                    {{> core_courseformat/local/content/section/summary }}
+                {{/ core_courseformat/local/content/section/summary }}
+                <a href="#" class="voir-plus">Voir la description complète</a>
+            </div>
+     
+        </div>
+        {{/summarytext}}
+    {{/summary}}
+    {{#availability}}
+        {{$ core_courseformat/local/content/section/availability }}
+            {{> core_courseformat/local/content/section/availability }}
+        {{/ core_courseformat/local/content/section/availability }}
+    {{/availability}}
+</div>
+{{#cmsummary}}
+    {{$ core_courseformat/local/content/section/cmsummary }}
+        {{> core_courseformat/local/content/section/cmsummary }}
+    {{/ core_courseformat/local/content/section/cmsummary }}
+{{/cmsummary}}
+{{#cmlist}}
+    {{$ core_courseformat/local/content/section/cmlist }}
+        {{> core_courseformat/local/content/section/cmlist }}
+    {{/ core_courseformat/local/content/section/cmlist }}
+{{/cmlist}}
+{{{cmcontrols}}}
+{{#insertafter}}
+    {{#numsections}}
+        {{$ core_courseformat/local/content/addsection}}
+            {{> core_courseformat/local/content/addsection}}
+        {{/ core_courseformat/local/content/addsection}}
+    {{/numsections}}
+{{/insertafter}}
diff --git a/templates/courseformat/content/section/header.mustache b/templates/courseformat/content/section/header.mustache
new file mode 100644
index 0000000000000000000000000000000000000000..eeb3df42950fd7b9d0b567fa5973bc4e354581dd
--- /dev/null
+++ b/templates/courseformat/content/section/header.mustache
@@ -0,0 +1,130 @@
+{{!
+    This file is part of Moodle - http://moodle.org/
+
+    Moodle is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Moodle is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
+}}
+{{!
+    @template core_courseformat/local/content/section/header
+
+    Displays a course section header.
+
+    Example context (json):
+    {
+        "id": 123,
+        "name": "Section title",
+        "title": "<a href=\"http://moodle/course/view.php?id=5#section-0\">Section title</a>",
+        "url": "#",
+        "headerdisplaymultipage": true,
+        "editing": 0
+    }
+}}
+{{#headerdisplaymultipage}}
+    <h3 id="sectionid-{{id}}-title" class="sectionname">
+        {{{title}}}
+    </h3>
+{{/headerdisplaymultipage}}
+{{^headerdisplaymultipage}}
+    {{#sitehome}}
+        <h2 id="sectionid-{{id}}-title" class="sectionname">
+            {{{title}}}
+        </h2>
+    {{/sitehome}}
+    {{^sitehome}}
+        {{#mode}}
+            
+            {{#presence}}
+            <div class="mobile_titre_section">
+                <div class="label_item sect-mode">
+                    <span class="iena-icon-presence" data-toggle="tooltip" data-placement="top" title="{{#str}} in_presence, format_iena {{/str}}"></span>
+                </div>
+            
+                {{#date}}
+                    <div class="label_item mobile-sect-date sect-date">
+                        {{date}}
+                    </div>
+                {{/date}}
+
+            </div>
+            <div class="titre_section set_height">
+                <div class="label_item sect-mode">
+                    <span class="iena-icon-presence" data-toggle="tooltip" data-placement="top" title="{{#str}} in_presence, format_iena {{/str}}"></span>
+                </div>
+            </div>
+            {{/presence}}
+            {{#distance}}
+            <div class="titre_section set_height">
+                <div class="label_item sect-mode">
+                    <span class="iena-icon-distance" data-toggle="tooltip" data-placement="top" title="{{#str}} not_presence, format_iena {{/str}}"></span>
+                </div>
+
+            </div>
+            <div class="mobile_titre_section">
+                <div class="label_item sect-mode">
+                    <span class="iena-icon-distance" data-toggle="tooltip" data-placement="top" title="{{#str}} not_presence, format_iena {{/str}}"></span>
+                </div>
+            
+                {{#date}}
+                    <div class="label_item mobile-sect-date sect-date">
+                        {{date}}
+                    </div>
+                {{/date}}
+            </div>
+            {{/distance}}
+        {{/mode}}
+        <div class="d-flex align-items-start position-relative">
+            <a role="button" data-toggle="collapse"
+               href="#coursecontentcollapse{{num}}"
+               id="collapssesection{{num}}"
+               aria-expanded="{{^contentcollapsed}}true{{/contentcollapsed}}{{#contentcollapsed}}false{{/contentcollapsed}}"
+               aria-controls="coursecontentcollapse{{num}}"
+               class="btn btn-icon mr-1 icons-collapse-expand justify-content-center
+                   {{^editing}} stretched-link {{/editing}}
+                   {{#contentcollapsed}} collapsed {{/contentcollapsed}}"
+               aria-label="{{name}}">
+            <span class="expanded-icon icon-no-margin p-2" title="{{#str}} collapse, core {{/str}}">
+                {{#pix}} t/expandedchevron, core {{/pix}}
+            </span>
+            <span class="collapsed-icon icon-no-margin p-2" title="{{#str}} expand, core {{/str}}">
+                <span class="dir-rtl-hide">{{#pix}} t/collapsedchevron, core {{/pix}}</span>
+                <span class="dir-ltr-hide">{{#pix}} t/collapsedchevron_rtl, core {{/pix}}</span>
+            </span>
+            </a>
+            <h3 class="sectionname course-content-item d-flex align-self-stretch align-items-center mb-0"
+                id="sectionid-{{id}}-title" data-for="section_title" data-id="{{id}}" data-number="{{num}}">
+                {{{title}}}
+            </h3>
+        </div>
+
+        
+        <div class="right_info">
+        
+        {{#date}}
+            <div class="label_item sect-date">
+                {{date}}
+            </div>
+        {{/date}}
+
+        {{#link_suivi}}
+            <a href='{{link_suivi}}' style='color : white'>
+                <div style="display:block;" class="nb_pers set_height id_groupe0">Suivi étudiant</div>
+                <div class="nb_pers set_height mobile-bouton-suivi"><i class="fa fa-tasks"></i></div>
+
+            </a>
+        {{/link_suivi}}
+        {{#progress}}
+            <div class="label_item sect-date prog" >{{progress}}%</div>
+        {{/progress}}
+         </div>
+    {{/sitehome}}
+{{/headerdisplaymultipage}}
diff --git a/templates/section.mustache b/templates/section.mustache
index bd3717d07567811bb40bbfa6c30ff491b588f00f..b9b134a75da1aef97f049a6e9afdf9d060b81232 100644
--- a/templates/section.mustache
+++ b/templates/section.mustache
@@ -35,9 +35,9 @@
 
 					</a>
 				{{/link_suivi}}
-				{{#section_progress}}
+				{{#progress_exists}}
 					<div class="label_item sect-date prog" >{{section_progress}}%</div>
-				{{/section_progress}}
+				{{/progress_exists}}
 				
 
 			</div>
diff --git a/templates/sections.mustache b/templates/sections.mustache
index 51fa14915c807c29fe57e69139a64a1308e927ca..3c5c3427de279a63fc87718735df25c3d14edb23 100644
--- a/templates/sections.mustache
+++ b/templates/sections.mustache
@@ -1,10 +1,10 @@
 
 <ul class="iena-editing">
 	<div class="iena-course-header"></div>
-	<!--<div class="iena-caption-sections">
+	<div class="iena-caption-sections">
 		<div class="iena-caption-icons"><span class="iena-icon-presence"></span>{{#str}} in_presence, format_iena {{/str}}</div>
 	 <div class="iena-caption-icons"><span class="iena-icon-distance"></span>{{#str}} not_presence, format_iena {{/str}}</div>
-	</div>-->
+	</div>
 	{{#sections}}
 		{{> format_iena/section}}
 	{{/sections}}
diff --git a/templates/suivi-table.mustache b/templates/suivi-table.mustache
index 0c8ddc220885e80748c29099549d65c9b237b896..3d0646a7a00945833142a5f34676769fab741d81 100644
--- a/templates/suivi-table.mustache
+++ b/templates/suivi-table.mustache
@@ -1,5 +1,5 @@
 {{#count_results}}
-	<p>{{count_results}} résultat(s)</p>
+	
 	<div class="table-wrapper">
 		<table id="suivi">
 			<thead>
@@ -28,7 +28,7 @@
 					{{#visible}}
 						<tr data-userid="{{id}}" data-percent={{percentage}}>
 							<td class="first-column-iena">
-								<input type="checkbox" name="checkstudent" value="{{id}}">
+								<input type="checkbox" class="checkstudent" name="checkstudent" value="{{id}}">
 							</td>
 							<td class="second-column-iena">
 								<span class="stud_perc">{{percentage}} %</span>
@@ -53,8 +53,8 @@
 			</tbody>
 		</table>
 	</div>
-	
 
+<p id="count-selected-students">0 résultat(s) sélectionnés sur {{count_results}}</p>
 {{/count_results}}
 {{^count_results}}
 	<div class="alert alert-primary">Il n'y a pas de résultats correspondants aux filtres sélectionnés</div>
diff --git a/templates/suivi.mustache b/templates/suivi.mustache
index 86e3ed54b0d07460c6975a6dae93b5add3471386..d7002c41daf1a0c3e238852b4723fa5c8d2e75d8 100644
--- a/templates/suivi.mustache
+++ b/templates/suivi.mustache
@@ -1,53 +1,33 @@
+{{#completion_enabled}}
 <div>
 
 	<h2 class="mb1" style="display: inline-block;">{{#str}}table_progress, format_iena{{/str}}</h2>
-
-	
-
-
 	<div class="context-header-settings-menu">
         <div class="action-menu moodle-actionmenu d-inline" id="action-menu-3" data-enhance="moodle-core-actionmenu">
-
-        <div class="menubar d-flex " id="action-menu-3-menubar" role="menubar">
-
-           
-
-            <div class="action-menu-trigger">
-                <div class="dropdown">
-                    <a href="#" tabindex="0" class=" dropdown-toggle icon-no-margin" id="action-menu-toggle-3" aria-label="Menu d'actions" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true" aria-controls="action-menu-3-menu">
-                        
-                        
-					<i class="icon fa fa-cog fa-fw " title="Menu d'actions" aria-label="Menu d'actions"></i>                                
-					</a>
-                    <div class="dropdown-menu dropdown-menu-right menu align-tr-br" id="action-menu-3-menu" data-rel="menu-content" aria-labelledby="action-menu-toggle-3" role="menu" data-align="tr-br" x-placement="bottom-end" style="position: absolute; transform: translate3d(-256px, 24px, 0px); top: 0px; left: 0px; will-change: transform;">
-                        {{#link_bulkcompletion}}
-                        <div class="dropdown-item">
-
-					    	<a target="_blank" href="{{link_bulkcompletion}}" class="" role="menuitem"><i class="icon fa fa-cog fa-fw " aria-hidden="true"></i>Paramétrer le suivi</a>
-
-						</div>
-						{{/link_bulkcompletion}}
-						<div class="dropdown-item">
-
-					    	<a href="{{link_classicview}}" class="" role="menuitem"><i class="icon fa fa-pencil fa-fw " aria-hidden="true"></i>Vue classique</a>
-
-						</div>
-					                                           
-	                </div>
-	            </div>
+	        <div class="menubar d-flex " id="action-menu-3-menubar" role="menubar">
+	            <div class="action-menu-trigger">
+	                <div class="dropdown">
+	                    <a href="#" tabindex="0" class=" dropdown-toggle icon-no-margin" id="action-menu-toggle-3" aria-label="Menu d'actions" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="true" aria-controls="action-menu-3-menu">
+							<i class="icon fa fa-cog fa-fw " title="Menu d'actions" aria-label="Menu d'actions"></i>                                
+						</a>
+	                    <div class="dropdown-menu dropdown-menu-right menu align-tr-br" id="action-menu-3-menu" data-rel="menu-content" aria-labelledby="action-menu-toggle-3" role="menu" data-align="tr-br" x-placement="bottom-end" style="position: absolute; transform: translate3d(-256px, 24px, 0px); top: 0px; left: 0px; will-change: transform;">
+	                        {{#link_bulkcompletion}}
+	                        <div class="dropdown-item">
+						    	<a target="_blank" href="{{link_bulkcompletion}}" class="" role="menuitem"><i class="icon fa fa-cog fa-fw " aria-hidden="true"></i>Paramétrer le suivi</a>
+							</div>
+							{{/link_bulkcompletion}}
+							<div class="dropdown-item">
+						    	<a href="{{link_classicview}}" class="" role="menuitem"><i class="icon fa fa-pencil fa-fw " aria-hidden="true"></i>Vue classique</a>
+							</div>                                      
+		                </div>
+		            </div>
+		        </div>
 	        </div>
-
-        </div>
-
+		</div>
 	</div>
 </div>
 
-
-
-
-</div>
-
-<form style="clear: right;" class="form-inline" action="" method="GET">
+<form style="clear: right;" class="form-inline iena-filters" action="" method="GET">
 	<input name="courseid" type="number" hidden="hidden" style="display: none;" value="">
 
 	<label class="sr-only" for="section-select">Section</label>
@@ -56,13 +36,36 @@
 			<div class="input-group-text">Section</div>
 		</div>
 		<select class="custom-select mr-sm-2" id="section-select" name="sectionid">
-			<option value="0">Toutes</option>
+			<option value="0">{{# str }} allActivities, format_iena {{/ str}}</option>
 			{{#sections}}
 				<option {{selected}} value={{id}}>{{name}}</option>
 			{{/sections}}
 		</select>
 	</div>
 
+	<label class="sr-only" for="activity-select">Activités</label>
+	<div class="input-group">
+		<div class="input-group-prepend">
+			<div class="input-group-text">Activités</div>
+		</div>
+		<div class="dropdown mr-sm-2 iena-custom-dropdown">
+			  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"><span class="dropdown-text">{{# str }} allActivities, format_iena {{/ str}}</span>
+			  <span class="caret"></span></button>
+				<ul class="dropdown-menu dropdown-menu-form" id="iena-activities-dropdown">
+				<li><label class="checkbox"><input type="checkbox" class="selectall" checked value='all'>Toutes les activités</label></li>
+				<li class="divider"></li>
+				<ul class="iena-dynamic-options">
+				{{#modules}}
+					{{#visible}}
+  						<li><label class="checkbox"><input type="checkbox" name="options[]" value={{id}} class="option justone">{{displayname}}</label></li>
+  					{{/visible}}
+				{{/modules}}
+				</ul>
+		</ul>
+		</div>
+
+	</div>
+
 	<label class="sr-only" for="group-select">Groupes</label>
 	<div class="input-group">
 		<div class="input-group-prepend">
@@ -110,9 +113,6 @@
 			
 		</select>
 	</div>
-
-
-
 </form>
 {{#msg_success}}
 	<div class="alert alert-success iena-message">Message(s) envoyé(s)</div>
@@ -121,7 +121,7 @@
 	<div class="alert alert-danger  iena-message">Messages non envoyés</div>
 {{/msg_failure}}
 <div id="caption-iena"><h5>{{# str }} caption, format_iena {{/ str}}</h5>
-	<div class="">
+	<div class="caption-wrapper">
 		<div class="caption-status"><div class="pointer-help state-0"><span class="icon-progress"></span></div> <span class="caption-title"> {{# str }} status0, format_iena {{/ str}}</span></div>
 		<div class="caption-status"><div class="pointer-help state-1"><span class="icon-progress"></span></div> <span class="caption-title">{{# str }} status1, format_iena {{/ str}}</span></div>
 		<div class="caption-status"><div class="pointer-help state-2"><span class="icon-progress"></span></div>  <span class="caption-title">{{# str }} status2, format_iena {{/ str}}</span></div>
@@ -157,4 +157,8 @@ require(['format_iena/suivi', 'core/templates'], function(module) {
 		</form>
 		</div>
 	</div>
-</div>
\ No newline at end of file
+</div>
+{{/completion_enabled}}
+{{^completion_enabled}}
+	<div class="alert alert-danger  iena-message">{{# str }} formatenabled, format_iena {{/ str}} {{{link_enable}}}</div>
+{{/completion_enabled}}
\ No newline at end of file
diff --git a/version.php b/version.php
index 035375978cf41f540dbda93b35a0b099dde69a09..517393a120a4a059016322419adfcf6d70898631 100644
--- a/version.php
+++ b/version.php
@@ -13,23 +13,22 @@
 //
 // You should have received a copy of the GNU General Public License
 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
-	
-	/**
-	 * Version details
-	 *
-	 * The iena format plugin add new course format
-	 *
-	 * @package    format_iena
-	 * @category   format
-	 * @copyright  2018 Softia/Université lorraine
-	 * @author     Vrignaud Camille / Lebeau Michael / Thomas fradet
-	 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
-	 */
-	
-	defined('MOODLE_INTERNAL') || die();
-	
-	$plugin->version = 2022062700;
-	$plugin->requires = 2014111000;
-	$plugin->component = 'format_iena';
-	$plugin->release = "1.0";
-	$plugin->maturity = MATURITY_STABLE;
+
+/**
+ * Version details
+ *
+ * The iena format plugin add new course format
+ *
+ * @package    format_iena
+ * @copyright  2018 Softia/Université lorraine
+ * @author     Vrignaud Camille / Lebeau Michael / Thomas fradet
+ * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
+ */
+
+defined('MOODLE_INTERNAL') || die();
+
+$plugin->version = 2023000001;
+$plugin->requires = 2014111000;
+$plugin->component = 'format_iena';
+$plugin->release = "1.0";
+$plugin->maturity = MATURITY_STABLE;
diff --git a/view/subview_param_indic.php b/view/subview_param_indic.php
index 5181d4d635dcf04eaf062048d8aa30feff9cf571..06bca82544fe9fe4a9a2d2ca1720c7cdb1d8c477 100644
--- a/view/subview_param_indic.php
+++ b/view/subview_param_indic.php
@@ -1,82 +1,82 @@
-<script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>
-
-<script>
-    $(document).ready(function () {
-        $('.sectionH').hide();
-        $('.' + $('#select-section').val()).show();
-        $('#select-section').on('change', function () {
-            $('.sectionH').hide();
-            $('.' + this.value).show();
-        });
-    });
-</script>
-
-<form action="/course/format/iena/param_indicateur.php?courseid=<?= $COURSE->id; ?>" method="post">
-	<section class="section" id="params">
-		<div class="\">
-			<h2 class="param"><?php get_string('indic_suivi', 'format_iena') ?></h2>
-			<select class="select" name='select-section' id="select-section">
-				<?php
-					foreach ($sections as $section) {
-						$checked = "";
-						if ($section->id == $_GET['sectionid']) {
-							$checked = "selected";
-						}
-						$content .= "<option value=\"section-" . $section->id . "\" " . $checked . ">" . $section->name . "</option>";
-					}
-				?>
-			</select>
-		</div>
-		<div class="\">
-			<h2 class="param"><?php get_string('check_completion', 'format_iena') ?></h2>
-			<p><?php get_string('for_section_select', 'format_iena') ?></p>
-		</div>
-	</section>
-	<?php
-		foreach ($sections
-		
-		as $section) {
-		$hidden_modules = $this->get_ressource_hide_indicator_new($section->id);
-	?>
-	<section class="section-<?= $section->id ?> sectionH ">
-		<div class="iena-heading_title">
-			<p><?= $section->name ?></p>
-		</div>
-		<?php
-			
-			foreach ($hidden_modules
-			
-			as $hidden_mod) {
-		?>
-
-		<div class="iena-field">
-			<div class="control">
-				<label class="checkbox">
-					<input type="checkbox" name="<?= $hidden_mod->cmid ?> section- <?= $hidden_mod->sectionid ?>
-			<?php
-						if ($hidden_mod->hide == 1) {
-							echo "checked";
-						}
-					?>
-			
-			">
-							<?php
-						$moduleTools->get_ressource_by_id($hidden_mod->cmid);
-						echo $moduleTools->name ?>
-						</label>
-					</div>
-				</div>
-				<?php
-						} ?>
-			</section>
-			<?php
-						}
-						$link_annuler = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $_GET['sectionid'];
-					?>
-	<section>
-		<a id="button" href='<?= $link_annuler?>' class="btn btn_reset big_button" style="font-weight:bold">
-					<i><?= get_string('cancel', 'format_iena')?> </i></a>
-					<button id="button" class="btn btn_blue big_button" style="font-weight:bold;" type="submit"><?= get_string('save', 'format_iena')?> "</i>
-					</button>
-	</section>
+<script type=\"text/javascript\" charset=\"utf8\" src=\"https://code.jquery.com/jquery-3.3.1.min.js\"></script>
+
+<script>
+    $(document).ready(function () {
+        $('.sectionH').hide();
+        $('.' + $('#select-section').val()).show();
+        $('#select-section').on('change', function () {
+            $('.sectionH').hide();
+            $('.' + this.value).show();
+        });
+    });
+</script>
+
+<form action="/course/format/iena/param_indicateur.php?courseid=<?= $COURSE->id; ?>" method="post">
+    <section class="section" id="params">
+        <div class="\">
+            <h2 class="param"><?php get_string('indic_suivi', 'format_iena') ?></h2>
+            <select class="select" name='select-section' id="select-section">
+                <?php
+                    foreach ($sections as $section) {
+                        $checked = "";
+                        if ($section->id == $_GET['sectionid']) {
+                            $checked = "selected";
+                        }
+                        $content .= "<option value=\"section-" . $section->id . "\" " . $checked . ">" . $section->name . "</option>";
+                    }
+                ?>
+            </select>
+        </div>
+        <div class="\">
+            <h2 class="param"><?php get_string('check_completion', 'format_iena') ?></h2>
+            <p><?php get_string('for_section_select', 'format_iena') ?></p>
+        </div>
+    </section>
+    <?php
+        foreach ($sections
+        
+        as $section) {
+        $hidden_modules = $this->get_ressource_hide_indicator_new($section->id);
+    ?>
+    <section class="section-<?= $section->id ?> sectionH ">
+        <div class="iena-heading_title">
+            <p><?= $section->name ?></p>
+        </div>
+        <?php
+            
+            foreach ($hidden_modules
+            
+            as $hidden_mod) {
+        ?>
+
+        <div class="iena-field">
+            <div class="control">
+                <label class="checkbox">
+                    <input type="checkbox" name="<?= $hidden_mod->cmid ?> section- <?= $hidden_mod->sectionid ?>
+            <?php
+                        if ($hidden_mod->hide == 1) {
+                            echo "checked";
+                        }
+                    ?>
+            
+            ">
+                            <?php
+                        $moduleTools->get_ressource_by_id($hidden_mod->cmid);
+                        echo $moduleTools->name ?>
+                        </label>
+                    </div>
+                </div>
+                <?php
+                        } ?>
+            </section>
+            <?php
+                        }
+                        $link_annuler = $CFG->wwwroot . "/course/format/iena/suivi_unit.php?courseid=" . $COURSE->id . "&sectionid=" . $_GET['sectionid'];
+                    ?>
+    <section>
+        <a id="button" href='<?= $link_annuler?>' class="btn btn_reset big_button" style="font-weight:bold">
+                    <i><?= get_string('cancel', 'format_iena')?> </i></a>
+                    <button id="button" class="btn btn_blue big_button" style="font-weight:bold;" type="submit"><?= get_string('save', 'format_iena')?> "</i>
+                    </button>
+    </section>
 </form>
\ No newline at end of file
diff --git a/view/view_course_header.php b/view/view_course_header.php
index da8733d24fdbf8aa1391a15310f4ce06615a70a1..b754dafa3c2d2ef0ced1800d5eaea20211640198 100644
--- a/view/view_course_header.php
+++ b/view/view_course_header.php
@@ -21,11 +21,11 @@ class view_course_header {
 	 * @return type
 	 */
 	public function create_view($progress) {
-		
 		// $this->get_progress_bis($this->section_names, $this->idSection, $this->course);
-		
 		$prog = $progress != false ? $progress : $this->get_progress_bis($this->section_names, $this->idSection, $this->course);
-
+		//var_dump($prog);
+	
+		//var_dump($prog_test);
 		$infos = [
 			'progress' => $prog,
 			'teachers' => $this->get_teachers(),
@@ -39,7 +39,7 @@ class view_course_header {
 	private function get_progress_bis($section_names, $idSection, $course) {
 
 		global $COURSE, $USER, $DB, $CFG;
-
+		
 		$completion = new \completion_info($COURSE);
 		if ( $completion->is_enabled_for_site() == false || $completion->has_activities() == false || $completion->is_enabled() == 0 ) {
 			return false;
@@ -231,6 +231,7 @@ class view_course_header {
 
 	// }
 
+	/*31/03/2023 : Useless
 	private function get_completion_by_section($idSection) {
 		global $COURSE, $USER;
 		$ressources_entity = new course_format_iena_section_ressources();
@@ -249,7 +250,7 @@ class view_course_header {
 			}
 		}
 		return array($modules, $valueTotal);
-	}
+	}*/
 
 	private function get_teachers() {
 		global $COURSE, $CFG, $USER;
@@ -309,7 +310,7 @@ class view_course_header {
 		$course_data=[];
 		$course_data['student']=false;
 		//if user is a student
-		if(!has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id)){
+		if(!has_capability('course/iena:suivi', $context = context_course::instance($COURSE->id), $USER->id) &&$infos["progress"]){
 			$course_data['progress_total']=$infos['progress']->total;
 			
 
diff --git a/view/view_suivi_unit3.php b/view/view_suivi_unit3.php
index 830b84a19a3123292ddf2b5bfa570cafb60cb9e4..cfbb7934778911bb3e846ebe3d728f9b0f4156e7 100644
--- a/view/view_suivi_unit3.php
+++ b/view/view_suivi_unit3.php
@@ -323,7 +323,6 @@ if (isset($_GET['filter'])) {
 				">25" => "&gt;=25%",
 				">0" => "&gt;0%",
 			];
-			var_dump($filter);
 			foreach ($filters as $value => $name) {
 				if ( $value == $filter ) {
 					echo "<option selected='selected' value='$value'>$name</option>";