From 30f269756b7408cfcc06bee3d9683223da806402 Mon Sep 17 00:00:00 2001 From: Yoshi5123 <alexis.duval2002@gmail.com> Date: Fri, 15 Jul 2022 16:33:53 +0200 Subject: [PATCH] Auto evaluation and bugs fixes --- notemyprogress/ajax.php | 40 ++- .../amd/build/auto_evaluation.min.js | 1 + notemyprogress/amd/build/emailform.js | 200 -------------- notemyprogress/amd/build/emailform.min.js | 1 + notemyprogress/amd/build/metareflexion.min.js | 2 +- notemyprogress/amd/build/setweeks.min.js | 2 +- notemyprogress/amd/src/auto_evaluation.js | 197 ++++++++++++++ notemyprogress/amd/src/metareflexion.js | 245 ++++++++---------- notemyprogress/amd/src/setweeks.js | 74 ++++-- notemyprogress/auto_evaluation.php | 133 ++++++++++ notemyprogress/classes/auto_evaluation.php | 100 +++++++ notemyprogress/classes/student.php | 15 ++ notemyprogress/db/access.php | 8 + notemyprogress/db/install.php | 34 ++- notemyprogress/db/install.xml | 23 ++ .../lang/en/local_notemyprogress.php | 46 +++- .../lang/es/local_notemyprogress.php | 75 ++++-- .../lang/fr/local_notemyprogress.php | 70 +++-- notemyprogress/lib.php | 17 +- notemyprogress/metareflexion.php | 1 + notemyprogress/setweeks.php | 12 +- .../templates/auto_evaluation.mustache | 36 +++ 22 files changed, 893 insertions(+), 439 deletions(-) create mode 100644 notemyprogress/amd/build/auto_evaluation.min.js delete mode 100644 notemyprogress/amd/build/emailform.js create mode 100644 notemyprogress/amd/build/emailform.min.js create mode 100644 notemyprogress/amd/src/auto_evaluation.js create mode 100644 notemyprogress/auto_evaluation.php create mode 100644 notemyprogress/classes/auto_evaluation.php create mode 100644 notemyprogress/templates/auto_evaluation.mustache diff --git a/notemyprogress/ajax.php b/notemyprogress/ajax.php index 15a22dd..1b082dd 100644 --- a/notemyprogress/ajax.php +++ b/notemyprogress/ajax.php @@ -64,6 +64,7 @@ $dayscommitted = optional_param('days', false, PARAM_TEXT); $goalscommitted = optional_param('goals', false, PARAM_TEXT); $hourscommitted = optional_param('hours', false, PARAM_INT); $idmetareflexion = optional_param('metareflexionid', false, PARAM_INT); +$auto_eval_answers = optional_param('auto_eval_answers', false, PARAM_RAW); $lastweekid = optional_param('lastweekid', false, PARAM_RAW); $classroom_hours = optional_param('classroom_hours', false, PARAM_RAW); @@ -298,7 +299,23 @@ if($action == 'saveconfigweek') {//Exemple: if the action passed is saveconfigwe if($courseid && $userid) { $func = "local_notemyprogress_viewed_student_lvl"; } -} +}elseif($action == 'saveautoeval') { + array_push($params, $userid); + array_push($params, $courseid); + array_push($params, $auto_eval_answers); + + if($userid && $auto_eval_answers){ + $func = "local_notemyprogress_save_auto_eval"; + } +}elseif($action == 'updateautoeval') { + array_push($params, $userid); + array_push($params, $courseid); + array_push($params, $auto_eval_answers); + + if($userid && $auto_eval_answers){ + $func = "local_notemyprogress_update_auto_eval"; + } +} if (isset($params) && isset($func)) { call_user_func_array($func, $params); @@ -308,6 +325,27 @@ if (isset($params) && isset($func)) { local_notemyprogress_ajax_response(array($message));//,$action,$courseid, $userid ,$rules , $levels, $settings, $url,$func), 442); } + +function local_notemyprogress_save_auto_eval($userid,$courseid, $auto_eval_answers) +{ + $logs = new \local_notemyprogress\logs($courseid, $userid); + $logs->addLogsNMP("Saved", "section", "Auto_Evaluation", "auto_evaluation", $url, "AutoEvaluationSaved"); + $auto_evaluation = new \local_notemyprogress\auto_evaluation($userid); + $auto_evaluation->auto_eval_answers = json_decode($auto_eval_answers) ; + $response = $auto_evaluation->save_answers(); + local_notemyprogress_ajax_response(array('responseautoevaluation' => $response)); +} + +function local_notemyprogress_update_auto_eval($userid,$courseid, $auto_eval_answers) +{ + $logs = new \local_notemyprogress\logs($courseid, $userid); + $logs->addLogsNMP("Updated", "section", "Auto_Evaluation", "auto_evaluation", $url, "AutoEvaluationUpdated"); + $auto_evaluation = new \local_notemyprogress\auto_evaluation($userid); + $auto_evaluation->auto_eval_answers = json_decode($auto_eval_answers) ; + $response = $auto_evaluation->update_answers(); + local_notemyprogress_ajax_response(array('responseautoevaluation' => $response)); +} + function local_sr_metareflexion_get_week($weekcode, $courseid, $userid, $profile) { diff --git a/notemyprogress/amd/build/auto_evaluation.min.js b/notemyprogress/amd/build/auto_evaluation.min.js new file mode 100644 index 0000000..37bd67a --- /dev/null +++ b/notemyprogress/amd/build/auto_evaluation.min.js @@ -0,0 +1 @@ +define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/moment","local_notemyprogress/pagination","local_notemyprogress/chartstatic","local_notemyprogress/pageheader","local_notemyprogress/modulesform","local_notemyprogress/helpdialog","local_notemyprogress/alertify"],(function(Vue,Vuetify,Axios,Moment,Pagination,ChartStatic,PageHeader,ModulesForm,HelpDialog,Alertify){"use strict";function init(content){Vue.use(Vuetify),Vue.component("pagination",Pagination),Vue.component("chart",ChartStatic),Vue.component("pageheader",PageHeader),Vue.component("modulesform",ModulesForm),Vue.component("helpdialog",HelpDialog);let vue=new Vue({delimiters:["[[","]]"],el:"#auto_evaluation",vuetify:new Vuetify,data:()=>({strings:content.strings,groups:content.groups,userid:content.userid,courseid:content.courseid,timezone:content.timezone,render_has:content.profile_render,loading:!1,errors:[],pages:content.pages,indicators:content.indicators,resources_access_colors:content.resources_access_colors,inverted_time_colors:content.inverted_time_colors,inverted_time:content.indicators.inverted_time,hours_sessions:content.indicators.hours_sessions,sections:content.indicators.sections,sections_map:null,week_progress:0,resource_access_categories:[],resource_access_data:[],modules_dialog:!1,help_dialog:!1,help_contents:[],auto_eval_answers:content.auto_eval_answers,saving_loader:!1,auto_eval_saved:content.auto_eval_saved}),beforeMount(){},mounted(){document.querySelector("#auto_evaluation-loader").style.display="none",document.querySelector("#auto_evaluation").style.display="block"},methods:{action_save_auto_evaluation(){this.auto_eval_saved?(console.log("update"),this.update_auto_eval()):(console.log("save"),this.save_auto_eval())},save_auto_eval(){var data={action:"saveautoeval",userid:this.userid,courseid:this.courseid,auto_eval_answers:this.auto_eval_answers};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.auto_eval_saved=!0,console.log("if"),Alertify.success(this.strings.message_save_successful)):(console.log("else"),Alertify.error(this.strings.api_error_network))}).catch(e=>{console.log("catch"),this.saving_loader=!1,Alertify.error(this.strings.api_error_network)}).finally(()=>{console.log("finally"),this.saving_loader=!1})},update_auto_eval(){var data={action:"updateautoeval",userid:this.userid,courseid:this.courseid,auto_eval_answers:this.auto_eval_answers};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(console.log("if"),Alertify.success(this.strings.message_update_successful)):(console.log("else"),Alertify.error(this.strings.api_error_network))}).catch(e=>{console.log("catch"),this.saving_loader=!1,Alertify.error(this.strings.api_error_network)}).finally(()=>{console.log("finally"),this.saving_loader=!1})},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"STUDENT_STUDY_SESSIONS",actiontype:action,objectType:objectType,objectName:objectName,currentUrl:document.location.href,objectDescription:objectDescription};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok}).catch(e=>{})},get_help_content(){var help_contents=[],help=new Object;return help.title=this.strings.page_title_auto_eval,help.description=this.strings.description_auto_eval,help_contents.push(help),help_contents}}})}return{init:init}})); \ No newline at end of file diff --git a/notemyprogress/amd/build/emailform.js b/notemyprogress/amd/build/emailform.js deleted file mode 100644 index a351128..0000000 --- a/notemyprogress/amd/build/emailform.js +++ /dev/null @@ -1,200 +0,0 @@ -define([ - "local_notemyprogress/axios", - "local_notemyprogress/alertify", -], function (Axios, Alertify) { - const emailform = { - template: ` - <v-main mt-10> - <v-row> - <v-col sm="12"> - <v-dialog - v-model="dialog" - width="800" - @click:outside="closeDialog()" - @keydown.esc="closeDialog()" - > - <v-card> - <v-toolbar color="#118AB2" dark> - <span v-text="emailform_title"></span> - <v-spacer></v-spacer> - <v-btn icon @click="reset"> - <v-icon v-text="close_icon"></v-icon> - </v-btn> - </v-toolbar> - - <v-container> - <v-row> - <v-col cols="12" sm="12"> - - <v-chip class="ma-2" color="#118AB2" label dark> - <span v-text="recipients"></span> - </v-chip> - - <template v-for="(user, index, key) in selected_users"> - <v-chip class="ma-2"> - <v-avatar left> - <img :src="get_picture_url(user.id)"> - </v-avatar> - <span>{{user.firstname}} {{user.lastname}}</span> - </v-chip> - </template> - - </v-col> - </v-row> - - <v-row> - <v-col cols="12" sm="12"> - <v-form ref="form" v-model="valid_form"> - <v-text-field - v-model="strings.subject" - :label="subject_label" - :rules="subject_rules" - required - solo - ></v-text-field> - - <v-textarea - v-model="message" - :label="message_label" - :rules="message_rules" - required - solo - ></v-textarea> - - <v-btn @click="submit" :disabled="!valid_form"> - <span v-text="submit_button"></span> - </v-btn> - - <v-btn @click="reset"> - <span v-text="cancel_button"></span> - </v-btn> - - <v-spacer></v-spacer> - - </v-form> - </v-col> - </v-row> - </v-container> - - </v-card> - </v-dialog> - </v-col> - </v-row> - - <v-row> - <v-col sm="12"> - <div class="text-center"> - <v-dialog - v-model="loader_dialog" - persistent - width="300" - > - <v-card color="#118AB2" dark> - <v-card-text> - <span v-text="sending_text"></span> - <v-progress-linear - indeterminate - color="white" - class="mb-0" - ></v-progress-linear> - </v-card-text> - </v-card> - </v-dialog> - </div> - </v-col> - </v-row> - </v-main> - `, - props: [ - "dialog", - "selected_users", - "strings", - "moduleid", - "modulename", - "courseid", - "userid", - ], - data() { - return { - close_icon: "mdi-minus", - valid_form: true, - subject_label: this.strings.subject_label, - subject_rules: [(v) => !!v || this.strings.validation_subject_text], - message: "", - message_label: this.strings.message_label, - message_rules: [(v) => !!v || this.strings.validation_message_text], - submit_button: this.strings.submit_button, - cancel_button: this.strings.cancel_button, - emailform_title: this.strings.emailform_title, - sending_text: this.strings.sending_text, - recipients: this.strings.recipients_label, - loader_dialog: false, - mailsended_text: this.strings.mailsended_text, - }; - }, - methods: { - get_picture_url(userid) { - let url = `${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`; - return url; - }, - - submit() { - let recipients = ""; - this.selected_users.forEach((item) => { - recipients = recipients.concat(item.id, ","); - }); - this.loader_dialog = true; - this.errors = []; - let data = { - action: "sendmail", - subject: this.strings.subject, - recipients: recipients, - text: this.message, - userid: this.userid, - courseid: this.courseid, - moduleid: this.moduleid, - modulename: this.modulename, - }; - Axios({ - method: "get", - url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php", - params: data, - }) - .then((response) => { - if (response.status == 200 && response.data.ok) { - this.$emit("update_dialog", false); - this.$refs.form.reset(); - Alertify.success(this.mailsended_text); - if (typeof this.$parent.$root.addLogsIntoDB === "function") { - this.$parent.$root.addLogsIntoDB( - "SendedTo : " + this.selected_users[0].email, - this.$parent.$root.email_object_name, - "email", - "Sent an email" - ); - } - } else { - Alertify.error(this.strings.api_error_network); - this.loader_dialog = false; - } - }) - .catch((e) => { - Alertify.error(this.strings.api_error_network); - }) - .finally(() => { - this.loader_dialog = false; - }); - }, - - reset() { - this.$emit("update_dialog", false); - this.$refs.form.resetValidation(); - }, - - closeDialog() { - this.$emit("update_dialog", false); - }, - }, - }; - return emailform; -}); diff --git a/notemyprogress/amd/build/emailform.min.js b/notemyprogress/amd/build/emailform.min.js new file mode 100644 index 0000000..51fb972 --- /dev/null +++ b/notemyprogress/amd/build/emailform.min.js @@ -0,0 +1 @@ +define(["local_notemyprogress/axios","local_notemyprogress/alertify"],(function(Axios,Alertify){const emailform={template:'\n <v-main mt-10>\n <v-row>\n <v-col sm="12">\n <v-dialog\n v-model="dialog"\n width="800"\n @click:outside="closeDialog()"\n @keydown.esc="closeDialog()"\n >\n <v-card>\n <v-toolbar color="#118AB2" dark>\n <span v-text="emailform_title"></span>\n <v-spacer></v-spacer>\n <v-btn icon @click="reset">\n <v-icon v-text="close_icon"></v-icon>\n </v-btn>\n </v-toolbar>\n \n <v-container>\n <v-row>\n <v-col cols="12" sm="12">\n \n <v-chip class="ma-2" color="#118AB2" label dark>\n <span v-text="recipients"></span>\n </v-chip>\n \n <template v-for="(user, index, key) in selected_users">\n <v-chip class="ma-2">\n <v-avatar left>\n <img :src="get_picture_url(user.id)">\n </v-avatar>\n <span>{{user.firstname}} {{user.lastname}}</span>\n </v-chip>\n </template>\n \n </v-col>\n </v-row>\n \n <v-row>\n <v-col cols="12" sm="12">\n <v-form ref="form" v-model="valid_form">\n <v-text-field\n v-model="strings.subject"\n :label="subject_label"\n :rules="subject_rules"\n required\n solo\n ></v-text-field>\n \n <v-textarea\n v-model="message"\n :label="message_label"\n :rules="message_rules"\n required\n solo\n ></v-textarea>\n \n <v-btn @click="submit" :disabled="!valid_form">\n <span v-text="submit_button"></span>\n </v-btn>\n \n <v-btn @click="reset">\n <span v-text="cancel_button"></span>\n </v-btn>\n \n <v-spacer></v-spacer>\n \n </v-form>\n </v-col>\n </v-row>\n </v-container>\n \n </v-card>\n </v-dialog>\n </v-col>\n </v-row>\n \n <v-row>\n <v-col sm="12">\n <div class="text-center">\n <v-dialog\n v-model="loader_dialog"\n persistent\n width="300"\n >\n <v-card color="#118AB2" dark>\n <v-card-text>\n <span v-text="sending_text"></span>\n <v-progress-linear\n indeterminate\n color="white"\n class="mb-0"\n ></v-progress-linear>\n </v-card-text>\n </v-card>\n </v-dialog>\n </div>\n </v-col>\n </v-row>\n </v-main>\n ',props:["dialog","selected_users","strings","moduleid","modulename","courseid","userid"],data(){return{close_icon:"mdi-minus",valid_form:!0,subject_label:this.strings.subject_label,subject_rules:[v=>!!v||this.strings.validation_subject_text],message:"",message_label:this.strings.message_label,message_rules:[v=>!!v||this.strings.validation_message_text],submit_button:this.strings.submit_button,cancel_button:this.strings.cancel_button,emailform_title:this.strings.emailform_title,sending_text:this.strings.sending_text,recipients:this.strings.recipients_label,loader_dialog:!1,mailsended_text:this.strings.mailsended_text}},methods:{get_picture_url(userid){let url;return`${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`},submit(){let recipients="";this.selected_users.forEach(item=>{recipients=recipients.concat(item.id,",")}),this.loader_dialog=!0,this.errors=[];let data={action:"sendmail",subject:this.strings.subject,recipients:recipients,text:this.message,userid:this.userid,courseid:this.courseid,moduleid:this.moduleid,modulename:this.modulename};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.$emit("update_dialog",!1),this.$refs.form.reset(),Alertify.success(this.mailsended_text),"function"==typeof this.$parent.$root.addLogsIntoDB&&this.$parent.$root.addLogsIntoDB("SendedTo : "+this.selected_users[0].email,this.$parent.$root.email_object_name,"email","Sent an email")):(Alertify.error(this.strings.api_error_network),this.loader_dialog=!1)}).catch(e=>{Alertify.error(this.strings.api_error_network)}).finally(()=>{this.loader_dialog=!1})},reset(){this.$emit("update_dialog",!1),this.$refs.form.resetValidation()},closeDialog(){this.$emit("update_dialog",!1)}}};return emailform})); \ No newline at end of file diff --git a/notemyprogress/amd/build/metareflexion.min.js b/notemyprogress/amd/build/metareflexion.min.js index 90d499c..63faf8f 100644 --- a/notemyprogress/amd/build/metareflexion.min.js +++ b/notemyprogress/amd/build/metareflexion.min.js @@ -1 +1 @@ -define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/alertify","local_notemyprogress/pagination","local_notemyprogress/chartdynamic","local_notemyprogress/pageheader"],(function(Vue,Vuetify,Axios,Alertify,Pagination,ChartStatic,Pageheader){"use strict";function init(content){Vue.use(Vuetify),Vue.component("pagination",Pagination),Vue.component("chart",ChartStatic),Vue.component("pageheader",Pageheader);const vue=new Vue({delimiters:["[[","]]"],el:"#metareflexion",vuetify:new Vuetify,data:{test:!0,module_groups:content.module_groups,indicators:content.indicators,resources_access_colors:content.resources_access_colors,inverted_time_colors:content.inverted_time_colors,inverted_time:content.indicators.inverted_time,hours_sessions:content.indicators.hours_sessions,sections:content.indicators.sections,sections_map:null,week_progress:0,resource_access_categories:[],resource_access_data:[],modules_dialog:!1,help_dialog:!1,help_contents:[],disabled_form:!1,groups:content.groups,students_planification:content.students_planification,selected_week:null,paginator_week:null,saved_planification:!1,strings:content.strings,userid:content.userid,courseid:content.courseid,loading:!1,compare_with_course:!1,current_week:content.cmcurrentweeknew,week_schedule:content.week_schedule,data_report_meta_days:content.data_report_days,data_report_meta_hours:content.data_report_hours,data_report_meta_goals:content.data_report_goals,data_report_meta_questions:content.data_report_hours_questions,data_report_meta_last_week:content.report_last_week,status_planning:content.status_planning,course_report_hours:content.course_report_hours,past_week:content.lastweek,render_has:content.profile_render,dialog:!1,days_week:[content.strings.currentweek_day_lun,content.strings.currentweek_day_mar,content.strings.currentweek_day_mie,content.strings.currentweek_day_jue,content.strings.currentweek_day_vie,content.strings.currentweek_day_sab,content.strings.currentweek_day_dom],active_tab:0,icons:{calendar:content.calendar_icon},tabs_header:[{name:content.strings.tab_1,id:1,teacher_can_view:!1,student_can_view:!0},{name:content.strings.tab_2,id:2,teacher_can_view:!1,student_can_view:!0}],hours_committed:0,id_committed:null,pages:content.pages,active_tab:null,chart_metareflexion_options:{maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{ticks:{beginAtZero:!0,callback:function(value){if(Number.isInteger(value))return value},suggestedMin:0,suggestedMax:5}}]}},img_no_data:content.image_no_data},mounted(){document.querySelector("#sr-loader").style.display="none",document.querySelector("#metareflexion").style.display="block",this.past_week.classroom_hours||(this.past_week.classroom_hours=0),this.past_week.classroom_hours||(this.past_week.hours_off_course=0),this.pages.forEach(page=>{page.selected&&(this.selected_week=page,this.paginator_week=page)}),setTimeout((function(){vue.setGraphicsEventListeners()}),500),vue.setGraphicsEventListeners()},computed:{progress(){var count_all=0,count_finished=0;Object.keys(this.module_groups).map(key=>{let group=this.module_groups[key];count_all+=group.count_all,count_finished+=group.count_finished});let average=100*count_finished/count_all;return average=Number.isNaN(average)?0:average.toFixed(0),average},isDisabledBtnLastWeek(){return null===this.data_report_meta_questions.questions[1].answer_selected||null===this.data_report_meta_questions.questions[2].answer_selected||null===this.data_report_meta_questions.questions[3].answer_selected||null===this.data_report_meta_questions.questions[4].answer_selected},hasLastWeek(){var last_week=!1;return this.pages.forEach(page=>{page.is_current_week&&page.number>1&&(last_week=!0)}),last_week},isDisabledQuestions(){return null==this.paginator_week||!(this.week_schedule[this.paginator_week.weekcode]&&!this.paginator_week.is_current_week)}},methods:{get_modules(day,cmid){return this.current_week[0].weekly_schedules_days.days_planned[day].includes(cmid)},update_interactions(week){this.loading=!0,this.errors=[];let data={action:"worksessions",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.hours_sessions=response.data.data.indicators.sessions,this.session_count=response.data.data.indicators.count,this.inverted_time=response.data.data.indicators.time):this.error_messages.push(this.strings.error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1,vue.addLogsIntoDB("viewed","week_"+week.weekcode,"week_section","Week section that allows you to obtain information on a specific week"),vue.setGraphicsEventListeners()}),this.data},convert_time(time){time*=3600;let h=this.strings.hours_short,m=this.strings.minutes_short,s=this.strings.seconds_short,hours=Math.floor(time/3600),minutes=Math.floor(time%3600/60),seconds=Math.floor(time%60),text;return text=hours>=1?minutes>=1?`${hours}${h} ${minutes}${m}`:`${hours}${h}`:minutes>=1?seconds>=1?`${minutes}${m} ${seconds}${s}`:`${minutes}${m}`:`${seconds}${s}`,text},get_help_content(){let contents=[];return contents.push({title:this.strings.section_help_title,description:this.strings.section_help_description}),contents},build_inverted_time_chart(){let chart=new Object,meta=new Object;meta=this.chartdata_hours_week_dedication();let invest=[{name:meta.labels[2],y:meta.datasets[0].data[2]},{name:meta.labels[0],y:meta.datasets[0].data[0]},{name:meta.labels[1],y:meta.datasets[0].data[1]}];return chart.chart={type:"bar",backgroundColor:null,style:{fontFamily:"poppins"}},chart.title={text:null},chart.colors=this.inverted_time_colors,chart.xAxis={type:"category",crosshair:!0},chart.yAxis={title:{text:this.strings.inverted_time_chart_x_axis}},chart.tooltip={shared:!0,useHTML:!0,formatter:function(){let category_name,time;return`<b>${this.points[0].key}: </b>${vue.convert_time(this.y)}`}},chart.legend={enabled:!1},chart.series=[{colorByPoint:!0,data:invest}],chart},get_goal(goal_id){return this.current_week[0].weekly_schedules_goals.includes(goal_id)},update_goal(goal_id,event){if(event)this.current_week[0].weekly_schedules_goals.push(goal_id);else{const i=this.current_week[0].weekly_schedules_goals.indexOf(goal_id);this.current_week[0].weekly_schedules_goals.splice(i,1)}},update_module(day,module_id,event){if(event)this.current_week[0].weekly_schedules_days.days_planned[day].push(module_id);else{const i=this.current_week[0].weekly_schedules_days.days_planned[day].indexOf(module_id);this.current_week[0].weekly_schedules_days.days_planned[day].splice(i,1)}},subtitle_reports_hours_label(){let label="";return label="teacher"==this.render_has?this.strings.subtitle_reports_hours_teacher:this.strings.subtitle_reports_hours_student,label},subtitle_reports_days_student_label(){let label="";return label="teacher"==this.render_has?this.strings.subtitle_reports_days_teacher:this.strings.subtitle_reports_days_student,label},translate_name(name,prefix){var index_name=prefix+name;return void 0!==this.strings[index_name]&&(name=this.strings[index_name]),name},get_interactions(week){this.loading=!0;var validresponse=!1;this.errors=[];var data={action:"metareflexionrepotgetweek",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.paginator_week=week,validresponse=!0,this.data_report_meta_goals=response.data.data.interactions_goals,this.data_report_meta_days=response.data.data.interactions_days,this.data_report_meta_hours=response.data.data.interactions_hours,this.data_report_meta_questions=response.data.data.interactions_questions,this.course_report_hours=response.data.data.course_report_hours,this.status_planning=response.data.data.status_planning):this.errors.push(this.strings.api_error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1}),validresponse},get_interacions_last_week(week){this.loading=!0;var validresponse=!1;this.errors=[];var data={action:"metareflexionreportlastweek",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.paginator_week=week,validresponse=!0,this.data_report_meta_classroom=response.data.data.average_hours_clases.average_classroom,this.data_report_meta_of_classroom=response.data.data.average_hours_clases.average_of_classroom,this.data_report_meta_last_week=response.data.data.report_last_week):this.errors.push(this.strings.api_error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1}),validresponse},get_week_dates(week){return`${week.weekstart} ${this.strings.tv_to} ${week.weekend}`},chartdata_hours_week_dedication(){var data=new Object;data.datasets=[];let inverted=`${this.strings.myself} ${this.strings.inverted_time}`,planified=`${this.strings.myself} ${this.strings.planified_time}`;data.labels=[inverted,planified];var dataset=new Object;return dataset.label="Horas",dataset.data=[parseFloat(this.data_report_meta_hours.hours_worked),parseInt(this.data_report_meta_hours.hours_planned)],dataset.backgroundColor=["#ffa700","#a0c2fa"],dataset.borderWidth=0,data.datasets.push(dataset),data.labels.splice(1,0,this.strings.inverted_time_course),dataset.data.splice(1,0,parseFloat(this.course_report_hours.hours_worked)),dataset.backgroundColor.splice(1,0,"#ffa700"),data},action_save_metareflexion(course_module){course_module.weekly_schedules_id?this.update_metareflexion(course_module):this.save_metareflexion_new(course_module),this.get_interaction_group(this.paginator_week)},updated_metareflexion(){this.selected_week.weekcode==this.paginator_week.weekcode&&this.saved_planification&&(this.get_interactions(this.paginator_week),this.saved_planification=!1)},get_selected_days(week){var filtered_days=[];return Object.keys(week).forEach((day,index)=>{week[day]&&filtered_days.push(day)}),filtered_days.join()},update_metareflexion(course_module){var data={action:"updatemetareflexion",metareflexionid:course_module.weekly_schedules_id,hours:this.current_week[0].weekly_schedules_hours.hours_planned,goals:this.current_week[0].weekly_schedules_goals,days:JSON.stringify(this.current_week[0].weekly_schedules_days.days_planned),courseid:this.courseid,weekcode:course_module.weekcode,userid:this.userid};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok&&(Alertify.success(this.strings.update_planification_success),course_module.modalopened=!1)}).catch(e=>{this.saving_loader=!1,Alertify.error("The note could not be saved...")})},save_metareflexion_new(course_module){var data={action:"savemetareflexion",userid:this.userid,courseid:this.courseid,weekcode:course_module.weekcode,hours:this.current_week[0].weekly_schedules_hours.hours_planned,goals:this.current_week[0].weekly_schedules_goals,days:JSON.stringify(this.current_week[0].weekly_schedules_days.days_planned)};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(course_module.weekly_schedules_id=response.data.data.responsemetareflexion.id,Alertify.success(this.strings.save_planification_success),course_module.modalopened=!1):Alertify.error(this.strings.api_error_network)}).catch(e=>{this.saving_loader=!1,Alertify.error(this.strings.api_error_network)}).finally(()=>{this.saving_loader=!1})},actions_last_week(){this.data_report_meta_questions.id?this.update_last_week():this.save_last_week()},save_last_week(){var data_params={action:"savelastweek",userid:this.userid,courseid:this.courseid.toString(),weekcode:this.paginator_week.weekcode,classroom_hours:this.data_report_meta_questions.classroom_hours,hours_off:this.data_report_meta_questions.hours_off_course,objectives_reached:this.data_report_meta_questions.questions[1].answer_selected,previous_class:this.data_report_meta_questions.questions[2].answer_selected,benefit:this.data_report_meta_questions.questions[3].answer_selected,feeling:this.data_report_meta_questions.questions[4].answer_selected};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data_params}).then(response=>{200==response.status&&response.data.ok&&(this.data_report_meta_questions.id=response.data.data.response_save_last_week.id,Alertify.success(this.strings.last_week_created))}).catch(e=>{Alertify.error(this.strings.api_error_network)})},update_last_week(){var data_params={action:"updatelastweek",userid:this.userid,courseid:this.courseid,lastweekid:this.data_report_meta_questions.id,classroom_hours:this.data_report_meta_questions.classroom_hours,hours_off:this.data_report_meta_questions.hours_off_course,objectives_reached:this.data_report_meta_questions.questions[1].answer_selected,previous_class:this.data_report_meta_questions.questions[2].answer_selected,benefit:this.data_report_meta_questions.questions[3].answer_selected,feeling:this.data_report_meta_questions.questions[4].answer_selected};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data_params}).then(response=>{200==response.status&&response.data.ok&&Alertify.success(this.strings.last_week_update)}).catch(e=>{Alertify.error(this.strings.api_error_network)})},get_icon(days_planned_trabajados,position){var icon_name="remove";return days_planned_trabajados.days_planned[position]&&(icon_name=days_planned_trabajados.days_worked[position]>0?"mdi-thumb-up-outline":"mdi-mdi-thumb-down-outline"),icon_name},get_help_content(){var helpcontents=[],help;if(0==this.active_tab)(help=new Object).title=this.strings.currentweek_card_title,help.description=this.strings.currentweek_description_student,helpcontents.push(help);else if(1==this.active_tab){var help;(help=new Object).title=this.strings.subtitle_reports_hours,help.description=this.strings.description_reports_hours_student,helpcontents.push(help),(help=new Object).description=this.strings.description_reports_goals_student,helpcontents.push(help),(help=new Object).title=this.strings.subtitle_reports_days,help.description=this.strings.description_reports_days_student,helpcontents.push(help),(help=new Object).description=this.strings.description_reports_meta_student,helpcontents.push(help)}return helpcontents},is_teacher(){let is_teacher;return"teacher"==this.render_has},must_renderize(tab){var render=!0;return render="teacher"==this.render_has?tab.teacher_can_view:tab.student_can_view},get_title_content(){var title_content_tab;return 0==this.active_tab?title_content_tab=this.strings.currentweek_card_title:1==this.active_tab&&(title_content_tab=this.strings.effectiveness_title),title_content_tab},planned_week_summary(){var summary=!1;return this.selected_week&&(summary=`<strong class="text-uppercase">${this.strings.pagination_name} ${this.selected_week.number}</strong>${this.strings.planning_week_start}\n ${this.selected_week.weekstart} ${this.strings.planning_week_end} ${this.selected_week.weekend}\n `),summary},get_interaction_group(week){this.get_interactions(week),this.get_interacions_last_week(week)},setGraphicsEventListeners(){let graphics=document.querySelectorAll(".highcharts-container");graphics.length<1?setTimeout(vue.setGraphicsEventListeners,500):(graphics[0].id="EfficiencyChart",graphics.forEach(graph=>{graph.addEventListener("mouseenter",vue.addLogsViewGraphic)}))},addLogsViewGraphic(e){event.stopPropagation();var action="",objectName="",objectType="",objectDescription="";switch(e.target.id){case"EfficiencyChart":action="viewed",objectName="reflection_chart",objectType="chart",objectDescription="A bar chart";break;default:action="viewed",objectName="",objectType="chart",objectDescription="A chart"}vue.addLogsIntoDB(action,objectName,objectType,objectDescription)},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"META_REFLECTION",actiontype:action,objectType:objectType,objectName:objectName,currentUrl:document.location.href,objectDescription:objectDescription};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok}).catch(e=>{})}}})}return{init:init}})); \ No newline at end of file +define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/alertify","local_notemyprogress/pagination","local_notemyprogress/chartdynamic","local_notemyprogress/pageheader"],(function(Vue,Vuetify,Axios,Alertify,Pagination,ChartStatic,Pageheader){"use strict";function init(content){Vue.use(Vuetify),Vue.component("pagination",Pagination),Vue.component("chart",ChartStatic),Vue.component("pageheader",Pageheader);const vue=new Vue({delimiters:["[[","]]"],el:"#metareflexion",vuetify:new Vuetify,data:{test:!0,module_groups:content.module_groups,indicators:content.indicators,resources_access_colors:content.resources_access_colors,inverted_time_colors:content.inverted_time_colors,inverted_time:content.indicators.inverted_time,hours_sessions:content.indicators.hours_sessions,sections:content.indicators.sections,sections_map:null,week_progress:0,resource_access_categories:[],resource_access_data:[],modules_dialog:!1,help_dialog:!1,help_contents:[],disabled_form:!1,groups:content.groups,students_planification:content.students_planification,selected_week:null,paginator_week:null,saved_planification:!1,strings:content.strings,userid:content.userid,courseid:content.courseid,loading:!1,compare_with_course:!1,current_week:content.cmcurrentweeknew,week_schedule:content.week_schedule,data_report_meta_days:content.data_report_days,data_report_meta_hours:content.data_report_hours,data_report_meta_goals:content.data_report_goals,data_report_meta_questions:content.data_report_hours_questions,data_report_meta_last_week:content.report_last_week,status_planning:content.status_planning,course_report_hours:content.course_report_hours,past_week:content.lastweek,render_has:content.profile_render,dialog:!1,days_week:[content.strings.currentweek_day_lun,content.strings.currentweek_day_mar,content.strings.currentweek_day_mie,content.strings.currentweek_day_jue,content.strings.currentweek_day_vie,content.strings.currentweek_day_sab,content.strings.currentweek_day_dom],active_tab:0,icons:{calendar:content.calendar_icon},tabs_header:[{name:content.strings.tab_1,id:1,teacher_can_view:!1,student_can_view:!0},{name:content.strings.tab_2,id:2,teacher_can_view:!1,student_can_view:!0}],hours_committed:0,id_committed:null,pages:content.pages,active_tab:null,chart_metareflexion_options:{maintainAspectRatio:!1,legend:{display:!1},scales:{xAxes:[{ticks:{beginAtZero:!0,callback:function(value){if(Number.isInteger(value))return value},suggestedMin:0,suggestedMax:5}}]}},img_no_data:content.image_no_data},mounted(){document.querySelector("#sr-loader").style.display="none",document.querySelector("#metareflexion").style.display="block",this.past_week.classroom_hours||(this.past_week.classroom_hours=0),this.past_week.classroom_hours||(this.past_week.hours_off_course=0),this.pages.forEach(page=>{page.selected&&(this.selected_week=page,this.paginator_week=page)}),setTimeout((function(){vue.setGraphicsEventListeners()}),500),vue.setGraphicsEventListeners()},computed:{progress(){var count_all=0,count_finished=0;Object.keys(this.module_groups).map(key=>{let group=this.module_groups[key];count_all+=group.count_all,count_finished+=group.count_finished});let average=100*count_finished/count_all;return average=Number.isNaN(average)?0:average.toFixed(0),average},isDisabledBtnLastWeek(){return null===this.data_report_meta_questions.questions[1].answer_selected||null===this.data_report_meta_questions.questions[2].answer_selected||null===this.data_report_meta_questions.questions[3].answer_selected||null===this.data_report_meta_questions.questions[4].answer_selected},hasLastWeek(){var last_week=!1;return this.pages.forEach(page=>{page.is_current_week&&page.number>1&&(last_week=!0)}),last_week},isDisabledQuestions(){return null==this.paginator_week||!(this.week_schedule[this.paginator_week.weekcode]&&!this.paginator_week.is_current_week)}},methods:{get_modules(day,cmid){return this.current_week[0].weekly_schedules_days.days_planned[day].includes(cmid)},update_interactions(week){this.loading=!0,this.errors=[];let data={action:"worksessions",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.hours_sessions=response.data.data.indicators.sessions,this.session_count=response.data.data.indicators.count,this.inverted_time=response.data.data.indicators.time):this.error_messages.push(this.strings.error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1,vue.addLogsIntoDB("viewed","week_"+week.weekcode,"week_section","Week section that allows you to obtain information on a specific week"),vue.setGraphicsEventListeners()}),this.data},convert_time(time){time*=3600;let h=this.strings.hours_short,m=this.strings.minutes_short,s=this.strings.seconds_short,hours=Math.floor(time/3600),minutes=Math.floor(time%3600/60),seconds=Math.floor(time%60),text;return text=hours>=1?minutes>=1?`${hours}${h} ${minutes}${m}`:`${hours}${h}`:minutes>=1?seconds>=1?`${minutes}${m} ${seconds}${s}`:`${minutes}${m}`:`${seconds}${s}`,text},get_help_content(){let contents=[];return contents.push({title:this.strings.section_help_title,description:this.strings.section_help_description}),contents},build_inverted_time_chart(){let chart=new Object,meta=new Object;meta=this.chartdata_hours_week_dedication();let invest=[{name:meta.labels[2],y:meta.datasets[0].data[2]},{name:meta.labels[0],y:meta.datasets[0].data[0]},{name:meta.labels[1],y:meta.datasets[0].data[1]}];return chart.chart={type:"bar",backgroundColor:null,style:{fontFamily:"poppins"}},chart.title={text:null},chart.colors=this.inverted_time_colors,chart.xAxis={type:"category",crosshair:!0},chart.yAxis={title:{text:this.strings.inverted_time_chart_x_axis}},chart.tooltip={shared:!0,useHTML:!0,formatter:function(){let category_name,time;return`<b>${this.points[0].key}: </b>${vue.convert_time(this.y)}`}},chart.legend={enabled:!1},chart.series=[{colorByPoint:!0,data:invest}],chart},get_goal(goal_id){return this.current_week[0].weekly_schedules_goals.includes(goal_id)},update_goal(goal_id,event){if(event)this.current_week[0].weekly_schedules_goals.push(goal_id);else{const i=this.current_week[0].weekly_schedules_goals.indexOf(goal_id);this.current_week[0].weekly_schedules_goals.splice(i,1)}},update_module(day,module_id,event){if(event)this.current_week[0].weekly_schedules_days.days_planned[day].push(module_id);else{const i=this.current_week[0].weekly_schedules_days.days_planned[day].indexOf(module_id);this.current_week[0].weekly_schedules_days.days_planned[day].splice(i,1)}},subtitle_reports_hours_label(){let label="";return label="teacher"==this.render_has?this.strings.subtitle_reports_hours_teacher:this.strings.subtitle_reports_hours_student,label},subtitle_reports_days_student_label(){let label="";return label="teacher"==this.render_has?this.strings.subtitle_reports_days_teacher:this.strings.subtitle_reports_days_student,label},translate_name(name,prefix){var index_name=prefix+name;return void 0!==this.strings[index_name]&&(name=this.strings[index_name]),name},get_interactions(week){this.loading=!0;var validresponse=!1;this.errors=[];var data={action:"metareflexionrepotgetweek",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.paginator_week=week,validresponse=!0,this.data_report_meta_goals=response.data.data.interactions_goals,this.data_report_meta_days=response.data.data.interactions_days,this.data_report_meta_hours=response.data.data.interactions_hours,this.data_report_meta_questions=response.data.data.interactions_questions,this.course_report_hours=response.data.data.course_report_hours,this.status_planning=response.data.data.status_planning):this.errors.push(this.strings.api_error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1}),validresponse},get_interacions_last_week(week){this.loading=!0;var validresponse=!1;this.errors=[];var data={action:"metareflexionreportlastweek",userid:this.userid,courseid:this.courseid,weekcode:week.weekcode,profile:this.render_has};return Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.paginator_week=week,validresponse=!0,this.data_report_meta_classroom=response.data.data.average_hours_clases.average_classroom,this.data_report_meta_of_classroom=response.data.data.average_hours_clases.average_of_classroom,this.data_report_meta_last_week=response.data.data.report_last_week):this.errors.push(this.strings.api_error_network)}).catch(e=>{this.errors.push(this.strings.api_error_network)}).finally(()=>{this.loading=!1}),validresponse},get_week_dates(week){return`${week.weekstart} ${this.strings.tv_to} ${week.weekend}`},chartdata_hours_week_dedication(){var data=new Object;data.datasets=[];let inverted=`${this.strings.myself} ${this.strings.inverted_time}`,planified=`${this.strings.myself} ${this.strings.planified_time}`;data.labels=[inverted,planified];var dataset=new Object;return dataset.label="Horas",dataset.data=[parseFloat(this.data_report_meta_hours.hours_worked),parseInt(this.data_report_meta_hours.hours_planned)],dataset.backgroundColor=["#ffa700","#a0c2fa"],dataset.borderWidth=0,data.datasets.push(dataset),data.labels.splice(1,0,this.strings.inverted_time_course),dataset.data.splice(1,0,parseFloat(this.course_report_hours.hours_worked)),dataset.backgroundColor.splice(1,0,"#ffa700"),data},action_save_metareflexion(course_module){course_module.weekly_schedules_id?this.update_metareflexion(course_module):this.save_metareflexion_new(course_module),this.get_interaction_group(this.paginator_week)},updated_metareflexion(){this.selected_week.weekcode==this.paginator_week.weekcode&&this.saved_planification&&(this.get_interactions(this.paginator_week),this.saved_planification=!1)},get_selected_days(week){var filtered_days=[];return Object.keys(week).forEach((day,index)=>{week[day]&&filtered_days.push(day)}),filtered_days.join()},update_metareflexion(course_module){var data={action:"updatemetareflexion",metareflexionid:course_module.weekly_schedules_id,hours:this.current_week[0].weekly_schedules_hours.hours_planned,goals:this.current_week[0].weekly_schedules_goals,days:JSON.stringify(this.current_week[0].weekly_schedules_days.days_planned),courseid:this.courseid,weekcode:course_module.weekcode,userid:this.userid};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok&&(Alertify.success(this.strings.update_planification_success),course_module.modalopened=!1)}).catch(e=>{this.saving_loader=!1,Alertify.error("The note could not be saved...")})},save_metareflexion_new(course_module){var data={action:"savemetareflexion",userid:this.userid,courseid:this.courseid,weekcode:course_module.weekcode,hours:this.current_week[0].weekly_schedules_hours.hours_planned,goals:this.current_week[0].weekly_schedules_goals,days:JSON.stringify(this.current_week[0].weekly_schedules_days.days_planned)};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(course_module.weekly_schedules_id=response.data.data.responsemetareflexion.id,Alertify.success(this.strings.save_planification_success),course_module.modalopened=!1):Alertify.error(this.strings.api_error_network)}).catch(e=>{this.saving_loader=!1,Alertify.error(this.strings.api_error_network)}).finally(()=>{this.saving_loader=!1})},actions_last_week(){this.data_report_meta_questions.id?this.update_last_week():this.save_last_week()},save_last_week(){var data_params={action:"savelastweek",userid:this.userid,courseid:this.courseid.toString(),weekcode:this.paginator_week.weekcode,classroom_hours:this.data_report_meta_questions.classroom_hours,hours_off:this.data_report_meta_questions.hours_off_course,objectives_reached:this.data_report_meta_questions.questions[1].answer_selected,previous_class:this.data_report_meta_questions.questions[2].answer_selected,benefit:this.data_report_meta_questions.questions[3].answer_selected,feeling:this.data_report_meta_questions.questions[4].answer_selected};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data_params}).then(response=>{200==response.status&&response.data.ok&&(this.data_report_meta_questions.id=response.data.data.response_save_last_week.id,Alertify.success(this.strings.last_week_created))}).catch(e=>{Alertify.error(this.strings.api_error_network)})},update_last_week(){var data_params={action:"updatelastweek",userid:this.userid,courseid:this.courseid,lastweekid:this.data_report_meta_questions.id,classroom_hours:this.data_report_meta_questions.classroom_hours,hours_off:this.data_report_meta_questions.hours_off_course,objectives_reached:this.data_report_meta_questions.questions[1].answer_selected,previous_class:this.data_report_meta_questions.questions[2].answer_selected,benefit:this.data_report_meta_questions.questions[3].answer_selected,feeling:this.data_report_meta_questions.questions[4].answer_selected};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data_params}).then(response=>{200==response.status&&response.data.ok&&Alertify.success(this.strings.last_week_update)}).catch(e=>{Alertify.error(this.strings.api_error_network)})},get_icon(days_planned_trabajados,position){var icon_name="remove";return days_planned_trabajados.days_planned[position]&&(icon_name=days_planned_trabajados.days_worked[position]>0?"mdi-thumb-up-outline":"mdi-mdi-thumb-down-outline"),icon_name},get_help_content(){var helpcontents=[],help;if(0==this.active_tab)(help=new Object).title=this.strings.currentweek_card_title,help.description=this.strings.currentweek_description_student,helpcontents.push(help);else if(1==this.active_tab){var help;(help=new Object).title=this.strings.subtitle_reports_hours,help.description=this.strings.description_reports_hours_student,helpcontents.push(help),(help=new Object).description=this.strings.description_reports_goals_student,helpcontents.push(help),(help=new Object).title=this.strings.subtitle_reports_days,help.description=this.strings.description_reports_days_student,helpcontents.push(help),(help=new Object).description=this.strings.description_reports_meta_student,helpcontents.push(help)}return helpcontents},is_teacher(){let is_teacher;return"teacher"==this.render_has},must_renderize(tab){var render=!0;return render="teacher"==this.render_has?tab.teacher_can_view:tab.student_can_view},get_title_content(){return this.strings.title_metareflexion},planned_week_summary(){var summary=!1;return this.selected_week&&(summary=`<strong class="text-uppercase">${this.strings.pagination_name} ${this.selected_week.number}</strong>${this.strings.planning_week_start}\n ${this.selected_week.weekstart} ${this.strings.planning_week_end} ${this.selected_week.weekend}\n `),summary},get_interaction_group(week){this.get_interactions(week),this.get_interacions_last_week(week)},setGraphicsEventListeners(){let graphics=document.querySelectorAll(".highcharts-container");graphics.length<1?setTimeout(vue.setGraphicsEventListeners,500):(graphics[0].id="EfficiencyChart",graphics.forEach(graph=>{graph.addEventListener("mouseenter",vue.addLogsViewGraphic)}))},addLogsViewGraphic(e){event.stopPropagation();var action="",objectName="",objectType="",objectDescription="";switch(e.target.id){case"EfficiencyChart":action="viewed",objectName="reflection_chart",objectType="chart",objectDescription="A bar chart";break;default:action="viewed",objectName="",objectType="chart",objectDescription="A chart"}vue.addLogsIntoDB(action,objectName,objectType,objectDescription)},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"META_REFLECTION",actiontype:action,objectType:objectType,objectName:objectName,currentUrl:document.location.href,objectDescription:objectDescription};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok}).catch(e=>{})}}})}return{init:init}})); \ No newline at end of file diff --git a/notemyprogress/amd/build/setweeks.min.js b/notemyprogress/amd/build/setweeks.min.js index 4fcb9b6..21a15cc 100644 --- a/notemyprogress/amd/build/setweeks.min.js +++ b/notemyprogress/amd/build/setweeks.min.js @@ -1 +1 @@ -define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/sortablejs","local_notemyprogress/draggable","local_notemyprogress/datepicker","local_notemyprogress/moment","local_notemyprogress/alertify","local_notemyprogress/pageheader"],(function(Vue,Vuetify,Axios,Sortable,Draggable,Datepicker,Moment,Alertify,Pageheader){"use strict";function init(content){content=add_collapsabled_property_to_weeks(content),Vue.use(Vuetify),Vue.component("draggable",Draggable),Vue.component("datepicker",Datepicker),Vue.component("pageheader",Pageheader);const app=new Vue({delimiters:["[[","]]"],el:"#setweeks",vuetify:new Vuetify,data:{display_settings:!1,settings:content.settings,new_group:!1,scroll_mode:!1,weeks_started_at:new Date(Moment(1e3*Number(content.weeks[0].weekstart))),strings:content.strings,sections:content.sections,courseid:content.courseid,userid:content.userid,raw_weeks:content.weeks,disabled_dates:{days:[0,2,3,4,5,6]},saving_loader:!1,error_messages:[],save_successful:!1,form_identical:!0},mounted(){document.querySelector("#setweeks-loader").style.display="none",document.querySelector("#setweeks").style.display="block",this.cache_weeks_started_at=new Date(this.weeks_started_at.getTime()),this.cache_sections=JSON.parse(JSON.stringify(this.sections)),this.cache_raw_weeks=JSON.parse(JSON.stringify(this.raw_weeks))},computed:{weeks(){for(let i=0;i<this.raw_weeks.length;i++){let week=this.raw_weeks[i];if(0==i){let start_weeks=this.weeks_started_at;week.weekstart=start_weeks,week.weekend=this.get_end_week(this.weeks_started_at)}else week.weekstart=this.get_start_week(this.raw_weeks[i-1].weekend),week.weekend=this.get_end_week(week.weekstart)}return this.raw_weeks},cache_weeks(){for(let i=0;i<this.cache_raw_weeks.length;i++){let week=this.cache_raw_weeks[i];if(0==i){let start_weeks=this.cache_weeks_started_at;week.weekstart=start_weeks,week.weekend=this.get_end_week(this.cache_weeks_started_at)}else week.weekstart=this.get_start_week(this.cache_raw_weeks[i-1].weekend),week.weekend=this.get_end_week(week.weekstart)}return this.cache_raw_weeks}},methods:{form_changed(){this.form_identical=!1},cache_save(){this.cache_weeks_started_at=new Date(this.weeks_started_at.getTime()),this.cache_sections=JSON.parse(JSON.stringify(this.sections)),this.cache_raw_weeks=JSON.parse(JSON.stringify(this.raw_weeks)),this.form_identical=!0},cache_cancel(){this.weeks_started_at=new Date(this.cache_weeks_started_at.getTime()),this.sections=JSON.parse(JSON.stringify(this.cache_sections)),this.raw_weeks=JSON.parse(JSON.stringify(this.cache_raw_weeks)),this.form_identical=!0},section_name(section){let name=null;return name=void 0!==section.section_name&§ion.section_name.length>0?section.section_name:section.name,name},section_exist(section){let exist=!0;return void 0!==section&&void 0!==section.exists&&0==section.exists&&(exist=!1),exist},format_name:(name,position)=>name+" "+(position+1),customFormatter(date){let weeks_start_at;return Moment(date).format("YYYY-MM-DD")},add_week(){this.raw_weeks.push({name:this.strings.week,position:this.weeks.length+1,weekstart:null,weekend:null,collapsabled:!1,hours_dedications:0,removable:!0,sections:[]}),this.form_changed()},has_items:array=>array.length>0,remove_week(week,index){if(0==index)return null;this.close_delete_confirm();for(let i=0;i<week.sections.length;i++)this.sections.push(week.sections[i]);let element_index=this.raw_weeks.indexOf(week);this.raw_weeks.splice(element_index,1),this.form_changed()},ask_delete_confirm(){this.delete_confirm=!0},close_delete_confirm(){this.delete_confirm=!1},get_start_week(pass_week){let start_date;return Moment(Moment(pass_week).add(1,"days")).format("YYYY-MM-DD")},get_end_week(start_week){let end_date;return Moment(Moment(start_week).add(6,"days")).format("YYYY-MM-DD")},get_date_next_day(requested_day,date,output_format=null){requested_day=requested_day.toLowerCase();let current_day=Moment(date).format("dddd").toLowerCase();for(;current_day!=requested_day;)date=Moment(date).add(1,"days"),current_day=Moment(date).format("dddd").toLowerCase();return output_format?date=date.format(output_format):"number"!=typeof date&&(date=parseInt(date.format("x"))),date},position:index=>`${++index} - `,save_changes(){return this.save_successful=!1,this.error_messages=[],this.empty_weeks()?(this.saving_loader=!1,Alertify.error(this.strings.error_empty_week),this.error_messages.push(this.strings.error_empty_week),!1):this.weeks_deleted_from_course()?(this.saving_loader=!1,this.error_messages.push(this.strings.error_section_removed),!1):void Alertify.confirm(this.strings.save_warning_content,()=>{this.saving_loader=!0;var weeks=this.weeks;weeks[0].weekstart=Moment(weeks[0].weekstart).format("YYYY-MM-DD");var data={action:"saveconfigweek",userid:this.userid,courseid:this.courseid,newinstance:this.new_group,weeks:this.minify_query(weeks)};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.settings=response.data.data.settings,Alertify.success(this.strings.save_successful),this.save_successful=!0,this.cache_save()):(Alertify.error(this.strings.error_network),this.error_messages.push(this.strings.error_network))}).catch(e=>{console.log("catch1"),Alertify.error(this.strings.error_network),console.log("catch2"),this.error_messages.push(this.strings.error_network),console.log("catch3")}).finally(()=>{this.saving_loader=!1})},()=>{this.saving_loader=!1,Alertify.warning(this.strings.cancel_action)}).set({title:this.strings.save_warning_title}).set({labels:{cancel:this.strings.confirm_cancel,ok:this.strings.confirm_ok}})},minify_query(weeks){var minify=[];return weeks.forEach(week=>{var wk=new Object;wk.h=week.hours_dedications,wk.s=week.weekstart,wk.e=week.weekend,wk.sections=[],week.sections.forEach(section=>{var s=new Object;s.sid=section.sectionid,wk.sections.push(s)}),minify.push(wk)}),JSON.stringify(minify)},empty_weeks(){if(this.weeks.length>=2&&this.weeks[0].sections.length<1)return!0;for(let i=0;i<this.weeks.length;i++)if(i>0&&this.weeks[i].sections.length<=0)return!0;return!1},weeks_deleted_from_course(){for(var week_position=0;week_position<this.weeks.length;week_position++)for(var section_position=0;section_position<this.weeks[week_position].sections.length;section_position++)if(!this.section_exist(this.weeks[week_position].sections[section_position]))return!0;return!1},exists_mistakes(){let exists_mistakes;return this.error_messages.length>0},change_collapsabled(index){this.raw_weeks[index].collapsabled=!this.raw_weeks[index].collapsabled,this.form_changed()},course_finished(){let finished=!1,last=this.weeks.length-1,end=Moment(this.weeks[last].weekend).format("X"),now;return finished=Moment().format("X")>end,finished},get_settings_status(){let visible=!0,status;return Object.keys(this.settings).map(key=>{this.settings[key]||(visible=!1)}),visible?this.strings.plugin_visible:this.strings.plugin_hidden},get_help_content(){var help_contents=[],help=new Object;return help.title=this.strings.title,help.description=this.strings.description,help_contents.push(help),help_contents},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"CONFIGURATION_COURSE_WEEK",actiontype:action,objectType:objectType,objectName:objectName,currentUrl:document.location.href,objectDescription:objectDescription};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok}).catch(e=>{})}}})}function add_collapsabled_property_to_weeks(content){for(let i=0;i<content.weeks.length;i++){let week=content.weeks[i];void 0===week.collapsabled&&(week.collapsabled=!1)}return content}return{init:init}})); \ No newline at end of file +define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/sortablejs","local_notemyprogress/draggable","local_notemyprogress/datepicker","local_notemyprogress/moment","local_notemyprogress/alertify","local_notemyprogress/pageheader"],(function(Vue,Vuetify,Axios,Sortable,Draggable,Datepicker,Moment,Alertify,Pageheader){"use strict";function init(content){content=add_collapsabled_property_to_weeks(content),Vue.use(Vuetify),Vue.component("draggable",Draggable),Vue.component("datepicker",Datepicker),Vue.component("pageheader",Pageheader);const app=new Vue({delimiters:["[[","]]"],el:"#setweeks",vuetify:new Vuetify,data:{display_settings:!1,settings:content.settings,new_group:!1,scroll_mode:!1,weeks_started_at:new Date(Moment(1e3*Number(content.weeks[0].weekstart))),strings:content.strings,sections:content.sections,courseid:content.courseid,userid:content.userid,raw_weeks:content.weeks,disabled_dates:{days:[0,2,3,4,5,6]},saving_loader:!1,error_messages:[],save_successful:!1,form_identical:!0},mounted(){document.querySelector("#setweeks-loader").style.display="none",document.querySelector("#setweeks").style.display="block",this.cache_weeks_started_at=new Date(this.weeks_started_at.getTime()),this.cache_sections=JSON.parse(JSON.stringify(this.sections)),this.cache_raw_weeks=JSON.parse(JSON.stringify(this.raw_weeks))},computed:{weeks(){for(let i=0;i<this.raw_weeks.length;i++){let week=this.raw_weeks[i];if(0==i){let start_weeks=this.weeks_started_at;week.weekstart=start_weeks,week.weekend=this.get_end_week(this.weeks_started_at)}else week.weekstart=this.get_start_week(this.raw_weeks[i-1].weekend),week.weekend=this.get_end_week(week.weekstart)}return this.raw_weeks},cache_weeks(){for(let i=0;i<this.cache_raw_weeks.length;i++){let week=this.cache_raw_weeks[i];if(0==i){let start_weeks=this.cache_weeks_started_at;week.weekstart=start_weeks,week.weekend=this.get_end_week(this.cache_weeks_started_at)}else week.weekstart=this.get_start_week(this.cache_raw_weeks[i-1].weekend),week.weekend=this.get_end_week(week.weekstart)}return this.cache_raw_weeks}},methods:{form_changed(){this.form_identical=!1},cache_save(){this.cache_weeks_started_at=new Date(this.weeks_started_at.getTime()),this.cache_sections=JSON.parse(JSON.stringify(this.sections)),this.cache_raw_weeks=JSON.parse(JSON.stringify(this.raw_weeks)),this.form_identical=!0},cache_cancel(){this.weeks_started_at=new Date(this.cache_weeks_started_at.getTime()),this.sections=JSON.parse(JSON.stringify(this.cache_sections)),this.raw_weeks=JSON.parse(JSON.stringify(this.cache_raw_weeks)),this.form_identical=!0},section_name(section){let name=null;return name=void 0!==section.section_name&§ion.section_name.length>0?section.section_name:section.name,name},section_exist(section){let exist=!0;return void 0!==section&&void 0!==section.exists&&0==section.exists&&(exist=!1),exist},format_name:(name,position)=>name+" "+(position+1),customFormatter(date){let weeks_start_at;return Moment(date).format("YYYY-MM-DD")},add_week(){this.raw_weeks.push({name:this.strings.week,position:this.weeks.length+1,weekstart:null,weekend:null,collapsabled:!1,hours_dedications:0,removable:!0,sections:[]}),this.form_changed()},has_items:array=>array.length>0,remove_week(week,index){if(0==index)return null;this.close_delete_confirm();for(let i=0;i<week.sections.length;i++)this.sections.push(week.sections[i]);let element_index=this.raw_weeks.indexOf(week);this.raw_weeks.splice(element_index,1),this.form_changed()},ask_delete_confirm(){this.delete_confirm=!0},close_delete_confirm(){this.delete_confirm=!1},get_start_week(pass_week){let start_date;return Moment(Moment(pass_week).add(1,"days")).format("YYYY-MM-DD")},get_end_week(start_week){let end_date;return Moment(Moment(start_week).add(6,"days")).format("YYYY-MM-DD")},get_date_next_day(requested_day,date,output_format=null){requested_day=requested_day.toLowerCase();let current_day=Moment(date).format("dddd").toLowerCase();for(;current_day!=requested_day;)date=Moment(date).add(1,"days"),current_day=Moment(date).format("dddd").toLowerCase();return output_format?date=date.format(output_format):"number"!=typeof date&&(date=parseInt(date.format("x"))),date},position:index=>`${++index} - `,save_changes(){return this.save_successful=!1,this.error_messages=[],this.empty_weeks()?(this.saving_loader=!1,Alertify.error(this.strings.error_empty_week),this.error_messages.push(this.strings.error_empty_week),!1):this.weeks_deleted_from_course()?(this.saving_loader=!1,this.error_messages.push(this.strings.error_section_removed),!1):void Alertify.confirm(this.strings.save_warning_content,()=>{this.saving_loader=!0;var weeks=this.weeks;weeks[0].weekstart=Moment(weeks[0].weekstart).format("YYYY-MM-DD");var data={action:"saveconfigweek",userid:this.userid,courseid:this.courseid,newinstance:this.new_group,weeks:this.minify_query(weeks)};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok?(this.settings=response.data.data.settings,this.settings.has_students&&this.settings.course_start&&this.settings.weeks?(Alertify.success(this.strings.save_successful),this.save_successful=!0,this.cache_save()):(Alertify.error(this.strings.error_conditions_setweek),this.error_messages.push(this.strings.error_conditions_setweek))):(Alertify.error(this.strings.error_network),this.error_messages.push(this.strings.error_network))}).catch(e=>{Alertify.error(this.strings.error_network),this.error_messages.push(this.strings.error_network)}).finally(()=>{this.saving_loader=!1})},()=>{this.saving_loader=!1,Alertify.warning(this.strings.cancel_action)}).set({title:this.strings.save_warning_title}).set({labels:{cancel:this.strings.confirm_cancel,ok:this.strings.confirm_ok}})},minify_query(weeks){var minify=[];return weeks.forEach(week=>{var wk=new Object;wk.h=week.hours_dedications,wk.s=week.weekstart,wk.e=week.weekend,wk.sections=[],week.sections.forEach(section=>{var s=new Object;s.sid=section.sectionid,wk.sections.push(s)}),minify.push(wk)}),JSON.stringify(minify)},empty_weeks(){if(this.weeks.length>=2&&this.weeks[0].sections.length<1)return!0;for(let i=0;i<this.weeks.length;i++)if(i>0&&this.weeks[i].sections.length<=0)return!0;return!1},weeks_deleted_from_course(){for(var week_position=0;week_position<this.weeks.length;week_position++)for(var section_position=0;section_position<this.weeks[week_position].sections.length;section_position++)if(!this.section_exist(this.weeks[week_position].sections[section_position]))return!0;return!1},exists_mistakes(){let exists_mistakes;return this.error_messages.length>0},change_collapsabled(index){this.raw_weeks[index].collapsabled=!this.raw_weeks[index].collapsabled,this.form_changed()},course_finished(){let finished=!1,last=this.weeks.length-1,end=Moment(this.weeks[last].weekend).format("X"),now;return finished=Moment().format("X")>end,finished},get_settings_status(){let visible=!0,status;return Object.keys(this.settings).map(key=>{this.settings[key]||(visible=!1)}),visible?this.strings.plugin_visible:this.strings.plugin_hidden},get_help_content(){var help_contents=[],help=new Object;return help.title=this.strings.title,help.description=this.strings.description,help_contents.push(help),help_contents},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"CONFIGURATION_COURSE_WEEK",actiontype:action,objectType:objectType,objectName:objectName,currentUrl:document.location.href,objectDescription:objectDescription};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{200==response.status&&response.data.ok}).catch(e=>{})}}})}function add_collapsabled_property_to_weeks(content){for(let i=0;i<content.weeks.length;i++){let week=content.weeks[i];void 0===week.collapsabled&&(week.collapsabled=!1)}return content}return{init:init}})); \ No newline at end of file diff --git a/notemyprogress/amd/src/auto_evaluation.js b/notemyprogress/amd/src/auto_evaluation.js new file mode 100644 index 0000000..977c3f0 --- /dev/null +++ b/notemyprogress/amd/src/auto_evaluation.js @@ -0,0 +1,197 @@ +define([ + "local_notemyprogress/vue", + "local_notemyprogress/vuetify", + "local_notemyprogress/axios", + "local_notemyprogress/moment", + "local_notemyprogress/pagination", + "local_notemyprogress/chartstatic", + "local_notemyprogress/pageheader", + "local_notemyprogress/modulesform", + "local_notemyprogress/helpdialog", + "local_notemyprogress/alertify", +], function ( + Vue, + Vuetify, + Axios, + Moment, + Pagination, + ChartStatic, + PageHeader, + ModulesForm, + HelpDialog, + Alertify +) { + "use strict"; + + function init(content) { + // //console.log(content); + Vue.use(Vuetify); + Vue.component("pagination", Pagination); + Vue.component("chart", ChartStatic); + Vue.component("pageheader", PageHeader); + Vue.component("modulesform", ModulesForm); + Vue.component("helpdialog", HelpDialog); + let vue = new Vue({ + delimiters: ["[[", "]]"], + el: "#auto_evaluation", + vuetify: new Vuetify(), + data() { + return { + strings: content.strings, + groups: content.groups, + userid: content.userid, + courseid: content.courseid, + timezone: content.timezone, + render_has: content.profile_render, + loading: false, + errors: [], + pages: content.pages, + + indicators: content.indicators, + resources_access_colors: content.resources_access_colors, + inverted_time_colors: content.inverted_time_colors, + inverted_time: content.indicators.inverted_time, + hours_sessions: content.indicators.hours_sessions, + sections: content.indicators.sections, + sections_map: null, + week_progress: 0, + resource_access_categories: [], + resource_access_data: [], + modules_dialog: false, + + help_dialog: false, + help_contents: [], + auto_eval_answers: content.auto_eval_answers, + saving_loader: false, + auto_eval_saved: content.auto_eval_saved, + }; + }, + beforeMount() {}, + mounted() { + document.querySelector("#auto_evaluation-loader").style.display = "none"; + document.querySelector("#auto_evaluation").style.display = "block"; + }, + methods: { + + action_save_auto_evaluation() { + if (this.auto_eval_saved) { + console.log("update") + this.update_auto_eval(); + } else { + console.log("save") + this.save_auto_eval(); + } + }, + + save_auto_eval() { + var data = { + action: "saveautoeval", + userid: this.userid, + courseid: this.courseid, + auto_eval_answers: this.auto_eval_answers + }; + + Axios({ + method: "get", + url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php", + params: data, + }) + .then((response) => { + //console.log("then"); + if (response.status == 200 && response.data.ok) { + this.auto_eval_saved = true; + //console.log(response.data.data.responsemetareflexion.days); + console.log("if"); + Alertify.success(this.strings.message_save_successful); + //course_module.modalopened = false; + } else { + console.log("else"); + Alertify.error(this.strings.api_error_network); + } + }) + .catch((e) => { + console.log("catch"); + this.saving_loader = false; + Alertify.error(this.strings.api_error_network); + }) + .finally(() => { + console.log("finally"); + this.saving_loader = false; + }); + }, + + update_auto_eval() { + var data = { + action: "updateautoeval", + userid: this.userid, + courseid: this.courseid, + auto_eval_answers: this.auto_eval_answers + }; + + Axios({ + method: "get", + url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php", + params: data, + }) + .then((response) => { + //console.log("then"); + if (response.status == 200 && response.data.ok) { + //console.log(response.data.data.responsemetareflexion.days); + console.log("if"); + Alertify.success(this.strings.message_update_successful); + //course_module.modalopened = false; + } else { + console.log("else"); + Alertify.error(this.strings.api_error_network); + } + }) + .catch((e) => { + console.log("catch"); + this.saving_loader = false; + Alertify.error(this.strings.api_error_network); + }) + .finally(() => { + console.log("finally"); + this.saving_loader = false; + }); + }, + + addLogsIntoDB(action, objectName, objectType, objectDescription) { + let data = { + courseid: content.courseid, + userid: content.userid, + action: "addLogs", + sectionname: "STUDENT_STUDY_SESSIONS", + actiontype: action, + objectType: objectType, + objectName: objectName, + currentUrl: document.location.href, + objectDescription: objectDescription, + }; + Axios({ + method: "get", + url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php", + params: data, + }) + .then((response) => { + if (response.status == 200 && response.data.ok) { + } + }) + .catch((e) => {}); + }, + get_help_content() { + var help_contents = []; + var help = new Object(); + help.title = this.strings.page_title_auto_eval; + help.description = this.strings.description_auto_eval; + help_contents.push(help); + return help_contents; + }, + }, + }); + } + + return { + init: init, + }; +}); diff --git a/notemyprogress/amd/src/metareflexion.js b/notemyprogress/amd/src/metareflexion.js index 9dc457a..d1b0354 100644 --- a/notemyprogress/amd/src/metareflexion.js +++ b/notemyprogress/amd/src/metareflexion.js @@ -4,11 +4,8 @@ define([ "local_notemyprogress/axios", "local_notemyprogress/alertify", "local_notemyprogress/pagination", - //"local_notemyprogress/paginationcomponent", "local_notemyprogress/chartdynamic", - //"local_notemyprogress/chartcomponent", "local_notemyprogress/pageheader", - //"local_student_reports/pageheadercomponent", ], function ( Vue, Vuetify, @@ -35,106 +32,106 @@ define([ el: "#metareflexion", vuetify: new Vuetify(), data: { - test: true, - module_groups: content.module_groups, - indicators: content.indicators, - resources_access_colors: content.resources_access_colors, - inverted_time_colors: content.inverted_time_colors, - inverted_time: content.indicators.inverted_time, - hours_sessions: content.indicators.hours_sessions, - sections: content.indicators.sections, - sections_map: null, - week_progress: 0, - resource_access_categories: [], - resource_access_data: [], - modules_dialog: false, - help_dialog: false, - help_contents: [], - - disabled_form: false, - groups: content.groups, - students_planification: content.students_planification, - selected_week: null, - paginator_week: null, - saved_planification: false, - strings: content.strings, - userid: content.userid, - courseid: content.courseid, - loading: false, - compare_with_course: false, - current_week: content.cmcurrentweeknew, - week_schedule: content.week_schedule, - - data_report_meta_days: content.data_report_days, - data_report_meta_hours: content.data_report_hours, - data_report_meta_goals: content.data_report_goals, - - data_report_meta_questions: content.data_report_hours_questions, - - // data_report_meta_classroom: content.data_report_classroom.average_classroom, - //data_report_meta_of_classroom: content.data_report_classroom.average_of_classroom, - data_report_meta_last_week: content.report_last_week, - - status_planning: content.status_planning, - course_report_hours: content.course_report_hours, - past_week: content.lastweek, - render_has: content.profile_render, - dialog: false, - days_week: [ - content.strings.currentweek_day_lun, - content.strings.currentweek_day_mar, - content.strings.currentweek_day_mie, - content.strings.currentweek_day_jue, - content.strings.currentweek_day_vie, - content.strings.currentweek_day_sab, - content.strings.currentweek_day_dom, - ], - active_tab: 0, - icons: { - calendar: content.calendar_icon, + test: true, + module_groups: content.module_groups, + indicators: content.indicators, + resources_access_colors: content.resources_access_colors, + inverted_time_colors: content.inverted_time_colors, + inverted_time: content.indicators.inverted_time, + hours_sessions: content.indicators.hours_sessions, + sections: content.indicators.sections, + sections_map: null, + week_progress: 0, + resource_access_categories: [], + resource_access_data: [], + modules_dialog: false, + help_dialog: false, + help_contents: [], + + disabled_form: false, + groups: content.groups, + students_planification: content.students_planification, + selected_week: null, + paginator_week: null, + saved_planification: false, + strings: content.strings, + userid: content.userid, + courseid: content.courseid, + loading: false, + compare_with_course: false, + current_week: content.cmcurrentweeknew, + week_schedule: content.week_schedule, + + data_report_meta_days: content.data_report_days, + data_report_meta_hours: content.data_report_hours, + data_report_meta_goals: content.data_report_goals, + + data_report_meta_questions: content.data_report_hours_questions, + + // data_report_meta_classroom: content.data_report_classroom.average_classroom, + //data_report_meta_of_classroom: content.data_report_classroom.average_of_classroom, + data_report_meta_last_week: content.report_last_week, + + status_planning: content.status_planning, + course_report_hours: content.course_report_hours, + past_week: content.lastweek, + render_has: content.profile_render, + dialog: false, + days_week: [ + content.strings.currentweek_day_lun, + content.strings.currentweek_day_mar, + content.strings.currentweek_day_mie, + content.strings.currentweek_day_jue, + content.strings.currentweek_day_vie, + content.strings.currentweek_day_sab, + content.strings.currentweek_day_dom, + ], + active_tab: 0, + icons: { + calendar: content.calendar_icon, + }, + tabs_header: [ + { + name: content.strings.tab_1, + id: 1, + teacher_can_view: false, + student_can_view: true, }, - tabs_header: [ - { - name: content.strings.tab_1, - id: 1, - teacher_can_view: false, - student_can_view: true, - }, - { - name: content.strings.tab_2, - id: 2, - teacher_can_view: false, - student_can_view: true, - }, - ], - hours_committed: 0, - id_committed: null, - pages: content.pages, - active_tab: null, - chart_metareflexion_options: { - maintainAspectRatio: false, - legend: { - display: false, - }, - scales: { - xAxes: [ - { - ticks: { - beginAtZero: true, - callback: function (value) { - if (Number.isInteger(value)) { - return value; - } - }, - suggestedMin: 0, - suggestedMax: 5, + { + name: content.strings.tab_2, + id: 2, + teacher_can_view: false, + student_can_view: true, + }, + ], + hours_committed: 0, + id_committed: null, + pages: content.pages, + active_tab: null, + chart_metareflexion_options: { + maintainAspectRatio: false, + legend: { + display: false, + }, + scales: { + xAxes: [ + { + ticks: { + beginAtZero: true, + callback: function (value) { + if (Number.isInteger(value)) { + return value; + } }, + suggestedMin: 0, + suggestedMax: 5, }, - ], - }, + }, + ], }, + }, - img_no_data: content.image_no_data, + img_no_data: content.image_no_data, }, mounted() { @@ -404,18 +401,19 @@ define([ update_module(day, module_id, event) { if (event) { - this.current_week[0].weekly_schedules_days.days_planned[ - day - ].push(module_id); + this.current_week[0].weekly_schedules_days.days_planned[day].push( + module_id + ); } else { const i = this.current_week[0].weekly_schedules_days.days_planned[ day ].indexOf(module_id); //console.log(i); - this.current_week[0].weekly_schedules_days.days_planned[ - day - ].splice(i, 1); + this.current_week[0].weekly_schedules_days.days_planned[day].splice( + i, + 1 + ); } //console.log(this.current_week[0].days_committed[day]); }, @@ -792,35 +790,6 @@ define([ return icon_name; }, - // open_chart_help(chart) { - // let contents = []; - // let action = ""; - // let objectType = ""; - // let objectName = ""; - // let objectDescription = ""; - // contents.push({ - // title: "t1", - // description: "desc1", - // }); - // contents.push({ - // description: this.strings.inverted_time_help_description_p2, - // }); - // action = "viewed"; - // objectType = "help"; - // objectName = "invested_time"; - // objectDescription = "Help section that provides information about the invested time chart"; - // // this.addLogsIntoDB( - // // action, - // // objectName, - // // objectType, - // // objectDescription - // // ); - // this.help_contents = contents; - // if (this.help_contents.length) { - // this.help_dialog = true; - // } - // }, - get_help_content() { var helpcontents = []; if (this.active_tab == 0) { @@ -866,15 +835,7 @@ define([ }, get_title_content() { - var title_content_tab; - - if (this.active_tab == 0) { - title_content_tab = this.strings.currentweek_card_title; - } else if (this.active_tab == 1) { - title_content_tab = this.strings.effectiveness_title; - } - - return title_content_tab; + return this.strings.title_metareflexion; }, planned_week_summary() { diff --git a/notemyprogress/amd/src/setweeks.js b/notemyprogress/amd/src/setweeks.js index 97747ff..1a7a8fc 100644 --- a/notemyprogress/amd/src/setweeks.js +++ b/notemyprogress/amd/src/setweeks.js @@ -38,22 +38,26 @@ define([ scroll_mode: false, weeks_started_at: new Date( Moment(Number(content.weeks[0].weekstart) * 1000) - ), + ), // will be cloned in the cachedValues cache strings: content.strings, - sections: content.sections, + sections: content.sections, // will be cloned in the cachedValues cache courseid: content.courseid, userid: content.userid, - raw_weeks: content.weeks, + raw_weeks: content.weeks, // will be cloned in the cachedValues cache disabled_dates: { days: [0, 2, 3, 4, 5, 6], }, saving_loader: false, error_messages: [], save_successful: false, + form_identical: true, }, mounted() { document.querySelector("#setweeks-loader").style.display = "none"; document.querySelector("#setweeks").style.display = "block"; + this.cache_weeks_started_at = new Date(this.weeks_started_at.getTime()); + this.cache_sections = JSON.parse(JSON.stringify(this.sections)); + this.cache_raw_weeks = JSON.parse(JSON.stringify(this.raw_weeks)); }, computed: { weeks() { @@ -72,8 +76,45 @@ define([ } return this.raw_weeks; }, + cache_weeks() { + for (let i = 0; i < this.cache_raw_weeks.length; i++) { + let week = this.cache_raw_weeks[i]; + if (i == 0) { + let start_weeks = this.cache_weeks_started_at; + week.weekstart = start_weeks; + week.weekend = this.get_end_week(this.cache_weeks_started_at); + } else { + week.weekstart = this.get_start_week( + this.cache_raw_weeks[i - 1].weekend + ); + week.weekend = this.get_end_week(week.weekstart); + } + } + return this.cache_raw_weeks; + }, }, + methods: { + + form_changed(){ + this.form_identical = false; + }, + cache_save() { + this.cache_weeks_started_at = new Date(this.weeks_started_at.getTime()); + this.cache_sections = JSON.parse(JSON.stringify(this.sections)); + this.cache_raw_weeks = JSON.parse(JSON.stringify(this.raw_weeks)); + this.form_identical = true; + //this.watcher_called = false; + }, + cache_cancel() { + this.weeks_started_at = new Date(this.cache_weeks_started_at.getTime()); + this.sections = JSON.parse(JSON.stringify(this.cache_sections)); + this.raw_weeks = JSON.parse(JSON.stringify(this.cache_raw_weeks)); + this.form_identical = true; + //this.watcher_called = false; + //console.log("cache_cancel end"); + }, + section_name(section) { let name = null; if ( @@ -119,6 +160,7 @@ define([ removable: true, sections: [], }); + this.form_changed(); }, has_items(array) { @@ -135,6 +177,7 @@ define([ } let element_index = this.raw_weeks.indexOf(week); this.raw_weeks.splice(element_index, 1); + this.form_changed(); }, ask_delete_confirm() { @@ -218,34 +261,28 @@ define([ params: data, }) .then((response) => { - console.log("then1"); if (response.status == 200 && response.data.ok) { - console.log("then1.2"); this.settings = response.data.data.settings; - console.log("then1.3"); - Alertify.success(this.strings.save_successful); - console.log("then1.4"); - this.save_successful = true; - console.log("then1.5"); + if (!this.settings.has_students || !this.settings.course_start || !this.settings.weeks){ + Alertify.error(this.strings.error_conditions_setweek); + this.error_messages.push(this.strings.error_conditions_setweek); + } + else{ + Alertify.success(this.strings.save_successful); + this.save_successful = true; + this.cache_save(); + } } else { - console.log("then1.6"); Alertify.error(this.strings.error_network); - console.log("then1.7"); this.error_messages.push(this.strings.error_network); - console.log("then1.8"); } }) .catch((e) => { - console.log("catch1"); Alertify.error(this.strings.error_network); - console.log("catch2"); this.error_messages.push(this.strings.error_network); - console.log("catch3"); }) .finally(() => { - console.log("finally1"); this.saving_loader = false; - console.log("finally2"); //this.addLogsIntoDB("saved", "configuration", "weeks", "Saved a new configuration for the weeks !"); }); }, @@ -325,6 +362,7 @@ define([ change_collapsabled(index) { this.raw_weeks[index].collapsabled = !this.raw_weeks[index].collapsabled; + this.form_changed(); }, course_finished() { diff --git a/notemyprogress/auto_evaluation.php b/notemyprogress/auto_evaluation.php new file mode 100644 index 0000000..dfe2e73 --- /dev/null +++ b/notemyprogress/auto_evaluation.php @@ -0,0 +1,133 @@ +<?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/>. + +/** + * local notemyprogress + * + * @package local_notemyprogress + * @copyright 2020 Edisson Sigua <edissonf.sigua@gmail.com>, Bryan Aguilar <bryan.aguilar6174@gmail.com> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ +require_once('locallib.php'); +global $COURSE, $USER; + +$courseid = required_param('courseid', PARAM_INT); +$course = $DB->get_record('course', array('id' => $courseid), '*', MUST_EXIST); +$context = context_course::instance($course->id); + +$url = '/local/notemyprogress/auto_evaluation.php'; +local_notemyprogress_set_page($course, $url); + +require_capability('local/notemyprogress:usepluggin', $context); +require_capability('local/notemyprogress:view_as_student', $context); +require_capability('local/notemyprogress:auto_evaluation', $context); + +if (is_siteadmin()) { + print_error(get_string("only_student", "local_notemyprogress")); +} + +$actualLink = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; + +$logs = new \local_notemyprogress\logs($COURSE->id, $USER->id); +$logs->addLogsNMP("viewed", "section", "AUTO_EVALUATION", "auto_evaluation", $actualLink, "A page containing a form with question for the students"); + +$reports = new \local_notemyprogress\student($COURSE->id, $USER->id); +$auto_evaluation = new \local_notemyprogress\auto_evaluation($USER->id); + +$configweeks = new \local_notemyprogress\configweeks($COURSE, $USER); +if (!$configweeks->is_set()) { + $message = get_string("weeks_not_config", "local_notemyprogress"); + print_error($message); +} + +$content = [ + 'strings' => [ + "section_help_title" => get_string("ss_section_help_title", "local_notemyprogress"), + "section_help_description" => get_string("ss_section_help_description", "local_notemyprogress"), + "inverted_time_help_title" => get_string("ss_inverted_time_help_title", "local_notemyprogress"), + "inverted_time_help_description_p1" => get_string("ss_inverted_time_help_description_p1", "local_notemyprogress"), + "inverted_time_help_description_p2" => get_string("ss_inverted_time_help_description_p2", "local_notemyprogress"), + "hours_session_help_title" => get_string("ss_hours_session_help_title", "local_notemyprogress"), + "hours_session_help_description_p1" => get_string("ss_hours_session_help_description_p1", "local_notemyprogress"), + "hours_session_help_description_p2" => get_string("ss_hours_session_help_description_p2", "local_notemyprogress"), + "resources_access_help_title" => get_string("ss_resources_access_help_title", "local_notemyprogress"), + "resources_access_help_description_p1" => get_string("ss_resources_access_help_description_p1", "local_notemyprogress"), + "resources_access_help_description_p2" => get_string("ss_resources_access_help_description_p2", "local_notemyprogress"), + "resources_access_help_description_p3" => get_string("ss_resources_access_help_description_p3", "local_notemyprogress"), + + "title" => get_string("nmp_title", "local_notemyprogress"), + + "no_data" => get_string("no_data", "local_notemyprogress"), + "pagination" => get_string("pagination", "local_notemyprogress"), + "ss_change_timezone" => get_string("ss_change_timezone", "local_notemyprogress"), + "graph_generating" => get_string("graph_generating", "local_notemyprogress"), + "api_error_network" => get_string("api_error_network", "local_notemyprogress"), + "pagination_name" => get_string("pagination_component_name", "local_notemyprogress"), + "pagination_separator" => get_string("pagination_component_to", "local_notemyprogress"), + "pagination_title" => get_string("pagination_title", "local_notemyprogress"), + "helplabel" => get_string("helplabel", "local_notemyprogress"), + "exitbutton" => get_string("exitbutton", "local_notemyprogress"), + "about" => get_string("nmp_about", "local_notemyprogress"), + + "btn_save_auto_eval" => get_string("btn_save_auto_eval", "local_notemyprogress"), + "message_save_successful" => get_string("message_save_successful", "local_notemyprogress"), + "message_update_successful" => get_string("message_update_successful", "local_notemyprogress"), + "page_title_auto_eval" => get_string("page_title_auto_eval", "local_notemyprogress"), + "form_questions_auto_eval" => get_string("form_questions_auto_eval", "local_notemyprogress"), + "description_auto_eval" => get_string("description_auto_eval", "local_notemyprogress"), + "qsts" => array( + "qst1" => get_string("qst1", "local_notemyprogress"), + "qst2" => get_string("qst2", "local_notemyprogress"), + "qst3" => get_string("qst3", "local_notemyprogress"), + "qst4" => get_string("qst4", "local_notemyprogress"), + "qst5" => get_string("qst5", "local_notemyprogress"), + "qst6" => get_string("qst6", "local_notemyprogress"), + "qst7" => get_string("qst7", "local_notemyprogress"), + "qst8" => get_string("qst8", "local_notemyprogress"), + "qst9" => get_string("qst9", "local_notemyprogress"), + "qst10" => get_string("qst10", "local_notemyprogress"), + "qst11" => get_string("qst11", "local_notemyprogress"), + "qst12" => get_string("qst12", "local_notemyprogress"), + "qst13" => get_string("qst13", "local_notemyprogress"), + "qst14" => get_string("qst14", "local_notemyprogress"), + "qst15" => get_string("qst15", "local_notemyprogress"), + "qst16" => get_string("qst16", "local_notemyprogress"), + "qst17" => get_string("qst17", "local_notemyprogress"), + "qst18" => get_string("qst18", "local_notemyprogress"), + "qst19" => get_string("qst19", "local_notemyprogress"), + "qst20" => get_string("qst20", "local_notemyprogress"), + "qst21" => get_string("qst21", "local_notemyprogress"), + "qst22" => get_string("qst22", "local_notemyprogress"), + "qst23" => get_string("qst23", "local_notemyprogress"), + "qst24" => get_string("qst24", "local_notemyprogress"), + ) + + ], + 'courseid' => $COURSE->id, + 'userid' => $USER->id, + 'indicators' => $reports->get_sessions(), + 'pages' => $configweeks->get_weeks_paginator(), + 'profile_render' => $reports->render_has(), + 'auto_eval_answers' => $auto_evaluation->get_auto_eval_answers(), + 'auto_eval_saved' => $auto_evaluation->is_saved(), + 'timezone' => $reports->timezone, +]; + +$PAGE->requires->js_call_amd('local_notemyprogress/auto_evaluation', 'init', ['content' => $content]); +echo $OUTPUT->header(); +echo $OUTPUT->render_from_template('local_notemyprogress/auto_evaluation', ['content' => $content]); +echo $OUTPUT->footer(); diff --git a/notemyprogress/classes/auto_evaluation.php b/notemyprogress/classes/auto_evaluation.php new file mode 100644 index 0000000..23dac78 --- /dev/null +++ b/notemyprogress/classes/auto_evaluation.php @@ -0,0 +1,100 @@ +<?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/>. + +/** + * local_notemyprogress + * + * @package local_notemyprogress + * @autor Edisson Sigua, Bryan Aguilar + * @copyright 2020 Edisson Sigua <edissonf.sigua@gmail.com>, Bryan Aguilar <bryan.aguilar6174@gmail.com> + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +namespace local_notemyprogress; + +defined('MOODLE_INTERNAL') || die; + +require_once('lib_trait.php'); + +use stdClass; + + +class auto_evaluation +{ + use \lib_trait; + public $user; + public $auto_eval_answers; + + function __construct($userid) + { + $this->user = self::get_user($userid); + } + + public function is_saved(){ + global $DB; + $sql = "select * from {notemyprogress_auto_aws} a where a.userid = ? limit 1 "; + $aws = $DB->get_records_sql($sql, array($this->user->id)); + return !(empty($aws)); + } + + public function get_auto_eval_answers() + { + global $DB; + $sql = "select q.description, a.level from {notemyprogress_auto_aws} a, {notemyprogress_auto_qst} q where a.auto_qst_id = q.id and a.userid = ? "; + $aws = $DB->get_records_sql($sql, array($this->user->id)); + if (empty($aws)){ + $aws = []; + for ($i = 1; $i <= 24; $i++) { + $aw = array("description"=> "qst" . $i,"level"=> 0); + $aws["qst" . $i] = $aw; + } + } + return $aws; + } + public function save_answers() + { + if (!isset($this->user) || !isset($this->auto_eval_answers)) { + return false; + } + global $DB; + $auto_evaluation = new stdClass(); + $auto_evaluation->userid = $this->user->id; + foreach ($this->auto_eval_answers as $key => $answer) { + $auto_evaluation->auto_qst_id = self::get_qst_id($answer->description); + $auto_evaluation->level = $answer->level; + $meta = $DB->insert_record("notemyprogress_auto_aws", $auto_evaluation, true); + } + return $meta; + } + + public function update_answers() + { + if (!isset($this->user) || !isset($this->auto_eval_answers)) { + return false; + } + global $DB; + foreach ($this->auto_eval_answers as $key => $answer) { + $sql = "update {notemyprogress_auto_aws} a, {notemyprogress_auto_qst} q set a.level = ? where a.auto_qst_id = q.id and a.userid = ? and q.id = ?"; + $meta = $DB->execute($sql, array($answer->level,$this->user->id,self::get_qst_id($answer->description))); + } + return $meta; + } + + public function get_qst_id($desc) + { + return (int)filter_var($desc, FILTER_SANITIZE_NUMBER_INT); + } +} diff --git a/notemyprogress/classes/student.php b/notemyprogress/classes/student.php index b842328..d92d34e 100644 --- a/notemyprogress/classes/student.php +++ b/notemyprogress/classes/student.php @@ -37,6 +37,21 @@ class student extends report self::set_users(); } + // public function get_auto_eval_answers() + // { + // global $DB; + // $sql = "select q.description, a.level from {notemyprogress_auto_aws} a, {notemyprogress_auto_qst} q where a.auto_qst_id = q.id and a.userid = ? "; + // $aws = $DB->get_records_sql($sql, array($this->users[0])); + // if (empty($aws)){ + // $aws = []; + // for ($i = 1; $i <= 24; $i++) { + // $aw = array("description"=> "qst" . $i,"level"=> 0); + // $aws["qst" . $i] = $aw; + // } + // } + // return $aws; + // } + public function get_modules_completion($weekcode = null) { diff --git a/notemyprogress/db/access.php b/notemyprogress/db/access.php index d052adf..f57052d 100644 --- a/notemyprogress/db/access.php +++ b/notemyprogress/db/access.php @@ -166,6 +166,14 @@ $capabilities = array( ) ), + 'local/notemyprogress:auto_evaluation' => array( + 'captype' => 'read', + 'contextlevel' => CONTEXT_COURSE, + 'archetypes' => array( + 'student' => CAP_ALLOW, + ) + ), + 'local/notemyprogress:teacher_gamification' => array( 'captype' => 'read', 'contextlevel' => CONTEXT_COURSE, diff --git a/notemyprogress/db/install.php b/notemyprogress/db/install.php index 7f2b634..cd97cf5 100644 --- a/notemyprogress/db/install.php +++ b/notemyprogress/db/install.php @@ -43,6 +43,13 @@ function xmldb_local_notemyprogress_install() $DB->insert_record("notemyprogress_goals_ct", $goal3, true); + //Add user questions (auto-evaluation) + for ($i = 1; $i <= 24; $i++) { + $question = new stdClass(); + $question->description = "qst" . $i; + $DB->insert_record("notemyprogress_auto_qst", $question, true); + } + //Question 1 $question = new stdClass(); $question->enunciated = 'question_number_one'; @@ -140,7 +147,7 @@ function xmldb_local_notemyprogress_install() $answer->questionid = $questionid; $answer->enunciated = 'answers_number_four_option_four'; $DB->insert_record("notemyprogress_answers", $answer, true); - + // TODO : rename the table FlipLearning to NoteMyProgress to keep the data from the versions older than 4.0 //* fliplearning_clustering -> notemyprogress_clustering //* fliplearning_instances -> notemyprogress_instances @@ -149,43 +156,42 @@ function xmldb_local_notemyprogress_install() //* fliplearning_weeks -> notemyprogress_weeks //? Algorithm idea : //? Initial state : table generated normally and old tables potentially present - //? 1 : Check if exist the old tables (Fliplearning) + //? 1 : vefrifier if exist the old tables (Fliplearning) //? 2 : If they exist drop the new similar tables //? 3 : rename the old tables like the news that we have just deleted - try{ + try { $table1 = $DB->get_record_sql("SELECT count(*) from {fliplearning_clustering}"); $DB->execute("DROP TABLE {notemyprogress_clustering}"); $DB->execute("RENAME TABLE {fliplearning_clustering} TO {notemyprogress_clustering}"); - }catch(Exception $e){ + } catch (Exception $e) { //this table do not exist } - try{ + try { $table1 = $DB->get_record_sql("SELECT count(*) from {fliplearning_instances}"); $DB->execute("DROP TABLE {notemyprogress_instances}"); $DB->execute("RENAME TABLE {fliplearning_instances} TO {notemyprogress_instances}"); - }catch(Exception $e){ + } catch (Exception $e) { //this table do not exist } - try{ + try { $table1 = $DB->get_record_sql("SELECT count(*) from {fliplearning_logs}"); $DB->execute("DROP TABLE {notemyprogress_logs}"); $DB->execute("RENAME TABLE {fliplearning_logs} TO {notemyprogress_logs}"); - }catch(Exception $e){ + } catch (Exception $e) { //this table do not exist } - try{ + try { $table1 = $DB->get_record_sql("SELECT count(*) from {fliplearning_sections}"); $DB->execute("DROP TABLE {notemyprogress_sections}"); $DB->execute("RENAME TABLE {fliplearning_sections} TO {notemyprogress_sections}"); - }catch(Exception $e){ + } catch (Exception $e) { //this table do not exist } - try{ + try { $table1 = $DB->get_record_sql("SELECT count(*) from {fliplearning_weeks}"); $DB->execute("DROP TABLE {notemyprogress_weeks}"); $DB->execute("RENAME TABLE {fliplearning_weeks} TO {notemyprogress_weeks}"); - }catch(Exception $e){ + } catch (Exception $e) { //this table do not exist } - -} \ No newline at end of file +} diff --git a/notemyprogress/db/install.xml b/notemyprogress/db/install.xml index 7176192..32f0fe4 100644 --- a/notemyprogress/db/install.xml +++ b/notemyprogress/db/install.xml @@ -132,6 +132,29 @@ <KEY NAME="primary" TYPE="primary" FIELDS="id"/> </KEYS> </TABLE> + + <TABLE NAME="notemyprogress_auto_aws" COMMENT="table notemyprogress_u_aws"> + <FIELDS> + <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> + <FIELD NAME="userid" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/> + <FIELD NAME="auto_qst_id" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/> + <FIELD NAME="level" TYPE="int" LENGTH="20" NOTNULL="true" SEQUENCE="false"/> + </FIELDS> + <KEYS> + <KEY NAME="primary" TYPE="primary" FIELDS="id"/> + </KEYS> + </TABLE> + + <TABLE NAME="notemyprogress_auto_qst" COMMENT="table notemyprogress_u_qst"> + <FIELDS> + <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> + <FIELD NAME="description" TYPE="char" LENGTH="1333" NOTNULL="true" SEQUENCE="false"/> + </FIELDS> + <KEYS> + <KEY NAME="primary" TYPE="primary" FIELDS="id"/> + </KEYS> + </TABLE> + <TABLE NAME="notemyprogress_logs" COMMENT="table notemyprogress_logs"> <FIELDS> <FIELD NAME="id" TYPE="int" LENGTH="10" NOTNULL="true" SEQUENCE="true"/> diff --git a/notemyprogress/lang/en/local_notemyprogress.php b/notemyprogress/lang/en/local_notemyprogress.php index 9952a9b..e090636 100644 --- a/notemyprogress/lang/en/local_notemyprogress.php +++ b/notemyprogress/lang/en/local_notemyprogress.php @@ -56,6 +56,7 @@ $string['menu_dropout'] = 'Dropout'; $string['menu_logs'] = "Activity reports"; $string['menu_planning'] = "Planning"; $string['menu_general'] = "Global indicators"; +$string['menu_auto_evaluation'] = "Auto-evaluation"; /* Nav Bar Menu */ $string['togglemenu'] = 'Show / Hide the NoteMyProgress menu'; @@ -64,14 +65,15 @@ $string['togglemenu'] = 'Show / Hide the NoteMyProgress menu'; $string['pagination_component_to'] = 'al'; $string['pagination_component_name'] = 'Week'; -/* Goups */ +/* Groups */ $string['group_allstudent'] = 'All students'; /* Erreurs générales */ $string['api_error_network'] = "An error occurred during communication with the server."; $string['api_invalid_data'] = 'Invalid data'; $string['api_save_successful'] = 'The data has been correctly recorded on the server'; -$string['api_cancel_action'] = 'You have cancelled the action '; +$string['api_cancel_action'] = 'You have cancelled the action'; +$string['api_error_conditions_setweek'] = 'Failed to register changes. Conditions not met.'; /* Admin Task Screen */ $string['generate_data_task'] = 'Data generation process for the NoteMyProgress plugin'; @@ -806,10 +808,6 @@ $string['sr_menu_activities_performed'] = "Activities performed"; $string['sr_menu_notes'] = "Annotations"; /* General Errors */ -$string['api_error_network'] = "An error occurred in the communication with the server"; -$string['api_invalid_data'] = "Incorrect data"; -$string['api_save_successful'] = "The data was successfully saved on the server"; -$string['api_cancel_action'] = "You have cancelled the action"; $string['pluginname'] = "Note My Progress"; $string['previous_days_to_create_report'] = "Days taken into account for report construction"; $string['previous_days_to_create_report_description'] = "Days before the current date that will be taken into account to generate the report"; @@ -912,7 +910,7 @@ $string['metareflexion_pw_btn_save'] = "Save"; $string['metareflexion_report_title'] = "Graphic linked to the Planning/Meta-Reflection Commitment Form"; $string['metareflexion_report_description_days_teacher'] = "In this graph, you will find the planned days that students have committed to work (first bar) versus the days actually worked (second bar). If the first bar is not visible, it means that your students did not schedule any days to work for that week; they scheduled days to work. If the second bar is not visible, it means that the students did not do the work they committed to do on the scheduled day."; -$string['metareflexion_report_description_days_student'] = "Below the objectives, you will find a table indicating whether you have respected the schedule of the modules according to the days you have set. If the deadline is met, a green thumb will be displayed. In the event that the scheduled work is not completed, a red thumb will be displayed.<br> Note that a module is considered validated when it is consulted. Thus, to validate a day, you must consult all the modules that you have planned in the section 'Planning for the week'<br> ."; +$string['metareflexion_report_description_days_student'] = "Below the objectives, you will find a table indicating whether you have respected the schedule of the modules according to the days you have set. If the deadline is met, a green thumb will be displayed. In the event that the scheduled work is not completed, a red thumb will be displayed.<br> Note that a module is considered validated when it is consulted. Thus, to validate a day, you must consult all the modules that you have planned in the section 'Planning for the week'.<br>"; $string['metareflexion_report_subtitle_days_student'] = "My planned commitments for this week"; $string['metareflexion_report_subtitle_days_teacher'] = "Percentage of students who stuck to their plan that day"; $string['metareflexion_report_description_goals_student'] = "Below this graph is a reminder of the goals you set last week."; @@ -959,6 +957,7 @@ $string['metareflexion_pres_question_learn_and_improvement'] = "What did I learn $string['metareflexion_goals_reflexion_title'] = "The goals chosen for this week."; $string['metareflexion_title_hours_plan'] = "Forecasted work time for the current week."; $string['metareflexion_title_retrospective'] = "Retrospective of the week"; +$string['metareflexion_title_metareflexion'] = "Planning"; /* Reports */ $string['student_reports:view_report_as_teacher'] = "View report as teacher"; @@ -1091,6 +1090,39 @@ $string['answers_number_four_option_two'] = "I am quite satisfied with the way I $string['answers_number_four_option_three'] = "I am satisfied with the way I have organized myself to achieve my goals"; $string['answers_number_four_option_four'] = "I am very satisfied with the way I have organized myself to achieve my goals"; +/* Auto-evaluation */ +$string['qst1'] = "I set standards for my assignments in online courses."; +$string['qst2'] = "I set short-term (daily or weekly) goals as well as long-term goals (monthly or for the semester)."; +$string['qst3'] = "I keep a high standard for my learning in my online courses."; +$string['qst4'] = "I set goals to help me manage studying time for my online courses."; +$string['qst5'] = "I don't compromise the quality of my work because it is online."; +$string['qst6'] = "I choose the location where I study to avoid too much distraction."; +$string['qst7'] = "I find a comfortable place to study."; +$string['qst8'] = "I know where I can study most efficiently for online courses."; +$string['qst9'] = "I choose a time with few distractions for studying for my online courses."; +$string['qst10'] = "I try to take more thorough notes for my online courses because notes are even more important for learning online than in a regular classroom."; +$string['qst11'] = "I read aloud instructional materials posted online to fight against distractions."; +$string['qst12'] = "I prepare my questions before joining in the chat room and discussion."; +$string['qst13'] = "I work extra problems in my online courses in addition to the assigned ones to master the course content."; +$string['qst14'] = "I allocate extra studying time for my online courses because I know it is time-demanding."; +$string['qst15'] = "I try to schedule the same time everyday or every week to study for my online courses, and I observe the schedule."; +$string['qst16'] = "Although we don't have to attend daily classes, I still try to distribute my studying time evenly across days."; +$string['qst17'] = "I find someone who is knowledgeable in course content so that I can consult with him or her when I need help."; +$string['qst18'] = "I share my problems with my classmates online so we know what we are struggling with and how to solve our problems."; +$string['qst19'] = "If needed, I try to meet my classmates face-to-face."; +$string['qst20'] = "I am persistent in getting help from the instructor through e-mail."; +$string['qst21'] = "I summarize my learning in online courses to examine my understanding of what I have learned."; +$string['qst22'] = "I ask myself a lot of questions about the course material when studying for an online course."; +$string['qst23'] = "I communicate with my classmates to find out how I am doing in my online classes."; +$string['qst24'] = "I communicate with my classmates to find out what I am learning that is different from what they are learning."; + +$string['btn_save_auto_eval'] = "Save"; +$string['message_save_successful'] = "Auto-evaluation successfully saved"; +$string['message_update_successful'] = "Auto-evaluation successfully updated"; +$string['page_title_auto_eval'] = "self-assessment"; +$string['form_questions_auto_eval'] = "Self-assessment questions"; +$string['description_auto_eval'] = "This page allows you to self-assess your study habits. This questionnaire is specific to each student but common to all courses on Moodle. Once you have completed it, you can save your answers with the button at the bottom of the page and change your choices whenever you wish."; + /* Groups */ $string['group_allstudent'] = "All students"; diff --git a/notemyprogress/lang/es/local_notemyprogress.php b/notemyprogress/lang/es/local_notemyprogress.php index 0b23564..aca7885 100644 --- a/notemyprogress/lang/es/local_notemyprogress.php +++ b/notemyprogress/lang/es/local_notemyprogress.php @@ -55,6 +55,7 @@ $string['menu_quiz'] = 'Seguimiento de Evaluaciones'; $string['menu_dropout'] = 'Seguimiento de estudiantes'; $string['menu_logs'] = "Registros de actividad"; $string['menu_general'] = "Indicadores Generales"; +$string['menu_auto_evaluation'] = "Auto-evaluación"; /* Nav Bar Menu */ $string['togglemenu'] = 'Mostrar/Ocultar menú de nmp'; @@ -71,7 +72,7 @@ $string['api_error_network'] = "Ha ocurrido un error en la comunicación con el $string['api_invalid_data'] = 'Datos incorrectos'; $string['api_save_successful'] = 'Se han guardado los datos correctamente en el servidor'; $string['api_cancel_action'] = 'Has cancelado la acción'; - +$string['api_error_conditions_setweek'] = 'No registrar los cambios. Condiciones no cumplidas.'; /* Admin Task Screen*/ $string['generate_data_task'] = 'Proceso para generar datos para Note My Progress Plugin'; @@ -738,19 +739,15 @@ $string['exitbutton'] = '¡Entendido!'; $string['hours_unit_time_label'] = 'Número de Horas'; /* Menú */ -$string['sr_menu_main_title'] = "Reportes"; -$string['sr_menu_setweek'] = "Configurar semanas"; -$string['sr_menu_logs'] = "Descargar registros"; +$string['sr_menu_main_title'] = "Reportes"; +$string['sr_menu_setweek'] = "Configurar semanas"; +$string['sr_menu_logs'] = "Descargar registros"; $string['sr_menu_time_worked_session_report'] = 'Sesiones de estudio por semana'; $string['sr_menu_time_visualization'] = 'Tiempo invertido (Horas por semana)'; $string['sr_menu_activities_performed'] = 'Actividades realizadas'; $string['sr_menu_notes'] = 'Anotaciones'; /* General Errors */ -$string['api_error_network'] = "Ha ocurrido un error en la comunicación con el servidor."; -$string['api_invalid_data'] = 'Datos incorrectos'; -$string['api_save_successful'] = 'Se han guardado los datos correctamente en el servidor'; -$string['api_cancel_action'] = 'Has cancelado la acción'; $string['pluginname'] = 'Note My Progress'; $string['previous_days_to_create_report'] = 'Días considerados para la construcción del reporte'; $string['previous_days_to_create_report_description'] = 'Días anteriores a la fecha actual que se tendrán en cuenta para generar el reporte.'; @@ -913,7 +910,7 @@ $string['metareflexion_pw_hours_off_course'] = "¿Cuántas horas de trabajo ha d $string['metareflexion_pw_btn_save'] = "Guardar"; $string['metareflexion_report_title'] = "Gráfico vinculado al formulario de compromiso de planificación/reflexión"; $string['metareflexion_report_description_days_teacher'] = "En este gráfico, encontrará los días previstos que los estudiantes se han comprometido a trabajar (primera barra) en comparación con los días realmente trabajados (segunda barra). Si la primera barra no es visible, significa que sus alumnos no han planificado ningún día de trabajo para esa semana; han planificado algunos días de trabajo. Si la segunda barra no es visible, significa que los alumnos no han realizado el trabajo que se comprometieron a hacer el día previsto."; -$string['metareflexion_report_description_days_student'] =" Debajo de los objetivos encontrarás una tabla que muestra si has cumplido con la programación del módulo según los días que has establecido. Si se cumple el plazo, se mostrará un pulgar verde. Si el trabajo previsto no se completa, se mostrará un pulgar rojo. <br> Hay que tener en cuenta que un módulo se considera validado cuando se consulta. Así, para validar un día, debe consultar todos los módulos que haya planificado en la sección 'Planificación de la semana'<br> ."; +$string['metareflexion_report_description_days_student'] = " Debajo de los objetivos encontrarás una tabla que muestra si has cumplido con la programación del módulo según los días que has establecido. Si se cumple el plazo, se mostrará un pulgar verde. Si el trabajo previsto no se completa, se mostrará un pulgar rojo. <br> Hay que tener en cuenta que un módulo se considera validado cuando se consulta. Así, para validar un día, debe consultar todos los módulos que haya planificado en la sección 'Planificación de la semana'.<br>"; $string['metareflexion_report_subtitle_days_student'] = "Mis compromisos previstos para esta semana"; $string['metareflexion_report_subtitle_days_teacher'] = "Porcentaje de estudiantes que se ciñen a su plan ese día"; $string['metareflexion_report_description_goals_student'] = "Debajo de este gráfico, encontrarás un recordatorio de los objetivos que fijaste la semana pasada."; @@ -960,7 +957,7 @@ $string['metareflexion_pres_question_learn_and_improvement'] = "¿Qué he aprend $string['metareflexion_goals_reflexion_title'] = "Los objetivos elegidos para esta semana"; $string['metareflexion_title_hours_plan'] = "Plan de horas para la semana actual"; $string['metareflexion_title_retrospective'] = "Retrospectiva de la semana"; - +$string['metareflexion_title_metareflexion'] = "Planning"; /* Reports */ $string['student_reports:view_report_as_teacher'] = 'Ver el reporte como profesor'; @@ -1092,6 +1089,38 @@ $string['answers_number_four_option_two'] = "Estoy bastante satisfecho con la fo $string['answers_number_four_option_three'] = "Estoy satisfecho con la forma en que me he organizado para lograr mis objetivos"; $string['answers_number_four_option_four'] = "Estoy muy satisfecho con la forma en que me he organizado para lograr mis objetivos"; +/* Auto-evaluation */ +$string['qst1'] = "Establezco objetivos de logro para mi trabajo personal"; +$string['qst2'] = "Establezco objetivos a corto plazo (diarios o semanales) y a largo plazo (mensuales o semestrales)"; +$string['qst3'] = "Soy exigente con mi propio aprendizaje y me pongo normas"; +$string['qst4'] = "Establezco objetivos para ayudarme a gestionar mi trabajo personal"; +$string['qst5'] = "No reduzco la calidad de mi trabajo cuando está en línea"; +$string['qst6'] = "Elijo dónde estudiar para evitar demasiadas distracciones"; +$string['qst7'] = "Elijo un lugar cómodo para estudiar"; +$string['qst8'] = "Ya sé dónde puedo estudiar mejor"; +$string['qst9'] = "Elijo un momento con pocas distracciones para trabajar"; +$string['qst10'] = "Intento hacer cursos de toma de apuntes en profundidad en línea, porque los apuntes son aún más importantes para aprender en línea que en un aula normal"; +$string['qst11'] = "Leo mis documentos en voz alta para combatir las distracciones"; +$string['qst12'] = "Preparo mis preguntas antes de entrar en la sala de debate y en la discusión"; +$string['qst13'] = "Trabajo en problemas adicionales más allá de los asignados para dominar el contenido del curso"; +$string['qst14'] = "Hago tiempo para trabajar fuera de clase"; +$string['qst15'] = "Intento programar la misma hora cada día o semana para estudiar, y me atengo a ese horario"; +$string['qst16'] = "Aunque no tenemos clases todos los días, intento repartir mi tiempo de trabajo uniformemente a lo largo de la semana"; +$string['qst17'] = "Busco un estudiante que domine el curso para poder consultarlo cuando necesite ayuda"; +$string['qst18'] = "Comparto mis problemas con mis compañeros para que podamos resolverlos juntos"; +$string['qst19'] = "Si es necesario, intento reunirme con mis compañeros cara a cara"; +$string['qst20'] = "No dudo en pedir ayuda al profesor por correo electrónico"; +$string['qst21'] = "Hago resúmenes de mis lecciones para ser consciente de lo que he entendido"; +$string['qst22'] = "Me hago muchas preguntas sobre el contenido del curso que estoy estudiando"; +$string['qst23'] = "Me comunico con mis compañeros para saber cómo me relaciono con ellos"; +$string['qst24'] = "Me comunico con mis compañeros para saber que lo que estoy aprendiendo es diferente de lo que ellos están aprendiendo"; + +$string['btn_save_auto_eval'] = "Guardar"; +$string['message_save_successful'] = "Autoevaluación guardada con éxito"; +$string['message_update_successful'] = "Autoevaluación actualizada con éxito"; +$string['page_title_auto_eval'] = "Autoevaluación"; +$string['form_questions_auto_eval'] = "Preguntas de autoevaluación"; +$string['description_auto_eval'] = "Esta página le permite autoevaluar sus métodos de estudio. Este cuestionario es específico para cada estudiante pero común a todos los cursos en Moodle. Una vez que lo hayas completado, puedes guardar tus respuestas con el botón de la parte inferior de la página y cambiar tus opciones en cualquier momento."; /* Goups */ $string['group_allstudent'] = 'Todos los estudiantes'; @@ -1099,13 +1128,13 @@ $string['group_allstudent'] = 'Todos los estudiantes'; $string['nmp_use_navbar_menu'] = 'Habilitar nuevo menú'; $string['nmp_use_navbar_menu_desc'] = 'Despliega el menú del plugin en la barra de navegación superior, del contrario incluirá el menú en el bloque de navegación.'; /* Gamification */ -$string['tg_tab1']="Cuadro"; -$string['tg_tab2']="Clasificación"; -$string['tg_tab3']="Mi perfil"; -$string['EnableGame']="Desactivar/Activar :"; -$string['studentRanking1']="¿Quieres aparecer en el ranking ? "; -$string['studentRanking2']="/!\ Te verán todos los inscritos en este curso que hayan aceptado. Aceptar es definitivo: "; -$string['studentRanking3']="Acceptar"; +$string['tg_tab1'] = "Cuadro"; +$string['tg_tab2'] = "Clasificación"; +$string['tg_tab3'] = "Mi perfil"; +$string['EnableGame'] = "Desactivar/Activar :"; +$string['studentRanking1'] = "¿Quieres aparecer en el ranking ? "; +$string['studentRanking2'] = "/!\ Te verán todos los inscritos en este curso que hayan aceptado. Aceptar es definitivo: "; +$string['studentRanking3'] = "Acceptar"; $string['gamification_denied'] = 'La gamificación ha sido desactivada por su maestro'; $string['tg_colon'] = '{$a->a}: {$a->b}'; $string['tg_section_title'] = 'Configuración de gamificación del curso'; @@ -1147,8 +1176,8 @@ $string['tg_section_settings_rules'] = 'Establecimiento de reglas'; $string['tg_section_settings_add_rule'] = 'Agregar nueva regla'; $string['tg_section_settings_earn'] = 'Para este evento, gane:'; $string['tg_section_settings_select_event'] = 'Seleccione un evento'; -$string['gm_Chart_Title']='Tabla de esparcimiento'; -$string['gm_Chart_Y']='Alumno'; +$string['gm_Chart_Title'] = 'Tabla de esparcimiento'; +$string['gm_Chart_Y'] = 'Alumno'; $string['tg_timenow'] = 'Justo ahora'; $string['tg_timeseconds'] = '{$a}s atrás'; @@ -1168,7 +1197,7 @@ $string['nmp_api_invalid_transaction'] = 'La solicitud es incorrecta'; $string['nmp_api_invalid_profile'] = 'No puedes hacer esta acción, tu perfil es incorrecto'; $string['nmp_api_save_successful'] = 'Los datos se han guardado correctamente en el servidor'; $string['nmp_api_cancel_action'] = 'Has cancelado la acción'; -$string['overview']='Visión de conjunto : '; -$string['game_point_error']='Los puntos son requeridos'; -$string['game_event_error']='El evento es requerido'; -$string['game_name_error']='Se requiere el nombre'; +$string['overview'] = 'Visión de conjunto : '; +$string['game_point_error'] = 'Los puntos son requeridos'; +$string['game_event_error'] = 'El evento es requerido'; +$string['game_name_error'] = 'Se requiere el nombre'; diff --git a/notemyprogress/lang/fr/local_notemyprogress.php b/notemyprogress/lang/fr/local_notemyprogress.php index dc056c7..84266a4 100644 --- a/notemyprogress/lang/fr/local_notemyprogress.php +++ b/notemyprogress/lang/fr/local_notemyprogress.php @@ -54,6 +54,7 @@ $string['menu_quiz'] = 'Suivi des évaluations'; $string['menu_dropout'] = 'Décrochage'; $string['menu_logs'] = "Journaux d'activités"; $string['menu_general'] = "Indicateurs généraux"; +$string['menu_auto_evaluation'] = "Auto-évaluation"; /* Nav Bar Menu */ $string['togglemenu'] = 'Afficher / Masquer le menu nmp'; @@ -70,7 +71,7 @@ $string['api_error_network'] = "Une erreur s'est produite lors de la communicati $string['api_invalid_data'] = 'Données incorrectes'; $string['api_save_successful'] = 'Les données ont été correctement enregistrées sur le serveur'; $string['api_cancel_action'] = 'Vous avez annulé l\'action '; - +$string['api_error_conditions_setweek'] = 'Echec de l\'enregistrement des modifications. Conditions non remplies.'; /* Admin Task Screen */ $string['generate_data_task'] = 'Processus de génération de données pour le plugin note my progress'; @@ -751,10 +752,6 @@ $string['sr_menu_activities_performed'] = "Activités réalisées"; $string['sr_menu_notes'] = "Annotations"; /* General Errors */ -$string['api_error_network'] = "Une erreur s'est produite dans la communication avec le serveur"; -$string['api_invalid_data'] = "Données incorrectes"; -$string['api_save_successful'] = "Les données ont été enregistrées avec succès sur le serveur"; -$string['api_cancel_action'] = "Vous avez annulé l’action"; $string['pluginname'] = "Note My Progress"; $string['previous_days_to_create_report'] = "Jours pris en compte pour la construction du rapport"; $string['previous_days_to_create_report_description'] = "Jours avant la date actuelle qui sera prise en compte pour générer le rapport"; @@ -915,7 +912,7 @@ $string['metareflexion_pw_hours_off_course'] = "Combien d'heures de travail avez $string['metareflexion_pw_btn_save'] = "Sauvegarder"; $string['metareflexion_report_title'] = "Graphique lié au formulaire d'engagement de Planification/Méta-réflexion"; $string['metareflexion_report_description_days_teacher'] = "Dans ce graphique, vous trouverez la planification des jours que les étudiants se sont engagés à travailler (première barre) par rapport aux jours réellement travaillés (deuxième barre). Si la première barre n'est pas visible, cela signifie que vos étudiants n'ont pas planifié de jours de travail pour cette semaine ; ils ont planifié des jours de travail. Si la deuxième barre n'est pas visible, cela signifie que les étudiants n'ont pas fait le travail qu'ils s'étaient engagés à faire le jour prévu."; -$string['metareflexion_report_description_days_student'] = "Vous trouverez en dessous des objectifs une table vous indiquant si vous avez respecté le planning des modules en fonction des jours que vous vous étiez fixé. Si le délai prévu est respecté, un pouce vert sera affiché. Dans le cas où le travail prévu n'est pas réalisé, un pouce rouge sera affiché.<br> Il faut noter qu'un module est considéré comme validé quand il est consulté. Ainsi, pour valider une journée, il faut consulter tous les modules que vous avez planifié dans la section 'Planification de la semaine'.<br> ."; +$string['metareflexion_report_description_days_student'] = "Vous trouverez en dessous des objectifs une table vous indiquant si vous avez respecté le planning des modules en fonction des jours que vous vous étiez fixé. Si le délai prévu est respecté, un pouce vert sera affiché. Dans le cas où le travail prévu n'est pas réalisé, un pouce rouge sera affiché.<br> Il faut noter qu'un module est considéré comme validé quand il est consulté. Ainsi, pour valider une journée, il faut consulter tous les modules que vous avez planifié dans la section 'Planification de la semaine'.<br>"; $string['metareflexion_report_subtitle_days_student'] = "Mes engagements prévus pour cette semaine"; $string['metareflexion_report_subtitle_days_teacher'] = "Pourcentage d'élèves qui ont respecté leur plan ce jour-là"; $string['metareflexion_report_description_goals_student'] = "En dessous de ce graphique, vous trouverez un rappel des objectifs que vous vous étiez fixés la semaine dernière."; @@ -962,6 +959,7 @@ $string['metareflexion_pres_question_learn_and_improvement'] = "Qu'ai-je appris $string['metareflexion_goals_reflexion_title'] = "Les objectifs choisis pour cette semaine"; $string['metareflexion_title_hours_plan'] = "Prévision du temps de travail pour la semaine courante"; $string['metareflexion_title_retrospective'] = "Retrospective de la semaine"; +$string['metareflexion_title_metareflexion'] = "Planning"; /* Reports */ $string['student_reports:view_report_as_teacher'] = "Voir le rapport en tant qu'enseignant"; $string['student_reports:view_report_as_student'] = "Voir le rapport en tant qu'étudiant"; @@ -1091,6 +1089,38 @@ $string['answers_number_four_option_two'] = "Je suis assez satisfait de la faço $string['answers_number_four_option_three'] = "Je suis satisfait de la façon dont je me suis organisé pour atteindre mes objectifs"; $string['answers_number_four_option_four'] = "Je suis très satisfait de la façon dont je me suis organisé pour atteindre mes objectifs"; +/* Auto-evaluation */ +$string['qst1'] = "Je me fixe des objectifs de réussite pour mon travail personnel."; +$string['qst2'] = "Je fixe des objectifs à court terme (quotidiens ou hebdomadaires) ainsi que des objectifs à long terme (mensuels ou semestriels)."; +$string['qst3'] = "Je suis exigent avec mon propre apprentissage et je m'impose des critères d'exigence."; +$string['qst4'] = "Je me fixe des objectifs pour m'aider à gérer mon travail personnel."; +$string['qst5'] = "Je ne réduis pas la qualité de mon travail quand il est en ligne."; +$string['qst6'] = "Je choisis l'endroit où j'étudie pour éviter trop de distractions."; +$string['qst7'] = "Je choisis un endroit confortable pour étudier."; +$string['qst8'] = "Je sais où je peux étudier plus efficacement."; +$string['qst9'] = "Je choisis un moment avec peu de distractions pour travailler."; +$string['qst10'] = "J'essaie de prendre des cours en ligne de formulation de notes approfondies, car des notes sont encore plus importants pour apprendre en ligne que dans une salle de classe normale."; +$string['qst11'] = "Je lis mes documents à voix haute pour lutter contre les distractions."; +$string['qst12'] = "Je prépare mes questions avant de rejoindre la salle de discussion et la discussion."; +$string['qst13'] = "Je travaille sur des problèmes supplémentaires en plus de ceux qui me sont attribués pour maîtriser le contenu du cours."; +$string['qst14'] = "Je me garde du temps pour travailler en dehors des cours."; +$string['qst15'] = "J'essaie de planifier le même moment chaque jour ou chaque semaine pour étudier, et je respecte cet horaire."; +$string['qst16'] = "Bien que nous n'ayons pas cours tous les jours, j'essaie de répartir mon temps de travail uniformément sur la semaine."; +$string['qst17'] = "Je trouve un étudiant qui maitrise le cours afin de pouvoir le consulter quand j'ai besoin d'aide."; +$string['qst18'] = "Je partage mes problèmes avec mes camarades afin que nous puissions résoudre ces problèmes de manière collective."; +$string['qst19'] = "Si nécessaire, j'essaie de rencontrer mes camarades de classe en face à face."; +$string['qst20'] = "Je n'hésite pas à demander de l'aide de l'enseignant par courrier électronique."; +$string['qst21'] = "Je fais des résumés de mes cours afin d'être conscient de ce que j'ai compris."; +$string['qst22'] = "Je me pose beaucoup de questions sur le contenu du cours que j'étudie."; +$string['qst23'] = "Je communique avec mes camarades de classe pour savoir comment je me situe par rapport à eux."; +$string['qst24'] = "Je communique avec mes camarades de classe pour découvrir que ce que j'apprends est différent de ce qu'ils apprennent."; + +$string['btn_save_auto_eval'] = "Sauvegarder"; +$string['message_save_successful'] = "Auto-évaluation sauvegardée avec succès"; +$string['message_update_successful'] = "Auto-évaluation mise à jour avec succès"; +$string['page_title_auto_eval'] = "Auto-évaluation"; +$string['form_questions_auto_eval'] = "Questions d'auto-évaluation"; +$string['description_auto_eval'] = "Cette page permet d'auto-évaluer ses méthodes pour étudier. Ce questionnaire est propre à chaque étudiant mais commun à tous les cours sur Moodle. Une fois que vous l'avez rempli, vous pouvez sauvegarder vos réponses avec le bouton en bas de page ainsi que modifier vos choix quand vous le souhaitez."; /* Groupes */ $string['group_allstudent'] = "Tous les étudiants"; @@ -1101,13 +1131,13 @@ $string['nmp_use_navbar_menu'] = 'Activer le nouveau menu'; $string['nmp_use_navbar_menu_desc'] = 'Afficher le menu du plugin dans la barre de navigation supérieure, sinon il inclura le menu dans le bloc de navigation.'; /* Gamification */ -$string['tg_tab1']="Répartition"; -$string['tg_tab2']="Classement"; -$string['tg_tab3']="Mon profil"; -$string['EnableGame']="Désactiver/Activer :"; -$string['studentRanking1']="Voulez vous apparaitre dans le ranking board ? "; -$string['studentRanking2']= "/!\ Tout les inscrits à ce cours ayant accepté vous verrons. Accepter est définitif:"; -$string['studentRanking3']="Accepter"; +$string['tg_tab1'] = "Répartition"; +$string['tg_tab2'] = "Classement"; +$string['tg_tab3'] = "Mon profil"; +$string['EnableGame'] = "Désactiver/Activer :"; +$string['studentRanking1'] = "Voulez vous apparaitre dans le ranking board ? "; +$string['studentRanking2'] = "/!\ Tout les inscrits à ce cours ayant accepté vous verrons. Accepter est définitif:"; +$string['studentRanking3'] = "Accepter"; $string['gamification_denied'] = 'La gamification a été désactivée par votre professeur'; $string['tg_colon'] = '{$a->a}: {$a->b}'; $string['tg_section_title'] = 'Gamification :'; @@ -1134,7 +1164,7 @@ $string['tg_section_ranking_ranking_text'] = 'Classement'; $string['tg_section_ranking_level'] = 'Niveau'; $string['tg_section_ranking_student'] = 'Élève'; $string['tg_section_ranking_total'] = 'Total'; -$string['tg_section_ranking_progress'] ='Progréssion %'; +$string['tg_section_ranking_progress'] = 'Progréssion %'; $string['tg_section_settings_appearance'] = 'Apparence'; $string['tg_section_settings_appearance_title'] = 'Titre'; @@ -1149,8 +1179,8 @@ $string['tg_section_settings_rules'] = 'Liste des régles'; $string['tg_section_settings_add_rule'] = 'Nouvelle règle'; $string['tg_section_settings_earn'] = 'Pour cet événement, victoire:'; $string['tg_section_settings_select_event'] = 'Sélectionnez un événement'; -$string['gm_Chart_Title']='Graphique de répartion'; -$string['gm_Chart_Y']='Etudiants'; +$string['gm_Chart_Title'] = 'Graphique de répartion'; +$string['gm_Chart_Y'] = 'Etudiants'; $string['tg_timenow'] = 'Juste maintenant'; $string['tg_timeseconds'] = 'il y a {$a}s '; @@ -1170,7 +1200,7 @@ $string['nmp_api_invalid_transaction'] = 'La demande est incorrecte'; $string['nmp_api_invalid_profile'] = 'Vous ne pouvez pas faire cette action, votre profil est incorrect'; $string['nmp_api_save_successful'] = 'Les données ont été enregistrées avec succès sur le serveur'; $string['nmp_api_cancel_action'] = 'Vous avez annulé l\'action'; -$string['overview']='Vue d\'ensemble : '; -$string['game_point_error']='Veuillez saisir les points'; -$string['game_event_error']='Veuillez saisir l\'évènement'; -$string['game_name_error']='Le nom est requis'; +$string['overview'] = 'Vue d\'ensemble : '; +$string['game_point_error'] = 'Veuillez saisir les points'; +$string['game_event_error'] = 'Veuillez saisir l\'évènement'; +$string['game_name_error'] = 'Le nom est requis'; diff --git a/notemyprogress/lib.php b/notemyprogress/lib.php index ef55353..09bdc34 100644 --- a/notemyprogress/lib.php +++ b/notemyprogress/lib.php @@ -108,7 +108,7 @@ function local_notemyprogress_render_navbar_output(\renderer_base $renderer) } //ADD menu items - if(has_capability('local/notemyprogress:logs', $context) && $configuration_is_set){ + if (has_capability('local/notemyprogress:logs', $context) && $configuration_is_set) { $text = get_string('menu_logs', 'local_notemyprogress'); $url = new moodle_url('/local/notemyprogress/logs.php?courseid=' . $COURSE->id); array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); @@ -127,15 +127,20 @@ function local_notemyprogress_render_navbar_output(\renderer_base $renderer) } - - if(has_capability('local/notemyprogress:teacher_gamification', $context) && $configuration_is_set){ + if (has_capability('local/notemyprogress:teacher_gamification', $context) && $configuration_is_set) { $text = 'Gamification'; - $url = new moodle_url('/local/notemyprogress/gamification.php?courseid='.$COURSE->id); + $url = new moodle_url('/local/notemyprogress/gamification.php?courseid=' . $COURSE->id); array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); } - if(has_capability('local/notemyprogress:student_gamification', $context) && !is_siteadmin() && $configuration_is_set){ + if (has_capability('local/notemyprogress:student_gamification', $context) && !is_siteadmin() && $configuration_is_set) { $text = 'Gamification'; - $url = new moodle_url('/local/notemyprogress/student_gamification.php?courseid='.$COURSE->id); + $url = new moodle_url('/local/notemyprogress/student_gamification.php?courseid=' . $COURSE->id); + array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); + } + + if (has_capability('local/notemyprogress:auto_evaluation', $context) && $configuration_is_set) { + $text = get_string('menu_auto_evaluation', 'local_notemyprogress'); + $url = new moodle_url('/local/notemyprogress/auto_evaluation.php?courseid=' . $COURSE->id); array_push($items, local_notemyprogress_new_menu_item(s($text), $url)); } diff --git a/notemyprogress/metareflexion.php b/notemyprogress/metareflexion.php index d124f0d..e646608 100644 --- a/notemyprogress/metareflexion.php +++ b/notemyprogress/metareflexion.php @@ -179,6 +179,7 @@ $content = [ "goals_reflexion_title" => get_string("metareflexion_goals_reflexion_title", "local_notemyprogress"), "title_hours_plan" => get_string("metareflexion_title_hours_plan", "local_notemyprogress"), "title_retrospective" => get_string("metareflexion_title_retrospective", "local_notemyprogress"), + "title_metareflexion"=> get_string("metareflexion_title_metareflexion", "local_notemyprogress"), "goal1" => get_string("metareflexion_goal1", "local_notemyprogress"), "goal2" => get_string("metareflexion_goal2", "local_notemyprogress"), "goal3" => get_string("metareflexion_goal3", "local_notemyprogress"), diff --git a/notemyprogress/setweeks.php b/notemyprogress/setweeks.php index 7069b36..656e568 100644 --- a/notemyprogress/setweeks.php +++ b/notemyprogress/setweeks.php @@ -45,7 +45,7 @@ $logs->addLogsNMP("viewed", "section", "CONFIGURATION_COURSE_WEEK", "configurati $configweeks = new \local_notemyprogress\configweeks($COURSE, $USER); $content = [ - 'strings' =>[ + 'strings' => [ 'title' => get_string('setweeks_title', 'local_notemyprogress'), 'description' => get_string('setweeks_description', 'local_notemyprogress'), 'sections' => get_string('setweeks_sections', 'local_notemyprogress'), @@ -57,6 +57,7 @@ $content = [ 'save' => get_string('setweeks_save', 'local_notemyprogress'), 'error_empty_week' => get_string('setweeks_error_empty_week', 'local_notemyprogress'), 'error_network' => get_string('api_error_network', 'local_notemyprogress'), + 'error_conditions_setweek' => get_string('api_error_conditions_setweek', 'local_notemyprogress'), 'save_successful' => get_string('api_save_successful', 'local_notemyprogress'), 'enable_scroll' => get_string('setweeks_enable_scroll', 'local_notemyprogress'), 'cancel_action' => get_string('api_cancel_action', 'local_notemyprogress'), @@ -77,10 +78,9 @@ $content = [ 'requirements_has_sections' => get_string('plugin_requirements_has_sections', 'local_notemyprogress'), 'plugin_visible' => get_string('plugin_visible', 'local_notemyprogress'), 'plugin_hidden' => get_string('plugin_hidden', 'local_notemyprogress'), - "helplabel" => get_string("helplabel","local_notemyprogress"), - "exitbutton" => get_string("exitbutton","local_notemyprogress"), - "title_conditions" => get_string("title_conditions","local_notemyprogress"), - "nothing"=>"something", + "helplabel" => get_string("helplabel", "local_notemyprogress"), + "exitbutton" => get_string("exitbutton", "local_notemyprogress"), + "title_conditions" => get_string("title_conditions", "local_notemyprogress"), ], 'sections' => $configweeks->get_sections_without_week(), 'userid' => $USER->id, @@ -90,7 +90,7 @@ $content = [ 'timezone' => $configweeks->get_timezone(), ]; -$PAGE->requires->js_call_amd('local_notemyprogress/setweeks','init', ['content' => $content]); +$PAGE->requires->js_call_amd('local_notemyprogress/setweeks', 'init', ['content' => $content]); echo $OUTPUT->header(); echo $OUTPUT->render_from_template('local_notemyprogress/setweeks', ['content' => $content]); diff --git a/notemyprogress/templates/auto_evaluation.mustache b/notemyprogress/templates/auto_evaluation.mustache new file mode 100644 index 0000000..42085bd --- /dev/null +++ b/notemyprogress/templates/auto_evaluation.mustache @@ -0,0 +1,36 @@ +<div id="auto_evaluation-loader"> + <div class="progressbar-notemyprogress"> + <div class="indeterminate"></div> + </div> +</div> + +<v-app id="auto_evaluation" class="notemyprogress"> + <v-main> + <pageheader :pagetitle="strings.page_title_auto_eval" :helptitle="strings.helplabel" :exitbutton="strings.exitbutton" :helpcontents="get_help_content()" :groups="groups" :courseid="courseid" :userid="userid"></pageheader> + <v-container pa-8> + <v-row v-if="loading"> + <v-progress-linear indeterminate color="cyan"></v-progress-linear> + </v-row> + <div v-else> + <v-alert v-if="errors.length > 0" dense outlined type="error" v-text="strings.api_error_network"></v-alert> + <v-card elevation="2"> + <v-card-title class="justify-center"> + <h5 v-text="strings.form_questions_auto_eval"></h5> + </v-card-title> + <v-card-text> + <v-col v-for="(answer,index,key) in auto_eval_answers"> + <span v-text="strings.qsts[answer.description]"></span> + <v-rating hover length="5" size="30" v-model.number="answer.level"></v-rating> + </v-col> + <v-col> + <v-layout justify-center> + <v-btn @click="action_save_auto_evaluation()" v-text="strings.btn_save_auto_eval" class="white--text" color="#118AB2"></v-btn> + <v-progress-linear v-if="saving_loader" indeterminate color="cyan" ></v-progress-linear> + </v-layout> + </v-col> + </v-card-text> + </v-card> + </div> + </v-container> + </v-main> +</v-app> \ No newline at end of file -- GitLab