diff --git a/.github/workflows/moodle-ci.yml b/.github/workflows/moodle-ci.yml index cd82f6f..471f2c2 100644 --- a/.github/workflows/moodle-ci.yml +++ b/.github/workflows/moodle-ci.yml @@ -4,7 +4,7 @@ on: [push, pull_request] jobs: test: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest services: postgres: @@ -30,22 +30,37 @@ jobs: fail-fast: false matrix: include: + - php: '8.3' + moodle-branch: 'MOODLE_405_STABLE' + database: 'pgsql' + - php: '8.2' + moodle-branch: 'MOODLE_405_STABLE' + database: 'mariadb' + - php: '8.1' + moodle-branch: 'MOODLE_405_STABLE' + database: 'pgsql' + - php: '8.3' + moodle-branch: 'MOODLE_404_STABLE' + database: 'mariadb' + - php: '8.2' + moodle-branch: 'MOODLE_404_STABLE' + database: 'pgsql' + - php: '8.1' + moodle-branch: 'MOODLE_404_STABLE' + database: 'mariadb' - php: '8.2' moodle-branch: 'MOODLE_403_STABLE' database: 'pgsql' - - php: '8.0' + - php: '8.1' moodle-branch: 'MOODLE_402_STABLE' database: 'mariadb' - php: '8.0' moodle-branch: 'MOODLE_401_STABLE' database: 'pgsql' - - php: '7.4' - moodle-branch: 'MOODLE_400_STABLE' - database: 'mariadb' steps: - name: Check out repository code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: plugin @@ -59,7 +74,7 @@ jobs: - name: Initialise moodle-plugin-ci run: | - composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^3 + composer create-project -n --no-dev --prefer-dist moodlehq/moodle-plugin-ci ci ^4 echo $(cd ci/bin; pwd) >> $GITHUB_PATH echo $(cd ci/vendor/bin; pwd) >> $GITHUB_PATH sudo locale-gen en_AU.UTF-8 @@ -76,16 +91,6 @@ jobs: if: ${{ always() }} run: moodle-plugin-ci phplint - - name: PHP Copy/Paste Detector - continue-on-error: true # This step will show errors but will not fail - if: ${{ always() }} - run: moodle-plugin-ci phpcpd - - - name: PHP Mess Detector - continue-on-error: true # This step will show errors but will not fail - if: ${{ always() }} - run: moodle-plugin-ci phpmd - - name: Moodle Code Checker if: ${{ always() }} run: moodle-plugin-ci codechecker --max-warnings 0 diff --git a/amd/build/skills.min.js.map b/amd/build/skills.min.js.map index 1a506fc..62f73bd 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) {\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 +{"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 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,YAIxBnB,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/amd/src/skills.js b/amd/src/skills.js index 1754b20..7aea0e5 100644 --- a/amd/src/skills.js +++ b/amd/src/skills.js @@ -44,7 +44,6 @@ define(['jquery', 'core/modal_factory', 'core/str', 'core_form/modalform'], func }); } - addActionListiners() { var self = this; diff --git a/classes/allocation_method.php b/classes/allocation_method.php index 2c7d88b..5603918 100644 --- a/classes/allocation_method.php +++ b/classes/allocation_method.php @@ -119,7 +119,7 @@ public function get_data() { * * @return \tool_skills\logs */ - public function get_logs() : \tool_skills\logs { + public function get_logs(): \tool_skills\logs { if ($this->logs == null) { $this->logs = new \tool_skills\logs(); diff --git a/classes/courseskills.php b/classes/courseskills.php index 0d938c9..4c9e394 100644 --- a/classes/courseskills.php +++ b/classes/courseskills.php @@ -69,7 +69,7 @@ protected function __construct(int $courseid) { * @param int $courseid * @return self */ - public static function get(int $courseid) : self { + public static function get(int $courseid): self { return new self($courseid); } @@ -79,7 +79,7 @@ public static function get(int $courseid) : self { * @param int $skillid * @return self */ - public static function get_for_skill(int $skillid) : array { + public static function get_for_skill(int $skillid): array { global $DB; $courses = $DB->get_records('tool_skills_courses', ['skill' => $skillid]); @@ -92,7 +92,7 @@ public static function get_for_skill(int $skillid) : array { * * @return stdClass Course record data. */ - public function get_course() : stdClass { + public function get_course(): stdClass { return get_course($this->courseid); } diff --git a/classes/form/course_form.php b/classes/form/course_form.php index 11eee9d..72efac7 100644 --- a/classes/form/course_form.php +++ b/classes/form/course_form.php @@ -102,7 +102,7 @@ public function definition() { * @return bool */ protected function check_access_for_dynamic_submission(): void { - // TODO: Validatation of user capability goes here. + // TODO MDL-0: Validatation of user capability goes here. } /** @@ -190,7 +190,7 @@ protected function get_page_url_for_dynamic_submission(): moodle_url { * @param bool $status * @return void */ - public static function update_status(int $skillid, int $courseid, bool $status) : void { + public static function update_status(int $skillid, int $courseid, bool $status): void { global $DB; $record = new stdClass; diff --git a/classes/level.php b/classes/level.php index 2b3b55d..b3d992b 100644 --- a/classes/level.php +++ b/classes/level.php @@ -94,7 +94,7 @@ protected function __construct(int $levelid) { * * @return stdClass Level record. */ - public function get_level_record() : stdClass { + public function get_level_record(): stdClass { return $this->levelrecord; } @@ -103,7 +103,7 @@ public function get_level_record() : stdClass { * * @return stdClass */ - public function get_data() : stdClass { + public function get_data(): stdClass { return $this->data; } @@ -112,7 +112,7 @@ public function get_data() : stdClass { * * @return stdClass|bool */ - protected function fetch_record() : ?stdClass { + protected function fetch_record(): ?stdClass { global $DB; if ($skill = $DB->get_record('tool_skills_levels', ['id' => $this->levelid])) { @@ -161,7 +161,7 @@ public function get_points() { * * @param int $levelid */ - public static function get(int $levelid) : \tool_skills\level { + public static function get(int $levelid): \tool_skills\level { // Create the instance for this skill and return. return new self($levelid); } diff --git a/classes/privacy/provider.php b/classes/privacy/provider.php index cac3689..b06aa5a 100644 --- a/classes/privacy/provider.php +++ b/classes/privacy/provider.php @@ -83,7 +83,7 @@ public static function get_metadata(collection $collection): collection { * @param int $userid The user to search. * @return contextlist $contextlist The list of contexts used in this plugin. */ - public static function get_contexts_for_userid(int $userid) : contextlist { + public static function get_contexts_for_userid(int $userid): contextlist { $contextlist = new \core_privacy\local\request\contextlist(); // User completions. $sql = "SELECT ctx.id @@ -238,7 +238,7 @@ public static function export_user_data(approved_contextlist $contextlist) { get_string('privacy:awardlogs', 'tool_skills'), array_filter( $userpoints, - function(stdClass $point) use ($contextlist) : bool { + function(stdClass $point) use ($contextlist): bool { return $point->userid == $contextlist->get_user()->id; } ), @@ -299,7 +299,7 @@ private static function export_user_points(string $path, array $userpoints, $use private static function group_by_property(array $classes, string $property): array { return array_reduce( $classes, - function (array $classes, stdClass $class) use ($property) : array { + function (array $classes, stdClass $class) use ($property): array { $classes[$class->{$property}][] = $class; return $classes; }, diff --git a/classes/skills.php b/classes/skills.php index 80ced6a..952ea86 100644 --- a/classes/skills.php +++ b/classes/skills.php @@ -141,7 +141,7 @@ protected function __construct(int $skillid) { * * @return stdClass Skill record. */ - public function get_skill_record() : stdClass { + public function get_skill_record(): stdClass { return $this->skillrecord; } @@ -150,7 +150,7 @@ public function get_skill_record() : stdClass { * * @return int */ - public function get_id() : int { + public function get_id(): int { return $this->data->id; } @@ -159,7 +159,7 @@ public function get_id() : int { * * @return stdClass */ - public function get_data() : stdClass { + public function get_data(): stdClass { return $this->data; } @@ -168,7 +168,7 @@ public function get_data() : stdClass { * * @return string */ - public function get_name() : string { + public function get_name(): string { return format_string($this->data->name); } @@ -177,7 +177,7 @@ public function get_name() : string { * * @return stdClass|bool */ - protected function fetch_skill_record() : ?stdClass { + protected function fetch_skill_record(): ?stdClass { global $DB; if ($skill = $DB->get_record('tool_skills', ['id' => $this->skillid])) { @@ -194,7 +194,7 @@ protected function fetch_skill_record() : ?stdClass { * * @return stdClass */ - protected function update_data_structure() : stdClass { + protected function update_data_structure(): stdClass { // Clone the skill record. $data = clone $this->skillrecord; @@ -317,7 +317,7 @@ public function get_points_to_earnskill() { * * @return void */ - protected function fetch_levels() : void { + protected function fetch_levels(): void { global $DB; $this->levels = $DB->get_records('tool_skills_levels', ['skill' => $this->skillid]); @@ -328,7 +328,7 @@ protected function fetch_levels() : void { * * @return array */ - public function get_levels() : array { + public function get_levels(): array { if (empty($this->levels)) { $this->fetch_levels(); @@ -342,7 +342,7 @@ public function get_levels() : array { * * @return int */ - public function get_levels_count() : int { + public function get_levels_count(): int { global $DB; return count($this->get_levels()); @@ -451,7 +451,7 @@ public function increase_points($skillobj, int $points, int $userid) { * @param int $points * @return int */ - public function set_userskill_points(int $userid, int $points) : int { + public function set_userskill_points(int $userid, int $points): int { global $DB; $record = ['skill' => $this->skillid, 'userid' => $userid]; @@ -525,7 +525,7 @@ public function get_proficient() { * * @param int $skillid */ - public static function get(int $skillid) : \tool_skills\skills { + public static function get(int $skillid): \tool_skills\skills { // Create the instance for this skill and return. return new self($skillid); } @@ -543,7 +543,7 @@ public static function manage_instance($formdata) { // Verfiy the current user has capability to manage skills. require_capability('tool/skills:manage', context_system::instance()); - // TODO: Try catch. + // TODO MDL-0: Try catch. $record = clone $formdata; $record->categories = json_encode($record->categories); diff --git a/classes/table/archived_skills.php b/classes/table/archived_skills.php index 8989906..4ee99df 100644 --- a/classes/table/archived_skills.php +++ b/classes/table/archived_skills.php @@ -96,8 +96,8 @@ public function query_db($pagesize, $useinitialsbar = true) { * @param stdClass $row * @return string */ - public function col_description(stdClass $row) : string { - return format_text($row->description, FORMAT_HTML, ['overflow' => false]); + public function col_description(stdClass $row): string { + return format_text($row->description, FORMAT_HTML); } /** @@ -106,7 +106,7 @@ public function col_description(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_name(stdClass $row) : string { + public function col_name(stdClass $row): string { return format_string($row->name); } @@ -116,7 +116,7 @@ public function col_name(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_categories(stdClass $row) : string { + public function col_categories(stdClass $row): string { $categories = $row->categories ?? []; if (empty($categories)) { @@ -139,7 +139,7 @@ public function col_categories(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_timecreated(stdClass $row) :string { + public function col_timecreated(stdClass $row): string { return userdate($row->timecreated); } @@ -150,7 +150,7 @@ public function col_timecreated(stdClass $row) :string { * @param stdClass $row * @return string */ - public function col_timearchived(stdClass $row) :string { + public function col_timearchived(stdClass $row): string { return userdate($row->timearchived); } @@ -160,7 +160,7 @@ public function col_timearchived(stdClass $row) :string { * @param stdClass $row * @return string */ - public function col_actions(stdClass $row) : string { + public function col_actions(stdClass $row): string { global $OUTPUT; // Base url to edit the skills. diff --git a/classes/table/course_skills_table.php b/classes/table/course_skills_table.php index 7c38331..8aaffcd 100644 --- a/classes/table/course_skills_table.php +++ b/classes/table/course_skills_table.php @@ -118,7 +118,7 @@ public function query_db($pagesize, $useinitialsbar = true) { * @param stdClass $row * @return string */ - public function col_name(stdClass $row) : string { + public function col_name(stdClass $row): string { return format_string($row->name); } @@ -128,8 +128,8 @@ public function col_name(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_description(stdClass $row) : string { - return format_text($row->description, FORMAT_HTML, ['overflow' => false]); + public function col_description(stdClass $row): string { + return format_text($row->description, FORMAT_HTML); } /** @@ -138,7 +138,7 @@ public function col_description(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_uponcompletion(stdClass $row) : string { + public function col_uponcompletion(stdClass $row): string { $completion = $row->uponcompletion ?? 0; @@ -169,7 +169,7 @@ public function col_uponcompletion(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_actions(stdClass $row) : string { + public function col_actions(stdClass $row): string { global $OUTPUT; // Base url to edit the skills. diff --git a/classes/table/skills_table.php b/classes/table/skills_table.php index 89865d9..71b8d9e 100644 --- a/classes/table/skills_table.php +++ b/classes/table/skills_table.php @@ -102,7 +102,7 @@ public function query_db($pagesize, $useinitialsbar = true) { * @param stdClass $row * @return string */ - public function col_name(stdClass $row) : string { + public function col_name(stdClass $row): string { return format_string($row->name); } @@ -112,8 +112,8 @@ public function col_name(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_description(stdClass $row) : string { - return format_text($row->description, FORMAT_HTML, ['overflow' => false]); + public function col_description(stdClass $row): string { + return format_text($row->description, FORMAT_HTML); } /** @@ -122,7 +122,7 @@ public function col_description(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_categories(stdClass $row) : string { + public function col_categories(stdClass $row): string { $categories = $row->categories ?? []; if (empty($categories)) { @@ -142,7 +142,7 @@ public function col_categories(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_timecreated(stdClass $row) : string { + public function col_timecreated(stdClass $row): string { return userdate($row->timecreated); } @@ -152,7 +152,7 @@ public function col_timecreated(stdClass $row) : string { * @param stdClass $row * @return string */ - public function col_actions(stdClass $row) : string { + public function col_actions(stdClass $row): string { global $OUTPUT; // Base url to edit the skills. diff --git a/lang/en/tool_skills.php b/lang/en/tool_skills.php index 807c08d..34e4dd3 100644 --- a/lang/en/tool_skills.php +++ b/lang/en/tool_skills.php @@ -22,6 +22,9 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ +// phpcs:disable moodle.Files.LangFilesOrdering.UnexpectedComment +// phpcs:disable moodle.Files.LangFilesOrdering.IncorrectOrder + defined('MOODLE_INTERNAL') || die('No direct access'); $string['pluginname'] = 'Skills'; @@ -32,12 +35,12 @@ $string['skills:viewotherspoints'] = 'View others points'; // ...error strings. $string['error:skillsnotfound'] = 'Skill record not found for the given id'; -$string['error:identityexists'] = 'Given skill identity is exists, Please use unique value'; +$string['error:identityexists'] = 'Given skill identity already exists. Please use a unique value.'; $string['error:numeric'] = 'Value should be in numbers'; // ...List page strings. $string['skillslist'] = 'List of skills'; $string['skillslisthead'] = 'Manage skills'; -$string['skillslist_desc'] = 'Create a new skill and edit exsiting skills'; +$string['skillslist_desc'] = 'Create a new skill and edit existing skills'; $string['createskill'] = 'Create skill'; $string['create'] = 'Create'; $string['editskill'] = 'Edit skill'; @@ -49,10 +52,10 @@ $string['timearchived'] = 'Archived time'; // ...Delete message. $string['skillsdeleted'] = 'Skills deleted'; -$string['deleteskill'] = 'Are you sure! do you want to delete this skill and its levels'; -$string['skillsnothingtodisplay'] = 'Skills are not created yet or not in use, Create a new skill using the create button'; -$string['archiveskill'] = 'Are you sure! do you want to archive this skill and its levels'; -$string['activeskillwarning'] = 'Are you sure! do you want to activate this skill and its levels'; +$string['deleteskill'] = 'Are you sure you want to delete this skill and its levels?'; +$string['skillsnothingtodisplay'] = 'No skills created yet or not in use. Create a new skill using the create button'; +$string['archiveskill'] = 'Are you sure you want to archive this skill and its levels?'; +$string['activeskillwarning'] = 'Are you sure you want to activate this skill and its levels?'; // ...Skills Form field strings. $string['key'] = 'Key'; $string['description'] = 'Description'; @@ -69,7 +72,7 @@ $string['skilltitle'] = 'Skill name'; $string['skilltitle_help'] = 'Name of the skill'; $string['identitykey'] = 'Key'; -$string['identitykey_help'] = 'Key to identity the skill, this should be unique value'; +$string['identitykey_help'] = 'Key to identify the skill; this should be a unique value'; $string['learningtime'] = 'Learning time'; $string['learningtime_help'] = 'Time to spend in the course to complete this skill'; $string['skillcolor'] = 'Skill color'; @@ -99,7 +102,7 @@ $string['completionforcelevel'] = 'Force level'; $string['completionlevel'] = 'Level'; $string['coursestatus'] = 'Assign skill to course'; -$string['coursestatus_help'] = 'Select enable to assign the skill to course, then user will receive the points/level for course completion'; +$string['coursestatus_help'] = 'Select \'enable\' to assign the skill to the course. The user will then receive points/levels upon course completion.'; $string['uponcompletion_help'] = '