From 3fef2a615ebb055324e59e67dddc0e936cfe7421 Mon Sep 17 00:00:00 2001
From: Thomas Fradet <t.fradet8@gmail.com>
Date: Fri, 24 May 2019 15:14:28 +0200
Subject: [PATCH] cron logs

---
 CHANGELOG.md                              | 7 +++++++
 entity/course_format_iena_cron_action.php | 7 ++++++-
 lang/en/format_iena.php                   | 2 +-
 lang/fr/format_iena.php                   | 2 +-
 view/view_param_section.php               | 4 ++--
 5 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d94d45..94cf18b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -233,6 +233,13 @@ Ajout d'un else à la condition pour que $date soit toujours instancié.
 
 [x] Solved. 
 
+### Page principale du cours sans achèvement activé dans le cours
+
+Si l'achèvement d'activité n'est pas activé dans le cours. 
+
+
+
+
 ### Page de suivi des étudiants
 
 #### 13
diff --git a/entity/course_format_iena_cron_action.php b/entity/course_format_iena_cron_action.php
index ffd2123..450cfd8 100644
--- a/entity/course_format_iena_cron_action.php
+++ b/entity/course_format_iena_cron_action.php
@@ -228,9 +228,12 @@
 			$message->courseid = $course->id;
 			$message->notification = '0';
 			$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) {
-				echo get_string('snd_msg_to', 'format_iena') . $student->firstname . ' ' . $student->lastname;
+				$studs_counter++;
 				$message->userto = $student;
+				$studs[] = 
 				$message->smallmessage = $messageContent;
 				$message->fullmessage = $messageContent;
 				$message->fullmessagehtml = $messageContent;
@@ -238,6 +241,8 @@
 				// $message->subject = $messageContent;
 				message_send($message);
 			}
+			$log .= $studs_counter . " students.";
+			echo $log;
 		}
 		
 		
diff --git a/lang/en/format_iena.php b/lang/en/format_iena.php
index 092a225..6fee564 100644
--- a/lang/en/format_iena.php
+++ b/lang/en/format_iena.php
@@ -80,4 +80,4 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.';
 	$string['section'] = 'Section';
 	$string['hide_section'] = 'HIDE section ';
 	$string['show_section'] = 'SHOW section ';
-	$string['sdn_msg_to'] = 'Send a message to';
+
diff --git a/lang/fr/format_iena.php b/lang/fr/format_iena.php
index 4b16796..3d63789 100644
--- a/lang/fr/format_iena.php
+++ b/lang/fr/format_iena.php
@@ -80,4 +80,4 @@ By definition an unnamed section is displayed as <strong>section [N]</strong>.';
 	$string['section'] = 'Section';
 	$string['hide_section'] = 'CACHER la section ';
 	$string['show_section'] = 'MONTRER la section ';
-	$string['sdn_msg_to'] = 'Envoyer un message à ';
+
diff --git a/view/view_param_section.php b/view/view_param_section.php
index 14ab4ed..205bd17 100644
--- a/view/view_param_section.php
+++ b/view/view_param_section.php
@@ -51,7 +51,7 @@
 		public function get_content($course, $dataSection)
 		{
 			global $DB, $CFG, $PAGE;
-
+			var_dump($dataSection);
 			$mform = $this->_form;
 			$sectionId = required_param('sectionid', PARAM_INT);
 			$courseID = required_param('courseid', PARAM_INT);
@@ -140,7 +140,7 @@
 			<div class=\"radio\">
 			<label for=\"radios-1\">
 			<input type=\"radio\" name=\"presence\" id=\"presence-2\" value=\"0\" ";
-			if ($dataSection == false) {
+			if ($dataSection == false || ($dataSection != false && $dataSection->presence == 0)) {
 				$content .= "checked=\"checked\"";
 			}
 			$content .= ">
-- 
GitLab