diff --git a/notemyprogress/amd/build/gamification.min.js b/notemyprogress/amd/build/gamification.min.js new file mode 100644 index 0000000000000000000000000000000000000000..4bc9231cc2516d4b11aef475757a34e9d2d29507 --- /dev/null +++ b/notemyprogress/amd/build/gamification.min.js @@ -0,0 +1 @@ +define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/alertify","local_notemyprogress/pageheader","local_notemyprogress/chartdynamic"],(function(Vue,Vuetify,Axios,Alertify,PageHeader,ChartDynamic){"use strict";function init(content){Vue.use(Vuetify),Vue.component("pageheader",PageHeader),Vue.component("chart",ChartDynamic);const app=new Vue({delimiters:["[[","]]"],el:"#gamification",vuetify:new Vuetify,data:{strings:content.strings,token:content.token,render_has:content.profile_render,ranking:content.ranking,notifications:[],loading:!1,tab:null,levelsData:content.levels_data.levelsdata,settings:content.levels_data.settings,rulesData:content.levels_data.rules,courseid:content.levels_data.courseid,userid:content.levels_data.created_by,enable:!1,events:content.events,setPointsOption:"calculated",pointsBase:0,pointsBaseOri:0,swDisableEnable:content.strings.swValue,spreadData:[],week_resources_categories:[],week_resources_data:[],week_resources_colors:"#FA4641",indicators:content.indicators,chartdata:content.chart_data},beforeMount(){},mounted(){this.pointsBase=+this.settings.pointsbase,this.pointsBaseOri=+this.settings.pointsbase,setTimeout((function(){app.setGraphicsEventListeners()}),500),app.setGraphicsEventListeners()},computed:{},methods:{get_help_content(){let help_contents=[],help=new Object;return help.title=this.strings.help_title,help.description=this.strings.help_description,help_contents.push(help),help_contents},update_dialog(value){this.dialog=value},update_help_dialog(value){this.help_dialog=value},openHelpSectionModalEvent(){this.saveInteraction(this.pluginSectionName,"viewed","section_help_dialog",3)},get_timezone(){let information;return`${this.strings.change_timezone} ${this.timezone}`},saveInteraction(component,interaction,target,interactiontype){let data={action:"saveinteraction",pluginsection:this.pluginSectionName,component:component,interaction:interaction,target:target,url:window.location.href,interactiontype:interactiontype,token:this.token};Axios({method:"post",url:`${M.cfg.wwwroot}/local/notemyprogress/ajax.php`,data:data}).then(r=>{}).catch(e=>{})},addLevel(){let newLevel=this.levelsData.length+1;this.levelsData.push({lvl:newLevel,nam:`${this.strings.level} ${newLevel}`,des:"",points:this.pointsBase*(newLevel-1)})},removeLevel(){this.levelsData.length>2&&this.levelsData.pop()},calculatePoints(index){let points=this.isNumber(this.pointsBase)*index;return this.levelsData[index].points=points,points},isNumber(x){return""===x||isNaN(x)||0==x?this.pointsBaseOri:parseInt(x)},save_changes(logParam){this.notifications=["Do you want to save the changes"],Alertify.confirm(this.strings.save_warning_content,()=>{this.saveGamificationConfig(logParam),console.log(logParam)}).set({title:this.strings.save_warning_title}).set({labels:{cancel:this.strings.confirm_cancel,ok:this.strings.confirm_ok}})},saveGamificationConfig(logParam){this.loading=!0;let settings={tit:this.settings.tit,des:this.settings.des,pointsbase:this.pointsBase},data={courseid:this.courseid,userid:this.userid,action:"savegamification",levels:JSON.stringify(this.levelsData),settings:JSON.stringify(settings),rules:JSON.stringify(this.rulesData),token:this.token,enable:this.enable,section:logParam},url_url=window.location.href;Axios({method:"post",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php?courseid="+this.courseid+"&userid="+this.userid+"&action=savegamification&levels="+data.levels+"&settings="+data.settings+"&rules="+data.rules+"&url="+url_url+"&enable="+data.enable+"§ion="+data.section,params:data}).then(response=>{if(200==response.status&&response.data.ok)this.showNotifications(response.data.data,"success");else{let message=response.data.error||this.strings.api_error_network;this.showNotifications(message,"error")}}).catch(e=>{let message=e.response.data||this.strings.api_error_network;this.showNotifications(message,"error")}).finally(()=>{this.loading=!1})},showNotifications(message,type,alert=!0,notify=!0){alert&&this.notifications.push({message:message,type:type}),notify&&Alertify.notify(message,type)},table_headers(){let headers;return[{text:this.strings.ranking_text,value:"ranking"},{text:this.strings.level,value:"level"},{text:this.strings.student,value:"student"},{text:this.strings.total,value:"total"},{text:this.strings.progress,value:"progress_percentage"}]},addRule(){this.rulesData.push({rule:"",points:0})},removeRule(index){this.rulesData.length>2&&this.rulesData.splice(index,1)},disableEnable(swDisableEnable){this.enable=swDisableEnable;let data={courseid:this.courseid,userid:this.userid,action:"saveEnable",enable:this.enable};Axios({method:"get",url:M.cfg.wwwroot+"/local/notemyprogress/ajax.php",params:data}).then(response=>{if(200==response.status&&response.data.ok)this.showNotifications(response.data.data,"success");else{let message=response.data.error||this.strings.api_error_network;this.showNotifications(message,"error")}}).catch(e=>{let message=e.response.data||this.strings.api_error_network;this.showNotifications(message,"error")}).finally(()=>{this.loading=!1})},chart_spread(){let chart=new Object;return chart.chart={type:"column",backgroundColor:null},chart.title={text:this.strings.chartTitle},chart.colors=["#118AB2"],chart.xAxis={type:"category",labels:{rotation:-45,style:{fontSize:"13px",fontFamily:"Verdana, sans-serif"}}},chart.yAxis={min:0,title:{text:this.strings.chartYaxis}},chart.legend={enabled:!1},chart.series=[{name:null,data:this.chartdata,dataLabels:{enabled:!0,rotation:-90,color:"#FFFFFF",align:"right",format:"{point.y:.1f}",y:10,style:{fontSize:"13px",fontFamily:"Verdana, sans-serif"}}}],console.log("series: "),console.log(chart.series),chart},setGraphicsEventListeners(){console.log("Listeners set");let graphics=document.querySelectorAll(".highcharts-container");graphics.length<1?setTimeout(app.setGraphicsEventListeners,500):(graphics[0].id="SpreadChart",graphics.forEach(graph=>{graph.addEventListener("mouseenter",app.addLogsViewGraphic)}))},addLogsViewGraphic(e){event.stopPropagation();var action="",objectName="",objectType="",objectDescription="";switch(e.target.id){case"SpreadChart":action="viewed",objectName="spreading_chart",objectType="chart",objectDescription="Bar chart that shows the level repartition in gamification";break;default:action="viewed",objectName="",objectType="chart",objectDescription="A chart"}app.addLogsIntoDB(action,objectName,objectType,objectDescription)},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"TEACHER_GAMIFICATION",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/metareflexion.min.js b/notemyprogress/amd/build/metareflexion.min.js new file mode 100644 index 0000000000000000000000000000000000000000..90d499c0af1fbfcbbf07a2d867ad34fe50ac9654 --- /dev/null +++ b/notemyprogress/amd/build/metareflexion.min.js @@ -0,0 +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 diff --git a/notemyprogress/amd/build/pagination.js b/notemyprogress/amd/build/pagination.js deleted file mode 100644 index a9ac549450903bd8e268c20bef667426bae3461f..0000000000000000000000000000000000000000 --- a/notemyprogress/amd/build/pagination.js +++ /dev/null @@ -1,62 +0,0 @@ -define([], function () { - const pagination = { - template: ` - <v-main mt-10> - <v-layout class="mb-2" justify-center> - <span v-text="title" class="notemyprogress-sub-title"></span> - </v-layout> - <v-layout justify-center> - <v-flex d-flex justify-end align-center no-wrap id="notemyprogress-display-weeks" class="flex-grow-0 pl-4"> - <span class="subtitle-1 pr-3" v-text="name"></span> - <v-layout v-for="(page, index, key) in pages" :key="key" class="flex-grow-0"> - <v-tooltip top attach> - <template v-slot:activator="{ on }"> - <span - v-on="on" - v-text="page.number" - :class="['pa-1 pr-4 pl-4 page', {'selected-page' : page.selected}]" - @click="update_selected_week(index)"></span> - </template> - <span v-text="get_week_dates(page)"></span> - </v-tooltip> - </v-layout> - </v-flex> - </v-layout> - <v-divider></v-divider> - </v-main> - `, - props: ["pages", "name", "nameseparator", "title"], - data() { - return {}; - }, - methods: { - get_week_dates(week) { - return `${week.weekstart} ${this.nameseparator} ${week.weekend}`; - }, - update_selected_week(index_page) { - this.loading = true; - let page = this.change_selected_week(index_page); - this.$emit("changepage", this.get_selected_week()); - }, - change_selected_week(selected_page) { - let current_selection = this.get_selected_week(); - current_selection = this.pages.indexOf(current_selection); - this.pages[current_selection].selected = false; - this.pages[selected_page].selected = true; - return this.pages[selected_page]; - }, - get_selected_week() { - let selected = null; - this.pages.forEach((page) => { - if (page.selected) { - selected = page; - } - }); - //console.log("selected ="); - //console.log(selected); - return selected; - }, - }, - }; - return pagination; -}); diff --git a/notemyprogress/amd/build/pagination.min.js b/notemyprogress/amd/build/pagination.min.js new file mode 100644 index 0000000000000000000000000000000000000000..03c2690e8a33c62133f0baa5eb3722b8b129b187 --- /dev/null +++ b/notemyprogress/amd/build/pagination.min.js @@ -0,0 +1 @@ +define([],(function(){const pagination={template:'\n <v-main mt-10>\n <v-layout class="mb-2" justify-center>\n <span v-text="title" class="notemyprogress-sub-title"></span>\n </v-layout>\n <v-layout justify-center>\n <v-flex d-flex justify-end align-center no-wrap id="notemyprogress-display-weeks" class="flex-grow-0 pl-4">\n <span class="subtitle-1 pr-3" v-text="name"></span>\n <v-layout v-for="(page, index, key) in pages" :key="key" class="flex-grow-0">\n <v-tooltip top attach>\n <template v-slot:activator="{ on }">\n <span \n v-on="on" \n v-text="page.number" \n :class="[\'pa-1 pr-4 pl-4 page\', {\'selected-page\' : page.selected}]" \n @click="update_selected_week(index)"></span>\n </template>\n <span v-text="get_week_dates(page)"></span>\n </v-tooltip>\n </v-layout>\n </v-flex>\n </v-layout>\n <v-divider></v-divider>\n </v-main>\n ',props:["pages","name","nameseparator","title"],data:()=>({}),methods:{get_week_dates(week){return`${week.weekstart} ${this.nameseparator} ${week.weekend}`},update_selected_week(index_page){this.loading=!0;let page=this.change_selected_week(index_page);this.$emit("changepage",this.get_selected_week())},change_selected_week(selected_page){let current_selection=this.get_selected_week();return current_selection=this.pages.indexOf(current_selection),this.pages[current_selection].selected=!1,this.pages[selected_page].selected=!0,this.pages[selected_page]},get_selected_week(){let selected=null;return this.pages.forEach(page=>{page.selected&&(selected=page)}),selected}}};return pagination})); \ No newline at end of file diff --git a/notemyprogress/amd/build/paginationcomponent.js b/notemyprogress/amd/build/paginationcomponent.js deleted file mode 100644 index 6c53c0811bb2a51b6c80765a9e291b6ab6503164..0000000000000000000000000000000000000000 --- a/notemyprogress/amd/build/paginationcomponent.js +++ /dev/null @@ -1,57 +0,0 @@ -define([], function () { - const paginationcomponent = { - template: ` - <v-content mt-10> - <v-layout class="mb-2" justify-center> - <span v-text="title" class="student-report-sub-title"></span> - </v-layout> - <v-layout justify-center> - <v-flex d-flex justify-end align-center no-wrap id="student-report-display-weeks" class="flex-grow-0 pl-4"> - <span class="subtitle-1 pr-3" v-text="name"></span> - <v-layout v-for="(page, index, key ) in pages" :key="key" class="flex-grow-0"> - <v-tooltip bottom> - <template v-slot:activator="{ on }"> - <span v-on="on" v-text="page.number" :class="['pa-1 pr-4 pl-4 page', {'selected-page' : page.selected}]" @click="update_selected_week(index)"></span> - </template> - <span v-text="get_week_dates(page)"></span> - </v-tooltip> - </v-layout> - </v-flex> - </v-layout> - <v-divider></v-divider> - </v-content> - `, - props: ["pages", "name", "nameseparator", "title"], - data() { - return {}; - }, - methods: { - get_week_dates(week) { - return `${week.weekstart} ${this.nameseparator} ${week.weekend}`; - }, - update_selected_week(index_page) { - this.loading = true; - var page = this.change_selected_week(index_page); - this.$emit("changepage", this.get_selected_week()); - }, - change_selected_week(selected_page) { - let current_selection = this.get_selected_week(); - current_selection = this.pages.indexOf(current_selection); - this.pages[current_selection].selected = false; - this.pages[selected_page].selected = true; - return this.pages[selected_page]; - }, - - get_selected_week() { - var selected = null; - this.pages.forEach((page) => { - if (page.selected) { - selected = page; - } - }); - return selected; - }, - }, - }; - return paginationcomponent; -}); diff --git a/notemyprogress/amd/build/paginationcomponent.min.js b/notemyprogress/amd/build/paginationcomponent.min.js new file mode 100644 index 0000000000000000000000000000000000000000..8db17b89ecdb9053e1b0ab924f0cf4f65751ed23 --- /dev/null +++ b/notemyprogress/amd/build/paginationcomponent.min.js @@ -0,0 +1 @@ +define([],(function(){const paginationcomponent={template:'\n <v-content mt-10>\n <v-layout class="mb-2" justify-center>\n <span v-text="title" class="student-report-sub-title"></span>\n </v-layout>\n <v-layout justify-center>\n <v-flex d-flex justify-end align-center no-wrap id="student-report-display-weeks" class="flex-grow-0 pl-4">\n <span class="subtitle-1 pr-3" v-text="name"></span>\n <v-layout v-for="(page, index, key ) in pages" :key="key" class="flex-grow-0">\n <v-tooltip bottom>\n <template v-slot:activator="{ on }">\n <span v-on="on" v-text="page.number" :class="[\'pa-1 pr-4 pl-4 page\', {\'selected-page\' : page.selected}]" @click="update_selected_week(index)"></span>\n </template>\n <span v-text="get_week_dates(page)"></span>\n </v-tooltip>\n </v-layout>\n </v-flex>\n </v-layout>\n <v-divider></v-divider>\n </v-content>\n ',props:["pages","name","nameseparator","title"],data:()=>({}),methods:{get_week_dates(week){return`${week.weekstart} ${this.nameseparator} ${week.weekend}`},update_selected_week(index_page){this.loading=!0;var page=this.change_selected_week(index_page);this.$emit("changepage",this.get_selected_week())},change_selected_week(selected_page){let current_selection=this.get_selected_week();return current_selection=this.pages.indexOf(current_selection),this.pages[current_selection].selected=!1,this.pages[selected_page].selected=!0,this.pages[selected_page]},get_selected_week(){var selected=null;return this.pages.forEach(page=>{page.selected&&(selected=page)}),selected}}};return paginationcomponent})); \ No newline at end of file diff --git a/notemyprogress/amd/build/setweeks.js b/notemyprogress/amd/build/setweeks.js deleted file mode 100644 index 97747ff54aaaec5c2f70c023b3278d342eb12f20..0000000000000000000000000000000000000000 --- a/notemyprogress/amd/build/setweeks.js +++ /dev/null @@ -1,405 +0,0 @@ -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: false, - settings: content.settings, - new_group: false, - scroll_mode: false, - weeks_started_at: new Date( - Moment(Number(content.weeks[0].weekstart) * 1000) - ), - 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: false, - error_messages: [], - save_successful: false, - }, - mounted() { - document.querySelector("#setweeks-loader").style.display = "none"; - document.querySelector("#setweeks").style.display = "block"; - }, - computed: { - weeks() { - for (let i = 0; i < this.raw_weeks.length; i++) { - let week = this.raw_weeks[i]; - if (i == 0) { - 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; - }, - }, - methods: { - section_name(section) { - let name = null; - if ( - typeof section.section_name != "undefined" && - section.section_name.length > 0 - ) { - name = section.section_name; - } else { - name = section.name; - } - return name; - }, - - section_exist(section) { - let exist = true; - if ( - typeof section != "undefined" && - typeof section.exists != "undefined" && - section.exists == false - ) { - exist = false; - } - return exist; - }, - - format_name(name, position) { - return name + " " + (position + 1); - }, - - customFormatter(date) { - let weeks_start_at = Moment(date).format("YYYY-MM-DD"); - return weeks_start_at; - }, - - add_week() { - this.raw_weeks.push({ - name: this.strings.week, - position: this.weeks.length + 1, - weekstart: null, - weekend: null, - collapsabled: false, - hours_dedications: 0, - removable: true, - sections: [], - }); - }, - - has_items(array) { - return array.length > 0; - }, - - remove_week(week, index) { - if (index == 0) { - 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); - }, - - ask_delete_confirm() { - this.delete_confirm = true; - }, - - close_delete_confirm() { - this.delete_confirm = false; - }, - - get_start_week(pass_week) { - let start_date = Moment(Moment(pass_week).add(1, "days")).format( - "YYYY-MM-DD" - ); - return start_date; - }, - - get_end_week(start_week) { - let end_date = Moment(Moment(start_week).add(6, "days")).format( - "YYYY-MM-DD" - ); - return end_date; - }, - - get_date_next_day(requested_day, date, output_format = null) { - requested_day = requested_day.toLowerCase(); - let current_day = Moment(date).format("dddd").toLowerCase(); - while (current_day != requested_day) { - date = Moment(date).add(1, "days"); - current_day = Moment(date).format("dddd").toLowerCase(); - } - if (output_format) { - date = date.format(output_format); - } else { - if (typeof date != "number") { - date = parseInt(date.format("x")); - } - } - return date; - }, - - position(index) { - index++; - return `${index} - `; - }, - - save_changes() { - this.save_successful = false; - this.error_messages = []; - if (this.empty_weeks()) { - this.saving_loader = false; - Alertify.error(this.strings.error_empty_week); - this.error_messages.push(this.strings.error_empty_week); - return false; - } - if (this.weeks_deleted_from_course()) { - this.saving_loader = false; - this.error_messages.push(this.strings.error_section_removed); - return false; - } - - Alertify.confirm( - this.strings.save_warning_content, - () => { - this.saving_loader = true; - 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), // Stringify is a hack to clone object :D - }; - - Axios({ - method: "get", - url: M.cfg.wwwroot + "/local/notemyprogress/ajax.php", - 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"); - } 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 !"); - }); - }, - () => { - // ON CANCEL - this.saving_loader = false; - 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 = []; - 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); - }); - return JSON.stringify(minify); - }, - - empty_weeks() { - if (this.weeks.length >= 2 && this.weeks[0].sections.length < 1) { - return true; - } - for (let i = 0; i < this.weeks.length; i++) { - if (i > 0 && this.weeks[i].sections.length <= 0) { - return true; - } - } - return false; - }, - - 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 true; - } - } - } - return false; - }, - - exists_mistakes() { - let exists_mistakes = this.error_messages.length > 0; - return exists_mistakes; - }, - - change_collapsabled(index) { - this.raw_weeks[index].collapsabled = - !this.raw_weeks[index].collapsabled; - }, - - course_finished() { - let finished = false; - let last = this.weeks.length - 1; - let end = Moment(this.weeks[last].weekend).format("X"); - let now = Moment().format("X"); - if (now > end) { - finished = true; - } else { - finished = false; - } - return finished; - }, - - get_settings_status() { - let visible = true; - Object.keys(this.settings).map((key) => { - if (!this.settings[key]) { - visible = false; - } - }); - let status = visible - ? this.strings.plugin_visible - : this.strings.plugin_hidden; - return status; - }, - - get_help_content() { - var help_contents = []; - var help = new Object(); - help.title = this.strings.title; - help.description = this.strings.description; - help_contents.push(help); - return 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) => { - if (response.status == 200 && 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]; - if (typeof week.collapsabled == "undefined") { - week.collapsabled = false; - } - } - return content; - } - - return { - init: init, - }; -}); diff --git a/notemyprogress/amd/build/setweeks.min.js b/notemyprogress/amd/build/setweeks.min.js new file mode 100644 index 0000000000000000000000000000000000000000..b23f6f716b3ea8261bf3928295aaaa758c36b238 --- /dev/null +++ b/notemyprogress/amd/build/setweeks.min.js @@ -0,0 +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},mounted(){document.querySelector("#setweeks-loader").style.display="none",document.querySelector("#setweeks").style.display="block"},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}},methods:{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:[]})},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)},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=>{console.log("then1"),200==response.status&&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=!0,console.log("then1.5")):(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=!1,console.log("finally2")})},()=>{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},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/build/teacher.js b/notemyprogress/amd/build/teacher.js deleted file mode 100644 index 3b811743617fd36bc6a18e23c33c159cc6429d41..0000000000000000000000000000000000000000 --- a/notemyprogress/amd/build/teacher.js +++ /dev/null @@ -1,305 +0,0 @@ -define([ - "local_notemyprogress/vue", - "local_notemyprogress/vuetify", - "local_notemyprogress/axios", - "local_notemyprogress/pagination", - "local_notemyprogress/chartstatic", - "local_notemyprogress/pageheader", - "local_notemyprogress/helpdialog", -], function ( - Vue, - Vuetify, - Axios, - Pagination, - ChartStatic, - PageHeader, - HelpDialog -) { - "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("helpdialog", HelpDialog); - let vue = new Vue({ - delimiters: ["[[", "]]"], - el: "#teacher", - 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, - - indicators: content.indicators, - week_resources_colors: content.week_resources_colors, - search: null, - week_resources_categories: [], - week_resources_data: [], - - help_dialog: false, - help_contents: [], - }; - }, - beforeMount() { - this.calculate_week_resources(); - }, - mounted() { - document.querySelector("#sessions-loader").style.display = "none"; - document.querySelector("#teacher").style.display = "block"; - }, - methods: { - get_help_content() { - let contents = []; - contents.push({ - title: this.strings.section_help_title, - description: this.strings.section_help_description, - }); - return contents; - }, - - get_course_grade() { - let grade = Number(this.indicators.course.grademax); - return this.isInt(grade) ? grade : grade.toFixed(2); - }, - - calculate_week_resources() { - let categories = [], - data = []; - let week_name; - this.indicators.weeks.forEach((week) => { - week_name = `${week.name} ${week.position + 1}`; - categories.push(week_name); - data.push(week.cms); - }); - let name = this.capitalizeFirstLetter( - this.strings.teacher_indicators_modules - ); - this.week_resources_categories = categories; - this.week_resources_data = [{ name, data }]; - }, - - build_week_resources_chart() { - let chart = new Object(); - chart.chart = { - type: "bar", - backgroundColor: null, - style: { fontFamily: "poppins" }, - }; - chart.title = { - text: null, - }; - chart.colors = this.week_resources_colors; - chart.xAxis = { - categories: this.week_resources_categories, - }; - chart.yAxis = { - min: 0, - title: { - text: this.strings.teacher_indicators_week_resources_yaxis_title, - }, - }; - chart.legend = { - enabled: false, - }; - chart.series = this.week_resources_data; - // console.log(chart.series); - return chart; - }, - - build_weeks_sessions_chart() { - let chart = new Object(); - chart.chart = { - type: "heatmap", - backgroundColor: null, - style: { fontFamily: "poppins" }, - }; - chart.title = { - text: null, - }; - chart.xAxis = { - categories: this.strings.weeks, - }; - chart.yAxis = { - categories: this.indicators.sessions.categories, - title: null, - reversed: true, - }; - chart.colorAxis = { - min: 0, - minColor: "#E0E0E0", - maxColor: "#118AB2", - }; - chart.legend = { - layout: "horizontal", - verticalAlign: "bottom", - }; - chart.tooltip = { - formatter: function () { - let days = - vue.indicators.sessions.weeks[this.point.y][this.point.x] || ""; - let xCategoryName = vue.get_point_category_name(this.point, "x"); - let yCategoryName = vue.get_point_category_name(this.point, "y"); - let label = vue.strings.teacher_indicators_sessions; - if (this.point.value == 1) { - label = vue.strings.teacher_indicators_session; - } - return ( - "<b>" + - yCategoryName + - " " + - xCategoryName + - "</b>: " + - this.point.value + - " " + - label + - "<br/>" + - days - ); - }, - }; - chart.series = [ - { - borderWidth: 2, - borderColor: "#FAFAFA", - data: this.indicators.sessions.data, - }, - ]; - return chart; - }, - - table_headers() { - let headers = [ - { text: "", value: "id", align: "center", sortable: false }, - { text: this.strings.thead_name, value: "firstname" }, - { text: this.strings.thead_lastname, value: "lastname" }, - { text: this.strings.thead_email, value: "email" }, - { - text: this.strings.thead_progress, - value: "progress_percentage", - align: "center", - }, - { - text: this.strings.thead_sessions, - value: "sessions_number", - align: "center", - }, - { - text: this.strings.thead_time, - value: "inverted_time", - align: "center", - }, - ]; - return headers; - }, - - get_picture_url(userid) { - let url = `${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`; - return url; - }, - - get_percentage_progress(value) { - return `${value} %`; - }, - - get_progress_tooltip(item) { - let module_label = this.strings.teacher_indicators_modules; - let finished_label = this.strings.teacher_indicators_finished; - if (item.cms.complete == 1) { - module_label = this.strings.teacher_indicators_module; - finished_label = this.strings.teacher_indicators_finalized; - } - return `${item.cms.complete} ${module_label} ${finished_label} ${this.strings.of_conector} ${item.cms.total}`; - }, - - get_point_category_name(point, dimension) { - let series = point.series, - isY = dimension === "y", - axis = series[isY ? "yAxis" : "xAxis"]; - return axis.categories[point[isY ? "y" : "x"]]; - }, - - capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); - }, - - isInt(n) { - return n % 1 === 0; - }, - - open_chart_help(chart) { - let contents = []; - if (chart == "week_resources") { - contents.push({ - title: this.strings.week_resources_help_title, - description: this.strings.week_resources_help_description_p1, - }); - contents.push({ - description: this.strings.week_resources_help_description_p2, - }); - } else if (chart == "weeks_sessions") { - contents.push({ - title: this.strings.weeks_sessions_help_title, - description: this.strings.week_sessions_help_description_p1, - }); - contents.push({ - description: this.strings.week_sessions_help_description_p2, - }); - } else if (chart == "progress_table") { - contents.push({ - title: this.strings.progress_table_help_title, - description: this.strings.progress_table_help_description, - }); - } - this.help_contents = contents; - if (this.help_contents.length) { - this.help_dialog = true; - } - }, - - update_help_dialog(value) { - this.help_dialog = value; - }, - - get_timezone() { - let information = `${this.strings.ss_change_timezone} ${this.timezone}`; - return information; - }, - - addLogsIntoDB(action, objectName, objectType, objectDescription) { - let data = { - courseid: content.courseid, - userid: content.userid, - action: "addLogs", - sectionname: "TEACHER_GENERAL_INDICATORS", - 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) => {}); - }, - }, - }); - } - - return { - init: init, - }; -}); diff --git a/notemyprogress/amd/build/teacher.min.js b/notemyprogress/amd/build/teacher.min.js new file mode 100644 index 0000000000000000000000000000000000000000..14c144421767cfcdca185f7ed4ae3b5ffc48ba5b --- /dev/null +++ b/notemyprogress/amd/build/teacher.min.js @@ -0,0 +1 @@ +define(["local_notemyprogress/vue","local_notemyprogress/vuetify","local_notemyprogress/axios","local_notemyprogress/pagination","local_notemyprogress/chartstatic","local_notemyprogress/pageheader","local_notemyprogress/helpdialog"],(function(Vue,Vuetify,Axios,Pagination,ChartStatic,PageHeader,HelpDialog){"use strict";function init(content){Vue.use(Vuetify),Vue.component("pagination",Pagination),Vue.component("chart",ChartStatic),Vue.component("pageheader",PageHeader),Vue.component("helpdialog",HelpDialog);let vue=new Vue({delimiters:["[[","]]"],el:"#teacher",vuetify:new Vuetify,data:()=>({strings:content.strings,groups:content.groups,userid:content.userid,courseid:content.courseid,timezone:content.timezone,render_has:content.profile_render,indicators:content.indicators,week_resources_colors:content.week_resources_colors,search:null,week_resources_categories:[],week_resources_data:[],help_dialog:!1,help_contents:[]}),beforeMount(){this.calculate_week_resources()},mounted(){document.querySelector("#sessions-loader").style.display="none",document.querySelector("#teacher").style.display="block"},methods:{get_help_content(){let contents=[];return contents.push({title:this.strings.section_help_title,description:this.strings.section_help_description}),contents},get_course_grade(){let grade=Number(this.indicators.course.grademax);return this.isInt(grade)?grade:grade.toFixed(2)},calculate_week_resources(){let categories=[],data=[],week_name;this.indicators.weeks.forEach(week=>{week_name=`${week.name} ${week.position+1}`,categories.push(week_name),data.push(week.cms)});let name=this.capitalizeFirstLetter(this.strings.teacher_indicators_modules);this.week_resources_categories=categories,this.week_resources_data=[{name:name,data:data}]},build_week_resources_chart(){let chart=new Object;return chart.chart={type:"bar",backgroundColor:null,style:{fontFamily:"poppins"}},chart.title={text:null},chart.colors=this.week_resources_colors,chart.xAxis={categories:this.week_resources_categories},chart.yAxis={min:0,title:{text:this.strings.teacher_indicators_week_resources_yaxis_title}},chart.legend={enabled:!1},chart.series=this.week_resources_data,chart},build_weeks_sessions_chart(){let chart=new Object;return chart.chart={type:"heatmap",backgroundColor:null,style:{fontFamily:"poppins"}},chart.title={text:null},chart.xAxis={categories:this.strings.weeks},chart.yAxis={categories:this.indicators.sessions.categories,title:null,reversed:!0},chart.colorAxis={min:0,minColor:"#E0E0E0",maxColor:"#118AB2"},chart.legend={layout:"horizontal",verticalAlign:"bottom"},chart.tooltip={formatter:function(){let days=vue.indicators.sessions.weeks[this.point.y][this.point.x]||"",xCategoryName=vue.get_point_category_name(this.point,"x"),yCategoryName=vue.get_point_category_name(this.point,"y"),label=vue.strings.teacher_indicators_sessions;return 1==this.point.value&&(label=vue.strings.teacher_indicators_session),"<b>"+yCategoryName+" "+xCategoryName+"</b>: "+this.point.value+" "+label+"<br/>"+days}},chart.series=[{borderWidth:2,borderColor:"#FAFAFA",data:this.indicators.sessions.data}],chart},table_headers(){let headers;return[{text:"",value:"id",align:"center",sortable:!1},{text:this.strings.thead_name,value:"firstname"},{text:this.strings.thead_lastname,value:"lastname"},{text:this.strings.thead_email,value:"email"},{text:this.strings.thead_progress,value:"progress_percentage",align:"center"},{text:this.strings.thead_sessions,value:"sessions_number",align:"center"},{text:this.strings.thead_time,value:"inverted_time",align:"center"}]},get_picture_url(userid){let url;return`${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`},get_percentage_progress:value=>`${value} %`,get_progress_tooltip(item){let module_label=this.strings.teacher_indicators_modules,finished_label=this.strings.teacher_indicators_finished;return 1==item.cms.complete&&(module_label=this.strings.teacher_indicators_module,finished_label=this.strings.teacher_indicators_finalized),`${item.cms.complete} ${module_label} ${finished_label} ${this.strings.of_conector} ${item.cms.total}`},get_point_category_name(point,dimension){let series,isY="y"===dimension,axis;return point.series[isY?"yAxis":"xAxis"].categories[point[isY?"y":"x"]]},capitalizeFirstLetter:string=>string.charAt(0).toUpperCase()+string.slice(1),isInt:n=>n%1==0,open_chart_help(chart){let contents=[];"week_resources"==chart?(contents.push({title:this.strings.week_resources_help_title,description:this.strings.week_resources_help_description_p1}),contents.push({description:this.strings.week_resources_help_description_p2})):"weeks_sessions"==chart?(contents.push({title:this.strings.weeks_sessions_help_title,description:this.strings.week_sessions_help_description_p1}),contents.push({description:this.strings.week_sessions_help_description_p2})):"progress_table"==chart&&contents.push({title:this.strings.progress_table_help_title,description:this.strings.progress_table_help_description}),this.help_contents=contents,this.help_contents.length&&(this.help_dialog=!0)},update_help_dialog(value){this.help_dialog=value},get_timezone(){let information;return`${this.strings.ss_change_timezone} ${this.timezone}`},addLogsIntoDB(action,objectName,objectType,objectDescription){let data={courseid:content.courseid,userid:content.userid,action:"addLogs",sectionname:"TEACHER_GENERAL_INDICATORS",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/gamification.js b/notemyprogress/amd/src/gamification.js similarity index 100% rename from notemyprogress/amd/build/gamification.js rename to notemyprogress/amd/src/gamification.js diff --git a/notemyprogress/amd/build/metareflexion.js b/notemyprogress/amd/src/metareflexion.js similarity index 100% rename from notemyprogress/amd/build/metareflexion.js rename to notemyprogress/amd/src/metareflexion.js diff --git a/notemyprogress/amd/src/pagination.js b/notemyprogress/amd/src/pagination.js index f77683da10e6b12f69d9d14563abe34041dab876..a9ac549450903bd8e268c20bef667426bae3461f 100644 --- a/notemyprogress/amd/src/pagination.js +++ b/notemyprogress/amd/src/pagination.js @@ -52,6 +52,8 @@ define([], function () { selected = page; } }); + //console.log("selected ="); + //console.log(selected); return selected; }, }, diff --git a/notemyprogress/amd/src/paginationcomponent.min.js b/notemyprogress/amd/src/paginationcomponent.min.js new file mode 100644 index 0000000000000000000000000000000000000000..8db17b89ecdb9053e1b0ab924f0cf4f65751ed23 --- /dev/null +++ b/notemyprogress/amd/src/paginationcomponent.min.js @@ -0,0 +1 @@ +define([],(function(){const paginationcomponent={template:'\n <v-content mt-10>\n <v-layout class="mb-2" justify-center>\n <span v-text="title" class="student-report-sub-title"></span>\n </v-layout>\n <v-layout justify-center>\n <v-flex d-flex justify-end align-center no-wrap id="student-report-display-weeks" class="flex-grow-0 pl-4">\n <span class="subtitle-1 pr-3" v-text="name"></span>\n <v-layout v-for="(page, index, key ) in pages" :key="key" class="flex-grow-0">\n <v-tooltip bottom>\n <template v-slot:activator="{ on }">\n <span v-on="on" v-text="page.number" :class="[\'pa-1 pr-4 pl-4 page\', {\'selected-page\' : page.selected}]" @click="update_selected_week(index)"></span>\n </template>\n <span v-text="get_week_dates(page)"></span>\n </v-tooltip>\n </v-layout>\n </v-flex>\n </v-layout>\n <v-divider></v-divider>\n </v-content>\n ',props:["pages","name","nameseparator","title"],data:()=>({}),methods:{get_week_dates(week){return`${week.weekstart} ${this.nameseparator} ${week.weekend}`},update_selected_week(index_page){this.loading=!0;var page=this.change_selected_week(index_page);this.$emit("changepage",this.get_selected_week())},change_selected_week(selected_page){let current_selection=this.get_selected_week();return current_selection=this.pages.indexOf(current_selection),this.pages[current_selection].selected=!1,this.pages[selected_page].selected=!0,this.pages[selected_page]},get_selected_week(){var selected=null;return this.pages.forEach(page=>{page.selected&&(selected=page)}),selected}}};return paginationcomponent})); \ No newline at end of file diff --git a/notemyprogress/amd/src/setweeks.js b/notemyprogress/amd/src/setweeks.js index 1b41697c4d5c776c641ae34c508a22ea31e7e940..97747ff54aaaec5c2f70c023b3278d342eb12f20 100644 --- a/notemyprogress/amd/src/setweeks.js +++ b/notemyprogress/amd/src/setweeks.js @@ -218,34 +218,34 @@ define([ params: data, }) .then((response) => { - //console.log("then1"); + console.log("then1"); if (response.status == 200 && response.data.ok) { - //console.log("then1.2"); + console.log("then1.2"); this.settings = response.data.data.settings; - //console.log("then1.3"); + console.log("then1.3"); Alertify.success(this.strings.save_successful); - //console.log("then1.4"); + console.log("then1.4"); this.save_successful = true; - //console.log("then1.5"); + console.log("then1.5"); } else { - //console.log("then1.6"); + console.log("then1.6"); Alertify.error(this.strings.error_network); - //console.log("then1.7"); + console.log("then1.7"); this.error_messages.push(this.strings.error_network); - //console.log("then1.8"); + console.log("then1.8"); } }) .catch((e) => { - //console.log("catch1"); + console.log("catch1"); Alertify.error(this.strings.error_network); - //console.log("catch2"); + console.log("catch2"); this.error_messages.push(this.strings.error_network); - //console.log("catch3"); + console.log("catch3"); }) .finally(() => { - //console.log("finally1"); + console.log("finally1"); this.saving_loader = false; - //console.log("finally2"); + console.log("finally2"); //this.addLogsIntoDB("saved", "configuration", "weeks", "Saved a new configuration for the weeks !"); }); }, diff --git a/notemyprogress/amd/src/teacher.js b/notemyprogress/amd/src/teacher.js index 25b58222436c3453d4e40f7103826300830921b8..3b811743617fd36bc6a18e23c33c159cc6429d41 100644 --- a/notemyprogress/amd/src/teacher.js +++ b/notemyprogress/amd/src/teacher.js @@ -1,272 +1,305 @@ -define(["local_notemyprogress/vue", - "local_notemyprogress/vuetify", - "local_notemyprogress/axios", - "local_notemyprogress/pagination", - "local_notemyprogress/chartstatic", - "local_notemyprogress/pageheader", - "local_notemyprogress/helpdialog", - ], - function(Vue, Vuetify, Axios, Pagination, ChartStatic, PageHeader, HelpDialog) { - "use strict"; +define([ + "local_notemyprogress/vue", + "local_notemyprogress/vuetify", + "local_notemyprogress/axios", + "local_notemyprogress/pagination", + "local_notemyprogress/chartstatic", + "local_notemyprogress/pageheader", + "local_notemyprogress/helpdialog", +], function ( + Vue, + Vuetify, + Axios, + Pagination, + ChartStatic, + PageHeader, + HelpDialog +) { + "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('helpdialog', HelpDialog); - let vue = new Vue({ - delimiters: ["[[", "]]"], - el: "#teacher", - 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, - - indicators: content.indicators, - week_resources_colors: content.week_resources_colors, - search: null, - week_resources_categories: [], - week_resources_data: [], + function init(content) { + // console.log(content); + Vue.use(Vuetify); + Vue.component("pagination", Pagination); + Vue.component("chart", ChartStatic); + Vue.component("pageheader", PageHeader); + Vue.component("helpdialog", HelpDialog); + let vue = new Vue({ + delimiters: ["[[", "]]"], + el: "#teacher", + 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, - help_dialog: false, - help_contents: [], - } - }, - beforeMount(){ - this.calculate_week_resources(); - }, - mounted(){ - document.querySelector("#sessions-loader").style.display = "none"; - document.querySelector("#teacher").style.display = "block"; - }, - methods : { - get_help_content(){ - let contents = []; - contents.push({ - title: this.strings.section_help_title, - description: this.strings.section_help_description, - }); - return contents; - }, + indicators: content.indicators, + week_resources_colors: content.week_resources_colors, + search: null, + week_resources_categories: [], + week_resources_data: [], - get_course_grade(){ - let grade = Number(this.indicators.course.grademax); - return (this.isInt(grade)) ? grade : grade.toFixed(2); - }, + help_dialog: false, + help_contents: [], + }; + }, + beforeMount() { + this.calculate_week_resources(); + }, + mounted() { + document.querySelector("#sessions-loader").style.display = "none"; + document.querySelector("#teacher").style.display = "block"; + }, + methods: { + get_help_content() { + let contents = []; + contents.push({ + title: this.strings.section_help_title, + description: this.strings.section_help_description, + }); + return contents; + }, - calculate_week_resources() { - let categories = [], data = []; - let week_name; - this.indicators.weeks.forEach(week => { - week_name = `${week.name} ${(week.position+1)}`; - categories.push(week_name); - data.push(week.cms); - }); - let name = this.capitalizeFirstLetter(this.strings.teacher_indicators_modules); - this.week_resources_categories = categories; - this.week_resources_data = [{ name, data}]; - }, + get_course_grade() { + let grade = Number(this.indicators.course.grademax); + return this.isInt(grade) ? grade : grade.toFixed(2); + }, - build_week_resources_chart() { - let chart = new Object(); - chart.chart = { - type: 'bar', - backgroundColor: null, - style: {fontFamily: 'poppins'}, - }; - chart.title = { - text: null, - }; - chart.colors = this.week_resources_colors; - chart.xAxis = { - //categories: this.week_resources_categories - categories:; - - }; - chart.yAxis = { - min: 0, - title: { - //text: this.strings.teacher_indicators_week_resources_yaxis_title - text:; - } - }; - chart.legend = { - enabled: false - }; - // chart.series = this.week_resources_data; - chart.series = ; - return chart; - }, + calculate_week_resources() { + let categories = [], + data = []; + let week_name; + this.indicators.weeks.forEach((week) => { + week_name = `${week.name} ${week.position + 1}`; + categories.push(week_name); + data.push(week.cms); + }); + let name = this.capitalizeFirstLetter( + this.strings.teacher_indicators_modules + ); + this.week_resources_categories = categories; + this.week_resources_data = [{ name, data }]; + }, - build_weeks_sessions_chart() { - let chart = new Object(); - chart.chart = { - type: 'heatmap', - backgroundColor: null, - style: {fontFamily: 'poppins'}, - }; - chart.title = { - text: null, - }; - chart.xAxis = { - categories: this.strings.weeks, - }; - chart.yAxis = { - categories: this.indicators.sessions.categories, - title: null, - reversed: true, - }; - chart.colorAxis = { - min: 0, - minColor: '#E0E0E0', - maxColor: '#118AB2' - }; - chart.legend = { - layout: 'horizontal', - verticalAlign: 'bottom', - }; - chart.tooltip = { - formatter: function () { - let days = vue.indicators.sessions.weeks[this.point.y][this.point.x] || ''; - let xCategoryName = vue.get_point_category_name(this.point, 'x'); - let yCategoryName = vue.get_point_category_name(this.point, 'y'); - let label = vue.strings.teacher_indicators_sessions; - if (this.point.value == 1) { - label = vue.strings.teacher_indicators_session; - } - return '<b>' + yCategoryName + ' ' + xCategoryName + '</b>: ' - + this.point.value +' ' + label + '<br/>' + days; - } - }; - chart.series = [{ - borderWidth: 2, - borderColor: '#FAFAFA', - data: this.indicators.sessions.data, - }]; - return chart; - }, + build_week_resources_chart() { + let chart = new Object(); + chart.chart = { + type: "bar", + backgroundColor: null, + style: { fontFamily: "poppins" }, + }; + chart.title = { + text: null, + }; + chart.colors = this.week_resources_colors; + chart.xAxis = { + categories: this.week_resources_categories, + }; + chart.yAxis = { + min: 0, + title: { + text: this.strings.teacher_indicators_week_resources_yaxis_title, + }, + }; + chart.legend = { + enabled: false, + }; + chart.series = this.week_resources_data; + // console.log(chart.series); + return chart; + }, - table_headers(){ - let headers = [ - { text: '', value : 'id', align : 'center', sortable : false}, - { text: this.strings.thead_name , value : 'firstname'}, - { text: this.strings.thead_lastname , value : 'lastname'}, - { text: this.strings.thead_email , value : 'email'}, - { text: this.strings.thead_progress , value : 'progress_percentage', align : 'center'}, - { text: this.strings.thead_sessions , value : 'sessions_number', align : 'center'}, - { text: this.strings.thead_time , value : 'inverted_time', align : 'center'}, - ]; - return headers; - }, + build_weeks_sessions_chart() { + let chart = new Object(); + chart.chart = { + type: "heatmap", + backgroundColor: null, + style: { fontFamily: "poppins" }, + }; + chart.title = { + text: null, + }; + chart.xAxis = { + categories: this.strings.weeks, + }; + chart.yAxis = { + categories: this.indicators.sessions.categories, + title: null, + reversed: true, + }; + chart.colorAxis = { + min: 0, + minColor: "#E0E0E0", + maxColor: "#118AB2", + }; + chart.legend = { + layout: "horizontal", + verticalAlign: "bottom", + }; + chart.tooltip = { + formatter: function () { + let days = + vue.indicators.sessions.weeks[this.point.y][this.point.x] || ""; + let xCategoryName = vue.get_point_category_name(this.point, "x"); + let yCategoryName = vue.get_point_category_name(this.point, "y"); + let label = vue.strings.teacher_indicators_sessions; + if (this.point.value == 1) { + label = vue.strings.teacher_indicators_session; + } + return ( + "<b>" + + yCategoryName + + " " + + xCategoryName + + "</b>: " + + this.point.value + + " " + + label + + "<br/>" + + days + ); + }, + }; + chart.series = [ + { + borderWidth: 2, + borderColor: "#FAFAFA", + data: this.indicators.sessions.data, + }, + ]; + return chart; + }, - get_picture_url(userid){ - let url = `${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`; - return url; - }, + table_headers() { + let headers = [ + { text: "", value: "id", align: "center", sortable: false }, + { text: this.strings.thead_name, value: "firstname" }, + { text: this.strings.thead_lastname, value: "lastname" }, + { text: this.strings.thead_email, value: "email" }, + { + text: this.strings.thead_progress, + value: "progress_percentage", + align: "center", + }, + { + text: this.strings.thead_sessions, + value: "sessions_number", + align: "center", + }, + { + text: this.strings.thead_time, + value: "inverted_time", + align: "center", + }, + ]; + return headers; + }, - get_percentage_progress(value){ - return `${value} %`; - }, + get_picture_url(userid) { + let url = `${M.cfg.wwwroot}/user/pix.php?file=/${userid}/f1.jpg`; + return url; + }, - get_progress_tooltip(item){ - let module_label = this.strings.teacher_indicators_modules; - let finished_label = this.strings.teacher_indicators_finished; - if (item.cms.complete == 1) { - module_label = this.strings.teacher_indicators_module; - finished_label = this.strings.teacher_indicators_finalized; - } - return `${item.cms.complete} ${module_label} ${finished_label} ${this.strings.of_conector} ${item.cms.total}`; - }, + get_percentage_progress(value) { + return `${value} %`; + }, - get_point_category_name(point, dimension) { - let series = point.series, - isY = dimension === 'y', - axis = series[isY ? 'yAxis' : 'xAxis']; - return axis.categories[point[isY ? 'y' : 'x']]; - }, + get_progress_tooltip(item) { + let module_label = this.strings.teacher_indicators_modules; + let finished_label = this.strings.teacher_indicators_finished; + if (item.cms.complete == 1) { + module_label = this.strings.teacher_indicators_module; + finished_label = this.strings.teacher_indicators_finalized; + } + return `${item.cms.complete} ${module_label} ${finished_label} ${this.strings.of_conector} ${item.cms.total}`; + }, - capitalizeFirstLetter(string) { - return string.charAt(0).toUpperCase() + string.slice(1); - }, + get_point_category_name(point, dimension) { + let series = point.series, + isY = dimension === "y", + axis = series[isY ? "yAxis" : "xAxis"]; + return axis.categories[point[isY ? "y" : "x"]]; + }, - isInt(n) { - return n % 1 === 0; - }, + capitalizeFirstLetter(string) { + return string.charAt(0).toUpperCase() + string.slice(1); + }, - open_chart_help(chart) { - let contents = []; - if (chart == "week_resources") { - contents.push({ - title: this.strings.week_resources_help_title, - description: this.strings.week_resources_help_description_p1, - }); - contents.push({ - description: this.strings.week_resources_help_description_p2, - }); - } else if (chart == "weeks_sessions") { - contents.push({ - title: this.strings.weeks_sessions_help_title, - description: this.strings.week_sessions_help_description_p1, - }); - contents.push({ - description: this.strings.week_sessions_help_description_p2, - }); - } else if (chart == "progress_table") { - contents.push({ - title: this.strings.progress_table_help_title, - description: this.strings.progress_table_help_description, - }); - } - this.help_contents = contents; - if (this.help_contents.length) { - this.help_dialog = true; - } - }, + isInt(n) { + return n % 1 === 0; + }, - update_help_dialog (value) { - this.help_dialog = value; - }, + open_chart_help(chart) { + let contents = []; + if (chart == "week_resources") { + contents.push({ + title: this.strings.week_resources_help_title, + description: this.strings.week_resources_help_description_p1, + }); + contents.push({ + description: this.strings.week_resources_help_description_p2, + }); + } else if (chart == "weeks_sessions") { + contents.push({ + title: this.strings.weeks_sessions_help_title, + description: this.strings.week_sessions_help_description_p1, + }); + contents.push({ + description: this.strings.week_sessions_help_description_p2, + }); + } else if (chart == "progress_table") { + contents.push({ + title: this.strings.progress_table_help_title, + description: this.strings.progress_table_help_description, + }); + } + this.help_contents = contents; + if (this.help_contents.length) { + this.help_dialog = true; + } + }, - get_timezone(){ - let information = `${this.strings.ss_change_timezone} ${this.timezone}` - return information; - }, + update_help_dialog(value) { + this.help_dialog = value; + }, - addLogsIntoDB(action, objectName, objectType, objectDescription) { - let data = { - courseid: content.courseid, - userid: content.userid, - action: "addLogs", - sectionname: "TEACHER_GENERAL_INDICATORS", - 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_timezone() { + let information = `${this.strings.ss_change_timezone} ${this.timezone}`; + return information; + }, - } + addLogsIntoDB(action, objectName, objectType, objectDescription) { + let data = { + courseid: content.courseid, + userid: content.userid, + action: "addLogs", + sectionname: "TEACHER_GENERAL_INDICATORS", + 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) => {}); + }, + }, + }); + } - return { - init : init - }; - }); \ No newline at end of file + return { + init: init, + }; +}); diff --git a/notemyprogress/fichiers_fliplearning.rar b/notemyprogress/fichiers_fliplearning.rar deleted file mode 100644 index ee1165312b26718ef94afa6a234fa9eb1064ba91..0000000000000000000000000000000000000000 Binary files a/notemyprogress/fichiers_fliplearning.rar and /dev/null differ