Gitlab CSE Unil

Commit c05b5095 authored by M. Chardon's avatar M. Chardon
Browse files

notification étudiant

parent 4758ef30
define(["jquery","mod_audioannotation/justWave","mod_audioannotation/editor","mod_audioannotation/rightMenu"],function(a,b,c,d){function e(a){e.currentUser="userid"in a?a.userid:null,e.courseid="course"in a?a.course:null,e.audioannotation="audioannotation"in a?a.audioannotation:null,e.eval="eval"in a?a.eval:0,e.iswriting="iswriting"in a?a.iswriting:0,e.pairing="pairing"in a?a.pairing:0;var f="repo"in a?a.repo:null,g="assignparts"in a?a.assignparts:null,h=null;if(g)try{h=JSON.parse(g)}catch(i){window.console.error(i)}var j="tags"in a?a.tags:null,k=null;if(j)try{k=JSON.parse(j)}catch(i){window.console.error(i)}if(e.wavePlayer=new b(this),e.editors=[],h)for(var l=0;l<h.length;l++){e.editors[h[l].id]=new c({controler:this,courseid:e.courseid,assignpart:h[l],audioannotation:e.audioannotation,tags:k,repo:f});var m=new b(this,e.editors[h[l].id]);e.editors[h[l].id].setWavePlayer(m),this.initWave(m,"justwave",h[l].id)}this.initTrigger(),e.rightMenu=new d({controler:this}),this.initDisplay()}return e.courseid=-1,e.audioannotation=-1,e.wavePlayer=null,e.prototype.editors=null,e.rightMenu=null,e.lastP=null,e.eval=0,e.iswriting=0,e.pairing=0,e.currentUser=null,e.prototype.initTrigger=function(){1!=e.eval&&1!=e.iswriting||(a(".btn_add_annotation").on("click",function(){e.editors[a(this).data("assignpart")].notify("add")}),a(".btn_add_annotation").on("mouseout",function(){a(this).blur(),a(this).parents('div[data-parent="#accordionAssignPart"]').focus()})),a(".select_tqs").on("change",function(){var b=a(this).data("assignpart");e.editors[b].notify("displaytqs",{tag:a("#select_tag"+b).val(),question:a("#select_question"+b).val(),statut:a("#select_statut"+b).val(),author:a("#select_author"+b).val()})}),a("li[data-annotation]").on("click",function(){var b=a(this).data("annotation"),c=a(this).parents(".annotationGroupAccordion").data("assignpart");b&&e.editors[c].notify("view",{annotation:b})}),a("#id_grade").on("change",function(){a(this).val()?a("input[name=gradeempty]").val(0):a("input[name=gradeempty]").val(1)}),a("div[data-parent='#accordionAssignPart']").on("show.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-right");c.removeClass("fa-caret-right"),c.addClass("fa-caret-down")}),a("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-down");c.removeClass("fa-caret-down"),c.addClass("fa-caret-right")});var b=a("input[name$='mod_audioannotation_form_assignaudio_eval_form']");a("div.feedback > form").on("submit",function(){a("div.feedback > form").append(b)})},e.prototype.initWave=function(b,c,d){b.init(c),b.drawWaveDisplay(a(".justwave"+d+" audio"))},e.prototype.initAnnotations=function(){for(var a=0;a<e.editors.length;a++)e.editors[a]&&e.editors[a].initAnnotationsDisplay()},e.prototype.initDisplay=function(){function b(){var b=a('input[name="remediation"]:checked').val();1==b?a('input[name="notification"]').parents("div.fitem").show():a('input[name="notification"]').parents("div.fitem").hide()}b(),a('input[name="remediation"]').on("change",function(){b()})},e.prototype.notify=function(a,b,c){switch(a){case"loadedmetadata":this.initAnnotations();break;case"addannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("add");break;case"editannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("edit");break;case"viewannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("view");break;case"deleteannotation":if("rightMenu"===b)for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].notify("delete",c);else for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("delete")}},e.prototype.getEval=function(){return e.eval},e.prototype.isWriting=function(){return e.iswriting},e.prototype.getPairing=function(){return e.pairing},e.prototype.getCurrentUser=function(){return e.currentUser},e});
\ No newline at end of file
define(["jquery","mod_audioannotation/justWave","mod_audioannotation/editor","mod_audioannotation/rightMenu"],function(a,b,c,d){function e(a){e.currentUser="userid"in a?a.userid:null,e.courseid="course"in a?a.course:null,e.audioannotation="audioannotation"in a?a.audioannotation:null,e.eval="eval"in a?a.eval:0,e.iswriting="iswriting"in a?a.iswriting:0,e.pairing="pairing"in a?a.pairing:0;var f="repo"in a?a.repo:null,g="assignparts"in a?a.assignparts:null,h=null;if(g)try{h=JSON.parse(g)}catch(i){window.console.error(i)}var j="tags"in a?a.tags:null,k=null;if(j)try{k=JSON.parse(j)}catch(i){window.console.error(i)}if(e.wavePlayer=new b(this),e.editors=[],h)for(var l=0;l<h.length;l++){e.editors[h[l].id]=new c({controler:this,courseid:e.courseid,assignpart:h[l],audioannotation:e.audioannotation,tags:k,repo:f});var m=new b(this,e.editors[h[l].id]);e.editors[h[l].id].setWavePlayer(m),this.initWave(m,"justwave",h[l].id)}this.initTrigger(),e.rightMenu=new d({controler:this}),this.initDisplay()}return e.courseid=-1,e.audioannotation=-1,e.wavePlayer=null,e.prototype.editors=null,e.rightMenu=null,e.lastP=null,e.eval=0,e.iswriting=0,e.pairing=0,e.currentUser=null,e.prototype.initTrigger=function(){1!=e.eval&&1!=e.iswriting||(a(".btn_add_annotation").on("click",function(){e.editors[a(this).data("assignpart")].notify("add")}),a(".btn_add_annotation").on("mouseout",function(){a(this).blur(),a(this).parents('div[data-parent="#accordionAssignPart"]').focus()})),a(".select_tqs").on("change",function(){var b=a(this).data("assignpart");e.editors[b].notify("displaytqs",{tag:a("#select_tag"+b).val(),question:a("#select_question"+b).val(),statut:a("#select_statut"+b).val(),author:a("#select_author"+b).val()})}),a("li[data-annotation]").on("click",function(){var b=a(this).data("annotation"),c=a(this).parents(".annotationGroupAccordion").data("assignpart");b&&e.editors[c].notify("view",{annotation:b})}),a("#id_grade").on("change",function(){a(this).val()?a("input[name=gradeempty]").val(0):a("input[name=gradeempty]").val(1)}),a("div[data-parent='#accordionAssignPart']").on("show.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-right");c.removeClass("fa-caret-right"),c.addClass("fa-caret-down")}),a("div[data-parent='#accordionAssignPart']").on("hide.bs.collapse",function(){var b=a("div[data-target='#"+a(this).attr("id")+"']"),c=b.find("i.fa-caret-down");c.removeClass("fa-caret-down"),c.addClass("fa-caret-right")});var b=a("input[name$='mod_audioannotation_form_assignaudio_eval_form']");a("div.feedback > form").on("submit",function(){a("div.feedback > form").append(b)})},e.prototype.initWave=function(b,c,d){b.init(c),b.drawWaveDisplay(a(".justwave"+d+" audio"))},e.prototype.initAnnotations=function(){for(var a=0;a<e.editors.length;a++)e.editors[a]&&e.editors[a].initAnnotationsDisplay()},e.prototype.initDisplay=function(){},e.prototype.notify=function(a,b,c){switch(a){case"loadedmetadata":this.initAnnotations();break;case"addannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("add");break;case"editannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("edit");break;case"viewannotation":for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("view");break;case"deleteannotation":if("rightMenu"===b)for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].notify("delete",c);else for(var d=0;d<e.editors.length;d++)e.editors[d]&&e.editors[d].setEditorStatus("delete")}},e.prototype.getEval=function(){return e.eval},e.prototype.isWriting=function(){return e.iswriting},e.prototype.getPairing=function(){return e.pairing},e.prototype.getCurrentUser=function(){return e.currentUser},e});
\ No newline at end of file
......@@ -165,7 +165,7 @@ define(['jquery', 'mod_audioannotation/justWave', 'mod_audioannotation/editor',
i.removeClass('fa-caret-down');
i.addClass('fa-caret-right');
});
//trigger for feedback validation button
//for feedback validation button
//si un autre form est inséré dans la page, ce champ disparait et le form n'est plus validable
var inputFeesbackForm = $("input[name$='mod_audioannotation_form_assignaudio_eval_form']");
$('div.feedback > form').on('submit', function () {
......@@ -199,18 +199,18 @@ define(['jquery', 'mod_audioannotation/justWave', 'mod_audioannotation/editor',
* Init global dispay
*/
Controler.prototype.initDisplay = function () {
function initVisuNotification() {
/*function initVisuNotification() {
var val = $('input[name="remediation"]:checked').val();
if (val == 1) {
$('input[name="notification"]').parents('div.fitem').show();
} else {
$('input[name="notification"]').parents('div.fitem').hide();
}
}
initVisuNotification();
$('input[name="remediation"]').on('change', function () {
}*/
//initVisuNotification();
/*$('input[name="remediation"]').on('change', function () {
initVisuNotification();
});
});*/
};
/**
......
......@@ -126,6 +126,12 @@ $string['remediation_message'] = '{$a->coursename}
A remediation of your work has been asked.
You can access the assignement following this link: {$a->url}';
$string['student_notification_subject'] = '[Moodle] Update for your work';
$string['student_notification_message'] = '{$a->coursename}
Some feedbacks have been released on your work.
You can access the assignement following this link: {$a->url}';
$string['partial_delivered'] = 'Partial delivered';
$string['evaluate'] = 'Evaluate';
......
......@@ -66,7 +66,7 @@ $string['settingaccessannotstartdate'] = 'Début accès annotations';
$string['settingaccessannotstartdate_help'] = 'help Début accès annotations';
$string['settingaccessannotenddate'] = 'Fin accès annotations';
$string['settingaccessannotenddate_help'] = 'help fin accès annotations';
$string['settingaccesspairing'] = 'Activer l\'évaludation par les pairs';
$string['settingaccesspairing'] = 'Activer l\'évaluation par les pairs';
$string['settingtags'] = 'Tags';
$string['settingtags_help'] = 'help tag';
$string['statut_not_found'] = 'Statut par défaut non trouvé, merci de prendre contact avec votre administrateur';
......@@ -121,11 +121,17 @@ $string['actions'] = 'Actions';
$string['delivered'] = 'Remis';
$string['with_delay'] = 'avec retard';
$string['not_delivered'] = 'non remis';
$string['remediation'] = 'Remédiation demandé';
$string['remediation_subject'] = '[Moodle] Remédiation demandé';
$string['remediation'] = 'Remédiation demandée';
$string['remediation_subject'] = '[Moodle] Remédiation demandée';
$string['remediation_message'] = '{$a->coursename}
Une remédiation de votre travail a été demandé.
Une remédiation de votre travail a été demandée.
Vous pouvez accéder à votre travail en suivant ce lien : {$a->url}';
$string['student_notification_subject'] = '[Moodle] Mise à jour de votre devoir';
$string['student_notification_message'] = '{$a->coursename}
Des corrections à votre travail ont été apportées.
Vous pouvez accéder à votre travail en suivant ce lien : {$a->url}';
$string['partial_delivered'] = 'Partiellement rendu';
......
......@@ -197,8 +197,8 @@ class audioannotation_assignement {
$this->importGradeLib();
$grading_info = grade_get_grades($this->course, 'mod', AUDIOANNOT_MODNAME, $audioannotation->id, $devoir->user);
$gradeRef = $grading_info->items[0]->grades[$devoir->user];
//$grading_info = grade_get_grades($this->course, 'mod', AUDIOANNOT_MODNAME, $audioannotation->id, $devoir->user);
//$gradeRef = $grading_info->items[0]->grades[$devoir->user];
$formData = $formAssign->get_data();
......@@ -224,17 +224,22 @@ class audioannotation_assignement {
if ($devoir->remediation != $remediation) {
$devoir->remediation = $remediation;
editor::editAssignement($devoir);
if ($formData->notification == 1) {
$urlparams = array('id' => $this->cm->id);
$url = new moodle_url('/mod/audioannotation/view.php', $urlparams);
$course = get_course($this->course);
$userStudent = $DB->get_record('user', array('id' => $devoir->user), '*', MUST_EXIST);
$messageParams = (object) [
'coursename' => format_string($course->shortname, true),
'url' => $url
];
}
if ($formData->notification == 1) {
$urlparams = array('id' => $this->cm->id);
$url = new moodle_url('/mod/audioannotation/view.php', $urlparams);
$course = get_course($this->course);
$userStudent = $DB->get_record('user', array('id' => $devoir->user), '*', MUST_EXIST);
$messageParams = (object) [
'coursename' => format_string($course->shortname, true),
'url' => $url->out(true)
];
if ($devoir->remediation == 1) {
email_to_user($userStudent, $USER, get_string('remediation_subject', AUDIOANNOT_MODNAME_COMPLETE),
get_string('remediation_message', AUDIOANNOT_MODNAME_COMPLETE, $messageParams));
} else {
email_to_user($userStudent, $USER, get_string('student_notification_subject', AUDIOANNOT_MODNAME_COMPLETE),
get_string('student_notification_message', AUDIOANNOT_MODNAME_COMPLETE, $messageParams));
}
}
return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment