mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 06:18:28 +01:00
1 line
1.7 KiB
JavaScript
1 line
1.7 KiB
JavaScript
define(["jquery","core/notification","core/str","core/ajax","core/log","core/templates","tool_lp/dialogue"],function(a,b,c,d,e,f,g){var h=function(b,c){this._regionSelector=b,this._userCompetencySelector=c,a(this._regionSelector).on("click",this._userCompetencySelector,this._handleClick.bind(this))};return h.prototype._handleClick=function(c){var f=a(c.target).closest(this._userCompetencySelector),g=a(f).data("competencyid"),h=a(f).data("courseid"),i=a(f).data("userid");e.debug("Clicked on cell: competencyId="+g+", courseId="+h+", userId="+i);var j=d.call([{methodname:"tool_lp_data_for_user_competency_summary_in_course",args:{userid:i,competencyid:g,courseid:h},done:this._contextLoaded.bind(this),fail:b.exception}]);j[0].then(function(){d.call([{methodname:"core_competency_user_competency_viewed_in_course",args:{userid:i,competencyid:g,courseid:h},fail:b.exception}])})},h.prototype._contextLoaded=function(a){var d=this;a.displayuser=!0,f.render("tool_lp/user_competency_summary_in_course",a).done(function(a,e){c.get_string("usercompetencysummary","report_competency").done(function(b){new g(b,a,f.runTemplateJS.bind(f,e),d._refresh.bind(d),!0)}).fail(b.exception)}).fail(b.exception)},h.prototype._refresh=function(){var c=a(this._regionSelector),e=c.data("courseid"),f=c.data("userid");d.call([{methodname:"report_competency_data_for_report",args:{courseid:e,userid:f},done:this._pageContextLoaded.bind(this),fail:b.exception}])},h.prototype._pageContextLoaded=function(a){var c=this;f.render("report_competency/report",a).done(function(a,b){f.replaceNode(c._regionSelector,a,b)}).fail(b.exception)},h.prototype._regionSelector=null,h.prototype._userCompetencySelector=null,h}); |