From a6a722d4bab19a95bb7932805ef92f301e5ff847 Mon Sep 17 00:00:00 2001 From: Frederic Massart Date: Tue, 5 Apr 2016 12:26:37 +0800 Subject: [PATCH] MDL-53700 competency: Migrating other competency related plugins --- admin/tool/cohortroles/classes/api.php | 2 +- .../classes/cohort_role_assignment.php | 2 +- admin/tool/cohortroles/tests/api_test.php | 2 +- .../tool/lpmigrate/classes/framework_mapper.php | 2 +- .../lpmigrate/classes/framework_processor.php | 8 ++++---- .../classes/output/migrate_framework_results.php | 14 ++++++++------ admin/tool/lpmigrate/frameworks.php | 3 ++- admin/tool/lpmigrate/settings.php | 6 ++++-- admin/tool/lpmigrate/tests/processor_test.php | 16 ++++++++-------- admin/tool/lpmigrate/version.php | 2 +- blocks/lp/block_lp.php | 2 +- .../output/competencies_to_review_page.php | 8 ++++---- .../lp/classes/output/plans_to_review_page.php | 6 +++--- blocks/lp/classes/output/summary.php | 13 +++++++------ blocks/lp/version.php | 2 +- report/competency/amd/build/grading_popup.min.js | 2 +- report/competency/amd/src/grading_popup.js | 2 +- report/competency/classes/external.php | 6 +++--- report/competency/classes/output/report.php | 12 ++++++------ .../classes/output/user_course_navigation.php | 6 +++--- report/competency/db/services.php | 2 +- report/competency/index.php | 4 ++-- report/competency/lib.php | 2 +- 23 files changed, 65 insertions(+), 59 deletions(-) diff --git a/admin/tool/cohortroles/classes/api.php b/admin/tool/cohortroles/classes/api.php index 53057bc81dafa..e610e35f442d2 100644 --- a/admin/tool/cohortroles/classes/api.php +++ b/admin/tool/cohortroles/classes/api.php @@ -25,7 +25,7 @@ use stdClass; use context_system; -use tool_lp\invalid_persistent_exception; +use core_competency\invalid_persistent_exception; /** * Class for doing things with cohort roles. diff --git a/admin/tool/cohortroles/classes/cohort_role_assignment.php b/admin/tool/cohortroles/classes/cohort_role_assignment.php index 6c1e4a1097388..08ac464107621 100644 --- a/admin/tool/cohortroles/classes/cohort_role_assignment.php +++ b/admin/tool/cohortroles/classes/cohort_role_assignment.php @@ -24,7 +24,7 @@ namespace tool_cohortroles; use lang_string; -use tool_lp\persistent; +use core_competency\persistent; /** * Class for loading/storing cohort_role_assignments from the DB. diff --git a/admin/tool/cohortroles/tests/api_test.php b/admin/tool/cohortroles/tests/api_test.php index ab08e5ec732a4..27c4cd8227ba7 100644 --- a/admin/tool/cohortroles/tests/api_test.php +++ b/admin/tool/cohortroles/tests/api_test.php @@ -75,7 +75,7 @@ public function test_create_cohort_role_assignment_without_permission() { } public function test_create_cohort_role_assignment_with_invalid_data() { - $this->setExpectedException('tool_lp\invalid_persistent_exception'); + $this->setExpectedException('core_competency\invalid_persistent_exception'); $this->setAdminUser(); $params = (object) array( 'userid' => $this->userassignto->id, diff --git a/admin/tool/lpmigrate/classes/framework_mapper.php b/admin/tool/lpmigrate/classes/framework_mapper.php index 56664c0901e50..83090fe67d144 100644 --- a/admin/tool/lpmigrate/classes/framework_mapper.php +++ b/admin/tool/lpmigrate/classes/framework_mapper.php @@ -25,7 +25,7 @@ namespace tool_lpmigrate; defined('MOODLE_INTERNAL') || die(); -use tool_lp\api; +use core_competency\api; /** * Framework mapper class. diff --git a/admin/tool/lpmigrate/classes/framework_processor.php b/admin/tool/lpmigrate/classes/framework_processor.php index 697b47c08210a..7c4f3946b028a 100644 --- a/admin/tool/lpmigrate/classes/framework_processor.php +++ b/admin/tool/lpmigrate/classes/framework_processor.php @@ -27,10 +27,10 @@ use coding_exception; use moodle_exception; -use tool_lp\api; -use tool_lp\competency; -use tool_lp\course_competency; -use tool_lp\course_module_competency; +use core_competency\api; +use core_competency\competency; +use core_competency\course_competency; +use core_competency\course_module_competency; /** * Processor class. diff --git a/admin/tool/lpmigrate/classes/output/migrate_framework_results.php b/admin/tool/lpmigrate/classes/output/migrate_framework_results.php index 405023fc188b2..065f63aec08e6 100644 --- a/admin/tool/lpmigrate/classes/output/migrate_framework_results.php +++ b/admin/tool/lpmigrate/classes/output/migrate_framework_results.php @@ -31,8 +31,10 @@ use renderable; use templatable; use stdClass; -use tool_lp\competency; -use tool_lp\competency_framework; +use core_competency\competency; +use core_competency\competency_framework; +use core_competency\external\competency_exporter; +use core_competency\external\competency_framework_exporter; use tool_lpmigrate\framework_processor; /** @@ -95,9 +97,9 @@ public function export_for_template(\renderer_base $output) { $data->unmappedfrom = array(); $data->unmappedto = array(); - $exporter = new \tool_lp\external\competency_framework_exporter($this->frameworkfrom); + $exporter = new competency_framework_exporter($this->frameworkfrom); $data->frameworkfrom = $exporter->export($output); - $exporter = new \tool_lp\external\competency_framework_exporter($this->frameworkto); + $exporter = new competency_framework_exporter($this->frameworkto); $data->frameworkto = $exporter->export($output); $fromcontext = $this->frameworkfrom->get_context(); @@ -105,12 +107,12 @@ public function export_for_template(\renderer_base $output) { $compcontext = null; foreach ($this->unmappedfrom as $comp) { - $exporter = new \tool_lp\external\competency_exporter($comp, array('context' => $fromcontext)); + $exporter = new competency_exporter($comp, array('context' => $fromcontext)); $data->unmappedfrom[] = $exporter->export($output); } foreach ($this->unmappedto as $comp) { - $exporter = new \tool_lp\external\competency_exporter($comp, array('context' => $tocontext)); + $exporter = new competency_exporter($comp, array('context' => $tocontext)); $data->unmappedto[] = $exporter->export($output); } diff --git a/admin/tool/lpmigrate/frameworks.php b/admin/tool/lpmigrate/frameworks.php index 58fd3ac51d116..a5edea4d52c1d 100644 --- a/admin/tool/lpmigrate/frameworks.php +++ b/admin/tool/lpmigrate/frameworks.php @@ -67,7 +67,8 @@ $unmappedfrom = $mapper->get_unmapped_objects_from(); $unmappedto = $mapper->get_unmapped_objects_to(); $renderable = new \tool_lpmigrate\output\migrate_framework_results($context, $processor, - \tool_lp\api::read_framework($data->from), \tool_lp\api::read_framework($data->to), $unmappedfrom, $unmappedto); + \core_competency\api::read_framework($data->from), \core_competency\api::read_framework($data->to), + $unmappedfrom, $unmappedto); echo $output->render($renderable); } else { diff --git a/admin/tool/lpmigrate/settings.php b/admin/tool/lpmigrate/settings.php index d8636be95f419..26b362295d60f 100644 --- a/admin/tool/lpmigrate/settings.php +++ b/admin/tool/lpmigrate/settings.php @@ -23,7 +23,9 @@ */ defined('MOODLE_INTERNAL') || die(); -if (\tool_lp\api::is_enabled()) { +if (\core_competency\api::is_enabled()) { + + $parentname = 'competencies'; // Manage competency frameworks page. $temp = new admin_externalpage( @@ -32,6 +34,6 @@ new moodle_url('/admin/tool/lpmigrate/frameworks.php'), array('tool/lpmigrate:frameworksmigrate') ); - $ADMIN->add('toollprootpage', $temp); + $ADMIN->add($parentname, $temp); } diff --git a/admin/tool/lpmigrate/tests/processor_test.php b/admin/tool/lpmigrate/tests/processor_test.php index 816cde1a02e6c..441c4463066e9 100644 --- a/admin/tool/lpmigrate/tests/processor_test.php +++ b/admin/tool/lpmigrate/tests/processor_test.php @@ -25,10 +25,10 @@ defined('MOODLE_INTERNAL') || die(); global $CFG; -use \tool_lp\course_competency; -use \tool_lp\course_module_competency; -use \tool_lpmigrate\framework_mapper; -use \tool_lpmigrate\framework_processor; +use core_competency\course_competency; +use core_competency\course_module_competency; +use tool_lpmigrate\framework_mapper; +use tool_lpmigrate\framework_processor; /** * Framework processor testcase. @@ -49,7 +49,7 @@ class tool_lpmigrate_framework_processor_testcase extends advanced_testcase { public function setUp() { $this->resetAfterTest(true); $dg = $this->getDataGenerator(); - $lpg = $dg->get_plugin_generator('tool_lp'); + $lpg = $dg->get_plugin_generator('core_competency'); $f1 = $lpg->create_framework(array('idnumber' => 'BIO2015')); $f2 = $lpg->create_framework(array('idnumber' => 'BIO2016')); @@ -313,7 +313,7 @@ public function test_course_start_date_from() { public function test_destination_competency_exists() { $this->setAdminUser(); - $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp'); + $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency'); // Pre-add the new competency to course 1. $lpg->create_course_competency(array('courseid' => $this->c1->id, 'competencyid' => $this->f2comps['A1']->get_id())); @@ -361,7 +361,7 @@ public function test_destination_competency_exists() { public function test_destination_competency_exists_remove_original() { $this->setAdminUser(); - $lpg = $this->getDataGenerator()->get_plugin_generator('tool_lp'); + $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency'); // Pre-add the new competency to course 1. $lpg->create_course_competency(array('courseid' => $this->c1->id, 'competencyid' => $this->f2comps['A1']->get_id())); @@ -410,7 +410,7 @@ public function test_permission_exception() { $dg->enrol_user($u->id, $this->c1->id, 'editingteacher'); $dg->enrol_user($u->id, $this->c2->id, 'editingteacher'); - assign_capability('tool/lp:coursecompetencymanage', CAP_PROHIBIT, $role, $sysctx->id); + assign_capability('moodle/competency:coursecompetencymanage', CAP_PROHIBIT, $role, $sysctx->id); role_assign($role, $u->id, context_course::instance($this->c1->id)->id); role_assign($role, $u->id, context_module::instance($this->cms[$this->c2->id]['F1']->cmid)->id); diff --git a/admin/tool/lpmigrate/version.php b/admin/tool/lpmigrate/version.php index 5ef920c498001..8c3976b7636c1 100644 --- a/admin/tool/lpmigrate/version.php +++ b/admin/tool/lpmigrate/version.php @@ -28,5 +28,5 @@ $plugin->requires = 2014110400; // Requires this Moodle version. $plugin->component = 'tool_lpmigrate'; // Full name of the plugin (used for diagnostics). $plugin->dependencies = array( - 'tool_lp' => 2016020904 + 'tool_lp' => ANY_VERSION ); diff --git a/blocks/lp/block_lp.php b/blocks/lp/block_lp.php index e7f0d1b056051..7093a4db1d819 100644 --- a/blocks/lp/block_lp.php +++ b/blocks/lp/block_lp.php @@ -60,6 +60,7 @@ public function get_content() { if (isset($this->content)) { return $this->content; } + $this->content = new stdClass(); $summary = new \block_lp\output\summary(); if (!$summary->has_content()) { @@ -67,7 +68,6 @@ public function get_content() { } $renderer = $this->page->get_renderer('block_lp'); - $this->content = new stdClass(); $this->content->text = $renderer->render($summary); $this->content->footer = ''; diff --git a/blocks/lp/classes/output/competencies_to_review_page.php b/blocks/lp/classes/output/competencies_to_review_page.php index 3616995da52bc..233ab632369eb 100644 --- a/blocks/lp/classes/output/competencies_to_review_page.php +++ b/blocks/lp/classes/output/competencies_to_review_page.php @@ -28,11 +28,11 @@ use templatable; use renderer_base; use stdClass; -use tool_lp\api; -use tool_lp\external\competency_exporter; -use tool_lp\external\user_competency_exporter; -use tool_lp\external\user_summary_exporter; use moodle_url; +use core_competency\api; +use core_competency\external\competency_exporter; +use core_competency\external\user_competency_exporter; +use core_competency\external\user_summary_exporter; /** * Competencies to review renderable class. diff --git a/blocks/lp/classes/output/plans_to_review_page.php b/blocks/lp/classes/output/plans_to_review_page.php index e12ea7ef717de..4920f1f0fb2e8 100644 --- a/blocks/lp/classes/output/plans_to_review_page.php +++ b/blocks/lp/classes/output/plans_to_review_page.php @@ -28,10 +28,10 @@ use templatable; use renderer_base; use stdClass; -use tool_lp\api; -use tool_lp\external\plan_exporter; -use tool_lp\external\user_summary_exporter; use moodle_url; +use core_competency\api; +use core_competency\external\plan_exporter; +use core_competency\external\user_summary_exporter; /** * Plans to review renderable class. diff --git a/blocks/lp/classes/output/summary.php b/blocks/lp/classes/output/summary.php index fde41262e8741..ff6459d78aca9 100644 --- a/blocks/lp/classes/output/summary.php +++ b/blocks/lp/classes/output/summary.php @@ -25,11 +25,12 @@ namespace block_lp\output; defined('MOODLE_INTERNAL') || die(); -use tool_lp\api; -use tool_lp\external\competency_exporter; -use tool_lp\external\plan_exporter; -use tool_lp\external\user_competency_exporter; -use tool_lp\external\user_summary_exporter; +use core_competency\api; +use core_competency\external\competency_exporter; +use core_competency\external\plan_exporter; +use core_competency\external\user_competency_exporter; +use core_competency\external\user_summary_exporter; +use core_competency\plan; use renderable; use renderer_base; use templatable; @@ -81,7 +82,7 @@ public function export_for_template(renderer_base $output) { if (count($plans) >= 3) { break; } - if ($plan->get_status() == \tool_lp\plan::STATUS_ACTIVE) { + if ($plan->get_status() == plan::STATUS_ACTIVE) { $plans[] = $plan; } } diff --git a/blocks/lp/version.php b/blocks/lp/version.php index f9ed86bb13348..31fe05c6ed002 100644 --- a/blocks/lp/version.php +++ b/blocks/lp/version.php @@ -28,5 +28,5 @@ $plugin->requires = 2014110400; $plugin->component = 'block_lp'; $plugin->dependencies = array( - 'tool_lp' => 2015111035 + 'tool_lp' => ANY_VERSION ); diff --git a/report/competency/amd/build/grading_popup.min.js b/report/competency/amd/build/grading_popup.min.js index 7517b1276170d..0bb5cc4dc69b1 100644 --- a/report/competency/amd/build/grading_popup.min.js +++ b/report/competency/amd/build/grading_popup.min.js @@ -1 +1 @@ -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:"tool_lp_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}); \ No newline at end of file +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}); \ No newline at end of file diff --git a/report/competency/amd/src/grading_popup.js b/report/competency/amd/src/grading_popup.js index 829aec2fef900..305f70897bac4 100644 --- a/report/competency/amd/src/grading_popup.js +++ b/report/competency/amd/src/grading_popup.js @@ -61,7 +61,7 @@ define(['jquery', 'core/notification', 'core/str', 'core/ajax', 'core/log', 'cor // Log the user competency viewed in course event. requests[0].then(function(){ ajax.call([{ - methodname : 'tool_lp_user_competency_viewed_in_course', + methodname : 'core_competency_user_competency_viewed_in_course', args: { userid: userId, competencyid: competencyId, courseid: courseId }, fail: notification.exception }]); diff --git a/report/competency/classes/external.php b/report/competency/classes/external.php index 44e74112fee08..01630d665292b 100644 --- a/report/competency/classes/external.php +++ b/report/competency/classes/external.php @@ -33,10 +33,10 @@ use external_multiple_structure; use external_single_structure; use external_value; +use core_competency\external\user_competency_course_exporter; +use core_competency\external\user_summary_exporter; use tool_lp\external\competency_summary_exporter; use tool_lp\external\course_summary_exporter; -use tool_lp\external\user_competency_course_exporter; -use tool_lp\external\user_summary_exporter; /** * This is the external API for this report. @@ -88,7 +88,7 @@ public static function data_for_report($courseid, $userid) { ); $context = context_course::instance($params['courseid']); self::validate_context($context); - if (!is_enrolled($context, $params['userid'], 'tool/lp:coursecompetencygradable')) { + if (!is_enrolled($context, $params['userid'], 'moodle/competency:coursecompetencygradable')) { throw new coding_exception('invaliduser'); } diff --git a/report/competency/classes/output/report.php b/report/competency/classes/output/report.php index 6ae3c7732c551..59322c9bd2f97 100644 --- a/report/competency/classes/output/report.php +++ b/report/competency/classes/output/report.php @@ -24,18 +24,18 @@ namespace report_competency\output; use context_course; -use tool_lp\external\competency_summary_exporter; -use tool_lp\external\course_summary_exporter; -use tool_lp\external\user_competency_course_exporter; -use tool_lp\external\user_summary_exporter; -use tool_lp\user_competency; use renderable; use core_user; use templatable; use renderer_base; use moodle_url; use stdClass; -use tool_lp\api; +use core_competency\api; +use core_competency\external\user_competency_course_exporter; +use core_competency\external\user_summary_exporter; +use core_competency\user_competency; +use tool_lp\external\competency_summary_exporter; +use tool_lp\external\course_summary_exporter; /** * Class containing data for learning plan template competencies page diff --git a/report/competency/classes/output/user_course_navigation.php b/report/competency/classes/output/user_course_navigation.php index 9f71c7c626962..6b7a62b5cf527 100644 --- a/report/competency/classes/output/user_course_navigation.php +++ b/report/competency/classes/output/user_course_navigation.php @@ -27,7 +27,7 @@ use renderer_base; use templatable; use context_course; -use \tool_lp\external\user_summary_exporter; +use core_competency\external\user_summary_exporter; use stdClass; /** @@ -78,7 +78,7 @@ public function export_for_template(renderer_base $output) { $data->baseurl = $this->baseurl; $data->groupselector = ''; - if (has_capability('tool/lp:coursecompetencymanage', $context)) { + if (has_capability('moodle/competency:coursecompetencymanage', $context)) { $course = $DB->get_record('course', array('id' => $this->courseid)); $currentgroup = groups_get_course_group($course, true); if ($currentgroup !== false) { @@ -93,7 +93,7 @@ public function export_for_template(renderer_base $output) { // Fetch current active group. $groupmode = groups_get_course_groupmode($course); - $users = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, + $users = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.*', null, 0, 0, $showonlyactiveenrol); $data->users = array(); diff --git a/report/competency/db/services.php b/report/competency/db/services.php index efa9be07872cd..dc134648fee06 100644 --- a/report/competency/db/services.php +++ b/report/competency/db/services.php @@ -36,7 +36,7 @@ 'classpath' => '', 'description' => 'Load the data for the competency report in a course.', 'type' => 'read', - 'capabilities' => 'tool/lp:coursecompetencyview', + 'capabilities' => 'moodle/competency:coursecompetencyview', 'ajax' => true, ) ); diff --git a/report/competency/index.php b/report/competency/index.php index 71c4c639de4ac..656619a179add 100644 --- a/report/competency/index.php +++ b/report/competency/index.php @@ -36,14 +36,14 @@ $groupmode = groups_get_course_groupmode($course); $currentgroup = groups_get_course_group($course, true); if (empty($currentuser)) { - $gradable = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, 'u.id', null, 0, 1); + $gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id', null, 0, 1); if (empty($gradable)) { $currentuser = 0; } else { $currentuser = array_pop($gradable)->id; } } else { - $gradable = get_enrolled_users($context, 'tool/lp:coursecompetencygradable', $currentgroup, 'u.id'); + $gradable = get_enrolled_users($context, 'moodle/competency:coursecompetencygradable', $currentgroup, 'u.id'); if (count($gradable) == 0) { $currentuser = 0; } else if (!in_array($currentuser, array_keys($gradable))) { diff --git a/report/competency/lib.php b/report/competency/lib.php index 9f9a54a77731d..35bd488f875f7 100644 --- a/report/competency/lib.php +++ b/report/competency/lib.php @@ -34,7 +34,7 @@ * @param stdClass $context The context of the course */ function report_competency_extend_navigation_course($navigation, $course, $context) { - if (has_capability('tool/lp:coursecompetencyview', $context)) { + if (has_capability('moodle/competency:coursecompetencyview', $context)) { $url = new moodle_url('/report/competency/index.php', array('id' => $course->id)); $name = get_string('pluginname', 'report_competency'); $navigation->add($name, $url, navigation_node::TYPE_SETTING, null, null, new pix_icon('i/report', ''));