diff --git a/amd/build/skills.min.js.map b/amd/build/skills.min.js.map index d7eac35..1a506fc 100644 --- a/amd/build/skills.min.js.map +++ b/amd/build/skills.min.js.map @@ -1 +1 @@ -{"version":3,"file":"skills.min.js","sources":["../src/skills.js"],"sourcesContent":["define(['jquery', 'core/modal_factory', 'core/str', 'core_form/modalform'], function($, ModalFactory, Str, ModalForm) {\r\n\r\n const SELECTORS = {\r\n table: '#tool_skills_list',\r\n editskill: '[data-target=\"toolskill-edit\"]',\r\n skillsRow: '#tool_skills_list .skill-actions a.action-edit'\r\n };\r\n\r\n class ToolSkillsCourses {\r\n\r\n constructor(skillID, courseID) {\r\n\r\n this.SELECTORS = SELECTORS;\r\n this.skillCourseID = '';\r\n this.skillID = skillID;\r\n this.courseID = courseID;\r\n\r\n this.SELECTORS.root = '#tool_skills_list [data-skillid=\"' + this.skillID + '\"]';\r\n this.addActionListiners();\r\n }\r\n\r\n getRoot() {\r\n return document.querySelector(this.SELECTORS.root);\r\n }\r\n\r\n showContentForm() {\r\n\r\n var formClass = 'tool_skills\\\\form\\\\course_form';\r\n\r\n const modalForm = new ModalForm({\r\n\r\n formClass: formClass,\r\n // Add as many arguments as you need, they will be passed to the form:\r\n args: {courseid: this.courseID, skill: this.skillID},\r\n // Modal configurations, here set modal title.\r\n modalConfig: {title: Str.get_string('courseskills', 'tool_skills')},\r\n });\r\n\r\n modalForm.show();\r\n\r\n // Listen to events if you want to execute something on form submit.\r\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, function() {\r\n window.location.reload();\r\n });\r\n }\r\n\r\n\r\n addActionListiners() {\r\n\r\n var self = this;\r\n\r\n this.getRoot().addEventListener('click', function(e) {\r\n\r\n if (e.target.closest(SELECTORS.editskill)) {\r\n e.preventDefault();\r\n self.showContentForm();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * Add event listenrs.\r\n *\r\n * @param {Integer} courseID\r\n */\r\n static createInstances(courseID) {\r\n\r\n let skills = document.querySelectorAll(SELECTORS.skillsRow);\r\n\r\n const skillsList = [];\r\n\r\n if (skills !== null) {\r\n\r\n var skill;\r\n skills.forEach((skl) => {\r\n var skillID = skl.dataset.skillid;\r\n if (skillID in skillsList) {\r\n skill = skillsList[skillID];\r\n } else {\r\n skill = new ToolSkillsCourses(skillID, courseID);\r\n skillsList[skillID] = skill;\r\n }\r\n });\r\n }\r\n }\r\n\r\n /**\r\n * Trigger the filter form to submit. to refresh the course content.\r\n *\r\n * @param {int} blockID\r\n */\r\n static refresh(blockID) {\r\n // Quick fix. TODO: Need to implement the method in Dashinstance.js to referesh the content from anywhere.\r\n var block = '#inst' + blockID;\r\n if ($(block).find('select:eq(1)').length == 0) {\r\n $(block).find('.filter-form').append('');\r\n }\r\n\r\n $(block).find('.filter-form').find('select').trigger('change');\r\n }\r\n\r\n }\r\n\r\n return {\r\n\r\n init: function(courseID) {\r\n ToolSkillsCourses.createInstances(courseID);\r\n }\r\n };\r\n});\r\n"],"names":["define","$","ModalFactory","Str","ModalForm","SELECTORS","table","editskill","skillsRow","ToolSkillsCourses","constructor","skillID","courseID","skillCourseID","root","this","addActionListiners","getRoot","document","querySelector","showContentForm","modalForm","formClass","args","courseid","skill","modalConfig","title","get_string","show","addEventListener","events","FORM_SUBMITTED","window","location","reload","self","e","target","closest","preventDefault","skills","querySelectorAll","skillsList","forEach","skl","dataset","skillid","blockID","block","find","length","append","trigger","init","createInstances"],"mappings":"AAAAA,4BAAO,CAAC,SAAU,qBAAsB,WAAY,wBAAwB,SAASC,EAAGC,aAAcC,IAAKC,iBAEjGC,UAAY,CACdC,MAAO,oBACPC,UAAW,iCACXC,UAAW,wDAGTC,kBAEFC,YAAYC,QAASC,eAEZP,UAAYA,eACZQ,cAAgB,QAChBF,QAAUA,aACVC,SAAWA,cAEXP,UAAUS,KAAO,oCAAsCC,KAAKJ,QAAU,UACtEK,qBAGTC,iBACWC,SAASC,cAAcJ,KAAKV,UAAUS,MAGjDM,wBAIUC,UAAY,IAAIjB,UAAU,CAE5BkB,UAJY,iCAMZC,KAAM,CAACC,SAAUT,KAAKH,SAAUa,MAAOV,KAAKJ,SAE5Ce,YAAa,CAACC,MAAOxB,IAAIyB,WAAW,eAAgB,kBAGxDP,UAAUQ,OAGVR,UAAUS,iBAAiBT,UAAUU,OAAOC,gBAAgB,WACxDC,OAAOC,SAASC,YAKxBnB,yBAEQoB,KAAOrB,UAENE,UAAUa,iBAAiB,SAAS,SAASO,GAE1CA,EAAEC,OAAOC,QAAQlC,UAAUE,aAC3B8B,EAAEG,iBACFJ,KAAKhB,6CAUMR,cAEf6B,OAASvB,SAASwB,iBAAiBrC,UAAUG,iBAE3CmC,WAAa,OAIXlB,MAFO,OAAXgB,QAGAA,OAAOG,SAASC,UACRlC,QAAUkC,IAAIC,QAAQC,QACtBpC,WAAWgC,WACXlB,MAAQkB,WAAWhC,UAEnBc,MAAQ,IAAIhB,kBAAkBE,QAASC,UACvC+B,WAAWhC,SAAWc,yBAWvBuB,aAERC,MAAQ,QAAUD,QACsB,GAAxC/C,EAAEgD,OAAOC,KAAK,gBAAgBC,QAC9BlD,EAAEgD,OAAOC,KAAK,gBAAgBE,OAAO,6DAGzCnD,EAAEgD,OAAOC,KAAK,gBAAgBA,KAAK,UAAUG,QAAQ,iBAKrD,CAEHC,KAAM,SAAS1C,UACXH,kBAAkB8C,gBAAgB3C"} \ No newline at end of file +{"version":3,"file":"skills.min.js","sources":["../src/skills.js"],"sourcesContent":["define(['jquery', 'core/modal_factory', 'core/str', 'core_form/modalform'], function($, ModalFactory, Str, ModalForm) {\n\n const SELECTORS = {\n table: '#tool_skills_list',\n editskill: '[data-target=\"toolskill-edit\"]',\n skillsRow: '#tool_skills_list .skill-actions a.action-edit'\n };\n\n class ToolSkillsCourses {\n\n constructor(skillID, courseID) {\n\n this.SELECTORS = SELECTORS;\n this.skillCourseID = '';\n this.skillID = skillID;\n this.courseID = courseID;\n\n this.SELECTORS.root = '#tool_skills_list [data-skillid=\"' + this.skillID + '\"]';\n this.addActionListiners();\n }\n\n getRoot() {\n return document.querySelector(this.SELECTORS.root);\n }\n\n showContentForm() {\n\n var formClass = 'tool_skills\\\\form\\\\course_form';\n\n const modalForm = new ModalForm({\n\n formClass: formClass,\n // Add as many arguments as you need, they will be passed to the form:\n args: {courseid: this.courseID, skill: this.skillID},\n // Modal configurations, here set modal title.\n modalConfig: {title: Str.get_string('courseskills', 'tool_skills')},\n });\n\n modalForm.show();\n\n // Listen to events if you want to execute something on form submit.\n modalForm.addEventListener(modalForm.events.FORM_SUBMITTED, function() {\n window.location.reload();\n });\n }\n\n\n addActionListiners() {\n\n var self = this;\n\n this.getRoot().addEventListener('click', function(e) {\n\n if (e.target.closest(SELECTORS.editskill)) {\n e.preventDefault();\n self.showContentForm();\n }\n });\n }\n\n /**\n * Add event listenrs.\n *\n * @param {Integer} courseID\n */\n static createInstances(courseID) {\n\n let skills = document.querySelectorAll(SELECTORS.skillsRow);\n\n const skillsList = [];\n\n if (skills !== null) {\n\n var skill;\n skills.forEach((skl) => {\n var skillID = skl.dataset.skillid;\n if (skillID in skillsList) {\n skill = skillsList[skillID];\n } else {\n skill = new ToolSkillsCourses(skillID, courseID);\n skillsList[skillID] = skill;\n }\n });\n }\n }\n\n /**\n * Trigger the filter form to submit. to refresh the course content.\n *\n * @param {int} blockID\n */\n static refresh(blockID) {\n // Quick fix. TODO: Need to implement the method in Dashinstance.js to referesh the content from anywhere.\n var block = '#inst' + blockID;\n if ($(block).find('select:eq(1)').length == 0) {\n $(block).find('.filter-form').append('');\n }\n\n $(block).find('.filter-form').find('select').trigger('change');\n }\n\n }\n\n return {\n\n init: function(courseID) {\n ToolSkillsCourses.createInstances(courseID);\n }\n };\n});\n"],"names":["define","$","ModalFactory","Str","ModalForm","SELECTORS","table","editskill","skillsRow","ToolSkillsCourses","constructor","skillID","courseID","skillCourseID","root","this","addActionListiners","getRoot","document","querySelector","showContentForm","modalForm","formClass","args","courseid","skill","modalConfig","title","get_string","show","addEventListener","events","FORM_SUBMITTED","window","location","reload","self","e","target","closest","preventDefault","skills","querySelectorAll","skillsList","forEach","skl","dataset","skillid","blockID","block","find","length","append","trigger","init","createInstances"],"mappings":"AAAAA,4BAAO,CAAC,SAAU,qBAAsB,WAAY,wBAAwB,SAASC,EAAGC,aAAcC,IAAKC,iBAEjGC,UAAY,CACdC,MAAO,oBACPC,UAAW,iCACXC,UAAW,wDAGTC,kBAEFC,YAAYC,QAASC,eAEZP,UAAYA,eACZQ,cAAgB,QAChBF,QAAUA,aACVC,SAAWA,cAEXP,UAAUS,KAAO,oCAAsCC,KAAKJ,QAAU,UACtEK,qBAGTC,iBACWC,SAASC,cAAcJ,KAAKV,UAAUS,MAGjDM,wBAIUC,UAAY,IAAIjB,UAAU,CAE5BkB,UAJY,iCAMZC,KAAM,CAACC,SAAUT,KAAKH,SAAUa,MAAOV,KAAKJ,SAE5Ce,YAAa,CAACC,MAAOxB,IAAIyB,WAAW,eAAgB,kBAGxDP,UAAUQ,OAGVR,UAAUS,iBAAiBT,UAAUU,OAAOC,gBAAgB,WACxDC,OAAOC,SAASC,YAKxBnB,yBAEQoB,KAAOrB,UAENE,UAAUa,iBAAiB,SAAS,SAASO,GAE1CA,EAAEC,OAAOC,QAAQlC,UAAUE,aAC3B8B,EAAEG,iBACFJ,KAAKhB,6CAUMR,cAEf6B,OAASvB,SAASwB,iBAAiBrC,UAAUG,iBAE3CmC,WAAa,OAIXlB,MAFO,OAAXgB,QAGAA,OAAOG,SAASC,UACRlC,QAAUkC,IAAIC,QAAQC,QACtBpC,WAAWgC,WACXlB,MAAQkB,WAAWhC,UAEnBc,MAAQ,IAAIhB,kBAAkBE,QAASC,UACvC+B,WAAWhC,SAAWc,yBAWvBuB,aAERC,MAAQ,QAAUD,QACsB,GAAxC/C,EAAEgD,OAAOC,KAAK,gBAAgBC,QAC9BlD,EAAEgD,OAAOC,KAAK,gBAAgBE,OAAO,6DAGzCnD,EAAEgD,OAAOC,KAAK,gBAAgBA,KAAK,UAAUG,QAAQ,iBAKrD,CAEHC,KAAM,SAAS1C,UACXH,kBAAkB8C,gBAAgB3C"} \ No newline at end of file diff --git a/classes/courseskills.php b/classes/courseskills.php index d1d9ba1..0d938c9 100644 --- a/classes/courseskills.php +++ b/classes/courseskills.php @@ -64,7 +64,7 @@ protected function __construct(int $courseid) { } /** - * Create the return the clas instance for this skillcourse id. + * Create the retun the clas instance for this skillcourse id. * * @param int $courseid * @return self diff --git a/classes/user.php b/classes/user.php index 6de44e7..8eb4522 100644 --- a/classes/user.php +++ b/classes/user.php @@ -221,7 +221,7 @@ public function get_user_proficency_level(int $skillid, int $points) { * Get the user percentage in the skill. * * @param int $skillid Skill ID - * @param int $points Point + * @param int $points * @return string */ public function get_user_percentage(int $skillid, $points) { diff --git a/lang/en/tool_skills.php b/lang/en/tool_skills.php index 6c96ea5..a70b5e6 100644 --- a/lang/en/tool_skills.php +++ b/lang/en/tool_skills.php @@ -177,3 +177,4 @@ $string['skillsdatasource'] = 'Skills'; $string['userproficiency'] = 'Proficiency'; $string['userpercentage'] = 'Percentage'; +$string['grade'] = 'Grade';