From 4c6ca1f309c5519e5aacff633868f2ad4ad6e8fa Mon Sep 17 00:00:00 2001
From: Myriam Delaruelle <myriam.delaruelle@univ-lorraine.fr>
Date: Tue, 4 Apr 2023 14:37:49 +0200
Subject: [PATCH] =?UTF-8?q?fix=20css=20+=20javascript=20tableau=20de=20sui?=
 =?UTF-8?q?vi,=20ajout=20d'un=20compteur=20pour=20la=20s=C3=A9lection?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 amd/build/suivi-table.js       | 17 +++++-----
 classes/output/renderer.php    | 12 +++++++
 renderer.php                   | 16 ++++-----
 styles.css                     | 61 ++++++++++++++++++++++++----------
 suivi_unit.php                 |  1 -
 templates/suivi-table.mustache |  4 +--
 templates/suivi.mustache       |  4 +--
 7 files changed, 75 insertions(+), 40 deletions(-)

diff --git a/amd/build/suivi-table.js b/amd/build/suivi-table.js
index 5d0388b..0a19aa8 100644
--- a/amd/build/suivi-table.js
+++ b/amd/build/suivi-table.js
@@ -24,7 +24,7 @@
 define(['jquery'],
        function($) {
        	var all_selected=false;
-        console.log($(".checkstudent"));
+        nb_results=$("#table-body input").length;
         $("#select-actions-suivi-iena").prop("disabled", true);
        	return{
        		registerSelectAll:function(){
@@ -32,12 +32,9 @@ define(['jquery'],
        			$('#iena-select-all').on('click', function(e){
 					select_all_studs(e);
 	    		});
-                 $(".checkstudent").on("click", function(){
-                    checkSelectActions();
-                })
-	    		
-	    		
-	    		
+            $(".checkstudent").on("click", function(){
+              checkSelectActions();
+            })
        		}
        	}
 
@@ -58,8 +55,10 @@ define(['jquery'],
 	}
 
       function checkSelectActions(){
+        var selectedChecks=$("#table-body input:checked");
         if($("#select-actions-suivi-iena").prop("disabled") == false){
-            var selectedChecks=$("#table-body input:checked");
+            
+            
             if(selectedChecks.length==0){
                 $("#select-actions-suivi-iena").prop("disabled", true);
             }
@@ -67,7 +66,7 @@ define(['jquery'],
         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/classes/output/renderer.php b/classes/output/renderer.php
index e02106a..db0b4f6 100644
--- a/classes/output/renderer.php
+++ b/classes/output/renderer.php
@@ -95,6 +95,18 @@ class renderer extends section_renderer {
         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/renderer.php b/renderer.php
index 8618de6..bdb75f0 100644
--- a/renderer.php
+++ b/renderer.php
@@ -13,24 +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/>.
-/**
- * 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
- */
+// 
+
+
+
 
 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/styles.css b/styles.css
index 5a67f01..1dc13c0 100644
--- a/styles.css
+++ b/styles.css
@@ -735,32 +735,40 @@ th.th-rotate > div > span {
 	color: white;
 }
 
+
 .state-1 span.icon-progress::after{
 	content: "\f1db";
 	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";
 	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;
@@ -870,34 +878,39 @@ tbody th{
 }
 
 #caption-iena .caption-status{
-	display: inline-block;
+	display: flex;
 	margin-right: 20px;
 }
 
 #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: 24px;
+    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;
@@ -932,7 +945,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{
@@ -967,4 +982,16 @@ th.first-column-iena, th.second-column-iena, th.actions-column-iena, th.third-co
 }
 .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;
 }
\ No newline at end of file
diff --git a/suivi_unit.php b/suivi_unit.php
index 7f61762..5c69804 100644
--- a/suivi_unit.php
+++ b/suivi_unit.php
@@ -368,7 +368,6 @@ if (isset($_POST['action']) && !empty($_POST['action'])) {
     }
     
     $renderer = $PAGE->get_renderer('format_iena');
-
     $renderer->display_completion($data);
     echo $OUTPUT->footer();
 }
diff --git a/templates/suivi-table.mustache b/templates/suivi-table.mustache
index c7454c5..3d0646a 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>
@@ -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 8c1a7b5..7c54138 100644
--- a/templates/suivi.mustache
+++ b/templates/suivi.mustache
@@ -27,7 +27,7 @@
 	</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>
@@ -98,7 +98,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>
-- 
GitLab