Skip to content
Snippets Groups Projects
Commit c119d067 authored by Esteban Villalobos's avatar Esteban Villalobos
Browse files

Merge branch 'DocumentRacine' into 'main'

All NMP file moved to root

See merge request laser-anr/notemyprogress-plug-in!3
parents 283a0a2a ac665c98
Branches
Tags ups/2022090800
No related merge requests found
Showing
with 40 additions and 1 deletion
File moved
File moved
......@@ -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)
{
......
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
File moved
File moved
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment